summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-04 17:07:05 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-04 17:32:32 -0700
commitd2cbe4c52ce0e8884d1337fb6cd543583ed75ecf (patch)
treec75a060150ec616ef0e303601c6a6244d09d25cb
parent6da538e8d30c42a403e929137bd10513b74a86b4 (diff)
parent96af584af6c8ea50f9cf871db9ffca91040fb85d (diff)
downloademacs-d2cbe4c52ce0e8884d1337fb6cd543583ed75ecf.tar.gz
Merge upstream Git snapshot into athena/unstable
-rw-r--r--.clang-format2
-rw-r--r--.dir-locals.el3
-rw-r--r--.gitignore1
-rw-r--r--ChangeLog.24
-rw-r--r--ChangeLog.322
-rw-r--r--README2
-rw-r--r--admin/admin.el2
-rw-r--r--configure.ac2
-rw-r--r--doc/emacs/maintaining.texi10
-rw-r--r--doc/lispref/compile.texi2
-rw-r--r--doc/lispref/display.texi8
-rw-r--r--doc/lispref/files.texi4
-rw-r--r--doc/lispref/frames.texi12
-rw-r--r--doc/lispref/internals.texi3
-rw-r--r--doc/lispref/parsing.texi18
-rw-r--r--doc/lispref/positions.texi31
-rw-r--r--doc/lispref/windows.texi3
-rw-r--r--doc/man/etags.12
-rw-r--r--doc/misc/eglot.texi1
-rw-r--r--doc/misc/erc.texi117
-rw-r--r--doc/misc/gnus.texi2
-rw-r--r--doc/misc/org-setup.org2
-rw-r--r--doc/misc/org.org2265
-rw-r--r--doc/misc/tramp.texi14
-rw-r--r--doc/misc/trampver.texi10
-rw-r--r--etc/NEWS169
-rw-r--r--etc/NEWS.194
-rw-r--r--etc/NEWS.222
-rw-r--r--etc/NEWS.242
-rw-r--r--etc/ORG-NEWS743
-rw-r--r--etc/org/README2
-rw-r--r--etc/publicsuffix.txt39
-rw-r--r--etc/refcards/orgcard.tex2
-rw-r--r--lib-src/ChangeLog.12
-rw-r--r--lib-src/be_resources.cc14
-rw-r--r--lib-src/emacsclient.c6
-rw-r--r--lib-src/etags.c150
-rw-r--r--lisp/ChangeLog.102
-rw-r--r--lisp/ChangeLog.119
-rw-r--r--lisp/ChangeLog.127
-rw-r--r--lisp/ChangeLog.142
-rw-r--r--lisp/ChangeLog.163
-rw-r--r--lisp/ChangeLog.33
-rw-r--r--lisp/ChangeLog.43
-rw-r--r--lisp/ChangeLog.62
-rw-r--r--lisp/ChangeLog.75
-rw-r--r--lisp/ChangeLog.811
-rw-r--r--lisp/ChangeLog.98
-rw-r--r--lisp/ansi-osc.el2
-rw-r--r--lisp/autorevert.el4
-rw-r--r--lisp/cedet/semantic/bovine/c.el2
-rw-r--r--lisp/cedet/semantic/db.el2
-rw-r--r--lisp/cedet/semantic/format.el2
-rw-r--r--lisp/cedet/semantic/grm-wy-boot.el4
-rw-r--r--lisp/cedet/semantic/ia.el2
-rw-r--r--lisp/cedet/semantic/idle.el2
-rw-r--r--lisp/cedet/semantic/lex-spp.el2
-rw-r--r--lisp/cedet/semantic/lex.el6
-rw-r--r--lisp/cedet/semantic/sort.el2
-rw-r--r--lisp/cedet/semantic/symref.el3
-rw-r--r--lisp/comint.el2
-rw-r--r--lisp/cus-edit.el2
-rw-r--r--lisp/descr-text.el5
-rw-r--r--lisp/emacs-lisp/byte-run.el2
-rw-r--r--lisp/emacs-lisp/chart.el2
-rw-r--r--lisp/emacs-lisp/comp.el5
-rw-r--r--lisp/emacs-lisp/easy-mmode.el7
-rw-r--r--lisp/emacs-lisp/icons.el4
-rw-r--r--lisp/emacs-lisp/multisession.el5
-rw-r--r--lisp/emacs-lisp/package-vc.el20
-rw-r--r--lisp/emacs-lisp/package.el13
-rw-r--r--lisp/emacs-lock.el7
-rw-r--r--lisp/epg.el2
-rw-r--r--lisp/erc/erc-sasl.el77
-rw-r--r--lisp/files.el5
-rw-r--r--lisp/gnus/ChangeLog.33
-rw-r--r--lisp/gnus/gnus-cache.el2
-rw-r--r--lisp/gnus/message.el2
-rw-r--r--lisp/help.el6
-rw-r--r--lisp/info.el3
-rw-r--r--lisp/ldefs-boot.el561
-rw-r--r--lisp/minibuffer.el4
-rw-r--r--lisp/net/ange-ftp.el2
-rw-r--r--lisp/net/tramp-adb.el1
-rw-r--r--lisp/net/tramp-archive.el1
-rw-r--r--lisp/net/tramp-crypt.el1
-rw-r--r--lisp/net/tramp-gvfs.el1
-rw-r--r--lisp/net/tramp-rclone.el1
-rw-r--r--lisp/net/tramp-sh.el1
-rw-r--r--lisp/net/tramp-smb.el1
-rw-r--r--lisp/net/tramp-sshfs.el4
-rw-r--r--lisp/net/tramp-sudoedit.el1
-rw-r--r--lisp/net/tramp.el84
-rw-r--r--lisp/obsolete/rfc2368.el12
-rw-r--r--lisp/org/ChangeLog.14
-rw-r--r--lisp/org/ob-C.el9
-rw-r--r--lisp/org/ob-R.el29
-rw-r--r--lisp/org/ob-awk.el8
-rw-r--r--lisp/org/ob-calc.el6
-rw-r--r--lisp/org/ob-clojure.el118
-rw-r--r--lisp/org/ob-comint.el33
-rw-r--r--lisp/org/ob-core.el792
-rw-r--r--lisp/org/ob-css.el6
-rw-r--r--lisp/org/ob-ditaa.el6
-rw-r--r--lisp/org/ob-dot.el8
-rw-r--r--lisp/org/ob-emacs-lisp.el7
-rw-r--r--lisp/org/ob-eshell.el6
-rw-r--r--lisp/org/ob-eval.el56
-rw-r--r--lisp/org/ob-exp.el319
-rw-r--r--lisp/org/ob-forth.el6
-rw-r--r--lisp/org/ob-fortran.el6
-rw-r--r--lisp/org/ob-gnuplot.el16
-rw-r--r--lisp/org/ob-groovy.el12
-rw-r--r--lisp/org/ob-haskell.el10
-rw-r--r--lisp/org/ob-java.el25
-rw-r--r--lisp/org/ob-js.el6
-rw-r--r--lisp/org/ob-julia.el6
-rw-r--r--lisp/org/ob-latex.el21
-rw-r--r--lisp/org/ob-lilypond.el12
-rw-r--r--lisp/org/ob-lisp.el6
-rw-r--r--lisp/org/ob-lob.el28
-rw-r--r--lisp/org/ob-lua.el8
-rw-r--r--lisp/org/ob-makefile.el6
-rw-r--r--lisp/org/ob-matlab.el6
-rw-r--r--lisp/org/ob-maxima.el15
-rw-r--r--lisp/org/ob-ocaml.el6
-rw-r--r--lisp/org/ob-octave.el8
-rw-r--r--lisp/org/ob-org.el6
-rw-r--r--lisp/org/ob-perl.el8
-rw-r--r--lisp/org/ob-plantuml.el31
-rw-r--r--lisp/org/ob-processing.el9
-rw-r--r--lisp/org/ob-python.el30
-rw-r--r--lisp/org/ob-ref.el30
-rw-r--r--lisp/org/ob-ruby.el6
-rw-r--r--lisp/org/ob-sass.el6
-rw-r--r--lisp/org/ob-scheme.el22
-rw-r--r--lisp/org/ob-screen.el8
-rw-r--r--lisp/org/ob-sed.el8
-rw-r--r--lisp/org/ob-shell.el91
-rw-r--r--lisp/org/ob-sql.el31
-rw-r--r--lisp/org/ob-sqlite.el8
-rw-r--r--lisp/org/ob-table.el75
-rw-r--r--lisp/org/ob-tangle.el183
-rw-r--r--lisp/org/ob.el6
-rw-r--r--lisp/org/oc-basic.el122
-rw-r--r--lisp/org/oc-biblatex.el229
-rw-r--r--lisp/org/oc-bibtex.el87
-rw-r--r--lisp/org/oc-csl.el198
-rw-r--r--lisp/org/oc-natbib.el4
-rw-r--r--lisp/org/oc.el193
-rw-r--r--lisp/org/ol-bbdb.el7
-rw-r--r--lisp/org/ol-bibtex.el70
-rw-r--r--lisp/org/ol-docview.el8
-rw-r--r--lisp/org/ol-doi.el3
-rw-r--r--lisp/org/ol-eshell.el9
-rw-r--r--lisp/org/ol-eww.el20
-rw-r--r--lisp/org/ol-gnus.el7
-rw-r--r--lisp/org/ol-info.el86
-rw-r--r--lisp/org/ol-irc.el3
-rw-r--r--lisp/org/ol-man.el25
-rw-r--r--lisp/org/ol-mhe.el5
-rw-r--r--lisp/org/ol-rmail.el5
-rw-r--r--lisp/org/ol-w3m.el5
-rw-r--r--lisp/org/ol.el222
-rw-r--r--lisp/org/org-agenda.el1626
-rw-r--r--lisp/org/org-archive.el30
-rw-r--r--lisp/org/org-attach-git.el6
-rw-r--r--lisp/org/org-attach.el182
-rw-r--r--lisp/org/org-capture.el101
-rw-r--r--lisp/org/org-clock.el447
-rw-r--r--lisp/org/org-colview.el54
-rw-r--r--lisp/org/org-compat.el628
-rw-r--r--lisp/org/org-crypt.el16
-rw-r--r--lisp/org/org-ctags.el25
-rw-r--r--lisp/org/org-cycle.el817
-rw-r--r--lisp/org/org-datetree.el16
-rw-r--r--lisp/org/org-duration.el54
-rw-r--r--lisp/org/org-element.el4069
-rw-r--r--lisp/org/org-entities.el11
-rw-r--r--lisp/org/org-faces.el13
-rw-r--r--lisp/org/org-feed.el9
-rw-r--r--lisp/org/org-fold-core.el1511
-rw-r--r--lisp/org/org-fold.el906
-rw-r--r--lisp/org/org-footnote.el23
-rw-r--r--lisp/org/org-goto.el17
-rw-r--r--lisp/org/org-habit.el8
-rw-r--r--lisp/org/org-id.el66
-rw-r--r--lisp/org/org-indent.el17
-rw-r--r--lisp/org/org-inlinetask.el23
-rw-r--r--lisp/org/org-install.el17
-rw-r--r--lisp/org/org-keys.el44
-rw-r--r--lisp/org/org-lint.el1094
-rw-r--r--lisp/org/org-list.el296
-rw-r--r--lisp/org/org-macro.el24
-rw-r--r--lisp/org/org-macs.el506
-rw-r--r--lisp/org/org-mobile.el7
-rw-r--r--lisp/org/org-mouse.el48
-rw-r--r--lisp/org/org-num.el4
-rw-r--r--lisp/org/org-pcomplete.el21
-rw-r--r--lisp/org/org-persist.el978
-rw-r--r--lisp/org/org-plot.el26
-rw-r--r--lisp/org/org-protocol.el43
-rw-r--r--lisp/org/org-refile.el29
-rw-r--r--lisp/org/org-src.el196
-rw-r--r--lisp/org/org-table.el109
-rw-r--r--lisp/org/org-tempo.el27
-rw-r--r--lisp/org/org-timer.el16
-rw-r--r--lisp/org/org-version.el4
-rw-r--r--lisp/org/org.el5039
-rw-r--r--lisp/org/ox-ascii.el8
-rw-r--r--lisp/org/ox-beamer.el35
-rw-r--r--lisp/org/ox-html.el317
-rw-r--r--lisp/org/ox-icalendar.el73
-rw-r--r--lisp/org/ox-koma-letter.el3
-rw-r--r--lisp/org/ox-latex.el1408
-rw-r--r--lisp/org/ox-man.el4
-rw-r--r--lisp/org/ox-md.el32
-rw-r--r--lisp/org/ox-odt.el107
-rw-r--r--lisp/org/ox-org.el9
-rw-r--r--lisp/org/ox-publish.el28
-rw-r--r--lisp/org/ox-texinfo.el346
-rw-r--r--lisp/org/ox.el721
-rw-r--r--lisp/outline.el41
-rw-r--r--lisp/paren.el2
-rw-r--r--lisp/play/zone.el2
-rw-r--r--lisp/proced.el302
-rw-r--r--lisp/progmodes/antlr-mode.el2
-rw-r--r--lisp/progmodes/asm-mode.el2
-rw-r--r--lisp/progmodes/c-ts-mode.el74
-rw-r--r--lisp/progmodes/cc-engine.el2
-rw-r--r--lisp/progmodes/cc-vars.el2
-rw-r--r--lisp/progmodes/compile.el2
-rw-r--r--lisp/progmodes/csharp-mode.el108
-rw-r--r--lisp/progmodes/eglot.el6
-rw-r--r--lisp/progmodes/gdb-mi.el6
-rw-r--r--lisp/progmodes/gud.el226
-rw-r--r--lisp/progmodes/java-ts-mode.el18
-rw-r--r--lisp/progmodes/js.el17
-rw-r--r--lisp/progmodes/project.el148
-rw-r--r--lisp/progmodes/python.el47
-rw-r--r--lisp/progmodes/scheme.el2
-rw-r--r--lisp/progmodes/sh-script.el96
-rw-r--r--lisp/progmodes/typescript-ts-mode.el185
-rw-r--r--lisp/progmodes/xref.el33
-rw-r--r--lisp/server.el22
-rw-r--r--lisp/shell.el2
-rw-r--r--lisp/speedbar.el2
-rw-r--r--lisp/startup.el6
-rw-r--r--lisp/strokes.el2
-rw-r--r--lisp/subr.el31
-rw-r--r--lisp/tab-bar.el25
-rw-r--r--lisp/term.el8
-rw-r--r--lisp/textmodes/css-mode.el34
-rw-r--r--lisp/textmodes/reftex.el3
-rw-r--r--lisp/treesit.el100
-rw-r--r--lisp/vc/vc-git.el2
-rw-r--r--lisp/vc/vc-rcs.el4
-rw-r--r--lisp/window.el2
-rw-r--r--msdos/sed2v2.inp2
-rw-r--r--nt/README.W322
-rw-r--r--src/.lldbinit2
-rw-r--r--src/ChangeLog.112
-rw-r--r--src/ChangeLog.32
-rw-r--r--src/alloc.c12
-rw-r--r--src/buffer.c37
-rw-r--r--src/dispextern.h10
-rw-r--r--src/editfns.c373
-rw-r--r--src/fns.c4
-rw-r--r--src/frame.c13
-rw-r--r--src/keyboard.c22
-rw-r--r--src/lisp.h3
-rw-r--r--src/treesit.c85
-rw-r--r--src/xdisp.c69
-rw-r--r--src/xterm.c77
-rw-r--r--src/xterm.h6
-rw-r--r--test/lisp/cedet/semantic-utest.el2
-rw-r--r--test/lisp/emacs-lisp/comp-tests.el55
-rw-r--r--test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el2
-rw-r--r--test/lisp/erc/erc-join-tests.el2
-rw-r--r--test/lisp/erc/erc-sasl-tests.el61
-rw-r--r--test/lisp/filenotify-tests.el4
-rw-r--r--test/lisp/international/ucs-normalize-tests.el100
-rw-r--r--test/lisp/net/tramp-archive-tests.el2
-rw-r--r--test/lisp/net/tramp-tests.el27
-rw-r--r--test/lisp/progmodes/project-tests.el29
-rw-r--r--test/lisp/progmodes/python-tests.el113
-rw-r--r--test/lisp/server-tests.el14
-rw-r--r--test/manual/cedet/cedet-utests.el3
-rw-r--r--test/manual/cedet/semantic-tests.el3
-rw-r--r--test/manual/cedet/tests/testpolymorph.cpp10
-rw-r--r--test/manual/cedet/tests/testsppreplace.c4
-rw-r--r--test/manual/cedet/tests/testsppreplaced.c4
-rw-r--r--test/manual/etags/CTAGS.good_crlf4484
-rw-r--r--test/manual/etags/CTAGS.good_update4483
-rw-r--r--test/manual/etags/Makefile15
-rw-r--r--test/manual/etags/crlf2
296 files changed, 32107 insertions, 9983 deletions
diff --git a/.clang-format b/.clang-format
index 2208240a669..5c987536b0c 100644
--- a/.clang-format
+++ b/.clang-format
@@ -7,6 +7,8 @@ BreakBeforeBinaryOperators: All
BreakBeforeBraces: GNU
ColumnLimit: 70
ContinuationIndentWidth: 2
+IndentPPDirectives: AfterHash
+PPIndentWidth: 1
ForEachMacros:
- FOR_EACH_TAIL
- FOR_EACH_TAIL_SAFE
diff --git a/.dir-locals.el b/.dir-locals.el
index f0ab46236f3..fc89dff87f2 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -11,7 +11,8 @@
(vc-prepare-patches-separately . nil)))
(c-mode . ((c-file-style . "GNU")
(c-noise-macro-names . ("INLINE" "NO_INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED"
- "UNINIT" "CALLBACK" "ALIGN_STACK"))
+ "UNINIT" "CALLBACK" "ALIGN_STACK" "ATTRIBUTE_MALLOC"
+ "ATTRIBUTE_DEALLOC_FREE"))
(electric-quote-comment . nil)
(electric-quote-string . nil)
(indent-tabs-mode . t)
diff --git a/.gitignore b/.gitignore
index 9be3bfc4f3b..272a29f38f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -163,6 +163,7 @@ test/manual/etags/srclist
test/manual/etags/regexfile
test/manual/etags/ETAGS
test/manual/etags/CTAGS
+test/manual/etags/CTAGS*.sorted
test/manual/indent/*.new
test/lisp/gnus/mml-sec-resources/random_seed
test/lisp/play/fortune-resources/fortunes.dat
diff --git a/ChangeLog.2 b/ChangeLog.2
index 483dec25420..143be59c9e9 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -23054,8 +23054,8 @@
Fix tests in file-notify-tests.el
* test/automated/file-notify-tests.el: Remove Tramp declarations.
- (file-notify-test00-availability): Print remote command w/o Tramp
- internal functions.
+ (file-notify-test00-availability): Print remote command without
+ Tramp internal functions.
(file-notify-test02-events, file-notify-test02-events-remote):
Adapt docstring.
(file-notify-test03-autorevert): Use `format-message' when
diff --git a/ChangeLog.3 b/ChangeLog.3
index d27a14d4279..136a276b632 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -32685,7 +32685,7 @@
* test/README: Mention $EMACS_TEST_DIRECTORY.
* test/lisp/image-tests.el (image-tests--emacs-images-directory):
- Use `data-directory', for runs w/o of make.
+ Use `data-directory', for runs without of make.
(image-type/from-filename): Check for `image-load-path'.
2021-03-16 Michael Albinus <michael.albinus@gmx.de>
@@ -69072,7 +69072,7 @@
2020-08-27 Tino Calancha <tino.calancha@gmail.com>
- dired: Show broken/circular links w/ different face
+ dired: Show broken/circular links with different face
* lisp/dired.el (dired-broken-symlink): New face.
(dired-font-lock-keywords):
@@ -107948,7 +107948,7 @@
2019-10-12 Rolf Ade <rolf@pointsman.de> (tiny change)
- TCL indentation fix outside functions
+ Tcl indentation fix outside functions
* lisp/progmodes/tcl.el (tcl-calculate-indent): Indent code
correctly outside of function definitions (bug#23565).
@@ -143455,7 +143455,8 @@
2018-12-28 Michael Albinus <michael.albinus@gmx.de>
- * lisp/net/tramp-sh.el (tramp-set-remote-path): Handle platforms w/o getconf.
+ * lisp/net/tramp-sh.el (tramp-set-remote-path): Handle platforms
+ without getconf.
2018-12-27 Paul Eggert <eggert@cs.ucla.edu>
@@ -157203,7 +157204,7 @@
Fix file name completion in Tramp
* lisp/net/tramp.el (tramp-handle-file-name-directory): Fix case
- of localname starts w/o a slash.
+ of localname starts without a slash.
* test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name):
Extend test.
@@ -177123,7 +177124,7 @@
Mention pcase as a fifth conditional form
* doc/lispref/control.texi (Conditionals): ...here,
- in first para, w/ xref to "Pattern-Matching Conditional".
+ in first para, with xref to "Pattern-Matching Conditional".
2018-05-27 Thien-Thi Nguyen <ttn@gnu.org>
@@ -192390,7 +192391,7 @@
2017-08-06 Tino Calancha <tino.calancha@gmail.com>
- Dired w/ eshell-ls: Handle shell wildcards in file name
+ Dired with eshell-ls: Handle shell wildcards in file name
* lisp/eshell/em-ls.el (eshell-ls--insert-directory):
Use eshell-extended-glob (Bug#27844).
@@ -192767,7 +192768,7 @@
2017-08-01 Tino Calancha <tino.calancha@gmail.com>
- Insert subdir content if dir-or-list is a string w/o wildcards
+ Insert subdir content if dir-or-list is a string without wildcards
* lisp/eshell/em-ls.el (eshell-ls--insert-directory):
Append '("-d") into 'eshell-ls-dired-initial-args'
@@ -206236,7 +206237,7 @@
2017-03-03 Rolf Ade <rolf@pointsman.de> (tiny change)
- sql-mode w/ sqlite: In-memory database
+ sql-mode with sqlite: In-memory database
Enable the usage of an in-memory database. Prior to this, sql-mode w/
sqlite could only be used with file databases.
@@ -211195,7 +211196,8 @@
2017-01-03 Stefan Monnier <monnier@iro.umontreal.ca>
- (cl-defstruct): Improve error message for slots w/o value (bug#25312)
+ (cl-defstruct): Improve error message for slots without value
+ (bug#25312)
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Don't signal an error but
emit a warning for those coders who forgot to put a default value in
diff --git a/README b/README
index 80c04e20fea..2f11148411b 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ Copyright (C) 2001-2022 Free Software Foundation, Inc.
See the end of the file for license conditions.
-This directory tree holds version 29.0.50 of GNU Emacs, the extensible,
+This directory tree holds version 29.0.60 of GNU Emacs, the extensible,
customizable, self-documenting real-time display editor.
The file INSTALL in this directory says how to build and install GNU
diff --git a/admin/admin.el b/admin/admin.el
index 6a67f172e2c..4743d776918 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -110,7 +110,7 @@ Root must be the root of an Emacs source tree."
(submatch (1+ (in "0-9."))))))
(set-version-in-file root "configure.ac" version
(rx (and "AC_INIT" (1+ (not (in ?,)))
- ?, (0+ space)
+ ?, (0+ space) ?\[
(submatch (1+ (in "0-9."))))))
(set-version-in-file root "nt/README.W32" version
(rx (and "version" (1+ space)
diff --git a/configure.ac b/configure.ac
index cc4e59ee5ac..b844c6bc730 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ dnl along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
AC_PREREQ([2.65])
dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el.
-AC_INIT([GNU Emacs], [29.0.50], [bug-gnu-emacs@gnu.org], [],
+AC_INIT([GNU Emacs], [29.0.60], [bug-gnu-emacs@gnu.org], [],
[https://www.gnu.org/software/emacs/])
dnl Set emacs_config_options to the options of 'configure', quoted for the shell,
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 44e9e1896fa..9ebb044652c 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1673,16 +1673,16 @@ is known as the @dfn{project root}.
@cindex project back-end
Whether a given directory is a root of some project is determined by
the project-specific infrastructure, known as @dfn{project back-end}.
-Emacs currently supports two such back-ends: VC (@pxref{Version
+Emacs currently supports two such back-ends: VC-aware (@pxref{Version
Control}), whereby a VCS repository is considered a project; and EDE
(@pxref{EDE}). This is expected to be extended in the future to
support additional types of projects.
Which files do or don't belong to a project is also determined by
-the project back-end. For example, the VC back-end doesn't consider
-``ignored'' files (@pxref{VC Ignore}) to be part of the project.
-Also, the VC Project back-end considers ``untracked'' files by default.
-That behavior is controllable with the variable
+the project back-end. For example, the VC-aware back-end doesn't
+consider ``ignored'' files (@pxref{VC Ignore}) to be part of the
+project. Also, the VC-aware Project back-end considers ``untracked''
+files by default. That behavior is controllable with the variable
@code{project-vc-include-untracked}.
@menu
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index d1d281d7094..3e397349995 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -516,7 +516,7 @@ using the @code{with-suppressed-warnings} macro:
@defspec with-suppressed-warnings warnings body@dots{}
In execution, this is equivalent to @code{(progn @var{body}...)}, but
the compiler does not issue warnings for the specified conditions in
-@var{body}. @var{warnings} is an associative list of warning symbols
+@var{body}. @var{warnings} is an association list of warning symbols
and function/variable symbols they apply to. For instance, if you
wish to call an obsolete function called @code{foo}, but want to
suppress the compilation warning, say:
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 10a1a18dd1c..9d929950a7e 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -5419,7 +5419,7 @@ before @code{height}.
@c We put all the '@code{(when ...)}' on one line to encourage
@c makeinfo's end-of-sentence heuristics to DTRT. Previously, the dot
-@c was at eol; the info file ended up w/ two spaces rendered after it.
+@c was at eol; the info file ended up with two spaces rendered after it.
You can make any display specification conditional. To do that,
package it in another list of the form
@code{(when @var{condition} . @var{spec})}.
@@ -7124,6 +7124,12 @@ This is only valid for @code{image} icons, and can be either a number
(which specifies the height in pixels), or the symbol @code{line},
which will use the default line height in the currently selected
window.
+
+@item :width
+This is only valid for @code{image} icons, and can be either a number
+(which specifies the width in pixels), or the symbol @code{font},
+which will use the width in pixels of the current buffer’s default
+face font.
@end table
@var{doc} should be a doc string.
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 183b2786eae..4b45d89f9d0 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3383,7 +3383,7 @@ first, before handlers for jobs such as remote file access.
@code{make-nearby-temp-file},
@code{make-process},
@code{make-symbolic-link},@*
-@code{process-attributes}, @code{process-file},
+@code{memory-info}, @code{process-attributes}, @code{process-file},
@code{rename-file}, @code{set-file-acl}, @code{set-file-modes},
@code{set-file-selinux-context}, @code{set-file-times},
@code{set-visited-file-modtime}, @code{shell-command},
@@ -3445,7 +3445,7 @@ first, before handlers for jobs such as remote file access.
@code{make-nearby-temp-file},
@code{make-process},
@code{make-symbolic-link},
-@code{process-attributes}, @code{process-file},
+@code{memory-info}, @code{process-attributes}, @code{process-file},
@code{rename-file}, @code{set-file-acl}, @code{set-file-modes},
@code{set-file-selinux-context}, @code{set-file-times},
@code{set-visited-file-modtime}, @code{shell-command},
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index b3f1a29ae8f..a656964198b 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -2854,10 +2854,18 @@ The plural ``frames'' in the previous paragraph is deliberate: while
Emacs itself has only one selected frame, Emacs can have frames on
many different terminals (recall that a connection to a window system
counts as a terminal), and each terminal has its own idea of which
-frame has input focus. When you set the input focus to a frame, you
-set the focus for that frame's terminal, but frames on other terminals
+frame has input focus. Under the X Window System, where user input is
+organized into individual ``seats'' of input, each seat in turn can
+have its own specific input focus. When you set the input focus to a
+frame, you set the focus for that frame's terminal on the last seat
+which interacted with Emacs, but frames on other terminals and seats
may still remain focused.
+If the input focus is set before any user interaction has occurred on
+the specified terminal, then the X server picks a random seat
+(normally the one with the lowest number) and sets the input focus
+there.
+
Lisp programs can switch frames temporarily by calling the function
@code{select-frame}. This does not alter the window system's concept
of focus; rather, it escapes from the window manager's control until
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 4640b6d7591..c4e724d761c 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -622,6 +622,9 @@ a certain kind of object. See the documentation string for details.
@defun memory-info
This functions returns an amount of total system memory and how much
of it is free. On an unsupported system, the value may be @code{nil}.
+
+If @code{default-directory} points to a remote host, memory
+information of that host is returned.
@end defun
@defvar gcs-done
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index 0f6a99b299c..3223875320a 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -725,10 +725,11 @@ the first node that matches, or @code{nil} if none does.
By default, this function only traverses named nodes, but if @var{all}
is non-@code{nil}, it traverses all the nodes. If @var{backward} is
-non-@code{nil}, it traverses backwards (i.e., it visits the last child first
-when traversing down the tree). If @var{limit} is non-@code{nil}, it
-must be a number that limits the tree traversal to that many levels
-down the tree.
+non-@code{nil}, it traverses backwards (i.e., it visits the last child
+first when traversing down the tree). If @var{limit} is
+non-@code{nil}, it must be a number that limits the tree traversal to
+that many levels down the tree. If @var{limit} is @code{nil}, it
+defaults to 1000.
@end defun
@defun treesit-search-forward start predicate &optional backward all
@@ -814,10 +815,11 @@ b 1 2 b | | b c d
@end group
@end example
-If @var{process-fn} is non-@code{nil}, instead of returning the matched
-nodes, this function passes each node to @var{process-fn} and uses the
-returned value instead. If non-@code{nil}, @var{limit} is the number of
-levels to go down from @var{root}.
+If @var{process-fn} is non-@code{nil}, instead of returning the
+matched nodes, this function passes each node to @var{process-fn} and
+uses the returned value instead. If non-@code{nil}, @var{limit} is
+the number of levels to go down from @var{root}. If @var{limit} is
+@code{nil}, it defaults to 1000.
Each node in the returned tree looks like
@w{@code{(@var{tree-sitter-node} . (@var{child} @dots{}))}}. The
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index a01e568de07..7acf2d052a8 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -836,20 +836,39 @@ of using its normal method.
@findex treesit-beginning-of-defun
@findex treesit-end-of-defun
-If Emacs is compiled with tree-sitter, it can use the tree-sitter parser
-information to move across syntax constructs. A major mode can set
-@code{treesit-defun-type-regexp} and get navigation functionality for
-free, by using @code{treesit-beginning-of-defun} and
-@code{treesit-end-of-defun}.
+If Emacs is compiled with tree-sitter, it can use the tree-sitter
+parser information to move across syntax constructs. Since what
+exactly is considered a defun varies between languages, a major mode
+should set @code{treesit-defun-type-regexp} to determine that. Then
+the mode can get navigation-by-defun functionality for free, by using
+@code{treesit-beginning-of-defun} and @code{treesit-end-of-defun}.
@defvar treesit-defun-type-regexp
The value of this variable is a regexp matching the node type of defun
-nodes. (For ``node'', ``node type'', @pxref{Parsing Program Source}.)
+nodes. (For ``node'' and ``node type'', @pxref{Parsing Program Source}.)
For example, @code{python-mode} sets this variable to a regexp that
matches either @code{function_definition} or @code{class_definition}.
@end defvar
+@defvar treesit-defun-prefer-top-level
+If this variable is non-@code{nil}, Emacs skips nested defuns, when it
+looks for beginning and end of a defun, and prefers to go to the
+top-level defun instead.
+
+In some languages, a defun could be nested in another one. By default,
+Emacs stops at the first defun it encounters. But if this variable's
+value is @code{t}, whenever Emacs finds a defun node, it tries to go
+up the parse tree until it finds the top-level defun.
+
+This variable can also be a list of cons cells of the form
+@w{@code{(@var{from} . @var{to}))}}, where @var{from} and @var{to} are
+regexps matching tree-sitter node types. When Emacs finds a defun
+node whose type matches any of the @var{from} regexps in the list, it
+then tries to go up the parse tree until it finds a higher-level node
+matching the corresponding @var{to} regexp.
+@end defvar
+
@node Skipping Characters
@subsection Skipping Characters
@cindex skipping characters
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 37884faec7e..5b50d5f296c 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -588,8 +588,7 @@ within that frame. @var{frame} should be a live frame; if omitted or
@defun set-frame-selected-window frame window &optional norecord
This function makes @var{window} the window selected within the frame
@var{frame}. @var{frame} should be a live frame; if @code{nil}, it
-defaults to the selected frame. @var{window} should be a live window;
-if @code{nil}, it defaults to the selected window.
+defaults to the selected frame. @var{window} must denote a live window.
If @var{frame} is the selected frame, this makes @var{window} the
selected window.
diff --git a/doc/man/etags.1 b/doc/man/etags.1
index 4681a9dadbf..8dbea25c4cf 100644
--- a/doc/man/etags.1
+++ b/doc/man/etags.1
@@ -233,7 +233,7 @@ CONFIGURATION\\)\ +[^\ ]*\ +OF/'\ \-\-regex\='/[\ \\t]*\\
\\|PROCEDURE\\|PROCESS\\|TYPE\\)[\ \\t]+\\([^\ \\t(]+\\)/\\3/'\fP
.br
-Tag TCL files (this last example shows the usage of a \fItagregexp\fP):
+Tag Tcl files (this last example shows the usage of a \fItagregexp\fP):
.br
\fI\-\-lang\=none \-\-regex\='/proc[\ \\t]+\\([^\ \\t]+\\)/\\1/'\fP
diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi
index a815aebf59b..b76f8bdfd71 100644
--- a/doc/misc/eglot.texi
+++ b/doc/misc/eglot.texi
@@ -178,6 +178,7 @@ start it.
@node Setting Up LSP Servers
@section Setting Up LSP Servers
@cindex setting up LSP server for Eglot
+@cindex LSP server for Eglot, setting up
@cindex language server for Eglot
For Eglot to be useful, it must first be combined with a suitable
diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi
index e165adbb498..a8d1dd78235 100644
--- a/doc/misc/erc.texi
+++ b/doc/misc/erc.texi
@@ -392,10 +392,14 @@ modules are loaded.
There is a spiffy customize interface, which may be reached by typing
@kbd{M-x customize-option @key{RET} erc-modules @key{RET}}.
When removing a module outside of the Custom ecosystem, you may wish
-to ensure it's disabled by invoking its associated minor-mode toggle,
-such as @kbd{M-x erc-spelling-mode @key{RET}}. Note that, these days,
-calling @code{erc-update-modules} in an init file is typically
-unnecessary.
+to ensure it's disabled by invoking its associated minor-mode toggle
+with a nonpositive prefix argument, for example, @kbd{C-u - M-x
+erc-spelling-mode @key{RET}}. Additionally, if you plan on loading
+third-party modules that perform atypical setup on activation, you may
+need to arrange for calling @code{erc-update-modules} in your init
+file. Examples of such setup might include registering an
+@code{erc-before-connect} hook, advising @code{erc-open}, and
+modifying @code{erc-modules} itself.
The following is a list of available modules.
@@ -1051,17 +1055,10 @@ borrowing that parameter for its own uses, thus allowing you to call
@code{erc-tls} with @code{:password} set to your NickServ password.
You can also set this to a nonemtpy string, and ERC will send that
-when needed, no questions asked. If you instead give a non-@code{nil}
-symbol (other than @code{:password}), like @samp{Libera.Chat}, ERC
-will use it for the @code{:host} field in an auth-source query.
-Actually, the same goes for when this option is @code{nil} but an
-explicit session ID is already on file (@pxref{Network Identifier}).
-For all such queries, ERC specifies the resolved value of
-@code{erc-sasl-user} for the @code{:user} (@code{:login}) param. Keep
-in mind that none of this matters unless
-@code{erc-sasl-auth-source-function} holds a function, and it's
-@code{nil} by default. As a last resort, ERC will prompt you for
-input.
+when needed, no questions asked. Or, if you'd rather use auth-source,
+set @code{erc-sasl-auth-source-function} to a function, and ERC will
+perform an auth-source query instead. As last resort in all cases,
+ERC will prompt you for input.
Lastly, if your mechanism is @code{ecdsa-nist256p-challenge}, this
option should instead hold the file name of your key.
@@ -1071,7 +1068,23 @@ option should instead hold the file name of your key.
This is nearly identical to the other ERC @samp{auth-source} function
options (@pxref{ERC auth-source functions}) except that the default
value here is @code{nil}, meaning you have to set it to something like
-@code{erc-auth-source-search} for queries to be performed.
+@code{erc-auth-source-search} for queries to be performed. For
+convenience, this module provides the following as a possible value:
+
+@defun erc-sasl-auth-source-password-as-host &rest plist
+Setting @code{erc-sasl-auth-source-function} to this function tells
+ERC to use @code{erc-sasl-password} for the @code{:host} field when
+querying auth-source, even if its value is the default
+@code{:password}, in which case ERC knows to ``resolve'' it to
+@code{erc-session-password} and use that as long as it's
+non-@code{nil}. Otherwise, ERC just defers to
+@code{erc-auth-source-search} to determine the @code{:host}, along
+with everything else.
+@end defun
+
+As long as this option specifies a function, ERC will pass it the
+``resolved'' value of @code{erc-sasl-user} for the auth-source
+@code{:user} param.
@end defopt
@defopt erc-sasl-authzid
@@ -1082,6 +1095,78 @@ such a thing, please contact your network operator. Otherwise, just
leave this set to @code{nil}.
@end defopt
+@subheading Examples
+
+@itemize @bullet
+@item
+Defaults
+
+@lisp
+(erc-tls :server "irc.libera.chat" :port 6697
+ :nick "aph"
+ :user "APHacker"
+ :password "changeme")
+@end lisp
+
+Here, after adding @code{sasl} to @code{erc-modules} via the Customize
+interface, you authenticate to Libera.Chat using the @samp{PLAIN}
+mechanism and your NickServ credentials, @samp{APHacker} and
+@samp{changeme}.
+
+@item
+External
+
+@lisp
+(setopt erc-sasl-mechanism 'external)
+
+(erc-tls :server "irc.libera.chat" :port 6697 :nick "aph"
+ :client-certificate
+ '("/home/aph/my.key" "/home/aph/my.crt"))
+@end lisp
+
+You decide to switch things up and try out the @samp{EXTERNAL}
+mechanism. You follow your network's instructions for telling
+NickServ about your client-certificate's fingerprint, and you
+authenticate successfully.
+
+@item
+Multiple networks
+
+@example
+# ~/.authinfo.gpg
+
+machine irc.libera.chat key /home/aph/my.key cert /home/aph/my.crt
+machine Example.Net login alyssa password sEcReT
+machine Example.Net login aph-bot password sesame
+@end example
+
+@lisp
+;; init.el
+
+(defun my-erc-up (network)
+ (interactive "Snetwork: ")
+
+ (pcase network
+ ('libera
+ (let ((erc-sasl-mechanism 'external))
+ (erc-tls :server "irc.libera.chat" :port 6697
+ :client-certificate t)))
+ ('example
+ (let ((erc-sasl-auth-source-function
+ #'erc-sasl-auth-source-password-as-host))
+ (erc-tls :server "irc.example.net" :port 6697
+ :user "alyssa"
+ :password "Example.Net")))))
+@end lisp
+
+You've started storing your credentials with auth-source and have
+decided to try SASL on another network as well. But there's a catch:
+this network doesn't support @samp{EXTERNAL}. You use
+@code{let}-binding to get around this and successfully authenticate to
+both networks.
+
+@end itemize
+
@subheading Troubleshooting
@strong{Warning:} ERC's SASL offering is currently limited by a lack
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 10f7bd94f7e..94c75ed30c3 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -20564,7 +20564,7 @@ returned value is required to be an integer.
(score-fn (custom-scoring))
@end example
-The user-defined function is called with an associative list with the
+The user-defined function is called with an association list with the
keys @code{number subject from date id refs chars lines xref extra}
followed by the article's score before the function is run.
diff --git a/doc/misc/org-setup.org b/doc/misc/org-setup.org
index 88474538e5b..561f05d7d97 100644
--- a/doc/misc/org-setup.org
+++ b/doc/misc/org-setup.org
@@ -49,5 +49,5 @@
# The "kbd" macro turns KBD into @kbd{KBD}. Additionally, it
# encloses case-sensitive special keys (SPC, RET...) within @key{...}.
-#+macro: kbd (eval (let ((case-fold-search nil) (regexp (regexp-opt '("SPC" "RET" "LFD" "TAB" "BS" "ESC" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt" "Cmd" "Super" "UP" "LEFT" "RIGHT" "DOWN") 'words))) (format "@@texinfo:@kbd{@@%s@@texinfo:}@@" (replace-regexp-in-string regexp "@@texinfo:@key{@@\\&@@texinfo:}@@" $1 t))))
+#+macro: kbd (eval (org-texinfo-kbd-macro $1))
diff --git a/doc/misc/org.org b/doc/misc/org.org
index 6ad8c462cc3..43d85099cff 100644
--- a/doc/misc/org.org
+++ b/doc/misc/org.org
@@ -18,24 +18,30 @@
:END:
#+cindex: 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 Mode is an authoring tool and a TODO lists manager for GNU Emacs.
+It relies on a lightweight plain-text markup language used in files
+with the =.org= extension.
+
+As an authoring tool, Org helps you write structured documents and
+provides exporting facilities. Org files can also be used for literate
+programming and reproducible research. As a TODO lists manager, Org
+helps you organize your tasks in a flexible way, from daily needs to
+detailed project-planning, allowing logging, multiple views on your
+tasks, exporting your agendas, etc.
+
+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. 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
+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
@@ -68,8 +74,8 @@ of Org, as well as additional information, frequently asked questions
[[https://orgmode.org]].
#+cindex: print edition
-An earlier version (7.3) of this manual was published as a paperback book by
-Network Theory Ltd. in 2010.
+An earlier version (7.3) of this manual was available as a paperback
+book from the Network Theory Ltd. publishing company, closed in 2009.
** Installation
:PROPERTIES:
@@ -77,15 +83,18 @@ Network Theory Ltd. in 2010.
:END:
#+cindex: 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.
+Org is included in distributions of GNU Emacs, you probably do not
+need to install it. Most users will simply activate Org and begin
+exploring its 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.
+Org's git repository. We *strongly recommend* sticking to a single
+installation method.
-We *strongly recommend* sticking to a single installation method.
+When installing Org on top of the pre-packaged version, please note
+that Org stable versions are meant to be fully compatible with the
+last three stable versions of Emacs but not with older Emacsen.
*** Using Emacs packaging system
:PROPERTIES:
@@ -121,8 +130,11 @@ 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.
+Make sure you set the load path correctly in your Emacs init file:
+
+#+begin_src emacs-lisp
+(add-to-list 'load-path "~/src/org-mode/lisp")
+#+end_src
You can also compile with =make=, generate the documentation with
=make doc=, create a local configuration with =make config= and
@@ -138,9 +150,13 @@ Org Build System page on [[https://orgmode.org/worg/dev/org-build-system.html][W
:END:
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 [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] repository, which you can install
-separately.
+contributed by others. As of Org 9.5, the directory has been moved to
+the dedicated org-contrib [[https://git.sr.ht/~bzg/org-contrib][repository]], which you can install
+separately as a [[https://elpa.nongnu.org/nongnu/org-contrib.html][package]] from NonGNU ELPA.
+
+There are enough valuable packages maintained outside of the Org repository.
+Worg has a list of [[https://orgmode.org/worg/org-contrib/index.html][org-contrib and external packages]], certainly it is not
+exhaustive.
** Activation
:PROPERTIES:
@@ -153,7 +169,8 @@ separately.
#+cindex: key bindings, global
Org mode buffers need Font Lock to be turned on: this is the default
-in Emacs[fn:1].
+in Emacs[fn:: If you do not use Font Lock globally turn it on in Org
+buffer with =(add-hook 'org-mode-hook #'turn-on-font-lock)=.].
There are compatibility issues between Org mode and some other Elisp
packages (see [[*Packages that conflict with Org mode]]). Please take the
@@ -205,11 +222,17 @@ region by using the mouse to select a region, or pressing
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
-[[mailto:emacs-orgmode@gnu.org]]. You can subscribe to the list [[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this
-web page]]. If you are not a member of the mailing list, your mail will
-be passed to the list after a moderator has approved it[fn:2]. We ask
-you to read and respect the [[https://www.gnu.org/philosophy/kind-communication.html][GNU Kind Communications Guidelines]] when
-sending messages on this mailing list.
+[[mailto:emacs-orgmode@gnu.org]]. You can subscribe to the list
+[[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this web
+page]]. If you are not a member of the mailing list, your mail will
+be passed to the list after a moderator has approved it[fn:: Please
+consider subscribing to the mailing list in order to minimize the work
+the mailing list moderators have to do.]. We ask you to read and
+respect the
+[[https://www.gnu.org/philosophy/kind-communication.html][GNU Kind
+Communications Guidelines]] when sending messages on this mailing
+list. Please allow up to one month for the response and followup if
+no response is received on the bug report.
#+findex: org-version
#+findex: org-submit-bug-report
@@ -256,6 +279,14 @@ shown below.
(add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
#+end_src
+If you are using Org mode version from Git repository, you can start
+minimal session using make.
+
+: # Bare Emacs
+: make repro
+: # or pass extra arguments
+: make repro REPRO_ARGS="-l /path/to/minimal/config.el /tmp/bug.org"
+
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:
@@ -380,7 +411,7 @@ the entire show and hide functionalities into a single command,
#+vindex: org-ctrl-k-protect-subtree
Headlines define the structure of an outline tree. Org headlines
-start on the left margin[fn:3] with one or more stars followed by
+start on the left margin[fn:1] with one or more stars followed by
a space. For example:
#+begin_example
@@ -449,7 +480,8 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
#+end_example
#+vindex: org-cycle-emulate-tab
- Point must be on a headline for this to work[fn:4].
+ Point must be on a headline for this to work[fn:: See, however, the
+ option ~org-cycle-emulate-tab~.].
- {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} ::
@@ -488,11 +520,11 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
Switch back to the startup visibility of the buffer (see [[*Initial
visibility]]).
-- {{{kbd(C-u C-u C-u TAB)}}} (~outline-show-all~) ::
+- {{{kbd(C-u C-u C-u TAB)}}} (~org-show-all~) ::
#+cindex: show all, command
#+kindex: C-u C-u C-u TAB
- #+findex: outline-show-all
+ #+findex: org-show-all
Show all, including drawers.
- {{{kbd(C-c C-r)}}} (~org-reveal~) ::
@@ -508,18 +540,18 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
headings. With a double prefix argument, also show the entire
subtree of the parent.
-- {{{kbd(C-c C-k)}}} (~outline-show-branches~) ::
+- {{{kbd(C-c C-k)}}} (~org-show-branches~) ::
#+cindex: show branches, command
#+kindex: C-c C-k
- #+findex: outline-show-branches
+ #+findex: org-show-branches
Expose all the headings of the subtree, but not their bodies.
-- {{{kbd(C-c TAB)}}} (~outline-show-children~) ::
+- {{{kbd(C-c TAB)}}} (~org-show-children~) ::
#+cindex: show children, command
#+kindex: C-c TAB
- #+findex: outline-show-children
+ #+findex: org-show-children
Expose all direct children of the subtree. With a numeric prefix
argument {{{var(N)}}}, expose all children down to level
{{{var(N)}}}.
@@ -528,7 +560,7 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
#+kindex: C-c C-x b
#+findex: org-tree-to-indirect-buffer
- Show the current subtree in an indirect buffer[fn:5]. With
+ Show the current subtree in an indirect buffer[fn:2]. With
a numeric prefix argument {{{var(N)}}}, go up to level {{{var(N)}}}
and then take that tree. If {{{var(N)}}} is negative then go up
that many levels. With a {{{kbd(C-u)}}} prefix, do not remove the
@@ -547,10 +579,12 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
#+vindex: org-startup-folded
When Emacs first visits an Org file, the global state is set to
-~showeverything~, i.e., all file content is visible[fn:6]. 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:
+~showeverything~, i.e., all file content is visible[fn:: 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
+[[*Speeding Up Your Agendas]]).]. 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:
#+cindex: @samp{STARTUP}, keyword
#+begin_example
@@ -583,10 +617,10 @@ for this property are =folded=, =children=, =content=, and =all=.
:END:
#+cindex: edits, catching invisible
-#+vindex: org-catch-invisible-edits
+#+vindex: org-fold-catch-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
+Setting ~org-fold-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.
@@ -897,8 +931,10 @@ keys have different functionality.
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[fn:7].
-Just try it out and you will see immediately how it works.
+is made visible along with the headline structure above it[fn:: See
+also the variable ~org-show-context-detail~ to decide how much context
+is shown around each match.]. 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:
@@ -916,16 +952,18 @@ commands can be accessed through a dispatcher:
#+kindex: C-c / /
#+findex: org-occur
#+vindex: org-remove-highlights-with-change
- Prompts for a regexp (see [[*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 {{{kbd(C-c C-c)}}}[fn:8]. When
- called with a {{{kbd(C-u)}}} prefix argument, previous highlights
- are kept, so several calls to this command can be stacked.
+ Prompts for a regexp (see [[*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 {{{kbd(C-c
+ C-c)}}}[fn:: This depends on the option
+ ~org-remove-highlights-with-change~.]. When called with a
+ {{{kbd(C-u)}}} prefix argument, previous highlights are kept, so
+ several calls to this command can be stacked.
- {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) ::
@@ -986,17 +1024,18 @@ every exporter (see [[*Exporting]]) can parse and format them.
Org knows ordered lists, unordered lists, and description lists.
#+attr_texinfo: :indic @bullet
-- /Unordered/ list items start with =-=, =+=, or =*=[fn:9] as bullets.
+- /Unordered/ list items start with =-=, =+=, or =*=[fn:3] as bullets.
-
#+vindex: org-plain-list-ordered-item-terminator
#+vindex: org-alphabetical-lists
- /Ordered/ list items start with a numeral followed by either
- a period or a right parenthesis[fn:10], such as =1.= or =1)=[fn:11]
- If you want a list to start with a different value---e.g.,
- 20---start the text of the item with =[@20]=[fn:12]. Those
- constructs can be used in any item of the list in order to enforce
- a particular numbering.
+ /Ordered/ list items start with a numeral followed by either a
+ period or a right parenthesis[fn:: You can filter out any of them by
+ configuring ~org-plain-list-ordered-item-terminator~.], such as =1.=
+ or =1)=[fn:4] If you want a list to start with a different
+ value---e.g., 20---start the text of the item with =[@20]=[fn:5].
+ 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
@@ -1075,12 +1114,13 @@ to disable them individually.
#+kindex: M-RET
#+findex: org-insert-heading
#+vindex: org-M-RET-may-split-line
- Insert new item at current level. With a prefix argument, force
- a new heading (see [[*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[fn:13]. If this command is executed
- /before item's body/, the new item is created /before/ the current
- one.
+ Insert new item at current level. With a prefix argument, force a
+ new heading (see [[*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[fn:: If you do not want the item to
+ be split, customize the variable ~org-M-RET-may-split-line~.]. If
+ this command is executed /before item's body/, the new item is
+ created /before/ the current one.
- {{{kbd(M-S-RET)}}} ::
@@ -1095,17 +1135,19 @@ to disable them individually.
#+vindex: org-support-shift-select
#+vindex: org-list-use-circular-motion
Jump to the previous/next item in the current list, but only if
- ~org-support-shift-select~ is off[fn:14]. If not, you can still use
- paragraph jumping commands like {{{kbd(C-UP)}}} and
- {{{kbd(C-DOWN)}}} to quite similar effect.
+ ~org-support-shift-select~ is off[fn:: If you want to cycle around
+ items that way, you may customize ~org-list-use-circular-motion~.].
+ If not, you can still use paragraph jumping commands like
+ {{{kbd(C-UP)}}} and {{{kbd(C-DOWN)}}} to quite similar effect.
- {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
#+kindex: M-UP
#+kindex: M-DOWN
- Move the item including subitems up/down[fn:15], i.e., swap with
- previous/next item of same indentation. If the list is ordered,
- renumbering is automatic.
+ Move the item including subitems up/down[fn:: See
+ ~org-list-use-circular-motion~ for a cyclic behavior.], i.e., swap
+ with previous/next item of same indentation. If the list is
+ ordered, renumbering is automatic.
- {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
@@ -1214,7 +1256,7 @@ Org mode uses this special drawer for storing properties (see
[[*Properties and Columns]]). You cannot use it for anything else.
Completion over drawer keywords is also possible using
-{{{kbd(M-TAB)}}}[fn:16].
+{{{kbd(M-TAB)}}}[fn:6].
Visibility cycling (see [[*Visibility Cycling]]) on the headline hides and
shows the entry, but keep the drawer collapsed to a single line. In
@@ -1274,10 +1316,11 @@ Calculator Manual]]).
#+cindex: table syntax
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[fn:17]. 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:
+=|= is also the column separator[fn:: To insert a vertical bar into a
+table field, use =\vert= or, inside a word =abc\vert{}def=.].
+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:
#+begin_example
| Name | Phone | Age |
@@ -1839,7 +1882,7 @@ 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:[fn:18]
+representation that looks like this:[fn:7]
: @ROW$COLUMN
@@ -1946,7 +1989,9 @@ and ~org-table-current-column~. Examples:
#+texinfo: @noindent
For the second and third examples, table {{{var(FOO)}}} must have at
least as many rows or columns as the current table. Note that this is
-inefficient[fn:19] for large number of rows.
+inefficient[fn:: The computation time scales as O(N^2) because table
+{{{var(FOO)}}} is parsed for each field to be copied.] for large
+number of rows.
**** Named references
:PROPERTIES:
@@ -1974,7 +2019,7 @@ constants in table formulas: for a property =Xyz= use the name
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[fn:20]. Column names and parameters can be specified in
+kilometers[fn:8]. Column names and parameters can be specified in
special table lines. These are described below, see [[*Advanced
features]]. All names must start with a letter, and further consist
of letters and numbers.
@@ -2095,7 +2140,7 @@ 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[fn:21]. A few examples:
+formatting[fn:9]. A few examples:
| =$1+$2= | Sum of first and second field |
| =$1+$2;%.2f= | Same, format result to two decimals |
@@ -2124,7 +2169,7 @@ Operations]]). For example
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= ::
+- =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=
@@ -2620,11 +2665,11 @@ keyword.
#+cindex: debugging, of table 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 {{{kbd(C-u C-u C-c = RET)}}} in
-a field. Detailed information are displayed.
+becomes the string =#ERROR=. If you want 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 {{{kbd(C-u C-u C-c = RET)}}} in a field.
+Detailed information are displayed.
*** Updating the table
:PROPERTIES:
@@ -2682,9 +2727,10 @@ following commands:
:END:
If you want the recalculation of fields to happen automatically, or if
-you want to be able to assign /names/[fn:22] to fields and columns,
-you need to reserve the first column of the table for special marking
-characters.
+you want to be able to assign /names/[fn:: Such names must start with
+an alphabetic character and use only alphanumeric/underscore
+characters.] to fields and columns, you need to reserve the first
+column of the table for special marking characters.
- {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) ::
@@ -2991,7 +3037,7 @@ links to other files, Usenet articles, emails, and much more.
#+cindex: angle bracket links
#+cindex: plain links
Org recognizes plain URIs, possibly wrapped within angle
-brackets[fn:23], and activate them as clickable links.
+brackets[fn:10], and activate them as clickable links.
#+cindex: bracket links
The general link format, however, looks like this:
@@ -3035,11 +3081,13 @@ the {{{var(LINK)}}} part, if there is no description, or the
If you place point at the beginning or just behind the end of the
displayed text and press {{{kbd(BS)}}}, you remove
-the---invisible---bracket at that location[fn:24]. This makes the link
+the---invisible---bracket at that location[fn:: More accurately, the
+precise behavior depends on how point arrived there---see
+[[info:elisp#Invisible Text][Invisible Text]].]. 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 \rarr Hyperlinks \rarr
-Literal links.
+the internal structure of all links, use the menu: Org \rarr
+Hyperlinks \rarr Literal links.
** Internal Links
:PROPERTIES:
@@ -3058,7 +3106,7 @@ 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=[fn:25].
+section]]= points to a headline with the name =Some section=[fn:11].
#+cindex: targets, for links
When the link does not belong to any of the cases above, Org looks for
@@ -3091,8 +3139,9 @@ you in the process, if needed. See [[*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[fn:26]. In the following excerpt from
-an Org buffer
+assigned to the marked object[fn:: When targeting a =NAME= keyword,
+the =CAPTION= keyword is mandatory in order to get proper numbering
+(see [[*Captions]]).]. In the following excerpt from an Org buffer
#+begin_example
1. one item
@@ -3234,7 +3283,7 @@ options:
| Link Type | Example |
|------------+----------------------------------------------------------|
-| http | =https://staff.science.uva.nl/c.dominik/= |
+| http | =http://staff.science.uva.nl/c.dominik/= |
| https | =https://orgmode.org/= |
| doi | =doi:10.1000/182= |
| file | =file:/home/dominik/images/jupiter.jpg= |
@@ -3245,7 +3294,7 @@ options:
| | =/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)[fn:27] |
+| | =file:projects.org::some words= (text search)[fn:12] |
| | =file:projects.org::*task title= (headline search) |
| | =file:projects.org::#custom-id= (headline search) |
| attachment | =attachment:projects.org= |
@@ -3328,7 +3377,7 @@ current buffer:
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[fn:28].
+ is also the description.
#+vindex: org-id-link-to-org-use-id
#+cindex: @samp{CUSTOM_ID}, property
@@ -3336,12 +3385,15 @@ current buffer:
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[fn:29]. 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.
+ =ID= property for the link[fn:: 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.]. 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/ ::
@@ -3398,11 +3450,11 @@ generally, act on links.
#+cindex: completion, of links
#+cindex: inserting links
#+vindex: org-link-keep-stored-after-insertion
- Insert a link[fn:30]. This prompts for a link to be inserted into
+ Insert a link[fn:13]. 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[fn:31]. If some text was selected at this time,
+ a descriptive text[fn:14]. If some text was selected at this time,
it becomes the default description.
- /Inserting stored links/ ::
@@ -3417,11 +3469,12 @@ generally, act on links.
prefixes like =http= or =ftp=, including the prefixes defined
through link abbreviations (see [[*Link Abbreviations]]). If you
press {{{kbd(RET)}}} after inserting only the prefix, Org offers
- specific completion support for some link types[fn:32]. For
- example, if you type {{{kbd(f i l e RET)}}}---alternative access:
- {{{kbd(C-u C-c C-l)}}}, see below---Org offers file name
- completion, and after {{{kbd(b b d b RET)}}} you can complete
- contact names.
+ specific completion support for some link types[fn:: This works if
+ a function has been defined in the ~:complete~ property of a link
+ in ~org-link-parameters~.]. For example, if you type {{{kbd(f i l
+ e RET)}}}---alternative access: {{{kbd(C-u C-c C-l)}}}, see
+ below---Org offers file name completion, and after {{{kbd(b b d b
+ RET)}}} you can complete contact names.
- {{{kbd(C-u C-c C-l)}}} ::
@@ -3488,7 +3541,8 @@ generally, act on links.
#+vindex: org-link-use-indirect-buffer-for-internals
#+kindex: mouse-3
Like {{{kbd(mouse-2)}}}, but force file links to be opened with
- Emacs, and internal links to be displayed in another window[fn:33].
+ Emacs, and internal links to be displayed in another window[fn:: See
+ the variable ~org-link-use-indirect-buffer-for-internals~.].
- {{{kbd(C-c %)}}} (~org-mark-ring-push~) ::
@@ -3566,7 +3620,7 @@ 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")
+ ("duckduckgo" . "https://duckduckgo.com/?q=%s")
("omap" . "https://nominatim.openstreetmap.org/search?q=%s&polygon=1")
("ads" . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\"")))
#+end_src
@@ -3598,8 +3652,11 @@ can define them in the file with
#+begin_example
,#+LINK: bugzilla https://10.1.2.9/bugzilla/show_bug.cgi?id=
,#+LINK: duckduckgo https://duckduckgo.com/?q=%s
+,#+LINK: "Nu Html Checker" https://validator.w3.org/nu/?doc=%h
#+end_example
+The abbreviations containing spaces must be quoted.
+
In-buffer completion (see [[*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
@@ -3622,11 +3679,12 @@ the link completion function like this:
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[fn:34]. For
+line number or a search option after a double colon[fn:: For backward
+compatibility, line numbers can also follow a single colon.]. For
example, when the command ~org-store-link~ creates a link (see
-[[*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 {{{kbd(C-c C-o)}}}.
+[[*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 {{{kbd(C-c C-o)}}}.
Note that all search options apply for Attachment links in the same
way that they apply for File links.
@@ -3706,12 +3764,13 @@ implementation example. See the file =ol-bibtex.el=.
:END:
#+cindex: TODO items
-Org mode does not maintain TODO lists as separate documents[fn:35].
-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.
+Org mode does not maintain TODO lists as separate documents[fn:: Of
+course, you can make a document that contains only long lists of TODO
+items, but this is not required.]. 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
@@ -3825,7 +3884,9 @@ TODO items in particular (see [[*Tags]]).
#+cindex: workflow states as TODO keywords
You can use TODO keywords to indicate different, possibly /sequential/
-states in the process of working on an item, for example[fn:36]:
+states in the process of working on an item, for example[fn:: Changing
+the variable ~org-todo-keywords~ only becomes effective after
+restarting Org mode in a buffer.]:
#+begin_src emacs-lisp
(setq org-todo-keywords
@@ -3874,22 +3935,22 @@ Using TODO types, it would be set up like this:
(setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
#+end_src
-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 {{{kbd(C-c
-C-t)}}}[fn:37]. 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
-{{{kbd(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 {{{kbd(C-c / t)}}}.
-For example, to see all things Lucy has to do, you would use
-{{{kbd(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: {{{kbd(C-3 M-x org-agenda
-t)}}}.
+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 {{{kbd(C-c C-t)}}}[fn:: This is
+also true for the {{{kbd(t)}}} command in the agenda buffer.]. 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 {{{kbd(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 {{{kbd(C-c / t)}}}. For example, to see all
+things Lucy has to do, you would use {{{kbd(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: {{{kbd(C-3 M-x org-agenda t)}}}.
*** Multiple keyword sets in one file
:PROPERTIES:
@@ -3950,8 +4011,9 @@ correct sequence. In addition to typing a keyword or using completion
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[fn:38]. For
-example:
+selection character after each keyword, in parentheses[fn:: All
+characters are allowed except =@=, =^= and =!=, which have a special
+meaning here.]. For example:
#+begin_src emacs-lisp
(setq org-todo-keywords
@@ -3963,7 +4025,7 @@ example:
#+vindex: org-fast-tag-selection-include-todo
If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
the entry is switched to this state. {{{kbd(SPC)}}} can be used to
-remove any TODO keyword from an entry[fn:39].
+remove any TODO keyword from an entry[fn:15].
*** Setting up keywords for individual files
:PROPERTIES:
@@ -4008,7 +4070,10 @@ 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 {{{kbd(C-c C-c)}}} with point still in the line to make the
-changes known to Org mode[fn:40].
+changes known to Org mode[fn:: Org mode parses these lines only when
+Org mode is activated after visiting a file. {{{kbd(C-c C-c)}}} with
+point in a line starting with =#+= is simply restarting Org mode for
+the current buffer.].
*** Faces for TODO keywords
:PROPERTIES:
@@ -4151,7 +4216,8 @@ clock working time for a task, see [[*Clocking Work Time]].
:END:
The most basic automatic logging is to keep track of /when/ a certain
-TODO item was marked as done. This can be achieved with[fn:41]
+TODO item was marked as done. This can be achieved with[fn:: The
+corresponding in-buffer setting is: =#+STARTUP: logdone=.]
#+begin_src emacs-lisp
(setq org-log-done 'time)
@@ -4165,8 +4231,9 @@ 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 {{{kbd(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[fn:42]
+~org-closed-keep-when-no-todo~ to non-~nil~. If you want to record a
+note along with the timestamp, use[fn:: The corresponding in-buffer
+setting is: =#+STARTUP: lognotedone=.]
#+begin_src emacs-lisp
(setq org-log-done 'note)
@@ -4188,13 +4255,16 @@ entry with a =Closing Note= heading.
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[fn:43].
-When taking a lot of notes, you might want to get the notes out of the
-way into a drawer (see [[*Drawers]]). Customize the variable
-~org-log-into-drawer~ to get this behavior---the recommended drawer
-for this is called =LOGBOOK=[fn:44]. You can also overrule the
-setting of this variable for a subtree by setting a =LOG_INTO_DRAWER=
-property.
+inserted after the headline as an itemized list, newest first[fn:: See
+the variable ~org-log-states-order-reversed~.]. When taking a lot of
+notes, you might want to get the notes out of the way into a drawer
+(see [[*Drawers]]). Customize the variable ~org-log-into-drawer~ to
+get this behavior---the recommended drawer for this is called
+=LOGBOOK=[fn:: Note that the =LOGBOOK= drawer is unfolded when
+pressing {{{kbd(SPC)}}} in the agenda to show an entry---use
+{{{kbd(C-u SPC)}}} to keep it folded here.]. 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
@@ -4211,7 +4281,7 @@ example, with the setting
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=[fn:45]. The setting for =WAIT= is even more special: the
+=CANCELED=[fn:16]. 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
@@ -4260,7 +4330,7 @@ specific settings like =TODO(!)=. For example:
#+cindex: @samp{STYLE}, property
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~
+TODO, called "habits." To use habits, you have to enable the ~habit~
module by customizing the variable ~org-modules~.
A habit has the following properties:
@@ -4416,10 +4486,11 @@ TODO items.
#+findex: org-priority-up
#+findex: org-priority-down
#+vindex: org-priority-start-cycle-with-default
- Increase/decrease the priority of the current headline[fn:46]. Note
- that these keys are also used to modify timestamps (see [[*Creating
- Timestamps]]). See also [[*Packages that conflict with Org mode]], for
- a discussion of the interaction with shift-selection.
+ Increase/decrease the priority of the current headline[fn:: See also
+ the option ~org-priority-start-cycle-with-default~.]. Note that
+ these keys are also used to modify timestamps (see [[*Creating
+ Timestamps]]). See also [[*Packages that conflict with Org mode]],
+ for a discussion of the interaction with shift-selection.
#+vindex: org-priority-highest
#+vindex: org-priority-lowest
@@ -4448,11 +4519,13 @@ Or, using numeric values:
#+vindex: org-agenda-todo-list-sublevels
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[fn:47]. 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 {{{kbd(C-c C-c)}}} on the cookie. For example:
+below a TODO item, with detailed subtasks on the tree[fn:: To keep
+subtasks out of the global TODO list, see the option
+~org-agenda-todo-list-sublevels~.]. 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
+{{{kbd(C-c C-c)}}} on the cookie. For example:
#+begin_example
,* Organize Party [33%]
@@ -4475,7 +4548,7 @@ in the subtree (not just direct children), configure the variable
include the word =recursive= into the value of the =COOKIE_DATA=
property.
-#+begin_example org
+#+begin_example
,* Parent capturing statistics [2/20]
:PROPERTIES:
:COOKIE_DATA: todo recursive
@@ -4504,7 +4577,7 @@ of) a large number of subtasks (see [[*Checkboxes]]).
#+cindex: checkboxes
#+vindex: org-list-automatic-rules
-Every item in a plain list[fn:48] (see [[*Plain Lists]]) can be made into
+Every item in a plain list[fn:17] (see [[*Plain Lists]]) can be made into
a checkbox by starting it with the string =[ ]=. This feature is
similar to TODO items (see [[*TODO Items]]), but is more lightweight.
Checkboxes are not included into the global TODO list, so they are
@@ -4540,14 +4613,17 @@ 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[fn:49]. 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.
+appears[fn:: 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.]. 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.
#+cindex: blocking, of checkboxes
#+cindex: checkbox blocking
@@ -4564,8 +4640,10 @@ The following commands work with checkboxes:
#+findex: 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[fn:50]. With a double prefix argument, set
- it to =[-]=, which is considered to be an intermediate state.
+ remove the current one[fn:: {{{kbd(C-u C-c C-c)}}} on the /first/
+ item of a list with no checkbox adds checkboxes to the rest of the
+ list.]. With a double prefix argument, set it to =[-]=, which is
+ considered to be an intermediate state.
- {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
@@ -4677,7 +4755,9 @@ 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[fn:51]
+surrounds the entire file. Use a line like this[fn:: As with all
+these in-buffer settings, pressing {{{kbd(C-c C-c)}}} activates any
+changes in the line.]
#+cindex: @samp{FILETAGS}, keyword
: #+FILETAGS: :Peter:Boss:Secret:
@@ -4691,10 +4771,11 @@ use the variables ~org-use-tag-inheritance~ and
#+vindex: org-tags-match-list-sublevels
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[fn:52]. 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).
+form---match as well[fn:: This is only true if the search does not
+involve more complex tests including properties (see [[*Property
+Searches]]).]. 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).
#+vindex: org-agenda-use-tag-inheritance
Tag inheritance is relevant when the agenda search tries to match
@@ -4744,9 +4825,12 @@ also a special command for inserting tags:
#+cindex: @samp{TAGS}, keyword
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[fn:53]. 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
+the buffer[fn:: To extend this default list to all tags used in all
+agenda files (see [[*Agenda Views]]), customize the variable
+~org-complete-tags-always-offer-all-agenda-tags~.]. 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
#+begin_example
,#+TAGS: @work @home @tennisclub
@@ -4830,7 +4914,8 @@ by the following configuration:
If at least one tag has a selection key then pressing {{{kbd(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[fn:54].
+valid tags with corresponding keys[fn:: Keys are automatically
+assigned to tags that have no configured keys.].
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
@@ -5101,7 +5186,7 @@ value after it. Keys are case-insensitive. Here is an example:
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 [[*Property Inheritance]].
+subtree defined by the entry, see [[*Property Inheritance]].
You may define the allowed values for a particular property =Xyz= by
setting a property =Xyz_ALL=. This special property is /inherited/,
@@ -5470,7 +5555,9 @@ optional. The individual parts have the following meaning:
- {{{var(SUMMARY-TYPE)}}} ::
The summary type. If specified, the column values for parent nodes
- are computed from the children[fn:55].
+ are computed from the children[fn:: If more than one summary type
+ applies to the same property, the parent values are computed
+ according to the first of them.].
Supported summary types are:
@@ -5487,7 +5574,7 @@ optional. The individual parts have the following meaning:
| =:min= | Smallest time value in column. |
| =:max= | Largest time value. |
| =:mean= | Arithmetic mean of time values. |
- | =@min= | Minimum age[fn:56] (in days/hours/mins/seconds). |
+ | =@min= | Minimum age[fn:18] (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. |
@@ -5515,7 +5602,9 @@ 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[fn:57].
+allowed values[fn:: Please note that the =COLUMNS= definition must be
+on a single line; it is wrapped here only because of formatting
+constraints.].
#+begin_example
:COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \
@@ -5788,7 +5877,9 @@ 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=[fn:58]. It provides a general API to collect
+in =org-contrib=[fn:: Contributed packages are not part of Emacs, but
+are distributed with the main distribution of Org---visit
+[[https://orgmode.org]].]. 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.
@@ -5821,7 +5912,7 @@ is used in a much wider sense.
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>=[fn:59].
+=<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:19].
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 [[*Weekly/daily agenda]]). We distinguish:
@@ -5847,8 +5938,8 @@ the agenda (see [[*Weekly/daily agenda]]). We distinguish:
#+cindex: 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:
+ a certain interval of N hours (h), days (d), weeks (w), months (m),
+ or years (y). The following shows up in the agenda every Wednesday:
#+begin_example
,* Pick up Sam at school
@@ -5859,9 +5950,15 @@ the agenda (see [[*Weekly/daily agenda]]). We distinguish:
#+cindex: diary style timestamps
#+cindex: sexp timestamps
+ # Mentioned inside the footnote.
+ #+findex: org-date
+ #+findex: org-anniversary
+ #+findex: org-cyclic
+ #+findex: org-block
+
For more complex date specifications, Org mode supports using the
special expression diary entries implemented in the Emacs Calendar
- package[fn:60]. For example, with optional time:
+ package[fn:20]. For example, with optional time:
#+begin_example
,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
@@ -6013,7 +6110,7 @@ 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[fn:61]. If the date has been automatically shifted into the
+date[fn:21]. 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
@@ -6078,11 +6175,13 @@ separator in the latter case, e.g.:
#+cindex: calendar, for selecting date
#+vindex: org-popup-calendar-for-date-prompt
-Parallel to the minibuffer prompt, a calendar is popped up[fn:62].
-When you exit the date prompt, either by clicking on a date in the
-calendar, or by pressing {{{kbd(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:
+Parallel to the minibuffer prompt, a calendar is popped up[fn:: If you
+do not need/want the calendar, configure the variable
+~org-popup-calendar-for-date-prompt~.]. When you exit the date
+prompt, either by clicking on a date in the calendar, or by pressing
+{{{kbd(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:
#+kindex: <
#+kindex: >
@@ -6111,14 +6210,15 @@ can control the calendar fully from the minibuffer:
| {{{kbd(<)}}} | Scroll calendar backward by one month. |
| {{{kbd(M-v)}}} | Scroll calendar forward by 3 months. |
| {{{kbd(C-v)}}} | Scroll calendar backward by 3 months. |
-| {{{kbd(C-.)}}} | Select today's date[fn:63] |
+| {{{kbd(C-.)}}} | Select today's date[fn:22] |
#+vindex: org-read-date-display-live
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[fn:64].
+is displayed live in the minibuffer[fn:: If you find this distracting,
+turn off the display with ~org-read-date-display-live~.].
*** Custom time format
:PROPERTIES:
@@ -6210,7 +6310,7 @@ immediately after the task they refer to.
date.
#+vindex: org-agenda-skip-scheduled-if-done
- The headline is listed under the given date[fn:65]. In addition,
+ The headline is listed under the given date[fn:23]. 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.
@@ -6262,7 +6362,7 @@ expression entry matches.
:END:
The following commands allow you to quickly insert a deadline or to
-schedule an item:[fn:66]
+schedule an item:[fn:24]
- {{{kbd(C-c C-d)}}} (~org-deadline~) ::
@@ -6274,7 +6374,8 @@ schedule an item:[fn:66]
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[fn:67].
+ deadline[fn:: Note the corresponding =STARTUP= options
+ =logredeadline=, =lognoteredeadline=, and =nologredeadline=.].
- {{{kbd(C-c C-s)}}} (~org-schedule~) ::
@@ -6286,7 +6387,8 @@ schedule an item:[fn:66]
=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[fn:68].
+ scheduling time[fn:: Note the corresponding =STARTUP= options
+ =logreschedule=, =lognotereschedule=, and =nologreschedule=.].
- {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
@@ -6326,7 +6428,7 @@ any current timestamp.
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[fn:69]. In the following example:
+=SCHEDULED=, or plain timestamps[fn:25]. In the following example:
#+begin_example
,** TODO Pay the rent
@@ -6347,16 +6449,19 @@ period last
#+vindex: org-todo-repeat-to-state
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
+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 {{{kbd(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[fn:70]. In the example
-above, setting the state to =DONE= would actually switch the date like
-this:
+immediately sets the entry state back to TODO[fn:: 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.]. In the example above, setting the
+state to =DONE= would actually switch the date like this:
#+begin_example
,** TODO Pay the rent
@@ -6367,7 +6472,7 @@ To mark a task with a repeater as DONE, use {{{kbd(C-- 1 C-c C-t)}}},
i.e., ~org-todo~ with a numeric prefix argument of =-1=.
#+vindex: org-log-repeat
-A timestamp[fn:71] is added under the deadline, to keep a record that
+A timestamp[fn:26] 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
@@ -6437,7 +6542,7 @@ 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[fn:72] of a project. And it remembers a history or tasks
+subtree[fn:27] 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.
@@ -6450,8 +6555,10 @@ To save the clock history across Emacs sessions, use:
#+vindex: org-clock-persist
When you clock into a new task after resuming Emacs, the incomplete
-clock[fn:73] is retrieved (see [[*Resolving idle time]]) and you are
-prompted about what to do with it.
+clock[fn:: To resume the clock under the assumption that you have
+worked on this task while outside Emacs, use =(setq org-clock-persist
+t)=.] is retrieved (see [[*Resolving idle time]]) and you are prompted
+about what to do with it.
*** Clocking commands
:PROPERTIES:
@@ -6487,17 +6594,20 @@ prompted about what to do with it.
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 [[*Effort Estimates]]), the mode
- line displays the current clocking time against it[fn:74]. If the
- task is a repeating one (see [[*Repeated tasks]]), show only the time
- since the last reset of the task[fn:75]. 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[fn:76]. Clicking with
- {{{kbd(mouse-1)}}} onto the mode line entry pops up a menu with
- clocking options.
+ the task has an effort estimate (see [[*Effort Estimates]]), the
+ mode line displays the current clocking time against it[fn:: To add
+ an effort estimate "on the fly", hook a function doing this to
+ ~org-clock-in-prepare-hook~.]. If the task is a repeating one (see
+ [[*Repeated tasks]]), show only the time since the last reset of the
+ task[fn:: The last reset of the task is recorded by the
+ =LAST_REPEAT= property.]. 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[fn:: See also the variable
+ ~org-clock-mode-line-total~.]. Clicking with {{{kbd(mouse-1)}}}
+ onto the mode line entry pops up a menu with clocking options.
- {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) ::
@@ -6509,7 +6619,8 @@ prompted about what to do with it.
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[fn:77].
+ timestamp[fn:: The corresponding in-buffer setting is: =#+STARTUP:
+ lognoteclock-out=.].
- {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) ::
@@ -6652,7 +6763,7 @@ into the buffer by ~org-clock-report~:
#+cindex: @samp{BEGIN clocktable}
#+begin_example
,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
-,#+END: clocktable
+,#+END:
#+end_example
#+vindex: org-clocktable-defaults
@@ -6689,16 +6800,16 @@ be selected:
absolutely, or relative to the current time and may be any of these
formats:
- | =2007-12-31= | New year eve 2007 |
- | =2007-12= | December 2007 |
- | =2007-W50= | ISO-week 50 in 2007 |
- | =2007-Q2= | 2nd quarter in 2007 |
- | =2007= | the year 2007 |
- | =today=, =yesterday=, =today-N= | a relative day |
- | =thisweek=, =lastweek=, =thisweek-N= | a relative week |
- | =thismonth=, =lastmonth=, =thismonth-N= | a relative month |
- | =thisyear=, =lastyear=, =thisyear-N= | a relative year |
- | =untilnow=[fn:78] | all clocked time ever |
+ | =2007-12-31= | New year eve 2007 |
+ | =2007-12= | December 2007 |
+ | =2007-W50= | ISO-week 50 in 2007 |
+ | =2007-Q2= | 2nd quarter in 2007 |
+ | =2007= | the year 2007 |
+ | =today=, =yesterday=, =today-N= | a relative day |
+ | =thisweek=, =lastweek=, =thisweek-N= | a relative week |
+ | =thismonth=, =lastmonth=, =thismonth-N= | a relative month |
+ | =thisyear=, =lastyear=, =thisyear-N= | a relative year |
+ | =untilnow=[fn:: When using ~:step~, ~untilnow~ starts from the beginning of 2003, not the beginning of time.] | all clocked time ever |
#+vindex: org-clock-display-default-range
When this option is not set, Org falls back to the value in
@@ -6730,7 +6841,7 @@ be selected:
- =:step= ::
- Set to =day=, =week=, =semimonth=, =month=, or =year= to split the
+ Set to =day=, =week=, =semimonth=, =month=, =quarter=, or =year= to split the
table into chunks. To use this, either =:block=, or =:tstart= and
=:tend= are required.
@@ -6760,7 +6871,9 @@ using the =:formatter= parameter.
- =:lang= ::
- Language[fn:79] to use for descriptive cells like "Task".
+ Language[fn:: Language terms can be set through the variable
+ ~org-clock-clocktable-language-setup~.] to use for descriptive cells
+ like "Task".
- =:link= ::
@@ -6776,6 +6889,10 @@ using the =:formatter= parameter.
Indent each headline field according to its level.
+- =:filetitle= ::
+
+ Show title in the file column if the file has a =#+title=.
+
- =:hidefiles= ::
Hide the file column when multiple files are used to produce the
@@ -6836,16 +6953,18 @@ day, you could write:
#+begin_example
,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
-,#+END: clocktable
+,#+END:
#+end_example
#+texinfo: @noindent
-To use a specific time range you could write[fn:80]
+To use a specific time range you could write[fn:: Note that all
+parameters must be specified in a single line---the line is broken
+here only to fit it into the manual.]
#+begin_example
,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
:tend "<2006-08-10 Thu 12:00>"
-,#+END: clocktable
+,#+END:
#+end_example
#+texinfo: @noindent
@@ -6853,7 +6972,7 @@ A range starting a week ago and ending right now could be written as
#+begin_example
,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
-,#+END: clocktable
+,#+END:
#+end_example
#+texinfo: @noindent
@@ -6861,7 +6980,7 @@ A summary of the current subtree with % times would be
#+begin_example
,#+BEGIN: clocktable :scope subtree :link t :formula %
-,#+END: clocktable
+,#+END:
#+end_example
#+texinfo: @noindent
@@ -6870,7 +6989,7 @@ last week would be
#+begin_example
,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
-,#+END: clocktable
+,#+END:
#+end_example
*** Resolving idle time and continuous clocking
@@ -6896,7 +7015,7 @@ current clock, or applying it to another one.
#+vindex: org-clock-x11idle-program-name
By customizing the variable ~org-clock-idle-time~ to some integer,
such as 10 or 15, Emacs can alert you when you get back to your
-computer after being idle for that many minutes[fn:81], and ask what
+computer after being idle for that many minutes[fn:28], 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
@@ -7065,12 +7184,14 @@ displayed.
#+vindex: org-agenda-columns-add-appointments-to-effort-sum
If you switch to column view in the daily/weekly agenda, the effort
-column summarizes the estimated work effort for each day[fn:82], 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.
+column summarizes the estimated work effort for each day[fn:: Please
+note the pitfalls of summing hierarchical data in a flat list (see
+[[*Using Column View in the Agenda]]).], 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 {{{kbd(/)}}} key in the agenda (see [[*Commands in
@@ -7098,12 +7219,12 @@ The relative and countdown are started with separate commands.
#+findex: org-timer-start
Start or reset the relative timer. By default, the timer is set
to 0. When called with a {{{kbd(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 {{{kbd(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.
+ a starting offset. The prompt will default to a timer string at
+ point (if any), providing a convenient way to restart taking notes
+ after a break in the process. When called with a double prefix
+ argument {{{kbd(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.
- {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) ::
@@ -7198,14 +7319,15 @@ special command:
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
+ 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~[fn:83] is set, a timestamp or a note is
- recorded whenever an entry is refiled.
+ variable ~org-log-refile~[fn:: Note the corresponding =STARTUP=
+ options =logrefile=, =lognoterefile=, and =nologrefile=.] is set, a
+ timestamp or a note is recorded whenever an entry is refiled.
- {{{kbd(C-u C-c C-w)}}} ::
@@ -7360,9 +7482,9 @@ its location in the outline tree, but behaves in the following way:
#+vindex: org-cycle-open-archived-trees
It does not open when you attempt to do so with a visibility cycling
command (see [[*Visibility Cycling]]). You can force cycling archived
- subtrees with {{{kbd(C-TAB)}}}, or by setting the option
+ subtrees with {{{kbd(C-c C-TAB)}}}, or by setting the option
~org-cycle-open-archived-trees~. Also normal outline commands, like
- ~outline-show-all~, open archived subtrees.
+ ~org-show-all~, open archived subtrees.
-
#+vindex: org-sparse-tree-open-archived-trees
@@ -7408,9 +7530,9 @@ The following commands help manage the =ARCHIVE= tag:
child. If point is /not/ on a headline when this command is
invoked, check the level 1 trees.
-- {{{kbd(C-c C-TAB)}}} (~org-force-cycle-archived~) ::
+- {{{kbd(C-c C-TAB)}}} (~org-cycle-force-archived~) ::
- #+kindex: C-TAB
+ #+kindex: C-c C-TAB
Cycle a tree even if it is tagged with =ARCHIVE=.
- {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) ::
@@ -7474,7 +7596,6 @@ You may also define a global key for capturing new material (see
- {{{kbd(M-x org-capture)}}} (~org-capture~) ::
#+findex: org-capture
- #+cindex: date tree
Display the capture templates menu. If you have templates defined
(see [[*Capture templates]]), it offers these templates for selection or
use a new Org outline node as the default template. It inserts the
@@ -7653,6 +7774,7 @@ Now lets look at the elements of a template definition. Each entry in
#+vindex: org-default-notes-file
#+vindex: org-directory
+ #+cindex: date tree
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
@@ -7686,7 +7808,7 @@ Now lets look at the elements of a template definition. Each entry in
- =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
- This target[fn:84] creates a heading in a date tree[fn:85] for
+ This target[fn:29] creates a heading in a date tree[fn:30] 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
@@ -7711,8 +7833,9 @@ Now lets look at the elements of a template definition. Each entry in
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[fn:86], or dynamically, from a function
- using either syntax:
+ template string from a file[fn:: When the file name is not absolute,
+ Org assumes it is relative to ~org-directory~.], or dynamically,
+ from a function using either syntax:
: (file "/path/to/template-file")
: (function FUNCTION-RETURNING-THE-TEMPLATE)
@@ -7807,17 +7930,38 @@ Now lets look at the elements of a template definition. Each entry in
Do not save the target file after finishing the capture.
- - ~:refile-targets :: Temporarily set ~org-refile-targets~ to the
+ - ~:refile-targets~ :: Temporarily set ~org-refile-targets~ to the
value of this property.
+ - ~:hook~ ::
+
+ A nullary function or list of nullary functions run before
+ ~org-capture-mode-hook~ when the template is selected.
+
+ - ~:prepare-finalize~ ::
+
+ A nullary function or list of nullary functions run before
+ ~org-capture-prepare-finalize-hook~ when the template is selected.
+
+ - ~:before-finalize~ ::
+
+ A nullary function or list of nullary functions run before
+ ~org-capture-before-finalize-hook~ when the template is selected.
+
+ - ~:after-finalize~ ::
+
+ A nullary function or list of nullary functions run before
+ ~org-capture-after-finalize-hook~ when the template is selected.
+
**** Template expansion
:PROPERTIES:
:DESCRIPTION: Filling in information about time and context.
:END:
-In the template itself, special "%-escapes"[fn:87] allow dynamic
-insertion of content. The templates are expanded in the order given
-here:
+In the template itself, special "%-escapes"[fn:: If you need one of
+these sequences literally, escape the =%= with a backslash.] allow
+dynamic insertion of content. The templates are expanded in the order
+given here:
- =%[FILE]= ::
@@ -7947,7 +8091,10 @@ here:
After completing the template, position point here.
#+vindex: org-store-link-props
-For specific link types, the following keywords are defined[fn:88]:
+For specific link types, the following keywords are defined[fn:: If
+you define your own link types (see [[*Adding Hyperlink Types]]), any
+property you store with ~org-store-link-props~ can be accessed in
+capture templates in a similar way.]:
#+vindex: org-link-from-user-regexp
| Link type | Available keywords |
@@ -7960,7 +8107,7 @@ For specific link types, the following keywords are defined[fn:88]:
| | =%:date= (message date header field) |
| | =%:date-timestamp= (date as active timestamp) |
| | =%:date-timestamp-inactive= (date as inactive timestamp) |
-| | =%:fromto= (either "to NAME" or "from NAME")[fn:89] |
+| | =%:fromto= (either "to NAME" or "from NAME")[fn:31] |
| gnus | =%:group=, for messages also all email fields |
| w3, w3m | =%:url= |
| info | =%:file=, =%:node= |
@@ -8019,7 +8166,9 @@ 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[fn:90].
+lives in the same directory where your Org file lives[fn:: 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.].
When attachments are made using ~org-attach~ a default tag =ATTACH= is
added to the node that gets the attachments.
@@ -8416,13 +8565,18 @@ the window configuration is restored when the agenda exits:
#+vindex: org-agenda-files
The information to be shown is normally collected from all /agenda
-files/, the files listed in the variable ~org-agenda-files~[fn:91].
-If a directory is part of this list, all files with the extension
-=.org= in this directory are part of the list.
+files/, the files listed in the variable ~org-agenda-files~[fn:: 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.]. 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[fn:92]. You can customize ~org-agenda-files~,
-but the easiest way to maintain it is through the following commands
+be put into the list[fn:: When using the dispatcher, pressing
+{{{kbd(<)}}} before selecting a command actually limits the command to
+the current file, and ignores ~org-agenda-files~ until the next
+dispatcher command.]. You can customize ~org-agenda-files~, but the
+easiest way to maintain it is through the following commands
#+attr_texinfo: :sep and
- {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) ::
@@ -8558,18 +8712,20 @@ commands:
- {{{kbd(<)}}} ::
#+kindex: < @r{(Agenda dispatcher)}
- Restrict an agenda command to the current buffer[fn:93]. If
- narrowing is in effect restrict to the narrowed part of the buffer.
- After pressing {{{kbd(<)}}}, you still need to press the character
- selecting the command.
+ Restrict an agenda command to the current buffer[fn:: For backward
+ compatibility, you can also press {{{kbd(1)}}} to restrict to the
+ current buffer.]. If narrowing is in effect restrict to the
+ narrowed part of the buffer. After pressing {{{kbd(<)}}}, you still
+ need to press the character selecting the command.
- {{{kbd(< <)}}} ::
#+kindex: < < @r{(Agenda dispatcher)}
If there is an active region, restrict the following agenda command
- to the region. Otherwise, restrict it to the current
- subtree[fn:94]. After pressing {{{kbd(< <)}}}, you still need to
- press the character selecting the command.
+ to the region. Otherwise, restrict it to the current subtree[fn::
+ For backward compatibility, you can also press {{{kbd(0)}}} to
+ restrict to the current region/subtree.]. After pressing {{{kbd(<
+ <)}}}, you still need to press the character selecting the command.
- {{{kbd(*)}}} ::
@@ -8618,7 +8774,7 @@ a paper agenda, showing all the tasks for the current week or day.
#+cindex: org-agenda, command
Compile an agenda for the current week from a list of Org files.
The agenda shows the entries for each day. With a numeric prefix
- argument[fn:95]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
+ argument[fn:32]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may
set the number of days to be displayed.
#+vindex: org-agenda-span
@@ -8677,7 +8833,10 @@ 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:[fn:96]
+them, as seen in the following segment of an Org file:[fn:: 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~.]
#+begin_example
,* Holidays
@@ -8789,7 +8948,7 @@ collected into a single place.
#+findex: org-todo-list
Show the global TODO list. This collects the TODO items from all
agenda files (see [[*Agenda Views]]) into a single buffer. By default,
- this lists items with a state the is not a DONE state. The buffer
+ this lists items with a state that 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 [[*Commands in the
Agenda Buffer]]).
@@ -9179,8 +9338,10 @@ Time ranges can be specified with two timestamps:
: <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
#+vindex: org-agenda-search-headline-for-time
-In the headline of the entry itself, a time(range)---like =12:45= or
-a =8:30-1pm=---may also appear as plain text[fn:97].
+In the headline of the entry itself, a time(range)---like =12:45= or a
+=8:30-1pm=---may also appear as plain text[fn:: You can, however,
+disable this by setting ~org-agenda-search-headline-for-time~ variable
+to a ~nil~ value.].
If the agenda integrates the Emacs diary (see [[*Weekly/daily agenda]]),
time specifications in diary entries are recognized as well.
@@ -9270,7 +9431,7 @@ 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[fn:98]. You can switch quickly between
+mostly used interactively[fn:33]. 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
@@ -9402,11 +9563,11 @@ the Internet, and outside of business hours, with something like this:
#+begin_src emacs-lisp
(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")))
+ (/= 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)))))
+ (let ((hr (nth 2 (decode-time))))
+ (or (< hr 8) (> hr 21)))))
(concat "-" tag)))
(setq org-agenda-auto-exclude-function #'my-auto-exclude-fn)
@@ -9732,11 +9893,13 @@ the other commands, point needs to be in the desired line.
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., {{{kbd(C-u R)}}}),
+ variable ~org-agenda-start-with-clockreport-mode~. By using a
+ prefix argument when toggling this mode (i.e., {{{kbd(C-u R)}}}),
the clock table does not show contributions from entries that are
- hidden by agenda filtering[fn:99]. See also the variable
- ~org-clock-report-include-clocking-task~.
+ hidden by agenda filtering[fn:: Only tags filtering is respected
+ here, effort filtering is ignored.]. See also the variables
+ ~org-clock-report-include-clocking-task~ and
+ ~org-agenda-clock-report-header~.
- {{{kbd(v c)}}} ::
@@ -10175,9 +10338,10 @@ the other commands, point needs to be in the desired line.
- {{{kbd(f)}}} ::
#+vindex: org-agenda-bulk-custom-functions
- Apply a function[fn:100] to marked entries. For example, the
- function below sets the =CATEGORY= property of the entries to
- =web=.
+ Apply a function[fn:: You can also create persistent custom
+ functions through ~org-agenda-bulk-custom-functions~.] to marked
+ entries. For example, the function below sets the =CATEGORY=
+ property of the entries to =web=.
#+begin_src emacs-lisp
(defun set-category ()
@@ -10215,9 +10379,10 @@ the other commands, point needs to be in the desired line.
#+cindex: diary entries, creating from agenda
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[fn:101], in a way similar to the {{{kbd(i)}}} command in the
- calendar. The diary file pops up in another window, where you can
- add the entry.
+ file[fn:: This file is parsed for the agenda when
+ ~org-agenda-include-diary~ is set.], in a way similar to the
+ {{{kbd(i)}}} command in the calendar. The diary file pops up in
+ another window, where you can add the entry.
#+vindex: org-agenda-diary-file
If you configure ~org-agenda-diary-file~ to point to an Org file,
@@ -10341,13 +10506,14 @@ 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[fn:102]. 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:
+key[fn:: You can provide a description for a prefix key by inserting a
+cons cell with the prefix and the description.]. 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:
- {{{kbd(x)}}} ::
- as a global search for agenda entries planned[fn:103] this week/day.
+ as a global search for agenda entries planned[fn:34] this week/day.
- {{{kbd(y)}}} ::
@@ -10527,11 +10693,14 @@ See the docstring of the variable for more information.
:END:
#+cindex: agenda views, exporting
-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[fn:104], Postscript,
-PDF[fn:105], and iCalendar files. If you want to do this only
-occasionally, use the following command:
+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[fn:: For HTML you need
+to install Hrvoje Nikšić's =htmlize.el= as an Emacs package from
+[[https://elpa.nongnu.org/][NonGNU ELPA]] or from
+[[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].],
+Postscript, PDF[fn:35], and iCalendar files. If you
+want to do this only occasionally, use the following command:
- {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
#+kindex: C-x C-w
@@ -10544,11 +10713,14 @@ occasionally, use the following command:
If you need to export certain agenda views frequently, you can
associate any custom agenda command with a list of output file
-names[fn:106]. 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.
+names[fn:: 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.]. 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.
#+begin_src emacs-lisp
(setq org-agenda-custom-commands
@@ -10632,7 +10804,8 @@ emacs -eval (org-batch-store-agenda-views) -kill
#+end_src
#+texinfo: @noindent
-or, if you need to modify some parameters[fn:107]
+or, if you need to modify some parameters[fn:: Quoting depends on the
+system you use, please check the FAQ for examples.]
#+begin_src shell
emacs -eval '(org-batch-store-agenda-views \
@@ -10902,7 +11075,9 @@ becomes =&nbsp;= in HTML and =~= in LaTeX.
#+cindex: special symbols, in-buffer display
If you would like to see entities displayed as UTF-8 characters, use
-the following command[fn:108]:
+the following command[fn:: 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=.]:
- {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
#+kindex: C-c C-x \
@@ -10915,8 +11090,9 @@ the following command[fn:108]:
#+cindex: shy hyphen, special symbol
#+cindex: dash, special symbol
#+cindex: ellipsis, special symbol
-In addition to regular entities defined above, Org exports in
-a special way[fn:109] the following commonly used character
+In addition to regular entities defined above, Org exports in a
+special way[fn:: This behavior can be disabled with =-= export setting
+(see [[*Export Settings]]).] the following commonly used character
combinations: =\-= is treated as a shy hyphen, =--= and =---= are
converted into dashes, and =...= becomes a compact set of dots.
@@ -10929,7 +11105,7 @@ converted into dashes, and =...= becomes a compact set of dots.
Plain ASCII is normally sufficient for almost all note taking.
Exceptions include scientific notes, which often require mathematical
-symbols and the occasional formula. LaTeX[fn:110] is widely used to
+symbols and the occasional formula. LaTeX[fn:36] 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
@@ -10951,7 +11127,7 @@ into images (see [[*Previewing LaTeX fragments]]).
LaTeX fragments do not need any special marking at all. The following
snippets are identified as LaTeX source code:
-- Environments of any kind[fn:111]. The only requirement is that the
+- Environments of any kind[fn:37]. The only requirement is that the
=\begin= statement appears on a new line, preceded by only
whitespace.
@@ -10995,7 +11171,7 @@ lines:
#+vindex: org-preview-latex-default-process
If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
-=convert= installed[fn:112], LaTeX fragments can be processed to
+=convert= installed[fn:38], LaTeX fragments can be processed to
produce images of the typeset expressions to be used for inclusion
while exporting to HTML (see [[*LaTeX fragments]]), or for inline
previewing within Org mode.
@@ -11065,10 +11241,12 @@ more details see the documentation of CDLaTeX mode):
- {{{kbd(TAB)}}} ::
#+kindex: TAB
- The {{{kbd(TAB)}}} key expands the template if point is inside
- a LaTeX fragment[fn:113]. For example, {{{kbd(TAB)}}} expands =fr=
- to =\frac{}{}= and position point correctly inside the first brace.
- Another {{{kbd(TAB)}}} gets you into the second brace.
+ The {{{kbd(TAB)}}} key expands the template if point is inside a
+ LaTeX fragment[fn:: 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~.]. For example, {{{kbd(TAB)}}}
+ expands =fr= to =\frac{}{}= and position point correctly inside the
+ first brace. Another {{{kbd(TAB)}}} gets you into the second brace.
Even outside fragments, {{{kbd(TAB)}}} expands environment
abbreviations at the beginning of a line. For example, if you write
@@ -11099,8 +11277,8 @@ more details see the documentation of CDLaTeX mode):
#+kindex: '
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.
+ LaTeX 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.
@@ -11146,12 +11324,12 @@ Here is an example
#+end_example
#+cindex: formatting source code, markup rules
-#+vindex: org-latex-listings
+#+vindex: org-latex-src-block-backend
If the example is source code from a programming language, or any
other text that can be marked up by Font Lock in Emacs, you can ask
-for the example to look like the fontified Emacs buffer[fn:114]. This
+for the example to look like the fontified Emacs buffer[fn:39]. This
is done with the code block, where you also need to specify the name
-of the major mode that should be used to fontify the example[fn:115],
+of the major mode that should be used to fontify the example[fn:40],
see [[*Structure Templates]] for shortcuts to easily insert code blocks.
#+cindex: @samp{BEGIN_SRC}
@@ -11192,9 +11370,12 @@ 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[fn:116]. 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:
+source code[fn:: 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.]. 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_example -l "(dumb-reference:%s)"
,#+BEGIN_SRC emacs-lisp -n -r
@@ -11236,10 +11417,11 @@ a shortcut is provided (see [[*Structure Templates]]).
works by switching to a temporary buffer with the source code. You
need to exit by pressing {{{kbd(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[fn:117] to allow creating
- ASCII drawings easily. Using this command in an empty line creates
- a new fixed-width region.
+ regions---where each line starts with a colon followed by a
+ space---are edited using Artist mode[fn:: You may select a different
+ mode with the variable ~org-edit-fixed-width-region-mode~.] to allow
+ creating ASCII drawings easily. Using this command in an empty line
+ creates a new fixed-width region.
#+cindex: storing link, in a source code buffer
Calling ~org-store-link~ (see [[*Handling Links]]) while editing a source
@@ -11256,8 +11438,10 @@ the end of the current line. Then the label is stored as a link
#+cindex: inlining images
#+cindex: images, markup rules
-An image is a link to an image file[fn:118] that does not have
-a description part, for example
+An image is a link to an image file[fn:: What Emacs considers to be an
+image depends on ~image-file-name-extensions~ and
+~image-file-name-regexps~.] that does not have a description part, for
+example
: ./img/cat.jpg
@@ -11280,11 +11464,40 @@ command:
#+kindex: C-c C-x C-v
#+findex: org-toggle-inline-images
#+vindex: org-startup-with-inline-images
- Toggle the inline display of linked images. When called with
- a prefix argument, also display images that do have a link
+ 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~[fn:119].
+ ~org-startup-with-inline-images~[fn:: The variable
+ ~org-startup-with-inline-images~ can be set within a buffer with the
+ =STARTUP= options =inlineimages= and =noinlineimages=.].
+
+
+ #+vindex: org-image-actual-width
+ #+cindex: @samp{ORG-IMAGE-ACTUAL-WIDTH}, property
+ By default, Org mode displays inline images according to their
+ actual width. You can customize the displayed image width using
+ ~org-image-actual-width~ variable (globally) or
+ =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:: The width can
+ be customized in Emacs >= 24.1, built with imagemagick support.].
+ Their value can be the following:
+ - (default) 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:
+ #+begin_example
+ ,#+ATTR_HTML: :width 300px
+ #+end_example
+ 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.
+
+
+#+vindex: org-cycle-inline-images-display
+Inline images can also be displayed when cycling the folding state.
+When custom option ~org-cycle-inline-images-display~ is set, the
+visible inline images under subtree will be displayed automatically.
** Captions
:PROPERTIES:
@@ -11333,9 +11546,9 @@ footnote reference is simply the marker in square brackets, inside
text. Markers always start with =fn:=. For example:
#+begin_example
-The Org homepage[fn:1] now looks a lot better than it used to.
+The Org website[fn:1] now looks a lot better than it used to.
...
-[fn:1] The link is: https://orgmode.org
+[fn:55] The link is: https://orgmode.org
#+end_example
Org mode extends the number-based syntax to /named/ footnotes and
@@ -11376,9 +11589,11 @@ The following command handles footnotes:
#+vindex: org-footnote-define-inline
#+vindex: org-footnote-section
Otherwise, create a new footnote. Depending on the variable
- ~org-footnote-define-inline~[fn:120], 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~.
+ ~org-footnote-define-inline~[fn:: The corresponding in-buffer
+ setting is: =#+STARTUP: fninline= or =#+STARTUP: nofninline=.], 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:
@@ -11391,9 +11606,10 @@ The following command handles footnotes:
| {{{kbd(d)}}} | Delete the footnote at point, including definition and references. |
#+vindex: org-footnote-auto-adjust
- Depending on the variable ~org-footnote-auto-adjust~[fn:121],
- renumbering and sorting footnotes can be automatic after each
- insertion or deletion.
+ Depending on the variable ~org-footnote-auto-adjust~[fn:: The
+ corresponding in-buffer options are =#+STARTUP: fnadjust= and
+ =#+STARTUP: nofnadjust=.], renumbering and sorting footnotes can be
+ automatic after each insertion or deletion.
- {{{kbd(C-c C-c)}}} ::
@@ -11479,7 +11695,7 @@ the hierarchical menu, press {{{kbd(?)}}}.
Invokes the export dispatcher interface. The options show default
settings. The {{{kbd(C-u)}}} prefix argument preserves options from
- the previous export, including any sub-tree selections.
+ the previous export, including any subtree selections.
Org exports the entire buffer by default. If the Org buffer has an
active region, then Org exports just that region.
@@ -11518,15 +11734,15 @@ further alter what is exported, and how.
- {{{kbd(C-s)}}} ::
#+kindex: C-c C-e 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
+ Toggle subtree export. When turned on, Org exports only the
+ subtree starting from point position at the time the export
+ dispatcher was invoked. Org uses the top heading of this subtree
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.
#+vindex: org-export-initial-scope
- To make sub-tree export the default, customize the variable
+ To make subtree export the default, customize the variable
~org-export-initial-scope~.
- {{{kbd(C-v)}}} ::
@@ -11559,7 +11775,7 @@ can be inserted from the export dispatcher (see [[*The Export
Dispatcher]]) using the =Insert template= command by pressing
{{{kbd(#)}}}. To insert keywords individually, a good way to make
sure the keyword is correct is to type =#+= and then to use
-{{{kbd(M-TAB)}}}[fn:16] for completion.
+{{{kbd(M-TAB)}}}[fn:6] for completion.
The export keywords available for every back-end, and their equivalent
global variables, include:
@@ -11581,7 +11797,9 @@ global variables, include:
#+cindex: @samp{DATE}, keyword
#+vindex: org-export-date-timestamp-format
- A date or a time-stamp[fn:122].
+ A date or a time-stamp[fn:: The variable
+ ~org-export-date-timestamp-format~ defines how this timestamp are
+ exported.].
- =EMAIL= ::
@@ -11596,7 +11814,7 @@ global variables, include:
Language to use for translating certain strings
(~org-export-default-language~). With =#+LANGUAGE: fr=, for
example, Org translates =Table of contents= to the French =Table des
- matières=[fn:123].
+ matières=[fn:41].
- =SELECT_TAGS= ::
@@ -11604,7 +11822,7 @@ global variables, include:
#+vindex: org-export-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
+ subtrees 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.
@@ -11614,9 +11832,9 @@ global variables, include:
#+vindex: org-export-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
+ its subtrees 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
+ =export= tag. Even if a subtree is not exported, Org executes any
code blocks contained there.
- =TITLE= ::
@@ -11835,10 +12053,10 @@ following arguments.
#+vindex: org-export-with-tables
Toggle inclusion of tables (~org-export-with-tables~).
-When exporting sub-trees, special node properties can override the
+When exporting subtrees, 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
+subtree. Except for =SETUPFILE=, all other keywords listed above
have an =EXPORT_= equivalent.
#+cindex: @samp{BIND}, keyword
@@ -11873,7 +12091,7 @@ keyword:
#+cindex: excluding entries from table of contents
#+cindex: table of contents, exclude entries
Org includes both numbered and unnumbered headlines in the table of
-contents[fn:124]. If you need to exclude an unnumbered headline,
+contents[fn:42]. If you need to exclude an unnumbered headline,
along with all its children, set the =UNNUMBERED= property to =notoc=
value.
@@ -11992,7 +12210,7 @@ be omitted to use the obvious defaults.
| =#+INCLUDE: "~/.emacs" :lines "10-"= | Include lines from 10 to EOF |
Inclusions may specify a file-link to extract an object matched by
-~org-link-search~[fn:125] (see [[*Search Options in File Links]]). The
+~org-link-search~[fn:43] (see [[*Search Options in File Links]]). The
ranges for =:lines= keyword are relative to the requested element.
Therefore,
@@ -12032,7 +12250,7 @@ following syntax:
: #+MACRO: name replacement text; $1, $2 are arguments
#+texinfo: @noindent
-which can be referenced using ={{{name(arg1, arg2)}}}=[fn:126]. For
+which can be referenced using ={{{name(arg1, arg2)}}}=[fn:44]. For
example
#+begin_example
@@ -12151,8 +12369,9 @@ 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[fn:127]. The command below helps changing the
-comment status of a headline.
+is executed either[fn:: For a less drastic behavior, consider using a
+select tag (see [[*Export Settings]]) instead.]. The command below
+helps changing the comment status of a headline.
- {{{kbd(C-c ;)}}} (~org-toggle-comment~) ::
#+kindex: C-c ;
@@ -12423,7 +12642,7 @@ should in principle be exportable as a Beamer presentation.
- Org exports a Beamer frame's objects as block environments. Org can
enforce wrapping in special block types when =BEAMER_ENV= property
- is set[fn:128]. For valid values see
+ is set[fn:45]. For valid values see
~org-beamer-environments-default~. To add more values, see
~org-beamer-environments-extra~.
#+vindex: org-beamer-environments-default
@@ -12492,7 +12711,7 @@ Insert Beamer-specific code using the following constructs:
,#+BEGIN_EXPORT beamer
Only Beamer export back-end exports this.
-,#+END_BEAMER
+,#+END_EXPORT
Text @@beamer:some code@@ within a paragraph.
#+end_example
@@ -12811,17 +13030,17 @@ 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~.
+string. If set to 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 above also applies to ~org-html-postamble~ and
+~org-html-postamble-format~. In addition, ~org-html-postamble~ can be
+set to ~auto~ (its default value), which makes the HTML exporter build
+a postamble from looking up author's name, email address, creator's
+name, and date.
+
*** Quoting HTML tags
:PROPERTIES:
@@ -12894,7 +13113,7 @@ changing the link's title and style:
#+cindex: @samp{ATTR_HTML}, keyword
#+begin_example
-,#+ATTR_HTML: :title The Org mode homepage :style color:red;
+,#+ATTR_HTML: :title The Org mode website :style color:red;
[[https://orgmode.org]]
#+end_example
@@ -13010,20 +13229,22 @@ as-is.
#+vindex: org-html-mathjax-options~
LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two
-different ways on HTML pages. The default is to use the [[https://www.mathjax.org][MathJax]],
-which should work out of the box with Org[fn:129][fn:130]. Some MathJax
-display options can be configured via ~org-html-mathjax-options~, or
-in the buffer. For example, with the following settings,
+different ways on HTML pages. The default is to use the
+[[https://www.mathjax.org][MathJax]], which should work out of the box
+with Org[fn:: By default, Org loads MathJax from
+[[https://www.jsdelivr.com/][jsDelivr]], as recommended in
+[[https://docs.mathjax.org/en/latest/web/start.html][Getting Started
+with MathJax Components]].][fn:46]. Some MathJax display options can
+be configured via ~org-html-mathjax-options~, or in the buffer. For
+example, with the following settings,
#+begin_example
-,#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
-,#+HTML_MATHJAX: cancel.js noErrors.js
+,#+HTML_MATHJAX: align: left indent: 5em tagside: left
#+end_example
#+texinfo: @noindent
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=[fn:131].
+five em from the left margin.
#+vindex: org-html-mathjax-template
See the docstring of ~org-html-mathjax-options~ for all supported
@@ -13086,10 +13307,12 @@ line.
#+vindex: org-export-html-todo-kwd-class-prefix
#+vindex: org-export-html-tag-class-prefix
You can modify the CSS style definitions for the exported file. The
-HTML exporter assigns the following special CSS classes[fn:132] 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.
+HTML exporter assigns the following special CSS classes[fn:: 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.] 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 |
@@ -13154,7 +13377,7 @@ external file.
#+cindex: @samp{HTML_CONTAINER_CLASS}, property
#+cindex: @samp{HTML_HEADLINE_CLASS}, property
-In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS=
+In order to add styles to a subtree, 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
@@ -13323,7 +13546,7 @@ LaTeX export back-end finds the compiler version to use from
Org file. See the docstring for the
~org-latex-default-packages-alist~ for loading packages with certain
compilers. Also see ~org-latex-bibtex-compiler~ to set the
-bibliography compiler[fn:133].
+bibliography compiler[fn:47].
*** LaTeX specific export settings
:PROPERTIES:
@@ -13349,15 +13572,23 @@ general options (see [[*Export Settings]]).
- =LANGUAGE= ::
#+cindex: @samp{LANGUAGE}, keyword
#+vindex: org-latex-packages-alist
+ #+vindex: org-latex-language-alist
+
+ Language code of the primary document language.
+
+ The list of language codes supported by Org is stored in the
+ variable ~org-latex-language-alist~.
+
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:
+ following snippet (note that =polyglossia= does not work with
+ pdfLaTeX):
#+begin_src emacs-lisp
(add-to-list 'org-latex-packages-alist
- '("AUTO" "babel" t ("pdflatex")))
+ '("AUTO" "babel" t ("pdflatex" "xelatex" "lualatex")))
(add-to-list 'org-latex-packages-alist
'("AUTO" "polyglossia" t ("xelatex" "lualatex")))
#+end_src
@@ -13447,7 +13678,7 @@ 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
+of the Org file, set a subtree 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
@@ -13487,6 +13718,54 @@ A sample Org file with the above headers:
some more text
#+end_example
+#+cindex: @samp{LANGUAGE}, keyword
+#+vindex: org-export-default-language
+LaTeX packages =babel= or =polyglossia= can also be loaded in a
+document. The "AUTO" string will be replaced in both cases by the
+appropriate value for the =LANGUAGE= keyword, if present in the
+document, or by the value of ~org-export-default-language~. Let's see
+some examples in one or another case.
+
+=Babel= accepts the classic syntax and (in addition) the new syntax
+with the =\babelprovide= command to load the languages using the new
+=INI= files procedure. Keep in mind that there are a number of
+languages that are only served in babel using =INI= files, so they
+cannot be declared using the classic syntax, but only using the
+=\babelprovide= command (see
+https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf).
+Valid usage examples could be:
+
+#+begin_example
+,#+LATEX_HEADER: \usepackage[french,italian,AUTO]{babel}
+#+end_example
+
+where "AUTO" is the main language. But it can also be loaded using
+the =\babelprovide= command:
+
+#+begin_example
+,#+LATEX_HEADER: \usepackage[french,italian]{babel}
+,#+LATEX_HEADER: \babelprovide[import, main]{AUTO}
+#+end_example
+
+=Polyglossia=, for this procedure to be effective, must be loaded
+using the same =babel= classic syntax (but note that /this is not/
+the actual polyglossia syntax). For example, suppose a document
+declares Polytonic Greek as the primary language, and French as the
+secondary language. In this case, it would be expressed as:
+
+#+begin_example
+,#+LANGUAGE: el-polyton
+,#+LATEX_HEADER: \usepackage[french,AUTO]{polyglossia}
+#+end_example
+
+This would produce in LaTeX (with the actual =polyglossia= syntax):
+
+#+begin_example
+\usepackage{polyglossia}
+\setmainlanguage[variant=polytonic]{greek}
+\setotherlanguage{french}
+#+end_example
+
*** Quoting LaTeX code
:PROPERTIES:
:DESCRIPTION: Incorporating literal @LaTeX{} code.
@@ -13533,10 +13812,12 @@ include:
#+vindex: org-latex-default-table-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=.
+ =table=, =math=, =inline-math=, =verbatim= or =tabbing=.
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.
+ For =tabbing= the LaTeX tabbing environment is used and the correct
+ tabbing delimiters =\>= are used.
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.
@@ -13565,7 +13846,12 @@ include:
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=.
+ options: =t= (for a default =table= environment), =sideways= (for a
+ =sidewaystable= environment), =multicolumn= (to span the table
+ across multiple columns of a page in a =table*= environment) and
+ =nil=. In addition to these three values, =:float= can pass through
+ any arbitrary value, for example a user-defined float type with the
+ =float= LaTeX package.
LaTeX floats can also have additional layout =:placement=
attributes. These are the usual =[h t b p ! H]= permissions
@@ -13577,6 +13863,14 @@ include:
The LaTeX export back-end uses these attributes for regular tables
to set their alignments, fonts, and widths.
+- =:options= ::
+
+ The =:options= attribute allows adding an optional argument with
+ a list of various table options (between brackets in LaTeX export),
+ since certain tabular environments, such as longtblr of the
+ tabularray LaTeX package, provides this structure. For example:
+ =:options remark{Note}={note},remark{Source}={source}=.
+
- =:spread= ::
When =:spread= is non-~nil~, the LaTeX export back-end spreads or
@@ -13671,8 +13965,7 @@ attribute to one of the following:
- =t= ::
- For a standard =figure= environment; used by default whenever an
- image has a caption.
+ For a default =figure= environment.
- =multicolumn= ::
@@ -13693,6 +13986,12 @@ attribute to one of the following:
To avoid a =:float= even if using a caption.
+- Any arbitrary value ::
+
+ For example, a user-defined float type with the =float= LaTeX
+ package.
+
+
Use the =placement= attribute to modify a floating environment's
placement.
@@ -13780,22 +14079,29 @@ objects through the attributes =:float= and =:options=. For =:float=:
#+vindex: org-latex-listings-options
#+vindex: org-latex-minted-options
+#+vindex: org-latex-engraved-options
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[fn:134].
+example below, the =:options= are set for Engraved or Minted. Minted
+is a source code highlighting LaTeX package with many configurable
+options[fn:: Minted uses an external Python package for code
+highlighting, which requires the flag =-shell-escape= to be added to
+~org-latex-pdf-process~.]. Both Minted and Engraved are built on
+[[https://www.ctan.org/pkg/fvextra][fvextra]], and so support many of
+the same options.
#+begin_example
-,#+ATTR_LATEX: :options commentstyle=\bfseries
+,#+ATTR_LATEX: :options mathescape
,#+BEGIN_SRC emacs-lisp
- (defun Fib (n)
+ (defun Fib (n) ; $n_i = n_{i-2} + n_{i-1}$
(if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
,#+END_SRC
#+end_example
-To apply similar configuration options for all source blocks in
-a file, use the ~org-latex-listings-options~ and
-~org-latex-minted-options~ variables.
+To apply similar configuration options for all source blocks in a
+file, use the ~org-latex-listings-options~,
+~org-latex-engraved-options~, and ~org-latex-minted-options~
+variables.
*** Example blocks in LaTeX export
:PROPERTIES:
@@ -14034,8 +14340,10 @@ a limit to a level before the absolute limit (see [[*Export Settings]]).
The ODT export back-end handles creating of OpenDocument Text (ODT)
format. Documents created by this exporter use the
-{{{cite(OpenDocument-v1.2 specification)}}}[fn:135] and are compatible
-with LibreOffice 3.4.
+{{{cite(OpenDocument-v1.2 specification)}}}[fn:: See
+[[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open
+Document Format for Office Applications (OpenDocument) Version 1.2]].]
+and are compatible with LibreOffice 3.4.
*** Pre-requisites for ODT export
:PROPERTIES:
@@ -14070,7 +14378,7 @@ executable. Without it, export cannot finish.
If the selected region is a single tree, the ODT export back-end
makes the tree head the document title. Incidentally, {{{kbd(C-c
- @)}}} selects the current sub-tree. If the tree head entry has, or
+ @)}}} selects the current subtree. If the tree head entry has, or
inherits, an =EXPORT_FILE_NAME= property, the ODT export back-end
uses that for file name.
@@ -14220,7 +14528,7 @@ The example here shows creating a style using LibreOffice.
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
+Templates derived from built-in ODT templates and styles seem to have
fewer problems.
*** Links in ODT export
@@ -14435,8 +14743,10 @@ document in one of the following ways:
variables ~org-latex-to-mathml-convert-command~ and
~org-latex-to-mathml-jar-file~.
- If you prefer to use MathToWeb[fn:136] as your converter, you can
- configure the above variables as shown below.
+ If you prefer to use MathToWeb[fn:: See
+ [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].]
+ as your converter, you can configure the above variables as shown
+ below.
#+begin_src emacs-lisp
(setq org-latex-to-mathml-convert-command
@@ -14446,7 +14756,8 @@ document in one of the following ways:
#+end_src
#+texinfo: @noindent
- or, to use LaTeX​ML[fn:137] instead,
+ or, to use LaTeX​ML[fn:: See [[https://dlmf.nist.gov/LaTeXML/]].]
+ instead,
#+begin_src emacs-lisp
(setq org-latex-to-mathml-convert-command
@@ -14765,7 +15076,9 @@ with the =#+ATTR_ODT= line. For a discussion on default formatting of
tables, see [[*Tables in ODT export]].
This feature closely mimics the way table templates are defined in the
-OpenDocument-v1.2 specification[fn:138].
+OpenDocument-v1.2 specification[fn::
+[[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2
+Specification]]].
#+vindex: org-odt-table-styles
For quick preview of this feature, install the settings below and export the
@@ -14799,7 +15112,8 @@ templates, define new styles there.
To use this feature proceed as follows:
-1. Create a table template[fn:139].
+1. Create a table template[fn:: See the =<table:table-template>=
+ element of the OpenDocument-v1.2 specification.].
A table template is set of =table-cell= and =paragraph= styles for
each of the following table cell categories:
@@ -14838,7 +15152,12 @@ To use this feature proceed as follows:
=</office:automatic-styles>= element of the content template file
(see [[x-orgodtcontenttemplate-xml][Factory styles]]).
-2. Define a table style[fn:140].
+2. Define a table style[fn:: 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.].
#+vindex: org-odt-table-styles
To define a table style, create an entry for the style in the
@@ -15221,6 +15540,23 @@ This paragraph is preceded by...
:DESCRIPTION: List attributes.
:END:
+#+cindex: lettered lists, in Texinfo export
+#+cindex: enum, Texinfo attribute
+The Texinfo export back-end converts unordered and ordered lists in
+the Org file using the default command =@itemize=.
+
+Ordered lists are numbered when exported to Texinfo format. Such
+numbering obeys any counter (see [[*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:
+
+#+begin_example
+#+ATTR_TEXINFO: :enum A
+1. Alpha
+2. Bravo
+3. Charlie
+#+end_example
+
#+cindex: @samp{ATTR_TEXINFO}, keyword
#+cindex: two-column tables, in Texinfo export
#+cindex: table-type, Texinfo attribute
@@ -15262,20 +15598,89 @@ This is the common text for variables foo and bar.
@end table
#+end_example
-#+cindex: lettered lists, in Texinfo export
-#+cindex: enum, Texinfo attribute
-Ordered lists are numbered when exported to Texinfo format. Such
-numbering obeys any counter (see [[*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
+The =:compact= attribute is an alternative to the =:sep= attribute,
+which allows writing each entry on its own line. If this attribute is
+non-nil and an item in a description list has no body but is followed
+by another item, then the second item is transcoded to =@itemx=. This
+example is transcoded to the same output as above.
#+begin_example
-#+ATTR_TEXINFO: :enum A
-1. Alpha
-2. Bravo
-3. Charlie
+,#+ATTR_TEXINFO: :table-type vtable :indic asis :compact t
+- foo ::
+- bar ::
+ This is the common text for variables foo and bar.
+#+end_example
+
+Support for this compact syntax can also be enabled for all lists in
+a file using the =compact-itemx= export option, or globally using the
+variable ~org-texinfo-compact-itemx~.
+
+The Texinfo export back-end also supports two approaches to writing
+Texinfo definition commands (see [[info:texinfo::Definition Commands]]).
+One of them uses description lists and is described below, the other
+relies on special blocks (see [[*Special blocks in Texinfo export]]).
+
+Items in a description list in a Org file that begin with =Function:=
+or certain other prefixes are converted using Texinfo definition
+commands. This works even if other items in the same list do not have
+such a prefix; if necessary a single description list is converted
+using multiple tables (such as =@vtable=) and definition commands
+(such as =@defun=).
+
+#+begin_example
+- Function: org-texinfo-drawer drawer contents info ::
+ Transcode a DRAWER element from Org to Texinfo.
+#+end_example
+
+#+texinfo: @noindent
+becomes
+
+#+begin_example
+@defun org-texinfo-drawer drawer contents info ::
+ Transcode a DRAWER element from Org to Texinfo.
+@end defun
#+end_example
+The recognized prefixes are =Command:=, =Function:=, =Macro:=,
+=Special Form:=, =Variable:= and =User Option:=. These are the same
+prefixes that appear in the Info file for the respective definition
+commands. For example a =Function:= item in the Org file is converted
+to a =@defun= command in the Texinfo file, which in turn is converted
+to a definition prefixed with =-- Function:= in the Info file.
+
+As a special case the prefix =Key:= is also recognized. No Texinfo
+definition command exists for key bindings and the output in Info
+files also lacks the =Key:= prefix. Even so this special case is
+supported because it provides a convenient shorthand, as illustrated
+here:
+
+#+begin_example
+- Key: C-c C-c (do-something) ::
+ This command does something.
+
+- User Option: do-something-somehow ::
+ This option controls how exactly ~do-something~ does its thing.
+#+end_example
+
+#+texinfo: @noindent
+becomes
+
+#+begin_example
+@table @asis
+@item @kbd{C-c C-c} (@code{do-something})
+@kindex C-c C-c
+@findex do-something
+This command does something.
+@end table
+
+@defopt do-something-somehow
+This option controls how exactly @code{do-something} does its thing.
+@end defopt
+#+end_example
+
+#+texinfo: @noindent
+Command in parenthesis, as done above, is optional.
+
*** Tables in Texinfo export
:PROPERTIES:
:DESCRIPTION: Table attributes.
@@ -15338,11 +15743,42 @@ your king.
,#+END_QUOTE
#+end_example
+*** Key bindings in Texinfo export
+:PROPERTIES:
+:DESCRIPTION: @@kbd Texinfo command.
+:END:
+
+Org does not provide any markup for key bindings that corresponds to
+Texinfo's ~@kbd~ and ~@key~ commands. One way to deal with this is to
+fall back to code syntax. =~C-x SPC~=, for example, is transcoded to
+~@code{C-x SPC}~.
+
+A better approach is to define and use an Org macro named ~kbd~. To
+make that easier the function ~org-texinfo-kbd-macro~ is provided,
+which is intended to be used like this:
+
+#+begin_example
+,#+macro: kbd (eval (org-texinfo-kbd-macro $1))
+
+Type {{{kbd(C-c SPC)}}}.
+#+end_example
+
+#+texinfo: @noindent
+which becomes
+
+#+begin_example
+Type @kbd{C-c @key{SPC}}.
+#+end_example
+
*** Special blocks in Texinfo export
:PROPERTIES:
:DESCRIPTION: Special block attributes.
:END:
+The Texinfo export back-end supports two approaches to writing Texinfo
+definition commands. One of them is described here, the other in
+[[*Plain lists in Texinfo export]].
+
#+cindex: @samp{ATTR_TEXINFO}, keyword
The Texinfo export back-end converts special blocks to commands with
@@ -15952,7 +16388,9 @@ If you want to publish the Org file as an =.org= file but with
~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[fn:141].
+=file.org.html= in the publishing directory[fn:: 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.].
Other files like images only need to be copied to the publishing
destination; for this you can use ~org-publish-attachment~. For
@@ -16110,7 +16548,7 @@ Settings]]), however, override everything.
| ~: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-align-individual-field~ | ~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~ |
@@ -16141,6 +16579,9 @@ Settings]]), however, override everything.
| ~: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-engraved-options~ | ~org-latex-engraved-options~ |
+| ~:latex-engraved-preamble~ | ~org-latex-engraved-preamble~ |
+| ~:latex-engraved-theme~ | ~org-latex-engraved-theme~ |
| ~: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~ |
@@ -16156,12 +16597,12 @@ Settings]]), however, override everything.
| ~: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-src-block-backend~ | ~org-latex-src-block-backend~ |
| ~:latex-table-scientific-notation~ | ~org-latex-table-scientific-notation~ |
| ~:latex-tables-booktabs~ | ~org-latex-tables-booktabs~ |
| ~:latex-tables-centered~ | ~org-latex-tables-centered~ |
@@ -16177,6 +16618,7 @@ Settings]]), however, override everything.
| ~:md-footnote-format~ | ~org-md-footnote-format~ |
| ~:md-footnotes-section~ | ~org-md-footnotes-section~ |
| ~:md-headline-style~ | ~org-md-headline-style~ |
+| ~:md-toplevel-hlevel~ | ~org-md-toplevel-hlevel~ |
**** ODT specific properties
:PROPERTIES:
@@ -16204,6 +16646,7 @@ Settings]]), however, override everything.
| ~:texinfo-active-timestamp-format~ | ~org-texinfo-active-timestamp-format~ |
| ~:texinfo-classes~ | ~org-texinfo-classes~ |
| ~:texinfo-class~ | ~org-texinfo-default-class~ |
+| ~:texinfo-compact-itemx | ~org-texinfo-compact-itemx~ |
| ~:texinfo-table-default-markup~ | ~org-texinfo-table-default-markup~ |
| ~:texinfo-diary-timestamp-format~ | ~org-texinfo-diary-timestamp-format~ |
| ~:texinfo-filename~ | ~org-texinfo-filename~ |
@@ -16224,13 +16667,16 @@ Settings]]), however, override everything.
#+cindex: links, publishing
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 [[*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.
+like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see
+[[*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.
+
+Links to encrypted Org files, like =[[file:foo.org.gpg]]= are also
+supported.
You may also link to related files, such as images. Provided you are
careful with relative file names, and provided you have also
@@ -16238,11 +16684,11 @@ configured Org to upload the related files, these links will work too.
See [[*Example: complex publishing configuration]], for an example of this
usage.
-Eventually, links between published documents can contain some search
-options (see [[*Search Options in File Links]]), 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=.
+Links between published documents can contain some search options (see
+[[*Search Options in File Links]]), 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=.
#+begin_example
[[file:foo.org::*heading]]
@@ -16537,7 +16983,13 @@ capabilities:
- 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~,
+To use a "citation processor", the user must load them; for example;
+
+#+begin_src emacs-lisp
+(require 'oc-bibtex)
+#+end_src
+
+They can then configure them with ~org-cite-activate-processor~,
~org-cite-follow-processor~, ~org-cite-insert-processor~, and
~org-cite-export-processors~ respectively.
@@ -16602,15 +17054,18 @@ Org currently includes the following export processors:
- csl :: this export processor uses format files written in [[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation
Style Language]] via [[https://github.com/andras-simonyi/citeproc-el][citeproc-el]];
-- In contrast, two other processors target LaTeX and LaTeX-derived
+- In contrast, three other processors target LaTeX and LaTeX-derived
formats exclusively:
- - natbib :: this export processor uses BibTeX, the historical
+ - bibtex :: 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.
+ data and style files compatible with this processor (including a
+ large number of publishers' styles). It only supports LaTeX's
+ =\cite= and =\nocite= commands.
+
+ - natbib :: as with the bibtex processor, but using 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
@@ -16643,6 +17098,72 @@ 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.
+** Bibliography printing
+
+The =PRINT_BIBLIOGRAPHY= keyword specifies where the bibliography
+should be printed (note the colon):
+
+: #+print_bibliography:
+
+The bibliography printed by the LaTeX-based export processors
+"bibtex", "natbib" and "biblatex" has a chapter or section heading by
+default, while the "basic" and "csl" processors print the list of
+bibliography entries without a heading.
+
+A document may contain more than one =PRINT_BIBLIOGRAPHY= keywords.
+Each of the keywords will trigger printing the bibliography.
+
+The keywords can be used with or without additional options. Options
+can be used, for example, to print only entries that belong to a
+certain category or to control formatting. The set of supported
+=PRINT_BIBLIOGRAPHY= options and their interpretation varies between
+the different citation export processors. Some export processors do
+not support passing options.
+
+*** Bibliography options in the "biblatex" and "csl" export processors
+
+The "biblatex" and "csl" export processors support bibliography
+options through a property list attached to the =PRINT_BIBLIOGRAPHY=
+keyword. For example,
+
+: #print_bibliography: :keyword algebra :type book
+
+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 "algebraic logic" :nottype article,book
+
+The "biblatex" export processor accepts all options supported by
+BibLaTeX's ~\printbibliography~ command, while the "csl" processor
+accepts the following ones:
+
+- =:keyword <keyword(,keyword2...)>= :: Print only entries whose
+ keyword field contains all given keywords.
+
+- =:notkeyword <keyword(,keyword2...)>= :: Print only entries whose
+ keyword field does not contain any of the given keywords.
+
+- =:type <entrytype>= :: Print only entries whose type is
+ =<entrytype>=. Entry type is the BibTeX/BibLaTeX entry type if this
+ information is available (the entry was read from a BibTeX/BibLaTeX
+ bibliography) and the CSL entry type otherwise.
+
+- =:nottype <entrytype(,entrytype2...)>= :: Print only entries whose
+ type is not among the given entry types. Entry type is determined
+ as in the case of =:type=.
+
+- =:csltype <entrytype>= :: Print only entries whose CSL entry type
+ (possibly based on a conversion from BibTeX/BibLaTeX to CSL) is
+ =<entrytype>=.
+
+- =:notcsltype <entrytype(,entrytype2...)>= :: Print only entries whose
+ CSL entry type (possibly based on a conversion from BibTeX/BibLaTeX
+ to CSL) is not among the listed entry types.
+
+- =:filter <predicate>= :: Print only entries for which the given
+ Emacs Lisp predicate returns a non-~nil~ value.
+
* Working with Source Code
:PROPERTIES:
:DESCRIPTION: Export, evaluate, and tangle code blocks.
@@ -16803,7 +17324,7 @@ or
Optional. Heading arguments control many aspects of evaluation,
export and tangling of code blocks (see [[*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
+ applied to the entire buffer or specific subtrees of the Org
document.
- =<body>= ::
@@ -16843,8 +17364,31 @@ following values:
:exports => "code"
:cache => "no"
:noweb => "no"
+:hlines => "no"
+:tangle => "no"
+#+end_example
+
+#+vindex: org-babel-default-inline-header-args
+Inline source blocks (see [[*Structure of Code Blocks]]) use slightly
+different default header arguments defined in
+~org-babel-default-inline-header-args~:
+
+#+begin_example
+:session => "none"
+:results => "replace"
+:exports => "results"
+:hlines => "yes"
#+end_example
+The most notable difference between default header arguments for
+inline and normal source blocks is =:exports= argument. For inline
+source blocks, results of evaluation are exported by default; not the
+code.
+
+Unlike the default values, header arguments set using Org mode
+properties (see [[*Header arguments in Org mode properties]]) do apply to
+both the normal source blocks and inline source blocks.
+
The example below sets =:noweb= header arguments to =yes=, which makes
Org expand =:noweb= references by default.
@@ -16882,13 +17426,13 @@ for any block.
#+vindex: org-use-property-inheritance
Header arguments set through Org's property drawers (see [[*Property
-Syntax]]) apply at the sub-tree level on down. Since these property
+Syntax]]) apply at the subtree 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.
+subtree.
#+begin_example
,* sample header
@@ -17177,9 +17721,10 @@ a colon, for example: =:var table=other-file.org:example-table=.
: 4
#+end_example
-- literal example ::
+- literal example, or code block contents ::
- A literal example block named with a =NAME= keyword.
+ A code block or literal example block named with a =NAME= keyword,
+ followed by brackets (optional for example blocks).
#+begin_example
,#+NAME: literal-example
@@ -17189,7 +17734,7 @@ a colon, for example: =:var table=other-file.org:example-table=.
,#+END_EXAMPLE
,#+NAME: read-literal-example
- ,#+BEGIN_SRC emacs-lisp :var x=literal-example
+ ,#+BEGIN_SRC emacs-lisp :var x=literal-example[]
(concatenate #'string x " for you.")
,#+END_SRC
@@ -17372,6 +17917,13 @@ directory with {{{kbd(M-x cd RET DIRECTORY)}}}, and then not setting
variable ~default-directory~. Setting =mkdirp= header argument to
a non-~nil~ value creates the directory, if necessary.
+Setting =dir= to the symbol ~attach~ or the string ~"'attach"~ will
+set =dir= to the directory returned by ~(org-attach-dir)~, set =:mkdir
+yes=, and insert any file paths, as when using =:results file=, which
+are under the node's attachment directory using =attachment:= links
+instead of the usual =file:= links. Any returned path outside of the
+attachment directory will use =file:= links as per usual.
+
For example, to save the plot file in the =Work/= folder of the home
directory---notice tilde is expanded:
@@ -17450,7 +18002,8 @@ see [[*Code Evaluation and Security Issues]].
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.
+keyword if one is not already there. More details in [[*Results of
+Evaluation]].
By default, Org enables only Emacs Lisp code blocks for execution.
See [[*Languages]] to enable other languages.
@@ -17459,13 +18012,15 @@ See [[*Languages]] to enable other languages.
#+kindex: C-c C-v e
#+findex: org-babel-execute-src-block
Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or
-{{{kbd(C-c C-v e)}}} with the point on a code block[fn:142] calls the
+{{{kbd(C-c C-v e)}}} with the point on a code block[fn:: The option
+~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used to remove code
+evaluation from the {{{kbd(C-c C-c)}}} key binding.] calls the
~org-babel-execute-src-block~ function, which executes the code in the
block, collects the results, and inserts them in the buffer.
#+cindex: @samp{CALL}, keyword
#+vindex: org-babel-inline-result-wrap
-By calling a named code block[fn:143] from an Org mode buffer or
+By calling a named code block[fn:48] from an Org mode buffer or
a table. Org can call the named code blocks from the current Org mode
buffer or from the "Library of Babel" (see [[*Library of Babel]]).
@@ -17536,6 +18091,10 @@ 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.
+- =yes= ::
+
+ Org always evaluates the source code without asking permission.
+
- =never= or =no= ::
Org never evaluates the source code.
@@ -17608,10 +18167,12 @@ The =cache= header argument can have one of two values: =yes= or =no=.
In this example, both functions are cached. But =caller= runs only if
the result from =random= has changed since the last run.
+# +1 here is to work around Emacs bug#59293.
+# Otherwise, (1) is recognized as footnote reference by info.el.
#+begin_example
,#+NAME: random
,#+BEGIN_SRC R :cache yes
- runif(1)
+ runif(+1)
,#+END_SRC
,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
@@ -17666,7 +18227,7 @@ they are mutually exclusive.
- =value= ::
- Default for most Babel libraries[fn:143]. Functional mode. Org
+ Default for most Babel libraries[fn:48]. 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
@@ -17697,8 +18258,12 @@ they are mutually exclusive.
:END:
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.
+block. Choose one of the options; they are mutually exclusive.
+
+The default behavior is to automatically determine the result type.
+The result type detection depends on the code block language, as
+described in the documentation for individual languages. See
+[[*Languages]].
#+attr_texinfo: :sep ,
- =table=, =vector= ::
@@ -17849,13 +18414,17 @@ follows from the type specified above.
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:
+ type, code block output is not written to the disk. The block is
+ expected to generate the file by its side-effects only, as in the
+ following example:
#+begin_example
- ,#+begin_src shell :results file link :file "download.tar.gz"
- wget -c "https://example.com/download.tar.gz"
+ ,#+begin_src shell :results file link :file "org-mode-unicorn.svg"
+ wget -c "https://orgmode.org/resources/img/org-mode-unicorn.svg"
,#+end_src
+
+ ,#+RESULTS:
+ [[file:org-mode-unicorn.svg]]
#+end_example
- =org= ::
@@ -17898,7 +18467,8 @@ value listed above. E.g.,
:UNNUMBERED: notoc
:END:
-Handling options after collecting the results.
+Handling options after collecting the results. Choose one of the
+options; they are mutually exclusive.
- =replace= ::
@@ -17912,8 +18482,18 @@ Handling options after collecting the results.
- =none= ::
- Do not process results at all. No inserting in the Org mode buffer
- nor echo them in the minibuffer. Usage example: =:results none=.
+ Compute results, but do not do anything with them. No inserting in
+ the Org mode buffer nor echo them in the minibuffer. The results
+ can still be used when referenced from another code block.
+ Usage example: =:results none=.
+
+- =discard= ::
+
+ Ignore the results completely. This option is similar to =none=,
+ but no processing is performed on the return value. Calling the
+ code block programmatically (see [[*How to evaluate source code]]) or by
+ reference (see [[*Passing arguments]] and [[*Noweb Reference Syntax]]) will
+ always yield nil.
- =append= ::
@@ -18004,10 +18584,11 @@ to pass data between 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 [[*Literal
-Examples]]. To selectively export sub-trees of an Org document, see
-[[*Exporting]].
+languages and /results/ for inline code blocks. For some languages,
+such as ditaa, Org defaults to /results/ both in ordinary source
+blocks and in inline source blocks. To export just the body of code
+blocks, see [[*Literal Examples]]. To selectively export subtrees of an
+Org document, see [[*Exporting]].
#+cindex: @samp{exports}, header argument
The =exports= header argument is to specify if that part of the Org
@@ -18034,6 +18615,36 @@ file is exported to, say, HTML or LaTeX formats.
exported file. Whether the code is evaluated at all depends on
other options. Example: =:exports none=.
+If a source block is named using =NAME= keyword, the same name will be
+assigned to the results of evaluation. This way, fuzzy links pointing
+to the named source blocks exported using =:exports results= will
+remain valid and point to the results of evaluation.
+
+Results of evaluation of a named block can also be explicitly named
+using a separate =NAME= keyword. The name value set via =NAME=
+keyword will be preferred over the parent source block.
+
+: #+NAME: code name
+: #+BEGIN_SRC emacs-lisp :exports both value
+: (+ 1 2)
+: #+END_SRC
+:
+: #+NAME: results name
+: #+RESULTS: code name
+: 3
+:
+: This [[code name][link]] will point to the code block.
+: Another [[results name][link]] will point to the results.
+
+Explicit setting of the result name may be necessary when a named code
+block is exported using =:exports both=. Links to such block may
+arbitrarily point either to the code block or to its results when
+results do not have a distinct name.
+
+Note that all the links pointing to a source block exported using
+=:exports none= will be broken. This will make export process fail,
+unless broken links are allowed during export (see [[*Export Settings]]).
+
#+vindex: org-export-use-babel
To stop Org from evaluating code blocks to speed exports, use the
header argument =:eval never-export= (see [[*Evaluating Code Blocks]]).
@@ -18049,9 +18660,9 @@ 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 [[*Evaluating Code Blocks]]).
-Org never evaluates code blocks in commented sub-trees when exporting
+Org never evaluates code blocks in commented subtrees when exporting
(see [[*Comment Lines]]). On the other hand, Org does evaluate code
-blocks in sub-trees excluded from export (see [[*Export Settings]]).
+blocks in subtrees excluded from export (see [[*Export Settings]]).
** Extracting Source Code
:PROPERTIES:
@@ -18165,13 +18776,23 @@ the tangled file's executable permission.
#+cindex: @samp{tangle-mode}, header argument
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.
+for tangled files by ~set-file-modes~. Permissions are given by an
+octal value, which can be provided calling the ~identity~ function on
+an elisp octal value. For instance, to create a read-only file one may
+use =:tangle-mode (identity #o444)=. To reduce the verbosity required,
+a octal shorthand is defined, =oXXX= (=o= for octal). Using this, our
+read-only example is =:tangle-mode o444=. Omitting the =o= prefix will
+cause the argument to be interpreted as an integer, which can lead to
+unexpected results (=444= is the same as =o674=).
+Two other shorthands are recognized, ls-style strings like
+=rw-r--r--=, and chmod-style permissions like =g+w=.
+Note that chmod-style permissions are based on
+~org-babel-tangle-default-file-mode~, which is =#o544= by default.
+
+When =:tangle-mode= and =:shebang= are both specified, the give
+=:tangle-mode= will override the permissions from =:shebang=. When
+multiple source code blocks tangle to a single file with conflicting
+=:tangle-mode= header arguments, Org's behavior is undefined.
#+cindex: @samp{no-expand}, header argument
By default Org expands code blocks during tangling. The =no-expand=
@@ -18208,6 +18829,20 @@ expanded anyway.
:UNNUMBERED: notoc
:END:
+- ~org-babel-pre-tangle-hook~ ::
+
+ #+vindex: org-babel-pre-tangle-hook
+ This hook is run before the tangle process begins. The active
+ buffer is buffer to be tangled.
+
+- ~org-babel-tangle-body-hook~ ::
+
+ #+vindex: org-babel-tangle-body-hook
+ This hook is run from a temporary buffer containing expanded code of
+ every tangled code block. The hook can modify the expanded code as
+ needed. The contents of the current buffer will be used as actual
+ code block expansion.
+
- ~org-babel-post-tangle-hook~ ::
#+vindex: org-babel-post-tangle-hook
@@ -18215,6 +18850,10 @@ expanded anyway.
~org-babel-tangle~, making it suitable for post-processing,
compilation, and evaluation of code in the tangled files.
+- ~org-babel-tangle-finished-hook~ ::
+ #+vindex: org-babel-tangle-finished-hook
+ This hook is run after post-tangle hooks, in the original buffer.
+
*** Jumping between code and Org
:PROPERTIES:
:UNNUMBERED: notoc
@@ -18239,8 +18878,8 @@ code block header arguments:
#+cindex: source code, languages
#+cindex: code block, languages
-Code blocks in dozens of languages are supported. See Worg for
-[[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language specific documentation]].
+Code blocks in dozens of languages are supported. See Worg website
+for [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language specific documentation]].
#+vindex: org-babel-load-languages
By default, only Emacs Lisp is enabled for evaluation. To enable or
@@ -18354,7 +18993,8 @@ for Python and Emacs Lisp languages.
#+cindex: @samp{noweb-ref}, header argument
Source code blocks can include references to other source code blocks,
-using a noweb[fn:144] style syntax:
+using a noweb[fn:: For noweb literate programming details, see
+https://www.cs.tufts.edu/~nr/noweb/.] style syntax:
: <<CODE-BLOCK-ID>>
@@ -18387,6 +19027,12 @@ tangled, or exported.
Expansion of noweb syntax references in the body of the code block
when tangling. No expansion when evaluating or exporting.
+- =strip-tangle= ::
+
+ Expansion of noweb syntax references in the body of the code block
+ when evaluating or exporting. Removes noweb syntax references
+ when exporting.
+
- =no-export= ::
Expansion of noweb syntax references in the body of the code block
@@ -18429,7 +19075,7 @@ the second code block is expanded as
#+end_example
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,
+=noweb-ref= header argument, which can be set at the file, subtree,
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.
@@ -18587,6 +19233,23 @@ else:
print('do things when false')
#+end_example
+This prefix behavior can be turned off in a block by setting the
+=noweb-prefix= header argument to =no=, as in:
+
+#+begin_example
+,#+BEGIN_SRC elisp :noweb-prefix no
+ (setq example-data "<<example>>")
+,#+END_SRC
+#+end_example
+
+#+texinfo: @noindent
+which expands to:
+
+#+begin_example
+(setq example-data "this is the
+multi-line body of example")
+#+end_example
+
When in doubt about the outcome of a source code block expansion, you
can preview the results with the following command:
@@ -18865,7 +19528,8 @@ Org Tempo expands snippets to structures defined in
~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For
example, {{{kbd(< s TAB)}}} creates a code block. Enable it by
customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs
-init file[fn:145].
+init file[fn:: For more information, please refer to the commentary
+section in =org-tempo.el=.].
#+attr_texinfo: :columns 0.1 0.9
| {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= |
@@ -18945,7 +19609,7 @@ in the desired amount with hard spaces and hiding leading stars.
To display the buffer in the indented view, activate Org Indent minor
mode, using {{{kbd(M-x org-indent-mode)}}}. Text lines that are not
headlines are prefixed with virtual spaces to vertically align with
-the headline text[fn:146].
+the headline text[fn:49].
#+vindex: org-indent-indentation-per-level
To make more horizontal space, the headlines are shifted by two
@@ -18973,9 +19637,10 @@ use =STARTUP= keyword as follows:
It is possible to use hard spaces to achieve the indentation instead,
if the bare ASCII file should have the indented look also outside
-Emacs[fn:147]. With Org's support, you have to indent all lines to
-line up with the outline headers. You would use these
-settings[fn:148]:
+Emacs[fn:50]. With Org's support, you have to indent all lines to
+line up with the outline headers. You would use these settings[fn::
+~org-adapt-indentation~ can also be set to ='headline-data=, in which
+case only data lines below the headline will be indented.]:
#+begin_src emacs-lisp
(setq org-adapt-indentation t
@@ -19138,9 +19803,10 @@ manual, but here is a consolidated list for easy reference.
#+cindex: special keywords
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.
+one or more spaces, 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.
#+cindex: refresh set-up
{{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings.
@@ -19246,7 +19912,10 @@ changes.
#+vindex: org-startup-indented
Dynamic virtual indentation is controlled by the variable
- ~org-startup-indented~[fn:149].
+ ~org-startup-indented~[fn:: 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.].
| =indent= | Start with Org Indent mode turned on. |
| =noindent= | Start with Org Indent mode turned off. |
@@ -19775,6 +20444,7 @@ moves across a special context.
(add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
(define-key yas/keymap [tab] 'yas/next-field)))
#+end_src
+
** Using Org on a TTY
:PROPERTIES:
:DESCRIPTION: Using Org on a tty.
@@ -20045,8 +20715,9 @@ Here is a suggestion for Org Crypt settings in Emacs init file:
(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.
+;; GPG key to use for encryption.
+;; nil means use symmetric encryption unconditionally.
+;; "" means use symmetric encryption unless heading sets CRYPTKEY property.
(setq auto-save-default nil)
;; Auto-saving does not cooperate with org-crypt.el: so you need to
@@ -20068,6 +20739,10 @@ specifying the respective key as property =CRYPTKEY=, e.g.:
:END:
#+end_example
+Note that =CRYPTKEY= property is only effective when ~org-crypt-key~
+is set to non-nil. ~nil~ value of ~org-crypt-key~ makes Org use
+symmetric encryption unconditionally.
+
Excluding the =crypt= tag from inheritance prevents already encrypted
text from being encrypted again.
@@ -20103,7 +20778,7 @@ Tags]]) only for those set in these variables.
#+vindex: org-mobile-directory
The mobile application needs access to a file directory on
-a server[fn:150] to interact with Emacs. Pass its location through
+a server[fn:51] 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:
@@ -20124,10 +20799,12 @@ 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~[fn:151]. 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.
+~org-mobile-use-encryption~[fn:: If Emacs is configured for safe
+storing of passwords, then configure the variable
+~org-mobile-encryption-password~; please read the docstring of that
+variable.]. 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.
*** Pushing to the mobile application
:PROPERTIES:
@@ -20140,16 +20817,19 @@ 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[fn:152].
+~org-directory~, so all files should be inside this directory[fn::
+Symbolic links in ~org-directory~ need to have the same name as their
+targets.].
Push creates a special Org file =agendas.org= with custom agenda views
-defined by the user[fn:153].
+defined by the user[fn:52].
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[fn:154]
-have changed.
+downloads, it is expected to only read files whose checksums[fn::
+Checksums are stored automatically in the file =checksums.dat=.] have
+changed.
*** Pulling from the mobile application
:PROPERTIES:
@@ -20165,11 +20845,12 @@ data in an inbox file format, through the following steps:
1.
#+vindex: org-mobile-inbox-for-pull
- Org moves all entries found in =mobileorg.org=[fn:155] 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.
+ Org moves all entries found in =mobileorg.org=[fn:: The file will
+ be empty after this operation.] 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.
#+cindex: @samp{FLAGGED}, tag
@@ -20459,11 +21140,12 @@ of these strategies:
#+cindex: @LaTeX{}, and Orgtbl mode
To wrap a source table in LaTeX, use the =comment= environment
-provided by =comment.sty=[fn:156]. To activate it, put
-~\usepackage{comment}~ in the document header. Orgtbl mode inserts
-a radio table skeleton[fn:157] with the command {{{kbd(M-x
-orgtbl-insert-radio-table)}}}, which prompts for a table name. For
-example, if =salesfigures= is the name, the template inserts:
+provided by =comment.sty=[fn:: https://www.ctan.org/pkg/comment]. To
+activate it, put ~\usepackage{comment}~ in the document header.
+Orgtbl mode inserts a radio table skeleton[fn:53] with the command
+{{{kbd(M-x orgtbl-insert-radio-table)}}}, which prompts for a table
+name. For example, if =salesfigures= is the name, the template
+inserts:
#+begin_example
% BEGIN RECEIVE ORGTBL salesfigures
@@ -20480,7 +21162,7 @@ The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function
~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
the table at the target (receive) location named =salesfigures=. Now
the table is ready for data entry. It can even use spreadsheet
-features[fn:158]:
+features[fn:54]:
#+begin_example
% BEGIN RECEIVE ORGTBL salesfigures
@@ -20696,10 +21378,12 @@ Dynamic blocks, like any other block, can be narrowed with
#+vindex: org-agenda-skip-function
#+vindex: org-agenda-skip-function-global
Org provides a special hook to further limit items in agenda views:
-~agenda~, ~agenda*~[fn:159], ~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.
+~agenda~, ~agenda*~[fn:: 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.], ~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
@@ -20737,11 +21421,15 @@ meaningful string suitable for the agenda view.
#+vindex: org-odd-levels-only
#+vindex: org-agenda-skip-function
+#+findex: org-agenda-skip-entry-if
+#+findex: org-agenda-skip-subtree-if
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=[fn:160]. 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
+include all levels, use =LEVEL>0=[fn:: Note that, for
+~org-odd-levels-only~, a level number corresponds to order in the
+hierarchy, not to the number of stars.]. 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)= ::
@@ -20834,6 +21522,17 @@ number. Here are tips to speed up:
(setq org-agenda-use-tag-inheritance nil)
#+end_src
+ #+vindex: org-agenda-ignore-properties
+- Disable parsing of some drawer properties:
+
+ #+begin_src emacs-lisp
+ (setq org-agenda-ignore-properties '(effort appt stats category))
+ #+end_src
+
+ The drawer properties you can disable in the agenda are effort
+ estimates (~effort~), appointments (~appt~), statistics (~stats~)
+ and subtree-local categories (~category~).
+
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 [[https://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for agenda
@@ -21067,13 +21766,13 @@ Call {{{var(FUNC)}}} at each headline selected by {{{var(MATCH)}}} in
{{{var(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.
+Org returns a list of return values of calls to the function.
To avoid preserving point, Org wraps the call to {{{var(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
+such as if the current subtree 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
{{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific
@@ -21627,308 +22326,147 @@ modify this GNU manual."
* Footnotes
-[fn: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)=.
-
-[fn:2] Please consider subscribing to the mailing list in order to
-minimize the work the mailing list moderators have to do.
-
-[fn:3] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
+[fn:1] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
and ~org-ctrl-k-protect-subtree~ to configure special behavior of
{{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines. Note
also that clocking only works with headings indented less than 30
stars.
-[fn:4] See, however, the option ~org-cycle-emulate-tab~.
-
-[fn:5] The indirect buffer contains the entire buffer, but is narrowed
+[fn: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 [[info:emacs#Indirect Buffers][GNU Emacs Manual]].
-[fn:6] 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 [[*Speeding Up Your Agendas]]).
-
-[fn:7] See also the variable ~org-show-context-detail~ to decide how
-much context is shown around each match.
-
-[fn:8] This depends on the option ~org-remove-highlights-with-change~.
-
-[fn:9] When using =*= as a bullet, lines must be indented so that they
+[fn:3] 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.
-[fn:10] You can filter out any of them by configuring
-~org-plain-list-ordered-item-terminator~.
-
-[fn:11] You can also get =a.=, =A.=, =a)= and =A)= by configuring
+[fn:4] 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.
-[fn:12] If there's a checkbox in the item, the cookie must be put
+[fn:5] 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]=.
-[fn:13] If you do not want the item to be split, customize the
-variable ~org-M-RET-may-split-line~.
-
-[fn:14] If you want to cycle around items that way, you may customize
-~org-list-use-circular-motion~.
-
-[fn:15] See ~org-list-use-circular-motion~ for a cyclic behavior.
-
-[fn:16] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
+[fn:6] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead.
-[fn:17] To insert a vertical bar into a table field, use =\vert= or,
-inside a word =abc\vert{}def=.
-
-[fn:18] Org understands references typed by the user as =B4=, but it
+[fn:7] 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~.
-[fn:19] The computation time scales as O(N^2) because table
-{{{var(FOO)}}} is parsed for each field to be copied.
-
-[fn:20] The file =constants.el= can supply the values of constants in
+[fn:8] 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.
-[fn:21] The printf reformatting is limited in precision because the
+[fn:9] 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.
-[fn:22] Such names must start with an alphabetic character and use
-only alphanumeric/underscore characters.
-
-[fn:23] Plain URIs are recognized only for a well-defined set of
+[fn:10] Plain URIs are recognized only for a well-defined set of
schemes. See [[*External Links]]. Unlike URI syntax, they cannot contain
parenthesis or white spaces, either. URIs within angle brackets have
no such limitation.
-[fn:24] More accurately, the precise behavior depends on how point
-arrived there---see [[info:elisp#Invisible Text][Invisible Text]].
-
-[fn:25] To insert a link targeting a headline, in-buffer completion
+[fn:11] 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 {{{kbd(M-TAB)}}}. All headlines in the current
buffer are offered as completions.
-[fn:26] When targeting a =NAME= keyword, the =CAPTION= keyword is
-mandatory in order to get proper numbering (see [[*Captions]]).
-
-[fn:27] The actual behavior of the search depends on the value of the
+[fn:12] 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.
-[fn:28] 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.
-
-[fn:29] 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.
-
-[fn:30] Note that you do not have to use this command to insert
+[fn:13] 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.
-[fn:31] After insertion of a stored link, the link will be removed
+[fn:14] 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 {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
configure the option ~org-link-keep-stored-after-insertion~.
-[fn:32] This works if a function has been defined in the ~:complete~
-property of a link in ~org-link-parameters~.
-
-[fn:33] See the variable ~org-link-use-indirect-buffer-for-internals~.
-
-[fn:34] For backward compatibility, line numbers can also follow a
-single colon.
-
-[fn:35] Of course, you can make a document that contains only long
-lists of TODO items, but this is not required.
-
-[fn:36] Changing the variable ~org-todo-keywords~ only becomes
-effective after restarting Org mode in a buffer.
-
-[fn:37] This is also true for the {{{kbd(t)}}} command in the agenda
-buffer.
-
-[fn:38] All characters are allowed except =@=, =^= and =!=, which have
-a special meaning here.
-
-[fn:39] Check also the variable ~org-fast-tag-selection-include-todo~,
+[fn:15] Check also the variable ~org-fast-tag-selection-include-todo~,
it allows you to change the TODO state through the tags interface (see
[[*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.
-[fn:40] Org mode parses these lines only when Org mode is activated
-after visiting a file. {{{kbd(C-c C-c)}}} with point in a line
-starting with =#+= is simply restarting Org mode for the current
-buffer.
-
-[fn:41] The corresponding in-buffer setting is: =#+STARTUP: logdone=.
-
-[fn:42] The corresponding in-buffer setting is: =#+STARTUP:
-lognotedone=.
-
-[fn:43] See the variable ~org-log-states-order-reversed~.
-
-[fn:44] Note that the =LOGBOOK= drawer is unfolded when pressing
-{{{kbd(SPC)}}} in the agenda to show an entry---use {{{kbd(C-u
-SPC)}}} to keep it folded here.
-
-[fn:45] It is possible that Org mode records two timestamps when you
+[fn:16] 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.
-[fn:46] See also the option ~org-priority-start-cycle-with-default~.
-
-[fn:47] To keep subtasks out of the global TODO list, see the option
-~org-agenda-todo-list-sublevels~.
-
-[fn:48] With the exception of description lists. But you can allow it
+[fn:17] With the exception of description lists. But you can allow it
by modifying ~org-list-automatic-rules~ accordingly.
-[fn:49] 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.
-
-[fn:50] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
-checkbox adds checkboxes to the rest of the list.
-
-[fn:51] As with all these in-buffer settings, pressing {{{kbd(C-c
-C-c)}}} activates any changes in the line.
-
-[fn:52] This is only true if the search does not involve more complex
-tests including properties (see [[*Property Searches]]).
-
-[fn:53] To extend this default list to all tags used in all agenda
-files (see [[*Agenda Views]]), customize the variable
-~org-complete-tags-always-offer-all-agenda-tags~.
-
-[fn:54] Keys are automatically assigned to tags that have no
-configured keys.
-
-[fn:55] If more than one summary type applies to the same property,
-the parent values are computed according to the first of them.
-
-[fn:56] An age can be defined as a duration, using units defined in
+[fn:18] 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.
-[fn:57] Please note that the =COLUMNS= definition must be on a single
-line; it is wrapped here only because of formatting constraints.
-
-[fn:58] Contributed packages are not part of Emacs, but are
-distributed with the main distribution of Org---visit
-[[https://orgmode.org]].
-
-[fn:59] The Org date format is inspired by the standard ISO 8601
+[fn:19] The Org date format is inspired by the standard ISO 8601
date/time format. To use an alternative format, see [[*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.
-[fn:60] When working with the standard diary expression functions, you
+[fn:20] 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
+specify a date December 1, 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~.
+these functions, namely ~org-date~, ~org-anniversary~, ~org-cyclic, and
+~org-block~. 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~.
-[fn:61] See the variable ~org-read-date-prefer-future~. You may set
+[fn:21] 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.
-[fn:62] If you do not need/want the calendar, configure the variable
-~org-popup-calendar-for-date-prompt~.
-
-[fn:63] You can also use the calendar command {{{kbd(.)}}} to jump to
+[fn:22] You can also use the calendar command {{{kbd(.)}}} to jump to
today's date, but if you are inserting an hour specification for your
timestamp, {{{kbd(.)}}} will then insert a dot after the hour. By contrast,
{{{kbd(C-.)}}} will always jump to today's date.
-[fn:64] If you find this distracting, turn off the display with
-~org-read-date-display-live~.
-
-[fn:65] It will still be listed on that date after it has been marked
+[fn:23] 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~.
-[fn:66] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
+[fn:24] 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.
-[fn:67] Note the corresponding =STARTUP= options =logredeadline=,
-=lognoteredeadline=, and =nologredeadline=.
-
-[fn:68] Note the corresponding =STARTUP= options =logreschedule=,
-=lognotereschedule=, and =nologreschedule=.
-
-[fn:69] Org does not repeat inactive timestamps, however. See
+[fn:25] Org does not repeat inactive timestamps, however. See
[[*Timestamps]].
-[fn:70] 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.
-
-[fn:71] You can change this using the option ~org-log-repeat~, or the
+[fn:26] 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.
-[fn:72] Clocking only works if all headings are indented with less
+[fn:27] 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~.
-[fn:73] To resume the clock under the assumption that you have worked
-on this task while outside Emacs, use =(setq org-clock-persist t)=.
-
-[fn:74] To add an effort estimate "on the fly", hook a function doing
-this to ~org-clock-in-prepare-hook~.
-
-[fn:75] The last reset of the task is recorded by the =LAST_REPEAT=
-property.
-
-[fn:76] See also the variable ~org-clock-mode-line-total~.
-
-[fn:77] The corresponding in-buffer setting is: =#+STARTUP:
-lognoteclock-out=.
-
-[fn:78] When using ~:step~, ~untilnow~ starts from the beginning of
-2003, not the beginning of time.
-
-[fn:79] Language terms can be set through the variable
-~org-clock-clocktable-language-setup~.
-
-[fn:80] Note that all parameters must be specified in a single
-line---the line is broken here only to fit it into the manual.
-
-[fn:81] On computers using macOS, idleness is based on actual user
+[fn:28] 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
@@ -21936,67 +22474,34 @@ variable ~org-clock-x11idle-program-name~ if you are running Debian,
to get the same general treatment of idleness. On other systems, idle
time refers to Emacs idle time only.
-[fn:82] Please note the pitfalls of summing hierarchical data in
-a flat list (see [[*Using Column View in the Agenda]]).
-
-[fn:83] Note the corresponding =STARTUP= options =logrefile=,
-=lognoterefile=, and =nologrefile=.
-
-[fn:84] Org used to offer four different targets for date/week tree
+[fn:29] Org used to offer four different targets for date/week tree
capture. Now, Org automatically translates these to use
~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
properties. Please rewrite your date/week-tree targets using
~file+olp+datetree~ since the older targets are now deprecated.
-[fn:85] A date tree is an outline structure with years on the highest
+[fn:30] 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.
-
-[fn:86] When the file name is not absolute, Org assumes it is relative
-to ~org-directory~.
+level.
-[fn:87] If you need one of these sequences literally, escape the =%=
-with a backslash.
+#+begin_example
+,* 2022
+,** 2022-10 October
+,*** 2022-10-07 Friday
+,*** 2022-10-08 Saturday
+#+end_example
-[fn:88] If you define your own link types (see [[*Adding Hyperlink
-Types]]), any property you store with ~org-store-link-props~ can be
-accessed in capture templates in a similar way.
+Tags are allowed in the tree structure.
-[fn:89] This is always the other, not the user. See the variable
+[fn:31] This is always the other, not the user. See the variable
~org-link-from-user-regexp~.
-[fn:90] 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.
-
-[fn:91] 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.
-
-[fn:92] When using the dispatcher, pressing {{{kbd(<)}}} before
-selecting a command actually limits the command to the current file,
-and ignores ~org-agenda-files~ until the next dispatcher command.
-
-[fn:93] For backward compatibility, you can also press {{{kbd(1)}}} to
-restrict to the current buffer.
-
-[fn:94] For backward compatibility, you can also press {{{kbd(0)}}} to
-restrict to the current region/subtree.
-
-[fn:95] For backward compatibility, the universal prefix argument
+[fn:32] For backward compatibility, the universal prefix argument
{{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
This feature is deprecated, use the dedicated TODO list, or a block
agenda instead (see [[*Block agenda]]).
-[fn:96] 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~.
-
-[fn:97] You can, however, disable this by setting
-~org-agenda-search-headline-for-time~ variable to a ~nil~ value.
-
-[fn:98] Custom agenda commands can preset a filter by binding one of
+[fn:33] 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
@@ -22006,229 +22511,97 @@ property of the entire agenda view---in a block agenda, you should
only set this in the global options section, not in the section of an
individual block.
-[fn:99] Only tags filtering is respected here, effort filtering is
-ignored.
-
-[fn:100] You can also create persistent custom functions through
-~org-agenda-bulk-custom-functions~.
-
-[fn:101] This file is parsed for the agenda when
-~org-agenda-include-diary~ is set.
-
-[fn:102] You can provide a description for a prefix key by inserting
-a cons cell with the prefix and the description.
-
-[fn:103] /Planned/ means here that these entries have some planning
+[fn:34] /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.
-[fn:104] For HTML you need to install Hrvoje Nikšić's =htmlize.el=
-as an Emacs package from [[https://elpa.nongnu.org/][NonGNU ELPA]] or from [[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].
-
-[fn:105] To create PDF output, the Ghostscript ps2pdf utility must be
+[fn:35] To create PDF output, the Ghostscript ps2pdf utility must be
installed on the system. Selecting a PDF file also creates the
postscript file.
-[fn:106] 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.
-
-[fn:107] Quoting depends on the system you use, please check the FAQ
-for examples.
-
-[fn:108] 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=.
-
-[fn:109] This behavior can be disabled with =-= export setting (see
-[[*Export Settings]]).
-
-[fn:110] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
+[fn:36] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
system. Many of the features described here as "LaTeX" are really
from TeX, but for simplicity I am blurring this distinction.
-[fn:111] When MathJax is used, only the environments recognized by
+[fn:37] When MathJax is used, only the environments recognized by
MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
used to create images, any LaTeX environment is handled.
-[fn:112] These are respectively available at
+[fn:38] These are respectively available at
[[https://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
and from the ImageMagick suite. Choose the converter by setting the
variable ~org-preview-latex-default-process~ accordingly.
-[fn:113] 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~.
-
-[fn:114] This works automatically for the HTML backend (it requires
+[fn:39] This works automatically for the HTML backend (it requires
version 1.34 of the =htmlize.el= package, which you need to install).
Fontified code chunks in LaTeX can be achieved using either the
-[[https://www.ctan.org/pkg/listings][listings]] package or the [[https://www.ctan.org/pkg/minted][minted]] package. Refer to
-~org-latex-listings~ for details.
+[[https://www.ctan.org/pkg/listings][listings]] LaTeX package, [[https://www.ctan.org/pkg/minted][minted]] LaTeX package, or by using
+[[https://elpa.gnu.org/packages/engrave-faces.html][engrave-faces]] . Refer to ~org-latex-src-block-backend~ for details.
-[fn:115] Source code in code blocks may also be evaluated either
+[fn:40] Source code in code blocks may also be evaluated either
interactively or on export. See [[*Working with Source Code]] for more
information on evaluating code blocks.
-[fn:116] 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.
-
-[fn:117] You may select a different mode with the variable
-~org-edit-fixed-width-region-mode~.
-
-[fn:118] What Emacs considers to be an image depends on
-~image-file-name-extensions~ and ~image-file-name-regexps~.
-
-[fn:119] The variable ~org-startup-with-inline-images~ can be set
-within a buffer with the =STARTUP= options =inlineimages= and
-=noinlineimages=.
-
-[fn:120] The corresponding in-buffer setting is: =#+STARTUP: fninline=
-or =#+STARTUP: nofninline=.
-
-[fn:121] The corresponding in-buffer options are =#+STARTUP: fnadjust=
-and =#+STARTUP: nofnadjust=.
-
-[fn:122] The variable ~org-export-date-timestamp-format~ defines how
-this timestamp are exported.
-
-[fn:123] For export to LaTeX format---or LaTeX-related formats such as
+[fn:41] For export to LaTeX format---or LaTeX-related formats such as
Beamer---, the =org-latex-package-alist= variable needs further
configuration. See [[LaTeX specific export settings]].
-[fn:124] At the moment, some export back-ends do not obey this
+[fn:42] 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.
-[fn:125] Note that ~org-link-search-must-match-exact-headline~ is
+[fn:43] Note that ~org-link-search-must-match-exact-headline~ is
locally bound to non-~nil~. Therefore, ~org-link-search~ only matches
headlines and named elements.
-[fn:126] Since commas separate the arguments, commas within arguments
+[fn:44] Since commas separate the arguments, commas within arguments
have to be escaped with the backslash character. So only those
backslash characters before a comma need escaping with another
backslash character.
-[fn:127] For a less drastic behavior, consider using a select tag (see
-[[*Export Settings]]) instead.
-
-[fn:128] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
+[fn:45] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
to make it visible. The tag serves as a visual aid and has no
semantic relevance.
-[fn:129] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by
-[[https://www.mathjax.org][MathJax]].
-
-[fn:130] Please note that exported formulas are part of an HTML
+[fn:46] Please note that exported formulas are part of an HTML
document, and that signs such as =<=, =>=, or =&= have special
-meanings. See [[https://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX support]].
-
-[fn:131] See [[https://docs.mathjax.org/en/latest/tex.html#tex-extensions][TeX and LaTeX extensions]] in the [[https://docs.mathjax.org][MathJax manual]] to learn
-about extensions.
+meanings. See [[https://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX in HTML documents]].
-[fn:132] 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.
-
-[fn:133] This does not allow setting different bibliography compilers
+[fn:47] This does not allow setting different bibliography compilers
for different files. However, "smart" LaTeX compilation systems, such
as latexmk, can select the correct bibliography compiler.
-[fn:134] Minted uses an external Python package for code highlighting,
-which requires the flag =-shell-escape= to be added to
-~org-latex-pdf-process~.
-
-[fn:135] See [[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications
-(OpenDocument) Version 1.2]].
-
-[fn:136] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
-
-[fn:137] See [[https://dlmf.nist.gov/LaTeXML/]].
-
-[fn:138] [[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]]
-
-[fn:139] See the =<table:table-template>= element of the
-OpenDocument-v1.2 specification.
-
-[fn:140] 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.
-
-[fn:141] 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.
-
-[fn:142] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used
-to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
-
-[fn:143] Actually, the constructs =call_<name>()= and =src_<lang>{}=
+[fn:48] Actually, the constructs =call_<name>()= and =src_<lang>{}=
are not evaluated when they appear in a keyword (see [[*Summary of
In-Buffer Settings]]).
-[fn:144] For noweb literate programming details, see
-https://www.cs.tufts.edu/~nr/noweb/.
-
-[fn:145] For more information, please refer to the commentary section
-in =org-tempo.el=.
-
-[fn:146] Org Indent mode also sets ~wrap-prefix~ correctly for
+[fn:49] Org Indent mode also sets ~wrap-prefix~ correctly for
indenting and wrapping long lines of headlines or text. This minor
mode also handles Visual Line mode and directly applied settings
through ~word-wrap~.
-[fn:147] This works, but requires extra effort. Org Indent mode is
+[fn:50] This works, but requires extra effort. Org Indent mode is
more convenient for most applications.
-[fn:148] ~org-adapt-indentation~ can also be set to ='headline-data=,
-in which case only data lines below the headline will be indented.
-
-[fn:149] 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.
-
-[fn:150] For a server to host files, consider using a WebDAV server,
+[fn:51] For a server to host files, consider using a WebDAV server,
such as [[https://nextcloud.com][Nextcloud]]. Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
-[fn:151] If Emacs is configured for safe storing of passwords, then
-configure the variable ~org-mobile-encryption-password~; please read
-the docstring of that variable.
-
-[fn:152] Symbolic links in ~org-directory~ need to have the same name
-as their targets.
-
-[fn:153] While creating the agendas, Org mode forces =ID= properties
+[fn:52] While creating the agendas, Org mode forces =ID= properties
on all referenced entries, so that these entries can be uniquely
identified if Org Mobile flags them for further action. To avoid
setting properties configure the variable
~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies
on outline paths, assuming they are unique.
-[fn:154] Checksums are stored automatically in the file
-=checksums.dat=.
-
-[fn:155] The file will be empty after this operation.
-
-[fn:156] https://www.ctan.org/pkg/comment
-
-[fn:157] By default this works only for LaTeX, HTML, and Texinfo.
+[fn:53] By default this works only for LaTeX, HTML, and Texinfo.
Configure the variable ~orgtbl-radio-table-templates~ to install
templates for other modes.
-[fn:158] If the =TBLFM= keyword contains an odd number of dollar
+[fn:54] 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~.
-
-[fn:159] 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.
-
-[fn:160] Note that, for ~org-odd-levels-only~, a level number
-corresponds to order in the hierarchy, not to the number of stars.
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 403c0daa67b..80874049faf 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -1,9 +1,9 @@
\input texinfo @c -*- mode: texinfo; coding: utf-8 -*-
-@setfilename ../../info/tramp.info
+@setfilename ../info/tramp
@c %**start of header
@include docstyle.texi
-@c In the Tramp GIT, the version number is auto-frobbed from tramp.el,
-@c and the bug report address is auto-frobbed from configure.ac.
+@c In the Tramp GIT, the version number and the bug report address
+@c are auto-frobbed from configure.ac.
@include trampver.texi
@settitle @value{tramp} @value{trampver} User Manual
@c %**end of header
@@ -3659,9 +3659,9 @@ directory:
@end group
@end example
-Since Tramp cannot know in advance which share directory is intended
-to use, this expansion can be applied only when a share directory has
-been used already.
+Since @value{tramp} cannot know in advance which share directory is
+intended to use, this expansion can be applied only when a share
+directory has been used already.
The methods @option{adb}, @option{rclone} and @option{sshfs} do not
support home directory expansion at all. However, @value{tramp} keeps
@@ -4398,7 +4398,7 @@ specifies the target to be applied for renaming buffer file names from
source via @code{tramp-rename-files}. @code{source} is a regular
expressions, which matches a remote file name. @code{target} must be
a directory name, which could be remote (including remote directories
-Tramp infers by default, such as @samp{@trampfn{method,user@@host,}}).
+@value{tramp} infers by default, such as @samp{@trampfn{method,user@@host,}}).
@code{target} can contain the patterns @code{%m}, @code{%u} or
@code{%h}, which are replaced by the method name, user name or host
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index 9e1be52cd38..45cc12b2394 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -5,9 +5,8 @@
@c Copyright (C) 2003--2022 Free Software Foundation, Inc.
@c See file doclicense.texi for copying conditions.
-@c In the Tramp GIT, the version numbers are auto-frobbed from
-@c tramp.el, and the bug report address is auto-frobbed from
-@c configure.ac.
+@c In the Tramp GIT, the version number and the bug report address
+@c are auto-frobbed from configure.ac.
@set trampver 2.6.0-pre
@set trampurl https://www.gnu.org/software/tramp/
@set tramp-bug-report-address tramp-devel@@gnu.org
@@ -19,7 +18,12 @@
@set infodir /usr/local/share/info
@c Formatting of the tramp program name consistent.
+@ifplaintext
+@set tramp Tramp
+@end ifplaintext
+@ifnotplaintext
@set tramp @sc{Tramp}
+@end ifnotplaintext
@c Some flags which define the remote file name syntax.
@ifclear unified
diff --git a/etc/NEWS b/etc/NEWS
index 3c9243784de..d38ccadba64 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -143,11 +143,6 @@ reaches the end of the script, Emacs will exit with an exit code from
the value of the final form.
+++
-** New function 'substitute-quotes'.
-This function works like 'substitute-command-keys' but only
-substitutes quote characters.
-
-+++
** Emacs now supports setting 'user-emacs-directory' via '--init-directory'.
+++
@@ -435,7 +430,7 @@ The user options 'url-gateway-rlogin-host',
are also obsolete.
---
-** The user function 'url-irc-function' now takes a 'scheme' argument.
+** The user function 'url-irc-function' now takes a SCHEME argument.
The user option 'url-irc-function' is now called with a sixth argument
corresponding to the scheme portion of the target URL. For example,
this would be "ircs" for a URL like "ircs://irc.libera.chat".
@@ -499,7 +494,7 @@ instead.
** The url-dired.el library is now obsolete.
---
-** The fast-lock.el and lazy-lock.el library have been removed.
+** The fast-lock.el and lazy-lock.el libraries have been removed.
They have been obsolete since Emacs 22.1.
The variable 'font-lock-support-mode' is occasionally useful for
@@ -1034,6 +1029,9 @@ The command pops up a buffer at the bottom of the screen with a few
helpful commands for various tasks. You can toggle the display using
'C-h q'.
+** Emacs 29.1 comes with Org v9.6.
+See the file ORG-NEWS for user-visible changes in Org.
+
** Outline Mode
+++
@@ -1388,7 +1386,7 @@ the QWERTY Slovak keyboards.
* Changes in Specialized Modes and Packages in Emacs 29.1
-** ecomplete
+** Ecomplete
---
*** New commands 'ecomplete-edit' and 'ecomplete-remove'.
@@ -1510,6 +1508,7 @@ It is enabled by default, but requires that the external "shellcheck"
command is installed.
** CC Mode
+
---
*** C++ Mode now supports most of the new features in the C++20 standard.
@@ -1593,32 +1592,32 @@ If no packages are marked, 'x' will install the package under point if
it isn't already, and remove it if it is installed.
+++
-*** New command 'package-vc-install'
+*** New command 'package-vc-install'.
Packages can now be installed directly from source by cloning from a
repository.
+++
-*** New command 'package-vc-install-from-checkout'
+*** New command 'package-vc-install-from-checkout'.
An existing checkout can now be loaded via package.el, by creating a
symbolic link from the usual package directory to the checkout.
+++
-*** New command 'package-vc-checkout'
+*** New command 'package-vc-checkout'.
Used to fetch the source of a package by cloning a repository without
activating the package.
+++
-*** New command 'package-vc-prepare-patch'
+*** New command 'package-vc-prepare-patch'.
This command allows you to send patches to package maintainers, for
packages checked out using 'package-vc-install'.
+++
-*** New command 'package-report-bug'
+*** New command 'package-report-bug'.
This command helps you compose an email for sending bug reports to
package maintainers.
+++
-*** New user option 'package-vc-selected-packages'
+*** New user option 'package-vc-selected-packages'.
By customizing this user option you can specify specific packages to
install.
@@ -1764,7 +1763,7 @@ There are two new values to control the way the "*Completions*" buffer
behaves after pressing a 'TAB' if completion is not unique. The value
'always' updates or shows the "*Completions*" buffer after any attempt
to complete. The value 'visual' is like 'always', but only updates
-the completions if they are already visible. The default value 't'
+the completions if they are already visible. The default value t
always hides the completion buffer after some completion is made.
*** New commands to complete the minibuffer history.
@@ -1998,11 +1997,11 @@ It narrows to the current node.
** EUDC
+++
-*** New user option 'eudc-ignore-options-file' that defaults to 'nil'
+*** New user option 'eudc-ignore-options-file' that defaults to nil.
The 'eudc-ignore-options-file' user option can be configured to ignore
the 'eudc-options-file' (typically "~/.emacs.d/eudc-options"). Most
-users should configure this to 't' and put EUDC configuration in the
-main Emacs initialization file (".emacs" or "~/.emacs.d/init.el").
+users should configure this to t and put EUDC configuration in the
+main Emacs initialization file ("~/.emacs" or "~/.emacs.d/init.el").
+++
*** 'eudc-expansion-overwrites-query' to 'eudc-expansion-save-query-as-kill'.
@@ -2051,15 +2050,15 @@ of attributes to use for queries, and delivers more attributes in
query results.
+++
-*** New back-end for ecomplete
+*** New back-end for ecomplete.
A new back-end for ecomplete allows information from that database to
be queried by EUDC, too. The attributes present in the EUDC query are
used to select the entry type in the ecomplete database.
+++
-*** New back-end for mailabbrev
+*** New back-end for mailabbrev.
A new back-end for mailabbrev allows information from that database to
-be queried by EUDC, too. The attributes email, name, and firstname
+be queried by EUDC, too. The attributes 'email', 'name', and 'firstname'
are supported only.
** EWW/SHR
@@ -2225,11 +2224,13 @@ underlying shell instead of using the normal Emacs bindings.
also handle ANSI codes for faint, italic and blinking text, displaying
it with new 'term-{faint,italic,slow-blink,fast-blink}' faces.
-** Xref
+** Project
+++
-*** 'project-find-file' and 'project-or-external-find-file' now accept
-a prefix argument which is interpreted to mean "include all files".
+*** 'project-find-file' and 'project-or-external-find-file' can include all.
+The commands 'project-find-file' and 'project-or-external-find-file'
+now accept a prefix argument, which is interpreted to mean "include
+all files".
+++
*** New command 'project-list-buffers' bound to 'C-x p C-b'.
@@ -2240,6 +2241,15 @@ This command displays a list of buffers from the current project.
Customize the user option 'project-kill-buffers-display-buffer-list'
to enable the display of the buffer list.
+*** New user option 'project-vc-extra-root-markers'.
+Use it to add detection of nested projects (inside a VCS repository),
+or projects outside of VCS repositories.
+
+As a consequence, the 'VC project backend' is formally renamed to
+'VC-aware project backend'.
+
+** Xref
+
+++
*** New command 'xref-go-forward'.
It is bound to 'C-M-,' and jumps to the location where 'xref-go-back'
@@ -2655,13 +2665,13 @@ customize this to "https" to always prefer HTTPS URLs.
---
*** New user option 'browse-url-irc-function'.
-This option specifies a function for opening irc:// links. It
+This option specifies a function for opening "irc://" links. It
defaults to the new function 'browse-url-irc'.
---
*** New function 'browse-url-irc'.
-This multipurpose autoloaded function can be used for opening irc://
-and ircs:// URLS by any caller that passes a URL string as an initial
+This multipurpose autoloaded function can be used for opening "irc://"
+and "ircs://" URLS by any caller that passes a URL string as an initial
arg.
---
@@ -2766,12 +2776,12 @@ error, and now expand to all directories recursively (following
symlinks in the latter case).
+++
-*** Lisp forms in Eshell now treat a 'nil' result as a failed exit status.
+*** Lisp forms in Eshell now treat a nil result as a failed exit status.
When executing a command that looks like '(lisp form)' and returns
-'nil', Eshell will set the exit status (available in the '$?'
+nil, Eshell will set the exit status (available in the '$?'
variable) to 2. This allows commands like that to be used in
conditionals. To change this behavior, customize the new
-'eshell-lisp-form-nil-is-failure' option.
+'eshell-lisp-form-nil-is-failure' user option.
** Shell
@@ -2800,6 +2810,22 @@ Set it to nil to exclude line numbering from kills and copies.
argument which allows tree-widget display to be activated and computed
only when the user expands the node.
+** Proced
+
+---
+*** proced.el shows system processes of remote hosts.
+When 'default-directory' is remote, and 'proced' is invoked with a
+negative argument like 'C-u - proced', the system processes of that
+remote host are shown. Alternatively, the user option
+'proced-show-remote-processes' can be set to non-nil.
+'proced-signal-function' has been marked obsolete.
+
+---
+*** Proced can now optionally show process details in color.
+New user option 'proced-enable-color-flag' enables coloring of Proced
+buffers. This option is disabled by default; customize it to a
+non-nil value to enable colors.
+
** Miscellaneous
---
@@ -2886,19 +2912,11 @@ also been renamed:
'unread-bib' to 'bib-unread'
---
-*** proced.el shows system processes of remote hosts.
-When 'default-directory' is remote, and 'proced' is invoked with a
-negative argument like 'C-u - proced', the system processes of that
-remote host are shown. Alternatively, the user option
-'proced-show-remote-processes' can be set to non-nil.
-'proced-signal-function' has been marked obsolete.
-
----
*** 'outlineify-sticky' command is renamed to 'allout-outlinify-sticky'.
The old name is still available as an obsolete function alias.
---
-*** The url-irc library now understands ircs:// links.
+*** The url-irc library now understands "ircs://" links.
---
*** New command 'world-clock-copy-time-as-kill' for 'M-x world-clock'.
@@ -2910,7 +2928,7 @@ The new face 'abbrev-table-name' is used to display the abbrev table
name.
---
-*** New key binding "O" in `M-x list-buffer'.
+*** New key binding 'O' in 'M-x list-buffers'.
This key is now bound to 'Buffer-menu-view-other-window', which will
view this line's buffer in View mode in another window.
@@ -2925,7 +2943,7 @@ based on data provided by language servers using the Language Server
Protocol (LSP).
+++
-** New commands 'image-crop' and 'image-cut.
+** New commands 'image-crop' and 'image-cut'.
These commands allow interactively cropping/cutting the image at
point. The commands are bound to keys 'i c' and 'i x' (respectively)
in the local keymap over images. They rely on external programs, by
@@ -2964,49 +2982,65 @@ Emacs buffers, like indentation and the like. The new ert function
'ert-test-erts-file' is used to parse these files.
---
-** New mode 'js-json-mode'.
+** New major mode 'js-json-mode'.
This is a lightweight variant of 'js-mode' that is used by default
when visiting JSON files.
-
-** New mode 'typescript-ts-mode'.
+** New major mode 'typescript-ts-mode'.
A major mode based on the tree-sitter library for editing programs
in the TypeScript language. It includes support for font-locking,
-indentation, and navigation.
+indentation, and navigation. This mode will be auto-enabled for
+files with the '.ts' extension.
-** New mode 'c-ts-mode'.
+** New major mode 'tsx-ts-mode'.
+A major mode based on the tree-sitter library for editing programs
+in the TypeScript language, with support for TSX. It includes
+support for font-locking, indentation, and navigation. This mode
+will be auto-enabled for files with the '.tsx' extension.
+
+** New major mode 'c-ts-mode'.
A major mode based on the tree-sitter library for editing programs
in the C language. It includes support for font-locking,
indentation, Imenu, which-func, and navigation.
-** New mode 'c++-ts-mode'.
+** New major mode 'c++-ts-mode'.
A major mode based on the tree-sitter library for editing programs
in the C++ language. It includes support for font-locking,
indentation, Imenu, which-func, and navigation.
-** New mode 'java-ts-mode'.
+** New major mode 'java-ts-mode'.
A major mode based on the tree-sitter library for editing programs
in the Java language. It includes support for font-locking,
indentation, Imenu, which-func, and navigation.
-** New mode 'css-ts-mode'.
+** New major mode 'python-ts-mode'.
A major mode based on the tree-sitter library for editing programs
-in the CSS language. It includes support for font-locking,
+in the Python language. It includes support for font-locking,
indentation, Imenu, which-func, and navigation.
-** New mode 'json-ts-mode'.
+** New major mode 'css-ts-mode'.
+A major mode based on the tree-sitter library for editing CSS
+(Cascading Style Sheets). It includes support for font-locking,
+indentation, Imenu, which-func, and navigation.
+
+** New major mode 'json-ts-mode'.
A major mode based on the tree-sitter library for editing programs
in the JSON language. It includes support for font-locking,
indentation, Imenu, which-func, and navigation.
-** New mode 'csharp-ts-mode'.
+** New major mode 'csharp-ts-mode'.
A major mode based on the tree-sitter library for editing programs
in the C# language. It includes support for font-locking,
indentation, Imenu, which-func, and navigation.
-** New mode 'csharp-mode'.
+** New major mode 'csharp-mode'.
A major mode based on CC Mode for editing programs in the C# language.
+** New major mode 'bash-ts-mode'.
+A major mode based on the tree-sitter library for editing Bash shell
+scripts. It includes support for font-locking, indentation, Imenu,
+which-func, and navigation.
+
* Incompatible Lisp Changes in Emacs 29.1
@@ -3015,6 +3049,11 @@ A major mode based on CC Mode for editing programs in the C# language.
This means that both the prompt and 'minibuffer-default-prompt-format'
will have key definitions and single quotes handled specially.
++++
+** New function 'substitute-quotes'.
+This function works like 'substitute-command-keys' but only
+substitutes quote characters.
+
---
** 'find-image' now uses 'create-image'.
This means that images found through 'find-image' also have
@@ -3667,7 +3706,7 @@ If the function returns 'dont-clear-message', then the message is not
cleared, with the assumption that the function cleared it itself.
+++
-** The local variable section now supports defining fallback modes.
+** The local variables section now supports defining fallback modes.
This was previously only available when using a property line (i.e.,
putting the modes on the first line of a file).
@@ -3714,8 +3753,7 @@ compliant.
+++
** New macro 'setopt'.
This is like 'setq', but is meant to be used for user options instead
-of plain variables, and
-uses 'custom-set'/'set-default' to set them.
+of plain variables, and uses 'custom-set'/'set-default' to set them.
+++
** New utility predicate 'mode-line-window-selected-p'.
@@ -4318,23 +4356,18 @@ asynchronous processes. The hitherto existing implementation has been
moved to 'internal-default-signal-process'.
+++
-** 'list-system-processes' now returns remote process IDs.
+** Some system information functions honor remote systems now.
+'list-system-processes' returns remote process IDs.
+'memory-info' returns memory information of remote systems.
+'process-attributes' expects a remote process ID.
This happens only when the current buffer's 'default-directory' is
-remote. In order to preserve the old behavior, apply
+remote. In order to preserve the old behavior, bind
+'default-directory' to a local directory, like
(let ((default-directory temporary-file-directory))
(list-system-processes))
+++
-** 'process-attributes' expects a remote process ID now.
-When current buffer's 'default-directory' is remote, the PID argument
-of 'process-attributes' is regarded as a remote process ID. In order
-to preserve the old behavior, apply
-
- (let ((default-directory temporary-file-directory))
- (process-attributes pid))
-
-+++
** New functions 'take' and 'ntake'.
'(take N LIST)' returns the first N elements of LIST; 'ntake' does
the same but works by modifying LIST destructively.
@@ -4426,5 +4459,5 @@ Local variables:
coding: utf-8
mode: outline
mode: emacs-news
-paragraph-separate: "[ ]"
+paragraph-separate: "[ ]"
end:
diff --git a/etc/NEWS.19 b/etc/NEWS.19
index d21cd8187f1..25f803d6e22 100644
--- a/etc/NEWS.19
+++ b/etc/NEWS.19
@@ -1111,7 +1111,7 @@ function definition, variable, or property.
** Font Lock mode
-*** Supports Scheme, TCL and Help modes
+*** Supports Scheme, Tcl and Help modes
For example, to automatically turn on Font Lock mode in the *Help*
buffer, put:
@@ -1735,7 +1735,7 @@ projects to define project-specific structures. It also enables the
use of etags and TAGS files for languages not supported by etags.
The Emacs manual section on Tags contains explanations and examples
-for Emacs's DEFVAR, VHDL, Cobol, PostScript and TCL.
+for Emacs's DEFVAR, VHDL, Cobol, PostScript and Tcl.
** Various mode-specific commands that used to be bound to C-c LETTER
have been moved.
diff --git a/etc/NEWS.22 b/etc/NEWS.22
index b4ecbe70393..bf172b4cc90 100644
--- a/etc/NEWS.22
+++ b/etc/NEWS.22
@@ -1993,7 +1993,7 @@ It is a modern replacement for 'zone-mode', which is now obsolete.
** 'cfengine-mode' is a major mode for editing GNU Cfengine
configuration files.
-** The TCL package tcl-mode.el was replaced by tcl.el.
+** The Tcl package tcl-mode.el was replaced by tcl.el.
This was actually done in Emacs-21.1, and was not documented.
* Changes in Specialized Modes and Packages in Emacs 22.1:
diff --git a/etc/NEWS.24 b/etc/NEWS.24
index 8ef479ac0aa..31e48f9acad 100644
--- a/etc/NEWS.24
+++ b/etc/NEWS.24
@@ -704,7 +704,7 @@ related to that keyword.
*** The format of 'archive-contents' files, generated by package
repositories, has changed to allow a new (fifth) element in the data
-vectors, containing an associative list with extra properties.
+vectors, containing an association list with extra properties.
(For example, 'describe-package' uses the ':url' extra property to
display a "Homepage" header.)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 3b6ab2e2adf..67889c0b109 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -11,6 +11,742 @@ See the end of the file for license conditions.
Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
+* Version 9.6
+
+** Important announcements and breaking changes
+*** =python-mode.el (MELPA)= support in =ob-python.el= is deprecated
+
+We no longer aim to support third-party =python-mode.el= implementation of Python REPL.
+Only the built-in =python.el= will be supported from now on.
+
+We still keep the old, partially broken, code in =ob-python.el= for
+the time being. It will be removed in the next release.
+
+See https://orgmode.org/list/87r0yk7bx8.fsf@localhost for more details.
+
+*** Element cache is enabled by default and work for headings
+
+The old element cache code has been refactored. Emacs does not hang
+anymore when the cache is enabled.
+
+When cache is enabled, ~org-element-at-point~ for headings is
+guaranteed to return valid =:parent= property. The highest-level
+headings contain new =org-data= element as their parent.
+
+The new =org-data= element provides properties from top-level property
+drawer, buffer-global category, and =:path= property containing file
+path for file Org buffers.
+
+The new cache still need to be tested extensively. Please, report any
+warning coming from element cache. If you see warnings regularly, it
+would be helpful to set ~org-element--cache-self-verify~ to
+='backtrace= and provide the backtrace to Org mailing list.
+
+*** Element cache persists across Emacs sessions
+
+The cache state is saved between Emacs sessions. Enabled by default.
+
+The cache persistence can be controlled via
+~org-element-cache-persistent~.
+
+*** Users experiencing performance issues can use new folding backend
+
+The old folding backend used in Org is poorly scalable when the file
+size increases beyond few Mbs. The symptoms usually include slow
+cursor motion, especially in long-running Emacs sessions.
+
+A new optimized folding backend is now available, and enabled by
+default. To disable it, put the following to the Emacs config *before*
+loading Org:
+
+#+begin_src emacs-lisp
+(setq org-fold-core-style 'overlays)
+#+end_src
+
+Even more performance optimization can be enabled by customizing
+=org-fold-core--optimise-for-huge-buffers=. However, this option may
+be dangerous. Please, read the variable docstring carefully to
+understand the possible consequences.
+
+When =org-fold-core-style= is set to =text-properties=, several new
+features will become available and several notable changes will happen
+to the Org behavior. The new features and changes are listed below.
+
+**** Hidden parts of the links can now be searched and revealed during isearch
+
+In the past, hidden parts of the links could not be searched using
+isearch (=C-s=). Now, they are searchable by default. The hidden
+match is also revealed temporarily during isearch.
+
+To restore the old behavior add the following core to your Emacs
+config:
+
+#+begin_src emacs-lisp
+(defun org-hidden-link-ignore-isearch ()
+ "Do not match hidden parts of links during isearch."
+ (org-fold-core-set-folding-spec-property 'org-link :isearch-open nil)
+ (org-fold-core-set-folding-spec-property 'org-link :isearch-ignore t))
+(add-hook 'org-mode-hook #'org-hidden-link-ignore-isearch)
+#+end_src
+
+See docstring of =org-fold-core--specs= to see more details about
+=:isearch-open= and =:isearch-ignore= properties.
+
+**** =org-catch-invisible-edits= now works for hidden parts of the links and for emphasis markers
+
+In the past, user could edit invisible parts of the links and emphasis markers. Now, the editing is respecting the value of =org-catch-invisible-edits=.
+
+Note that hidden parts of sub-/super-scripts are still not handled.
+
+**** Breaking structure of folded elements automatically reveals the folded text
+
+In the past, the user could be left with unfoldable text after breaking the org structure.
+
+For example, if
+
+#+begin_src org
+:DRAWER:
+like this
+:END:
+#+end_src
+
+is folded and then edited into
+
+#+begin_src org
+DRAWER:
+like this
+:END:
+#+end_src
+The hidden text would not be revealed.
+
+Now, breaking structure of drawers, blocks, and headings automatically
+reveals the folded text.
+
+**** Folding state of the drawers is now preserved when cycling headline visibility
+
+In the past drawers were folded every time a headline is unfolded.
+
+Now, it is not the case anymore. The drawer folding state is
+preserved. The initial folding state of all the drawers in buffer is
+set according to the startup visibility settings.
+
+To restore the old behavior, add the following code to Emacs config:
+
+#+begin_src emacs-lisp
+(add-hook 'org-cycle-hook #'org-cycle-hide-drawers)
+#+end_src
+
+Note that old behavior may cause performance issues when cycling
+headline visibility in large buffers.
+
+**** =outline-*= functions may no longer work correctly in Org mode
+
+The new folding backend breaks some of the =outline-*= functions that
+rely on the details of visibility state implementation in
+=outline.el=. The old Org folding backend was compatible with the
+=outline.el= folding, but it is not the case anymore with the new
+backend. From now on, using =outline-*= functions is strongly
+discouraged when working with Org files.
+
+*** HTML export uses MathJax 3+ instead of MathJax 2
+
+Org now uses MathJax 3 by default instead of MathJax 2. During HTML
+exports, Org automatically converts all legacy MathJax 2 options to
+the corresponding MathJax 3+ options, except for the ~path~ option in
+which now /must/ point to a file containing MathJax version 3 or
+later. The new Org does /not/ work with the legacy MathJax 2.
+
+Further, if you need to use a non-default ~font~ or ~linebreaks~ (now
+~overflow~), then the ~path~ must point to MathJax 4 or later.
+
+See the updated ~org-html-mathjax-options~ for more details.
+
+MathJax 3, a ground-up rewrite of MathJax 2 came out in 2019. The new
+version brings modularity, better and faster rendering, improved LaTeX
+support, and more.
+
+For more information about new features, see:
+
+https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.html
+https://docs.mathjax.org/en/latest/upgrading/whats-new-3.1.html
+https://docs.mathjax.org/en/latest/upgrading/whats-new-3.2.html
+
+MathJax 3 comes with useful extensions. For instance, you can typeset
+calculus with the ~physics~ extension or chemistry with the ~mhchem~
+extension, like in LaTeX.
+
+Note that the Org manual does not discuss loading of MathJax
+extensions via ~+HTML_MATHJAX~ anymore. It has never worked anyway.
+To actually load extensions, consult the official documentation:
+
+https://docs.mathjax.org/en/latest/input/tex/extensions.html
+
+Lastly, MathJax 3 changed the default JavaScript content delivery
+network (CDN) provider from CloudFlare to jsDelivr. You can find the
+new terms of service, including the privacy policy, at
+https://www.jsdelivr.com/terms.
+
+*** List references in source block variable assignments are now proper lists
+
+List representation of named lists is now converted to a simple list
+as promised by the manual section [[info:org#Environment of a Code Block][org#Environment of a Code Block]].
+Previously, it was converted to a list of lists.
+
+Before:
+
+#+begin_src org
+,#+NAME: example-list
+- simple
+ - not
+ - nested
+- list
+
+,#+BEGIN_SRC emacs-lisp :var x=example-list :results value
+(format "%S" x)
+,#+END_SRC
+
+,#+RESULTS:
+: (("simple" (unordered ("not") ("nested"))) ("list"))
+#+end_src
+
+After:
+
+#+begin_src org
+,#+BEGIN_SRC emacs-lisp :var x=example-list :results value
+(format "%S" x)
+,#+END_SRC
+
+,#+RESULTS:
+: ("simple" "list")
+#+end_src
+
+** New features
+*** Clock table can now produce quarterly reports
+
+=:step= clock table parameter can now be set to =quarter=.
+*** Publishing now supports links to encrypted Org files
+
+Links to other published Org files are automatically converted to the
+corresponding html links. Now, this feature is also available when
+links point to encrypted Org files, like
+=[[file:foo.org.gpg::Heading]]=.
+
+*** Interactive commands now support escaping text inside comment blocks
+
+~org-edit-special~ and ~org-insert-structure-template~ now handle
+comment blocks.
+
+See [[*New command ~org-edit-comment-block~ to edit comment block at
+point]].
+
+*** New customization option =org-property-separators=
+A new alist variable to control how properties are combined.
+
+If a property is specified multiple times with a =+=, like
+
+#+begin_src org
+:PROPERTIES:
+:EXPORT_FILE_NAME: some/path
+:EXPORT_FILE_NAME+: to/file
+:END:
+#+end_src
+
+the old behavior was to always combine them with a single space
+(=some/path to/file=). For the new variable, the car of each item in
+the alist should be either a list of property names or a regular
+expression, while the cdr should be the separator to use when
+combining that property.
+
+The default value for the separator is a single space, if none of the
+provided items in the alist match a given property.
+
+For example, in order to combine =EXPORT_FILE_NAME= properties with a
+forward slash =/=, one can use
+
+#+begin_src emacs-lisp
+(setq org-property-separators '((("EXPORT_FILE_NAME") . "/")))
+#+end_src
+
+The example above would then produce the property value
+=some/path/to/file=.
+
+*** New library =org-persist.el= implements variable persistence across Emacs sessions
+
+The library stores variable data in ~org-persist-directory~ (set to XDG
+cache dir by default).
+
+The entry points are ~org-persist-register~, ~org-persist-unregister~,
+~org-persist-read~, and ~org-persist-read-all~. Storing circular
+structures is supported. Storing references between different
+variables is also supported (see =:inherit= key in
+~org-persist-register~).
+
+The library permits storing buffer-local variables. Such variables
+are linked to the buffer text, file =inode=, and file path.
+
+*** New =:options= attribute when exporting tables to LaTeX
+
+The =:options= attribute allows adding an optional argument with a
+list of various table options (between brackets in LaTeX export),
+since certain tabular environments, such as longtblr of the
+tabularray LaTeX package, provides this structure.
+
+*** New =:compact= attribute when exporting lists to Texinfo
+
+The =:compact= attribute allows exporting multiple description list
+items to one =@item= command and one or more =@itemx= commands. This
+feature can also be enabled for all description lists in a file using
+the =compact-itemx= export option, or globally using the
+~org-texinfo-compact-itemx~ variable.
+
+*** New shorthands recognized when exporting to Texinfo
+
+Items in a description list that begin with =Function:=, =Variable:=
+or certain related prefixes are converted using Texinfo definition
+commands.
+*** New =:noweb-prefix= babel header argument
+
+=:noweb-prefix= can be set to =no= to prevent the prefix characters
+from being repeated when expanding a multiline noweb reference.
+
+*** New =:noweb= babel header argument value =strip-tangle=
+
+=:noweb= can be set to =strip-tangle= to strip the noweb syntax references
+before tangling.
+
+*** New LaTeX source block backend using =engraved-faces-latex=
+
+When ~org-latex-src-block-backend~ is set to ~engraved~,
+=engrave-faces-latex= from [[http://elpa.gnu.org/packages/engrave-faces.html][engrave-faces]] is used to transcode source
+blocks to LaTeX. This requires the =fvextra=, =float=, and (by
+default, but not necessarily) =tcolorbox= LaTeX packages be
+installed. It uses Emacs' font-lock information, and so tends to
+produce results superior to Minted or Listings.
+*** Support for =#+include=-ing URLs
+
+=#+include: FILE= will now accept URLs as the file.
+*** Structure templates now respect case used in ~org-structure-template-alist~
+
+The block type in ~org-structure-template-alist~ is not case-sensitive.
+When the block type starts from the upper case, structure template
+will now insert =#+BEGIN_TYPE=. Previously, lower-case =#+begin_type= was inserted unconditionally.
+*** New ox-latex tabbing support for tables.
+
+Latex tables can now be exported to the latex tabbing environment
+tabbing environment]].
+This is done by adding =#+ATTR_LATEX: :mode tabbing= at the top
+of the table.
+The default column width is set to 1/n times the latex textwidth,
+where n is the number of columns.
+This behavior can be changed by supplying a =:align= parameter.
+
+The tabbing environment can be useful when generating simple tables which
+can be span multiple pages and when table cells are allowed to overflow.
+*** Support for =nocite= citations and sub-bibliographies in the "csl" export processor
+
+The "csl" citation export processor now supports =nocite= style
+citations that add items to the printed bibliography without visible
+references in the text. Using the key =*= in a nocite citation, for
+instance,
+
+#+begin_src org
+[cite/n:@*]
+#+end_src
+
+includes all available items in the printed bibliography.
+
+The "csl" export processor now also supports sub-bibliographies that
+show only a subset of the references based on some criterion. For
+example,
+
+#+begin_src org
+#+print_bibliography: :type book :keyword ai
+#+end_src
+
+prints a sub-bibliography containing the book entries with =ai= among
+their keywords.
+*** New =:filetitle= option for clock table
+
+The =:filetitle= option for clock tables can be set to ~t~ to show org
+file title (set by =#+title:=) in the File column instead of the
+file name. For example:
+
+#+begin_src org
+,#+BEGIN: clocktable :scope agenda :maxlevel 2 :block thisweek :filetitle t
+#+end_src
+
+If a file does not have a title, the table will show the file name
+instead.
+*** New =org-md-toplevel-hlevel= variable for Markdown export
+
+The =org-md-toplevel-hlevel= customization variable sets the heading
+level used for top level headings, much like how
+=org-html-toplevel-hlevel= sets the heading level used for top level
+headings in HTML export.
+*** Babel: new syntax to pass the contents of a src block as argument
+
+Use the header argument =:var x=code-block[]= or
+: #+CALL: fn(x=code-block[])
+to pass the contents of a named code block as a string argument.
+*** New property =ORG-IMAGE-ACTUAL-WIDTH= for overriding global ~org-image-actual-width~
+
+The new property =ORG-IMAGE-ACTUAL-WIDTH= can override the global
+variable ~org-image-actual-width~ value for inline images display width.
+
+*** Outline cycling can now include inline image visibility
+
+New ~org-cycle-hook~ function ~org-cycle-display-inline-images~ for
+auto-displaying inline images in the visible parts of the subtree.
+This behavior is controlled by new custom option
+~org-cycle-inline-images-display~.
+
+*** New ~org-babel-tangle-finished-hook~ hook run at the very end of ~org-babel-tangle~
+
+This provides a proper counterpart to ~org-babel-pre-tangle-hook~, as
+~org-babel-post-tangle-hook~ is run
+per-tangle-destination. ~org-babel-tangle-finished-hook~ is just run
+once after the post tangle hooks.
+
+*** New =:backend= header argument for clojure code blocks
+
+The =:backend= header argument on clojure code blocks can override the
+value of ~org-babel-clojure-backend~. For example:
+
+#+begin_src clojure :backend babashka
+(range 2)
+#+end_src
+
+*** New =:results discard= header argument
+
+Unlike =:results none=, the return value of code blocks called with
+=:results discard= header argument is always ~nil~. Org does not
+attempt to analyze the results and simply returns nil. This can be
+useful when the code block is used for side effects only but generates
+large outputs that may be slow to analyze for Org.
+
+*** Add Capture template hook properties
+
+Capture templates can now attach template specific hooks via the
+following properties: ~:hook~, ~:prepare-finalize~,
+~:before-finalize~, ~:after-finalize~. These nullary functions run
+prior to their global counterparts for the selected template.
+
+** New options
+*** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets
+
+Setting ~org-refile-use-outline-path~ to ~'title~ will show title
+instead of the file name in refile targets. If the document do not have
+a title, the filename will be used, similar to ~'file~ option.
+
+*** A new option for custom setting ~org-agenda-show-outline-path~ to show document title
+
+Setting ~org-agenda-show-outline-path~ to ~'title~ will show title
+instead of the file name at the beginning of the outline. The title of
+the document can be set by special keyword =#+title:=.
+
+*** New custom settings =org-icalendar-scheduled-summary-prefix= and =org-icalendar-deadline-summary-prefix=
+
+These settings allow users to define prefixes for exported summary
+lines in ICS exports. The customization can be used to disable
+the prefixes completely or make them a little bit more verbose
+(e.g. "Deadline: " instead of the default "DL: ").
+
+The same settings can also be applied via corresponding exporter
+options:
+=:icalendar-scheduled-summary-prefix=,
+=:icalendar-deadline-summary-prefix=
+
+*** A new custom setting =org-hide-drawer-startup= to control initial folding state of drawers
+
+Previously, all the drawers were always folded when opening an Org
+file. This only had an effect on the drawers outside folded
+headlines. The drawers inside folded headlines were re-folded because
+=org-cycle-hide-drawers= was present inside =org-cycle-hook=.
+
+With the new folding backend, running =org-cycle-hide-drawers= is no
+longer needed if all the drawers are truly folded on startup: [[*Folding
+state of the drawers is now preserved when cycling headline
+visibility]]. However, this has an unwanted effect when a user does
+not want the drawers to be folded (see [[https://orgmode.org/list/m2r14f407q.fsf@ntnu.no][this bug report]]).
+
+The new custom setting gives more control over initial folding state
+of the drawers. When set to =nil= (default is =t=), the drawers are
+not folded on startup.
+
+The folding state can also be controlled on per-file basis using
+=STARTUP= keyword:
+
+: #+startup: hidedrawers
+: #+startup: nohidedrawers
+
+*** New custom setting ~org-icalendar-force-alarm~
+
+The new setting, when set to non-nil, makes Org create alarm at the
+event time when the alarm time is set to 0. The default value is
+nil -- do not create alarms at the event time.
+
+*** New special value ~'attach~ for src block =:dir= option
+
+Passing the symbol ~attach~ or string ="'attach"= (with quotes) to the =:dir=
+option of a src block is now equivalent to =:dir (org-attach-dir) :mkdir yes=
+and any file results with a path descended from the attachment directory will
+use =attachment:= style links instead of the standard =file:= link type.
+
+** New functions and changes in function arguments
+*** New function ~org-get-title~ to get =#+TITLE:= property from buffers
+
+A function to collect the document title from the org-mode buffer.
+
+*** ~org-fold-show-entry~ does not fold drawers by default anymore
+
+~org-fold-show-entry~ now accepts an optional argument HIDE-DRAWERS.
+When the argument is non-nil, the function folds all the drawers
+inside entry. This was the default previously.
+
+Now, ~org-fold-show-entry~ does not fold drawers by default.
+
+*** New command ~org-edit-comment-block~ to edit comment block at point
+
+As the contents of comments blocks is not parsed as Org markup, the
+headlines and keywords inside should be escaped, similar to src
+blocks, example blocks, and export blocks. This in inconvenient to do
+manually and ~org-edit-special~ is usually advised to edit text in
+such kind of blocks.
+
+Now, comment block editing is also supported via this new function.
+
+*** New function ~org-element-cache-map~ for quick mapping across Org elements
+
+When element cache is enabled, the new function provides the best
+possible performance to map across large Org buffers.
+
+It is recommended to provide =:next-re= and =:fail-re= parameters for
+best speed.
+
+Diagnostic information about execution speed can be provided according
+to ~org-element--cache-map-statistics~ and
+~org-element--cache-map-statistics-threshold~.
+
+~org-scan-tags~ and tag views in agenda utilize the new function.
+*** New function ~org-element-at-point-no-context~
+
+This function is like ~org-element-at-point~, but it does not try to
+update the cache and does not guarantee correct =:parent= properties
+for =headline= elements.
+
+This function is faster than ~org-element-at-point~ when used together
+with frequent buffer edits.
+*** Various Org API functions now use cache and accept Org elements as optional arguments
+
+~org-in-archived-heading-p~, ~org-in-commented-heading-p~,
+~org-up-heading-safe~, ~org-end-of-subtree~, ~org-goto-first-child~,
+~org-back-to-heading~, ~org-entry-get-with-inheritance~, and
+~org-narrow-to-subtree~ all accept Org element as an extra optional
+argument.
+
+~org-get-tags~ now accepts Org element or buffer position as first
+argument.
+
+*** New function ~org-texinfo-kbd-macro~
+
+This function is intended for us in the definition of a ~kbd~ macro in
+files that are exported to Texinfo.
+
+*** =org-at-heading-p= now recognizes optional argument. Its meaning is inverted.
+
+=org-at-heading-p= now returns t by default on headings inside folds.
+Passing optional argument will produce the old behavior.
+
+*** =org-babel-execute:plantuml= can output ASCII graphs in the buffer
+
+Previously, executing PlantUML src blocks always exported to a file. Now, if
+:results is set to a value which does not include "file", no file will be
+exported and an ASCII graph will be inserted below the src block.
+
+** Removed or renamed functions and variables
+*** =org-plantump-executable-args= is renamed and applies to jar as well
+
+The new variable name is =org-plantuml-args=. It now applies to both
+jar PlantUML file and executable.
+*** Default values and interpretations of ~org-time-stamp-formats~ and ~org-time-stamp-custom-formats~ are changed
+
+Leading =<= and trailing =>= in the default values of
+~org-time-stamp-formats~ and ~org-time-stamp-custom-formats~ are
+stripped.
+
+The Org functions that are using these variables also ignore leading
+and trailing brackets (=<...>= and =[...]=, if present).
+
+This change makes the Org code more consistent and also makes the
+docstring for ~org-time-stamp-custom-formats~ accurate.
+
+No changes on the user side are needed if
+~org-time-stamp-custom-formats~ was customized.
+*** ~org-timestamp-format~ is renamed to ~org-format-timestamp~
+
+The old function name is similar to other ~org-time-stamp-format~
+function. The new name emphasizes that ~org-format-timestamp~ works
+on =timestamp= objects.
+
+*** Updated argument list in ~org-time-stamp-format~
+
+New =custom= argument in ~org-time-stamp-format~ makes the function
+use ~org-time-stamp-custom-formats~ instead of
+~org-time-stamp-formats~ to determine the format.
+
+Optional argument =long= is renamed to =with-time=, emphasizing that it refers to time stamp format with time specification.
+
+Optional argument =inactive= can now have a value =no-brackets= to
+return format string with brackets stripped.
+
+** Miscellaneous
+*** SQL Babel ~:dbconnection~ parameter can be mixed with other SQL Babel parameters
+
+Before you could either specify SQL parameters like ~:dbhost~,
+~:dbuser~, ~:database~, etc or a ~:dbconnection~ parameter which looks
+up all other parameters from the ~sql-connection-alist~ variable. Now
+it's possible to specify a ~:dbconnection~ and additionally other
+parameters that will add or overwrite the parameters coming from
+~sql-connection-alist~.
+
+E.g. if you have a connection in your ~sql-connection-alist~ to a
+server that has many databases, you don't need an entry for every
+database but instead can just specify ~:database~ next to your
+~:dbconnection~ parameter.
+
+*** Post-processing code blocks can return an empty list
+
+When the result of a regular code block is nil, then that was already
+treated as an empty list. Now that is also the case for code blocks
+that post-process the result of another block.
+
+*** Styles are customizable in ~biblatex~ citation processor
+
+It is now possible to add new styles or modify old ones in ~biblatex~
+citation processor. See ~org-cite-biblatex-styles~ for more
+information.
+
+*** Citation processors can declare styles dynamically
+
+When a citation processor is registered, it is now possible to set
+~:cite-styles~ key to a function, which will be called whenever the
+list of styles is required.
+
+*** Org also searches for CSL style files in default directory
+
+When CSL style file name is relative, Org first looks into
+default-directory before trying ~org-cite-csl-styles-dir~.
+
+*** Users can add checkers to the linting process
+
+The function ~org-lint-add-checker~ allows one to add personal checks
+when calling ~org-lint~. See its docstring for more information.
+
+*** New =transparent-image-converter= property for =dvipng=
+
+The =dvipng= option in ~org-preview-latex-process-alist~ has a new
+property =transparent-image-converter= which is used instead of
+=image-converter= when producing transparent images.
+
+*** =:tangle-mode= now accepts more permissions formats
+
+Previously =:tangle-mode (identity #o755)= was the only reasonable way
+to set the file mode. ~org-babel-interpret-file-mode~ has been
+introduced which will accept three new formats:
++ Short octals, e.g. =:tangle-mode o755=
++ ls-style, e.g. =:tangle-mode rwxrw-rw-=
++ chmod-style, e.g. =:tangle-mode u+x=
+
+Chmod-style permissions are based on the new variable
+~org-babel-tangle-default-file-mode~.
+
+*** A new custom setting =org-agenda-clock-report-header= to add a header to org agenda clock report
+
+*** ~org-latex-listings~ has been replaced with ~org-latex-src-block-backend~
+
+~org-latex-listings~ has been renamed to better reflect the current
+purpose of the variable. The replacement variable
+~org-latex-src-block-backend~ acts in exactly the same way, however it
+accepts =listings= and =verbatim= in place of =t= and =nil= (which
+still work, but are no longer listed as valid options).
+
+*** ~org-link-parameters~ has a new ~:insert-description~ parameter
+
+The value of ~:insert-description~ is used as the initial input when
+prompting for a link description. It can be a string (used as-is) or
+a function (called with the same arguments as
+~org-make-link-description-function~ to return a string to use).
+
+An example of a such function for =info:= links is
+~org-info-description-as-command~. To access a manual section outside
+of Org, description may be pasted to shell prompt or evaluated within
+Emacs using =M-:= (wrapped into parenthesis). For example,
+description of the =info:org#Tags= link is =info "(org) Tags"=. To
+restore earlier behavior add to your Emacs init file the following:
+#+begin_src elisp :results silent :eval never-export
+ (with-eval-after-load 'ol-info
+ (org-link-set-parameters "info" :insert-description nil))
+#+end_src
+
+*** New list of languages for LaTeX export: ~org-latex-language-alist~
+
+~org-latex-language-alist~ unifies into a single list the old language
+lists for the =babel= and =polyglossia= LaTeX packages:
+~org-latex-babel-language-alist~ and
+~org-latex-polyglossia-language-alist~, respectively, which are
+declared obsolete.
+
+This new list captures the current state of art regarding language
+support in LaTeX. The new =babel= syntax for loading languages via
+=ini= files and the new command =\babelprovide= (see:
+https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf)
+are also supported.
+*** Texinfo exports include LaTeX
+
+With the new customization option ~org-texinfo-with-latex~ set to (its
+default value) ~'detect~, if the system runs Texinfo 6.8 (3 July 2021)
+or newer, Org will export all LaTeX fragments and environments using
+Texinfo ~@math~ and ~@displaymath~ commands respectively.
+*** More flexible ~org-attach-id-to-path-function-list~
+
+List entries may return nil if they are unable to handle the passed
+ID. So, responsibility is passed to the next item in the list.
+Default entries ~org-attach-id-uuid-folder-format~ and
+~org-attach-id-ts-folder-format~ now return nil for too short IDs.
+Earlier an obscure error has been thrown.
+
+After the change, error text suggests adjusting
+~org-attach-id-to-path-function-list~ value. The
+~org-attach-dir-from-id~ function is adapted to ignore nil values and
+to take first non-nil value instead of the value returned by first
+~org-attach-id-to-path-function-list~ item.
+
+New policy allows mixing different ID styles while keeping subfolder
+layout suited best for each one. For example, one can use the
+following snippet to allow multiple different ID formats in Org files.
+
+#+begin_src emacs-lisp
+(setq org-attach-id-to-path-function-list
+ '(;; When ID looks like an UUIDs or Org internal ID, use
+ ;; `org-attach-id-uuid-folder-format'.
+ (lambda (id)
+ (and (or (org-uuidgen-p id)
+ (string-match-p "[0-9a-z]\\{12\\}" id))
+ (org-attach-id-uuid-folder-format id)))
+ ;; When ID looks like a timestap-based ID. Group by year-month
+ ;; folders.
+ (lambda (id)
+ (and (string-match-p "[0-9]\\{8\\}T[0-9]\\{6\\}\.[0-9]\\{6\\}" id)
+ (org-attach-id-ts-folder-format id)))
+ ;; Any other ID goes into "important" folder.
+ (lambda (id) (format "important/%s/%s" (substring id 0 1) id))
+ ;; Fallback to detect existing attachments for old defaults.
+ ;; All the above functions, even when return non-nil, would
+ ;; point to non-existing folders.
+ org-attach-id-uuid-folder-format
+ org-attach-id-ts-folder-format))
+#+end_src
+
* Version 9.5
** Important announcements and breaking changes
@@ -1466,6 +2202,7 @@ the headline to use for making the table of contents.
,* Another section
,#+TOC: headlines 1 :target "#TargetSection"
#+end_example
+
** New functions
*** ~org-dynamic-block-insert-dblock~
@@ -1756,6 +2493,7 @@ CIDER version which has not =sesman= integrated, only has
(dissoc Clojure 'JVM)
(conj clojurists "stardiviner")
#+end_src
+
*** Add ~:results link~ support for Babel
With this output format, create a link to the file specified in
@@ -1774,14 +2512,17 @@ wget -c "https://ben.akrin.com/crackzor/crackzor_1.0.c.gz"
#+begin_src js :session "*Javascript REPL*"
console.log("stardiviner")
#+end_src
+
*** Add ~:session~ support of ob-js for Indium
#+begin_src js :session "*JS REPL*"
console.log("stardiviner")
#+end_src
+
*** Add ~:session~ support of ob-js for skewer-mode
#+begin_src js :session "*skewer-repl*"
console.log("stardiviner")
#+end_src
+
*** Add support for links to LaTeX equations in HTML export
Use MathJax links when enabled (by ~org-html-with-latex~), otherwise
add a label to the rendered equation.
@@ -1868,6 +2609,7 @@ you should expect to see something like:
#+BEGIN_EXAMPLE
,#+STARTUP: shrink
#+END_EXAMPLE
+
*** Allow to filter by tags/property when capturing colview
You can now use =:match= to filter entries using a todo/tags/properties
@@ -2250,6 +2992,7 @@ To use =vertica= in an sql =SRC_BLK= set the =:engine= like this:
SELECT * FROM nodes;
,#+END_SRC
#+END_EXAMPLE
+
**** C++: New header ~:namespaces~
The new ~:namespaces~ export option can be used to specify namespaces
diff --git a/etc/org/README b/etc/org/README
index aac788d3c64..af15f95ab0d 100644
--- a/etc/org/README
+++ b/etc/org/README
@@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
Author: Jambunathan K <kjambunathan at gmail dot com>
Keywords: outlines, hypermedia, calendar, wp
-Homepage: https://orgmode.org
+URL: https://orgmode.org
Commentary:
diff --git a/etc/publicsuffix.txt b/etc/publicsuffix.txt
index 025cf47274b..60d72fd0d53 100644
--- a/etc/publicsuffix.txt
+++ b/etc/publicsuffix.txt
@@ -7171,7 +7171,7 @@ org.zw
// newGTLDs
-// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2022-10-29T15:16:24Z
+// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2022-11-29T15:14:18Z
// This list is auto-generated, don't edit it manually.
// aaa : 2015-02-26 American Automobile Association, Inc.
aaa
@@ -7221,9 +7221,6 @@ aco
// actor : 2013-12-12 Dog Beach, LLC
actor
-// adac : 2015-07-16 Allgemeiner Deutscher Automobil-Club e.V. (ADAC)
-adac
-
// ads : 2014-12-04 Charleston Road Registry Inc.
ads
@@ -8511,7 +8508,7 @@ hisamitsu
// hitachi : 2014-10-31 Hitachi, Ltd.
hitachi
-// hiv : 2014-03-13 UNR Corp.
+// hiv : 2014-03-13 Internet Naming Company LLC
hiv
// hkt : 2015-05-14 PCCW-HKT DataCom Services Limited
@@ -8715,7 +8712,7 @@ jpmorgan
// jprs : 2014-09-18 Japan Registry Services Co., Ltd.
jprs
-// juegos : 2014-03-20 UNR Corp.
+// juegos : 2014-03-20 Internet Naming Company LLC
juegos
// juniper : 2015-07-30 JUNIPER NETWORKS, INC.
@@ -9441,7 +9438,7 @@ promo
// properties : 2013-12-05 Binky Moon, LLC
properties
-// property : 2014-05-22 UNR Corp.
+// property : 2014-05-22 Internet Naming Company LLC
property
// protection : 2015-04-23 XYZ.COM LLC
@@ -9717,7 +9714,7 @@ sew
// sex : 2014-11-13 ICM Registry SX LLC
sex
-// sexy : 2013-09-11 UNR Corp.
+// sexy : 2013-09-11 Internet Naming Company LLC
sexy
// sfr : 2015-08-13 Societe Francaise du Radiotelephone - SFR
@@ -10065,7 +10062,7 @@ travelers
// travelersinsurance : 2015-03-26 Travelers TLD, LLC
travelersinsurance
-// trust : 2014-10-16 UNR Corp.
+// trust : 2014-10-16 Internet Naming Company LLC
trust
// trv : 2015-03-26 Travelers TLD, LLC
@@ -10658,6 +10655,10 @@ graphox.us
// Submitted by Craig Jellick <domains@acorn.io>
*.on-acorn.io
+// ActiveTrail: https://www.activetrail.biz/
+// Submitted by Ofer Kalaora <postmaster@activetrail.com>
+activetrail.biz
+
// Adobe : https://www.adobe.com/
// Submitted by Ian Boston <boston@adobe.com> and Lars Trieloff <trieloff@adobe.com>
adobeaemcloud.com
@@ -10702,6 +10703,10 @@ altervista.org
// Submitted by Cyril <admin@alwaysdata.com>
alwaysdata.net
+// Amaze Software : https://amaze.co
+// Submitted by Domain Admin <domainadmin@amaze.co>
+myamaze.net
+
// Amazon : https://www.amazon.com/
// Submitted by AWS Security <psl-maintainers@amazon.com>
// Subsections of Amazon/subsidiaries will appear until "concludes" tag
@@ -11178,8 +11183,11 @@ cloudcontrolapp.com
// Cloudflare, Inc. : https://www.cloudflare.com/
// Submitted by Cloudflare Team <publicsuffixlist@cloudflare.com>
-pages.dev
+cf-ipfs.com
+cloudflare-ipfs.com
trycloudflare.com
+pages.dev
+r2.dev
workers.dev
// Clovyr : https://clovyr.io
@@ -12447,7 +12455,6 @@ herokussl.com
// Hibernating Rhinos
// Submitted by Oren Eini <oren@ravendb.net>
ravendb.cloud
-myravendb.com
ravendb.community
ravendb.me
development.run
@@ -13809,6 +13816,8 @@ direct.quickconnect.to
// Tabit Technologies Ltd. : https://tabit.cloud/
// Submitted by Oren Agiv <oren@tabit.cloud>
tabitorder.co.il
+mytabit.co.il
+mytabit.com
// TAIFUN Software AG : http://taifun-software.de
// Submitted by Bjoern Henke <dev-server@taifun-software.de>
@@ -13841,10 +13850,6 @@ telebit.app
telebit.io
*.telebit.xyz
-// The Gwiddle Foundation : https://gwiddlefoundation.org.uk
-// Submitted by Joshua Bayfield <joshua.bayfield@gwiddlefoundation.org.uk>
-gwiddle.co.uk
-
// Thingdust AG : https://thingdust.com/
// Submitted by Adrian Imboden <adi@thingdust.com>
*.firenet.ch
@@ -13879,10 +13884,6 @@ pages.torproject.net
bloxcms.com
townnews-staging.com
-// TradableBits: https://tradablebits.com
-// Submitted by Dmitry Khrisanov dmitry@tradablebits.com
-tbits.me
-
// TrafficPlex GmbH : https://www.trafficplex.de/
// Submitted by Phillipp Röll <phillipp.roell@trafficplex.de>
12hp.at
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 9462df8574c..654d76ced89 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,5 +1,5 @@
% Reference Card for Org Mode
-\def\orgversionnumber{9.5.5}
+\def\orgversionnumber{9.6}
\def\versionyear{2021} % latest update
\input emacsver.tex
diff --git a/lib-src/ChangeLog.1 b/lib-src/ChangeLog.1
index 0829f50a56d..c5988072e99 100644
--- a/lib-src/ChangeLog.1
+++ b/lib-src/ChangeLog.1
@@ -3661,7 +3661,7 @@
2004-05-07 Thien-Thi Nguyen <ttn@gnu.org>
* b2m.c (GOOD, BAD): Delete macros. Throughout,
- replace w/ `EXIT_SUCCESS' and `EXIT_FAILURE', respectively.
+ replace with `EXIT_SUCCESS' and `EXIT_FAILURE', respectively.
(main): Use `EXIT_SUCCESS' or `EXIT_FAILURE' for return value.
* etags.c: Likewise.
diff --git a/lib-src/be_resources.cc b/lib-src/be_resources.cc
index 414f91a192d..ece573a85a6 100644
--- a/lib-src/be_resources.cc
+++ b/lib-src/be_resources.cc
@@ -71,9 +71,11 @@ be_perror (status_t code, char *arg)
}
}
else
- {
- abort ();
- }
+ abort ();
+
+ fprintf (stderr, "Setting resources failed on the `src/Emacs' binary.\n"
+ "This may result in the installed `Emacs' binary not launching\n"
+ " from the tracker, but is inconsequential during packaging.\n");
}
int
@@ -111,19 +113,19 @@ main (int argc, char **argv)
if (code != B_OK)
{
be_perror (code, argv[2]);
- return EXIT_FAILURE;
+ return 0;
}
code = info.SetTo (&file);
if (code != B_OK)
{
be_perror (code, argv[2]);
- return EXIT_FAILURE;
+ return 0;
}
code = info.SetAppFlags (B_EXCLUSIVE_LAUNCH | B_ARGV_ONLY);
if (code != B_OK)
{
be_perror (code, argv[2]);
- return EXIT_FAILURE;
+ return 0;
}
icon = BTranslationUtils::GetBitmapFile (argv[1], NULL);
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index ee124ea135c..af488128ba7 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -568,6 +568,7 @@ decode_options (int argc, char **argv)
case 't':
tty = true;
create_frame = true;
+ reuse_frame = false;
break;
case 'c':
@@ -576,7 +577,8 @@ decode_options (int argc, char **argv)
case 'r':
create_frame = true;
- reuse_frame = true;
+ if (!tty)
+ reuse_frame = true;
break;
case 'p':
@@ -689,7 +691,7 @@ The following OPTIONS are accepted:\n\
Set the parameters of a new frame\n\
-e, --eval Evaluate the FILE arguments as ELisp expressions\n\
-n, --no-wait Don't wait for the server to return\n\
--w, --timeout Seconds to wait before timing out\n\
+-w, --timeout=SECONDS Seconds to wait before timing out\n\
-q, --quiet Don't display messages on success\n\
-u, --suppress-output Don't display return values from the server\n\
-d DISPLAY, --display=DISPLAY\n\
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 3107c7b380e..d1d20858cdd 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -375,7 +375,7 @@ static void just_read_file (FILE *);
static language *get_language_from_langname (const char *);
static void readline (linebuffer *, FILE *);
-static ptrdiff_t readline_internal (linebuffer *, FILE *, char const *);
+static ptrdiff_t readline_internal (linebuffer *, FILE *, char const *, const bool);
static bool nocase_tail (const char *);
static void get_tag (char *, char **);
static void get_lispy_tag (char *);
@@ -399,7 +399,9 @@ static void free_fdesc (fdesc *);
static void pfnote (char *, bool, char *, ptrdiff_t, intmax_t, intmax_t);
static void invalidate_nodes (fdesc *, node **);
static void put_entries (node *);
+static void cleanup_tags_file (char const * const, char const * const);
+static void do_move_file (const char *, const char *);
static char *concat (const char *, const char *, const char *);
static char *skip_spaces (char *);
static char *skip_non_spaces (char *);
@@ -1332,7 +1334,7 @@ main (int argc, char **argv)
if (parsing_stdin)
fatal ("cannot parse standard input "
"AND read file names from it");
- while (readline_internal (&filename_lb, stdin, "-") > 0)
+ while (readline_internal (&filename_lb, stdin, "-", false) > 0)
process_file_name (filename_lb.buffer, lang);
}
else
@@ -1380,9 +1382,6 @@ main (int argc, char **argv)
/* From here on, we are in (CTAGS && !cxref_style) */
if (update)
{
- char *cmd =
- xmalloc (strlen (tagfile) + whatlen_max +
- sizeof "mv..OTAGS;grep -Fv '\t\t' OTAGS >;rm OTAGS");
for (i = 0; i < current_arg; ++i)
{
switch (argbuffer[i].arg_type)
@@ -1393,17 +1392,8 @@ main (int argc, char **argv)
default:
continue; /* the for loop */
}
- char *z = stpcpy (cmd, "mv ");
- z = stpcpy (z, tagfile);
- z = stpcpy (z, " OTAGS;grep -Fv '\t");
- z = stpcpy (z, argbuffer[i].what);
- z = stpcpy (z, "\t' OTAGS >");
- z = stpcpy (z, tagfile);
- strcpy (z, ";rm OTAGS");
- if (system (cmd) != EXIT_SUCCESS)
- fatal ("failed to execute shell command");
+ cleanup_tags_file (tagfile, argbuffer[i].what);
}
- free (cmd);
append_to_tagfile = true;
}
@@ -1448,6 +1438,51 @@ main (int argc, char **argv)
return EXIT_SUCCESS;
}
+/*
+ * Equivalent to: mv tags OTAGS;grep -Fv ' filename ' OTAGS >tags;rm OTAGS
+ */
+static void
+cleanup_tags_file (const char* tagfile, const char* match_file_name)
+{
+ FILE *otags_f = fopen ("OTAGS", "wb");
+ FILE *tag_f = fopen (tagfile, "rb");
+
+ if (otags_f == NULL)
+ pfatal ("OTAGS");
+
+ if (tag_f == NULL)
+ pfatal (tagfile);
+
+ int buf_len = strlen (match_file_name) + sizeof ("\t\t ") + 1;
+ char *buf = xmalloc (buf_len);
+ snprintf (buf, buf_len, "\t%s\t", match_file_name);
+
+ linebuffer line;
+ linebuffer_init (&line);
+ while (readline_internal (&line, tag_f, tagfile, true) > 0)
+ {
+ if (ferror (tag_f))
+ pfatal (tagfile);
+
+ if (strstr (line.buffer, buf) == NULL)
+ {
+ fprintf (otags_f, "%s\n", line.buffer);
+ if (ferror (tag_f))
+ pfatal (tagfile);
+ }
+ }
+ free (buf);
+ free (line.buffer);
+
+ if (fclose (otags_f) == EOF)
+ pfatal ("OTAGS");
+
+ if (fclose (tag_f) == EOF)
+ pfatal (tagfile);
+
+ do_move_file ("OTAGS", tagfile);
+ return;
+}
/*
* Return a compressor given the file name. If EXTPTR is non-zero,
@@ -1831,7 +1866,7 @@ find_entries (FILE *inf)
/* Else look for sharp-bang as the first two characters. */
if (parser == NULL
- && readline_internal (&lb, inf, infilename) > 0
+ && readline_internal (&lb, inf, infilename, false) > 0
&& lb.len >= 2
&& lb.buffer[0] == '#'
&& lb.buffer[1] == '!')
@@ -6878,7 +6913,7 @@ analyze_regex (char *regex_arg)
if (regexfp == NULL)
pfatal (regexfile);
linebuffer_init (&regexbuf);
- while (readline_internal (&regexbuf, regexfp, regexfile) > 0)
+ while (readline_internal (&regexbuf, regexfp, regexfile, false) > 0)
analyze_regex (regexbuf.buffer);
free (regexbuf.buffer);
if (fclose (regexfp) != 0)
@@ -7226,11 +7261,13 @@ get_lispy_tag (register char *bp)
/*
* Read a line of text from `stream' into `lbp', excluding the
- * newline or CR-NL, if any. Return the number of characters read from
- * `stream', which is the length of the line including the newline.
+ * newline or CR-NL (if `leave_cr` is false), if any. Return the
+ * number of characters read from `stream', which is the length
+ * of the line including the newline.
*
- * On DOS or Windows we do not count the CR character, if any before the
- * NL, in the returned length; this mirrors the behavior of Emacs on those
+ * On DOS or Windows, if `leave_cr` is false, we do not count the
+ * CR character, if any before the NL, in the returned length;
+ * this mirrors the behavior of Emacs on those
* platforms (for text files, it translates CR-NL to NL as it reads in the
* file).
*
@@ -7238,7 +7275,8 @@ get_lispy_tag (register char *bp)
* appended to `filebuf'.
*/
static ptrdiff_t
-readline_internal (linebuffer *lbp, FILE *stream, char const *filename)
+readline_internal (linebuffer *lbp, FILE *stream, char const *filename,
+ const bool leave_cr)
{
char *buffer = lbp->buffer;
char *p = lbp->buffer;
@@ -7268,19 +7306,19 @@ readline_internal (linebuffer *lbp, FILE *stream, char const *filename)
break;
}
if (c == '\n')
- {
- if (p > buffer && p[-1] == '\r')
- {
- p -= 1;
- chars_deleted = 2;
- }
- else
- {
- chars_deleted = 1;
- }
- *p = '\0';
- break;
- }
+ {
+ if (!leave_cr && p > buffer && p[-1] == '\r')
+ {
+ p -= 1;
+ chars_deleted = 2;
+ }
+ else
+ {
+ chars_deleted = 1;
+ }
+ *p = '\0';
+ break;
+ }
*p++ = c;
}
lbp->len = p - buffer;
@@ -7311,7 +7349,7 @@ static void
readline (linebuffer *lbp, FILE *stream)
{
linecharno = charno; /* update global char number of line start */
- ptrdiff_t result = readline_internal (lbp, stream, infilename);
+ ptrdiff_t result = readline_internal (lbp, stream, infilename, false);
lineno += 1; /* increment global line number */
charno += result; /* increment global char number */
@@ -7669,6 +7707,46 @@ etags_mktmp (void)
return templt;
}
+static void
+do_move_file(const char *src_file, const char *dst_file)
+{
+ if (rename (src_file, dst_file) == 0)
+ return;
+
+ FILE *src_f = fopen (src_file, "rb");
+ FILE *dst_f = fopen (dst_file, "wb");
+
+ if (src_f == NULL)
+ pfatal (src_file);
+
+ if (dst_f == NULL)
+ pfatal (dst_file);
+
+ int c;
+ while ((c = fgetc (src_f)) != EOF)
+ {
+ if (ferror (src_f))
+ pfatal (src_file);
+
+ if (ferror (dst_f))
+ pfatal (dst_file);
+
+ if (fputc (c, dst_f) == EOF)
+ pfatal ("cannot write");
+ }
+
+ if (fclose (src_f) == EOF)
+ pfatal (src_file);
+
+ if (fclose (dst_f) == EOF)
+ pfatal (dst_file);
+
+ if (unlink (src_file) == -1)
+ pfatal ("unlink error");
+
+ return;
+}
+
/* Return a newly allocated string containing the file name of FILE
relative to the absolute directory DIR (which should end with a slash). */
static char *
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index de73fe7f0a2..7c080ea4961 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -4788,7 +4788,7 @@
2003-03-10 Thien-Thi Nguyen <ttn@gnu.org>
* progmodes/scheme.el (scheme-mode-syntax-table):
- Construct w/o using `with-syntax-table'.
+ Construct without using `with-syntax-table'.
2003-03-10 John Paul Wallington <jpw@gnu.org>
diff --git a/lisp/ChangeLog.11 b/lisp/ChangeLog.11
index 53a83c638c5..f16191e8b7b 100644
--- a/lisp/ChangeLog.11
+++ b/lisp/ChangeLog.11
@@ -212,7 +212,7 @@
2004-12-27 Richard M. Stallman <rms@gnu.org>
* files.el (buffer-save-without-query): New var (buffer-local).
- (save-some-buffers): Save those buffers first, w/o asking.
+ (save-some-buffers): Save those buffers first, without asking.
* files.el (insert-directory-ls-version): New variable.
(insert-directory): When ls returns an error, test the version
@@ -491,7 +491,7 @@
instead of `direction'. Update callers. When `del-count' is
non-nil, delete that many characters, otherwise `count' characters
backwards. Insert the newly-replaced string `count' times.
- (zone-fret): Handle chars w/ width greater than one.
+ (zone-fret): Handle chars with width greater than one.
(zone-fall-through-ws): No longer take window width `ww'.
Update callers. Add handling for `char-width' greater than one.
(zone-pgm-drip): Update var holding window-end position every cycle.
@@ -3584,7 +3584,8 @@
* startup.el (fancy-splash-tail, normal-splash-screen):
Update copyright year.
- * shadowfile.el (shadowfile-unload-hook): Set as variable w/ add-hook.
+ * shadowfile.el (shadowfile-unload-hook): Set as variable with
+ add-hook.
* server.el (server-unload-hook): Set as a variable with add-hook.
@@ -8939,7 +8940,7 @@
(compilation-skip-visited, compilation-context-lines):
Declare :version when added to Emacs.
(compilation-error-regexp-alist-alist): Extend caml and irix.
- (compilation-setup): Fix if font-locked w/o font-lock-defaults.
+ (compilation-setup): Fix if font-locked without font-lock-defaults.
(compilation-mode-font-lock-keywords): Temporarily undo line as
function patch, which wasn't ready.
diff --git a/lisp/ChangeLog.12 b/lisp/ChangeLog.12
index 0796965a9ba..ec58ffc173a 100644
--- a/lisp/ChangeLog.12
+++ b/lisp/ChangeLog.12
@@ -24499,8 +24499,9 @@
is updated.
* whitespace.el (whitespace-buffer-leading-cleanup):
- Simplify w/ skip-chars-forward.
- (whitespace-buffer-trailing-cleanup): Simplify w/ skip-chars-backward.
+ Simplify with skip-chars-forward.
+ (whitespace-buffer-trailing-cleanup): Simplify with
+ skip-chars-backward.
* mail/rmail.el (rmail-only-expunge): Fix paren error.
Unconditionally try to leave point at the same old place.
@@ -31346,7 +31347,7 @@
* facemenu.el (list-colors-print): Print #RRGGBB in default face.
Remove 1 space before #RRGGBB to not truncate it on terminal
- windows w/o fringes. Remove 1 space between bg and fg examples
+ windows without fringes. Remove 1 space between bg and fg examples
to get more space.
(list-colors-duplicates): Replace `and' with `if' for `boundp' to
avoid byte-compile warnings.
diff --git a/lisp/ChangeLog.14 b/lisp/ChangeLog.14
index 8d8c6117788..eae47fe1985 100644
--- a/lisp/ChangeLog.14
+++ b/lisp/ChangeLog.14
@@ -20218,7 +20218,7 @@
2008-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
* doc-view.el (doc-view-display): Change file arg to buffer arg, so it
- works also for buffers w/o buffer-file-name. Update callers.
+ works also for buffers without buffer-file-name. Update callers.
(doc-view-clone-buffer-hook): New fun.
(doc-view-mode): Use it for indirect clones. Mark the overlays with
the `doc-view' property so they can be recognized.
diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16
index 7b57c014d2b..1d7684be812 100644
--- a/lisp/ChangeLog.16
+++ b/lisp/ChangeLog.16
@@ -4871,7 +4871,8 @@
2012-10-11 Stefan Monnier <monnier@iro.umontreal.ca>
- * help-fns.el (describe-function-1): Handle autoloads w/o docstrings.
+ * help-fns.el (describe-function-1): Handle autoloads without
+ docstrings.
* emacs-lisp/bytecomp.el (byte-compile-eval): Adjust to long-ago
changes to the format of load-history.
diff --git a/lisp/ChangeLog.3 b/lisp/ChangeLog.3
index e23226b8440..46089685a3d 100644
--- a/lisp/ChangeLog.3
+++ b/lisp/ChangeLog.3
@@ -4172,7 +4172,8 @@
(next-matching-history-element): Likewise.
(minibuffer-history-search-history): New variable.
- * simple.el (read-expression-map): New keymap, w/ lisp-complete-symbol.
+ * simple.el (read-expression-map): New keymap, with
+ lisp-complete-symbol.
(eval-expression, edit-and-eval-command): Use read-expression-map.
(repeat-complex-command): Likewise.
diff --git a/lisp/ChangeLog.4 b/lisp/ChangeLog.4
index ea0502975ec..ddea2a4e2fb 100644
--- a/lisp/ChangeLog.4
+++ b/lisp/ChangeLog.4
@@ -7238,7 +7238,8 @@
* ispell.el (ispell-menu-map): Add missing quote in defalias.
(ispell-window-configuration): Initialize to nil.
- * vc-hooks.el (vc-rcs-status): Make work buffer's name start w/ space.
+ * vc-hooks.el (vc-rcs-status): Make work buffer's name start with
+ space.
* simple.el (completion-setup-function): Insert the mouse help message
only if non-nil `window-system'.
diff --git a/lisp/ChangeLog.6 b/lisp/ChangeLog.6
index 27d522aaf2a..8e07e5c36af 100644
--- a/lisp/ChangeLog.6
+++ b/lisp/ChangeLog.6
@@ -1915,7 +1915,7 @@
* menu-bar.el (menu-bar-tools-menu): Delete ediff-doc and
eregistry items.
- * help.el (describe-mode): Handle minor mode w/o mode line indicator.
+ * help.el (describe-mode): Handle minor mode without mode line indicator.
* bibtex.el (bibtex-version): Variable deleted.
(bibtex-submit-bug-report): Don't use that.
diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7
index 32208324541..91b8d474224 100644
--- a/lisp/ChangeLog.7
+++ b/lisp/ChangeLog.7
@@ -1175,7 +1175,7 @@
(speedbar-supported-extension-expressions): Add more extensions.
(speedbar-add-supported-extension)
(speedbar-add-ignored-path-regexp): Made interactive.
- (speedbar-update-flag): Nil w/ no window system.
+ (speedbar-update-flag): Nil with no window system.
(speedbar-file-key-map): Move some key bindings from
`speedbar-key-map' to this map.
(speedbar-make-specialized-keymap): New function.
@@ -4223,7 +4223,8 @@
Do the right thing when nil is specified as criterion for activeness.
Fix string used to report an invalid item.
- * tmm.el (tmm-get-keymap): Handle new format menu item w/o cache.
+ * tmm.el (tmm-get-keymap): Handle new format menu item without
+ cache.
(tmm-prompt): If reach an empty menu, get an error.
1998-04-20 Per Starbäck <starback@update.uu.se>
diff --git a/lisp/ChangeLog.8 b/lisp/ChangeLog.8
index a14d6821925..3b6205bc60d 100644
--- a/lisp/ChangeLog.8
+++ b/lisp/ChangeLog.8
@@ -117,7 +117,7 @@
overlays if they interfere.
(compilation-find-file): Make intangible overlays tangible.
- * progmodes/hideshow.el: Generally, synch w/ maintainer
+ * progmodes/hideshow.el: Generally, synch with maintainer
version 5.9.
(hs-show-hidden-short-form): Delete var; hard-code uses as `t'.
@@ -6715,7 +6715,7 @@
* speedbar.el (speedbar-item-info-file-helper): Add optional arg
of the file whose info we want to display.
- (speedbar-easymenu-definition-trailer) Fix list issue w/ customize.
+ (speedbar-easymenu-definition-trailer) Fix list issue with customize.
(speedbar-add-mode-functions-list) Improve doc.
(speedbar-line-token) New function.
(speedbar-dired) Fix order of directories in -shown-directories.
@@ -9800,8 +9800,8 @@
1998-08-27 Richard Stallman <rms@gnu.org>
* calendar/cal-tex.el (cal-tex-cursor-filofax-daily): Don't use oddp.
- * calendar/appt.el (appt-check): Start the appt-mode-string w/ space.
- Clear appt-mode-string if we don't put something in it.
+ * calendar/appt.el (appt-check): Start the appt-mode-string with
+ space. Clear appt-mode-string if we don't put something in it.
1998-08-27 Dave Love <fx@gnu.org>
@@ -9979,7 +9979,8 @@
(speedbar-mode): Set buffer to read only.
(speedbar-temp-buffer-show-function): For Emacs don't call hook
with arguments.
- (speedbar-stealthy-updates): Do all updates w/ the buffer writable.
+ (speedbar-stealthy-updates): Do all updates with the buffer
+ writable.
1998-08-19 Dan Nicolaescu <done@ece.arizona.edu>
diff --git a/lisp/ChangeLog.9 b/lisp/ChangeLog.9
index 469d0970f82..be6ba962cf3 100644
--- a/lisp/ChangeLog.9
+++ b/lisp/ChangeLog.9
@@ -1418,13 +1418,13 @@
2001-08-28 Thien-Thi Nguyen <ttn@gnu.org>
* progmodes/hideshow.el: Update first-line description.
- Sync comments w/ maintainer version 5.31.
+ Sync comments with maintainer version 5.31.
(hs-isearch-open): Default value now `code'.
Fix docstring to use "code blocks" vs "comment blocks",
as opposed to "block" vs "comment".
(hs-flag-region): Accept `hs-isearch-open' value
- of `block' as synonymous w/ `code'.
+ of `block' as synonymous with `code'.
(hs-hide-block-at-point): For code blocks, pass `code'
to `hs-flag-region' instead of `block'.
@@ -11483,7 +11483,7 @@
2000-09-23 Thien-Thi Nguyen <ttn@gnu.org>
* progmodes/hideshow.el: Update author email address.
- Generally, sync w/ maintainer version 5.22.
+ Generally, sync with maintainer version 5.22.
(hs-hide-all-non-comment-function): New var.
(hs-hide-hook, hs-show-hook, hs-minor-mode): Update docstrings.
(hs-hide-all): Use `hs-hide-all-non-comment-function'.
@@ -17879,7 +17879,7 @@
(speedbar-make-button): Call `speedbar-insert-image-button-maybe'.
(speedbar-directory-buttons): Update path search/expansion.
(speedbar-make-tag-line): Pay attention to
- `speedbar-indentation-width'. Use more care w/ invisible
+ `speedbar-indentation-width'. Use more care with invisible
properties.
(speedbar-change-expand-button-char):
Call `speedbar-insert-image-button-maybe'.
diff --git a/lisp/ansi-osc.el b/lisp/ansi-osc.el
index a8523fc9dc2..9b7f586d164 100644
--- a/lisp/ansi-osc.el
+++ b/lisp/ansi-osc.el
@@ -108,7 +108,7 @@ list that is the value of `ansi-osc-handlers'."
"Update `default-directory' from OSC 7 escape sequences.
This function is intended to be included as an element of the
-the list that is the value of `ansi-osc-handlers'. You should arrange
+list that is the value of `ansi-osc-handlers'. You should arrange
for your shell to print the appropriate escape sequence at each prompt,
such as with the following command:
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index e3d66c04bc2..1ed3f693ab7 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -718,7 +718,7 @@ system.")
(string-equal
(file-name-nondirectory file)
(file-name-nondirectory buffer-file-name)))
- ;; A buffer w/o a file, like dired.
+ ;; A buffer without a file, like dired.
(null buffer-file-name))
(auto-revert-notify-rm-watch)
;; Restart the timer if it wasn't running.
@@ -739,7 +739,7 @@ system.")
(string-equal
(file-name-nondirectory file1)
(file-name-nondirectory buffer-file-name)))))
- ;; A buffer w/o a file, like dired.
+ ;; A buffer without a file, like dired.
(and (null buffer-file-name)
(memq action '(created renamed deleted))))
;; Mark buffer modified.
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index 5e08413a96d..c8470e08cb8 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -1578,7 +1578,7 @@ Optional PARENT and COLOR as specified with
c-mode (token &optional parent color)
"Return an UML string describing TOKEN for C and C++.
Optional PARENT and COLOR as specified with
-`semantic-abbreviate-tag-default'."
+`semantic-format-tag-abbreviate-default'."
;; If we have special template things, append.
(concat (semantic-format-tag-uml-prototype-default token parent color)
(semantic-c-template-string token parent color)))
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index ff62f53d3cf..08e03bf7158 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -351,7 +351,7 @@ Note: This index will not be saved in a persistent file.")
;; the tables without using the accessor.
:accessor semanticdb-get-database-tables
:protection :protected
- :documentation "List of `semantic-db-table' objects."))
+ :documentation "List of `semanticdb-table' objects."))
"Database of file tables.")
(cl-defmethod semanticdb-full-filename ((obj semanticdb-table))
diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el
index 80e7f1117a2..3d9476d685f 100644
--- a/lisp/cedet/semantic/format.el
+++ b/lisp/cedet/semantic/format.el
@@ -123,7 +123,7 @@ See that variable for details on adding new types."
(defun semantic--format-colorize-merge-text (precoloredtext face-class)
"Apply onto PRECOLOREDTEXT a color associated with FACE-CLASS.
-FACE-CLASS is a tag type found in `semantic-formatface-alist'.
+FACE-CLASS is a tag type found in `semantic-format-face-alist'.
See that variable for details on adding new types."
(let ((face (cdr-safe (assoc face-class semantic-format-face-alist)))
(newtext (concat precoloredtext)))
diff --git a/lisp/cedet/semantic/grm-wy-boot.el b/lisp/cedet/semantic/grm-wy-boot.el
index 7fff36a3d02..376fab89c23 100644
--- a/lisp/cedet/semantic/grm-wy-boot.el
+++ b/lisp/cedet/semantic/grm-wy-boot.el
@@ -396,12 +396,12 @@
(let
((s $1))
(if
- (string-match "^{[\^M\n ]*" s)
+ (string-match "^{[ \n ]*" s)
(setq s
(substring s
(match-end 0))))
(if
- (string-match "[\^M\n ]*}$" s)
+ (string-match "[ \n ]*}$" s)
(setq s
(substring s 0
(match-beginning 0))))
diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el
index 2172085d6b9..da884b9d16d 100644
--- a/lisp/cedet/semantic/ia.el
+++ b/lisp/cedet/semantic/ia.el
@@ -457,7 +457,7 @@ parts of the parent classes are displayed."
;; it. The simple `semanticdb-find-tag-by-...' are simple, and
;; you need to pass it the exact name you want.
;;
- ;; The analyzer function `semantic-analyze-tag-name' will take
+ ;; The analyzer function `semantic-analyze-find-tag' will take
;; more complex names, such as the cpp symbol foo::bar::baz,
;; and break it up, and dive through the namespaces.
(let ((class (semantic-analyze-find-tag typename)))
diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el
index e53dd9104ad..8ab115d717e 100644
--- a/lisp/cedet/semantic/idle.el
+++ b/lisp/cedet/semantic/idle.el
@@ -347,7 +347,7 @@ Returns t if all processing succeeded."
"Core handler for idle work processing of long running tasks.
Visits Semantic controlled buffers, and makes sure all needed
include files have been parsed, and that the typecache is up to date.
-Uses `semantic-idle-work-for-on-buffer' to do the work."
+Uses `semantic-idle-work-for-one-buffer' to do the work."
(let*
((errbuf nil)
(interrupted
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index b66e5c19cb2..390c13ec98b 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -1256,7 +1256,7 @@ DOC is the documentation for the analyzer.
REGEXP is a regular expression for the analyzer to match.
See `define-lex-regex-analyzer' for more on regexp.
TOKIDX is an index into REGEXP for which a new lexical token
-of type `spp-macro-include' is to be created.
+of type `spp-system-include' is to be created.
VALFORM are forms that return the name of the thing being included, and the
type of include. The return value should be of the form:
(NAME . TYPE)
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index b3c9e96538c..264b2027711 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -1436,9 +1436,9 @@ Return either a paren token or a semantic list token depending on
(define-lex semantic-comment-lexer
"A simple lexical analyzer that handles comments.
-This lexer will only return comment tokens. It is the default lexer
-used by `semantic-find-doc-snarf-comment' to snarf up the comment at
-point."
+This lexer will only return comment tokens. It is the default
+lexer used by `semantic-doc-snarf-comment-for-tag' to snarf up
+the comment at point."
semantic-lex-ignore-whitespace
semantic-lex-ignore-newline
semantic-lex-comments
diff --git a/lisp/cedet/semantic/sort.el b/lisp/cedet/semantic/sort.el
index 756b949c0d1..e02abe98765 100644
--- a/lisp/cedet/semantic/sort.el
+++ b/lisp/cedet/semantic/sort.el
@@ -474,7 +474,7 @@ The default behavior, if not overridden with
the name of TAG.
If this function is overridden, use
-`semantic-tag-external-member-children-p-default' to also
+`semantic-tag-external-member-children-default' to also
include the default behavior, and merely extend your own."
)
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 16bbacc428e..2ad95fb5a05 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -388,7 +388,8 @@ Each element is a cons cell of the form (LINE . FILENAME).")
:type list
:documentation
"The list of tags with hits in them.
-Use the `semantic-symref-hit-tags' method to get this list.")
+Use the `semantic-symref-hit-to-tag-via-buffer' method to get
+this list.")
)
"The results from a symbol reference search.")
diff --git a/lisp/comint.el b/lisp/comint.el
index 93b97cb22b4..4d9fc501874 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -78,7 +78,7 @@
;;
;; Not bound by default in comint-mode (some are in shell mode)
;; comint-run Run a program under comint-mode
-;; comint-send-invisible Read a line w/o echo, and send to proc
+;; comint-send-invisible Read a line without echo, and send to proc
;; comint-dynamic-complete-filename Complete filename at point.
;; comint-dynamic-list-filename-completions List completions in help buffer.
;; comint-replace-by-expanded-filename Expand and complete filename at point;
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 00ee9504c22..0e09e99da95 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1238,7 +1238,7 @@ Show the buffer in another window, but don't select it."
(unless (eq symbol basevar)
(message "`%s' is an alias for `%s'" symbol basevar))))
-(defvar customize-changed-options-previous-release "28.1"
+(defvar customize-changed-options-previous-release "28.2"
"Version for `customize-changed' to refer back to by default.")
;; Packages will update this variable, so make it available.
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 7fad031add6..f2ffddcf702 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -77,8 +77,9 @@ into help buttons that call `describe-text-category' or
(prin1-to-string (nth 0 b) t)))))
(let ((key (nth 0 elt))
(value (nth 1 elt)))
- (insert (propertize (format " %-20s " key)
- 'face 'help-argument-name))
+ (insert (format " %-20s "
+ (propertize (symbol-name key)
+ 'face 'help-argument-name)))
(cond ((eq key 'category)
(insert-text-button
(symbol-name value)
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index a33808ab92d..1babf3ec2c4 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -632,7 +632,7 @@ enabled."
(defmacro with-suppressed-warnings (warnings &rest body)
"Like `progn', but prevents compiler WARNINGS in BODY.
-WARNINGS is an associative list where the first element of each
+WARNINGS is an association list where the first element of each
item is a warning type, and the rest of the elements in each item
are symbols they apply to. For instance, if you want to suppress
byte compilation warnings about the two obsolete functions `foo'
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 9ff893b75b6..16c2c347409 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -35,7 +35,7 @@
;; anything encapsulated in a nice eieio object.
;;
;; Current example apps for chart can be accessed via these commands:
-;; `chart-file-count' - count files w/ matching extensions
+;; `chart-file-count' - count files with matching extensions
;; `chart-space-usage' - display space used by files/directories
;; `chart-emacs-storage' - Emacs storage units used/free (garbage-collect)
;; `chart-emacs-lists' - length of Emacs lists
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 0ee094c34d8..7b562aaa53d 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4115,7 +4115,6 @@ the deferred compilation mechanism."
comp-ctxt
(comp-ctxt-output comp-ctxt)
(file-exists-p (comp-ctxt-output comp-ctxt)))
- (message "Deleting %s" (comp-ctxt-output comp-ctxt))
(delete-file (comp-ctxt-output comp-ctxt))))))))
(defun native-compile-async-skip-p (file load selector)
@@ -4333,7 +4332,9 @@ of (commands) to run simultaneously."
(interactive)
(unless (featurep 'native-compile)
(user-error "This Emacs isn't built with native-compile support"))
- (dolist (dir native-comp-eln-load-path)
+ ;; The last item in native-comp-eln-load-path is assumed to be a system
+ ;; directory, so don't try to delete anything there (bug#59658).
+ (dolist (dir (butlast native-comp-eln-load-path))
;; If a directory is non absolute it is assumed to be relative to
;; `invocation-directory'.
(setq dir (expand-file-name dir invocation-directory))
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 7d54a84687b..2df390ecbeb 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -417,8 +417,6 @@ No problems result if this variable is not bound.
`(defvar ,keymap-sym
(let ((m ,keymap))
(cond ((keymapp m) m)
- ;; FIXME: `easy-mmode-define-keymap' is obsolete,
- ;; so this form should also be obsolete somehow.
((listp m)
(with-suppressed-warnings ((obsolete
easy-mmode-define-keymap))
@@ -684,7 +682,6 @@ Valid keywords and arguments are:
:group Ignored.
:suppress Non-nil to call `suppress-keymap' on keymap,
`nodigits' to suppress digits as prefix arguments."
- (declare (obsolete define-keymap "29.1"))
(let (inherit dense suppress)
(while args
(let ((key (pop args))
@@ -725,7 +722,9 @@ The M, BS, and ARGS arguments are as per that function. DOC is
the constant's documentation.
This macro is deprecated; use `defvar-keymap' instead."
- (declare (doc-string 3) (indent 1) (obsolete defvar-keymap "29.1"))
+ ;; FIXME: Declare obsolete in favor of `defvar-keymap'. It is still
+ ;; used for `gud-menu-map' and `gud-minor-mode-map', so fix that first.
+ (declare (doc-string 3) (indent 1))
`(defconst ,m
(easy-mmode-define-keymap ,bs nil (if (boundp ',m) ,m) ,(cons 'list args))
,doc))
diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el
index 86c44830308..8ba6d97ea00 100644
--- a/lisp/emacs-lisp/icons.el
+++ b/lisp/emacs-lisp/icons.el
@@ -202,6 +202,10 @@ present if the icon is represented by an image."
(list :height (if (eq height 'line)
(window-default-line-height)
height)))
+ (if-let ((width (plist-get keywords :width)))
+ (list :width (if (eq width 'font)
+ (default-font-width)
+ width)))
'(:scale 1)
(if-let ((rotation (plist-get keywords :rotation)))
(list :rotation rotation))
diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
index 9d6e8c0d88d..78d4137317d 100644
--- a/lisp/emacs-lisp/multisession.el
+++ b/lisp/emacs-lisp/multisession.el
@@ -447,8 +447,9 @@ storage method to list."
(let* ((object (or
;; If the multisession variable already exists, use
;; it (so that we update it).
- (and (intern-soft (cdr id))
- (bound-and-true-p (intern (cdr id))))
+ (if-let (sym (intern-soft (cdr id)))
+ (and (boundp sym) (symbol-value sym))
+ nil)
;; Create a new object.
(make-multisession
:package (car id)
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index deb0debab4d..a4520ab800f 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -284,7 +284,7 @@ asynchronously."
finally return "unknown"))
(defun package-vc--version (pkg)
- "Return the version number for the source package PKG."
+ "Return the version number for the VC package PKG."
(cl-assert (package-vc-p pkg))
(if-let ((main-file (package-vc--main-file pkg)))
(with-temp-buffer
@@ -387,7 +387,7 @@ otherwise it's assumed to be an Info file."
"Prepare PKG-DESC that is already checked-out in PKG-DIR.
This includes downloading missing dependencies, generating
autoloads, generating a package description file (used to
-identify a package as a source package later on), building
+identify a package as a VC package later on), building
documentation and marking the package as installed."
;; Remove any previous instance of PKG-DESC from `package-alist'
(let ((pkgs (assq (package-desc-name pkg-desc) package-alist)))
@@ -467,7 +467,7 @@ documentation and marking the package as installed."
;; Confirm that the installation was successful
(let ((main-file (package-vc--main-file pkg-desc)))
- (message "Source package `%s' installed (Version %s, Revision %S)."
+ (message "VC package `%s' installed (Version %s, Revision %S)."
(package-desc-name pkg-desc)
(lm-with-file main-file
(package-strip-rcs-id
@@ -534,11 +534,11 @@ checkout. This overrides the `:branch' attribute in PKG-SPEC."
(package-vc--unpack-1 pkg-desc pkg-dir)))
(defun package-vc--read-package-name (prompt &optional allow-url installed)
- "Query the user for a source package and return a name with PROMPT.
+ "Query the user for a VC package and return a name with PROMPT.
If the optional argument ALLOW-URL is non-nil, the user is also
allowed to specify a non-package name. If the optional argument
INSTALLED is non-nil, the selection will be filtered down to
-source packages that have already been installed."
+VC packages that have already been installed."
(package-vc--archives-initialize)
(completing-read prompt (if installed package-alist package-archive-contents)
(if installed
@@ -554,9 +554,9 @@ source packages that have already been installed."
(not allow-url)))
(defun package-vc--read-package-desc (prompt &optional installed)
- "Query the user for a source package and return a description with PROMPT.
+ "Query the user for a VC package and return a description with PROMPT.
If the optional argument INSTALLED is non-nil, the selection will
-be filtered down to source packages that have already been
+be filtered down to VC packages that have already been
installed, and the package description will be that of an
installed package."
(cadr (assoc (package-vc--read-package-name prompt nil installed)
@@ -576,7 +576,7 @@ installed package."
;;;###autoload
(defun package-vc-update (pkg-desc)
"Attempt to update the package PKG-DESC."
- (interactive (list (package-vc--read-package-desc "Update source package: " t)))
+ (interactive (list (package-vc--read-package-desc "Update VC package: " t)))
;; HACK: To run `package-vc--unpack-1' after checking out the new
;; revision, we insert a hook into `vc-post-command-functions', and
;; remove it right after it ran. To avoid running the hook multiple
@@ -660,8 +660,8 @@ Optional argument BACKEND specifies the VC backend to use for cloning
the package's repository; this is only possible if NAME-OR-URL is a URL,
a string. If BACKEND is omitted or nil, the function
uses `package-vc-heuristic-alist' to guess the backend.
-Note that by default, a source package will be prioritized over a
-regular package, but it will not remove a source package."
+Note that by default, a VC package will be prioritized over a
+regular package, but it will not remove a VC package."
(interactive
(progn
;; Initialize the package system to get the list of package
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 2e6927f9004..3ea5aa2bd47 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -459,7 +459,7 @@ synchronously."
(defvar package--default-summary "No description available.")
(define-inline package-vc-p (pkg-desc)
- "Return non-nil if PKG-DESC is a source package."
+ "Return non-nil if PKG-DESC is a VC package."
(inline-letevals (pkg-desc)
(inline-quote (eq (package-desc-kind ,pkg-desc) 'vc))))
@@ -910,7 +910,7 @@ correspond to previously loaded files."
(let ((v1 (package-desc-version p1))
(v2 (package-desc-version p2)))
(or
- ;; Prefer source packages.
+ ;; Prefer VC packages.
(package-vc-p p1)
(package-vc-p p2)
;; Prefer builtin packages.
@@ -2697,7 +2697,10 @@ Helper function for `describe-package'."
(signed (if desc (package-desc-signed desc)))
(maintainer (cdr (assoc :maintainer extras)))
(authors (cdr (assoc :authors extras)))
- (news (and-let* ((file (expand-file-name "news" pkg-dir))
+ (news (and-let* (pkg-dir
+ ((not built-in))
+ (file (expand-file-name "news" pkg-dir))
+ ((file-regular-p file))
((file-readable-p file)))
file)))
(when (string= status "avail-obso")
@@ -3108,7 +3111,7 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC."
"If non-nil, include packages that don't have a version in `list-packages'.")
(defvar package-list-unsigned nil
- "If non-nil, mention in the list which packages were installed w/o signature.")
+ "If non-nil, mention in the list which packages were installed without signature.")
(defvar package--emacs-version-list (version-to-list emacs-version)
"The value of variable `emacs-version' as a list.")
@@ -4550,7 +4553,7 @@ will be signaled in that case."
(user-error "Package `%s' has no explicit maintainer" name))
((and (not (progn
(require 'ietf-drums)
- (ietf-drums-parse-address maint)))
+ (ietf-drums-parse-address (cdr maint))))
(null no-error))
(user-error "Package `%s' has no maintainer address" name))
((not (null maint))
diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el
index 1818e22a923..3c8b81e94da 100644
--- a/lisp/emacs-lock.el
+++ b/lisp/emacs-lock.el
@@ -165,13 +165,14 @@ Return a value appropriate for `kill-buffer-query-functions' (which see)."
(message "Buffer %S is locked and cannot be killed" (buffer-name))
nil))
-(defun emacs-lock--set-mode (mode arg)
+(defun emacs-lock--set-mode (mode arg prefix)
"Setter function for `emacs-lock-mode'."
(setq emacs-lock-mode
(cond ((memq arg '(all exit kill))
;; explicit locking mode arg, use it
arg)
- ((and (eq arg current-prefix-arg) (consp current-prefix-arg))
+ ;; kludgy, but commit 2a4b0da28c converts arg to number
+ ((and (eq arg 4) (equal prefix '(4)))
;; called with C-u M-x emacs-lock-mode, so ask the user
(intern (completing-read
(format-prompt "Locking mode"
@@ -214,7 +215,7 @@ some major modes from being locked under some circumstances."
:group 'emacs-lock
:variable (emacs-lock-mode .
(lambda (mode)
- (emacs-lock--set-mode mode arg)))
+ (emacs-lock--set-mode mode arg current-prefix-arg)))
(when emacs-lock-mode
(setq emacs-lock--old-mode emacs-lock-mode)
(setq emacs-lock--try-unlocking
diff --git a/lisp/epg.el b/lisp/epg.el
index ceeb269b070..527ebfcc2b9 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -482,7 +482,7 @@ callback data (if any)."
(format " skipped new keys: %d\n"
(epg-import-result-not-imported import-result)))
(if (> (epg-import-result-no-user-id import-result) 0)
- (format " w/o user IDs: %d\n"
+ (format " without user IDs: %d\n"
(epg-import-result-no-user-id import-result)))
(if (> (epg-import-result-imported import-result) 0)
(concat (format " imported: %d"
diff --git a/lisp/erc/erc-sasl.el b/lisp/erc/erc-sasl.el
index 9084d873ce4..5b2c93988af 100644
--- a/lisp/erc/erc-sasl.el
+++ b/lisp/erc/erc-sasl.el
@@ -77,15 +77,14 @@ version is used."
(defcustom erc-sasl-password :password
"Optional account password to send when authenticating.
-When the value is a string, ERC will use it unconditionally for
-most mechanisms. Likewise with `:password', except ERC will
-instead use the \"session password\" on file, which often
-originates from the entry-point commands `erc' or `erc-tls'.
-Otherwise, when `erc-sasl-auth-source-function' is a function,
-ERC will attempt an auth-source query, possibly using a non-nil
-symbol for the suggested `:host' parameter if set as this
-option's value or passed as an `:id' to `erc-tls'. Failing that,
-ERC will prompt for input.
+When `erc-sasl-auth-source-function' is a function, ERC will
+attempt an auth-source query and prompt for input if it fails.
+Otherwise, when the value is a nonempty string, ERC will use it
+unconditionally for most mechanisms. Likewise with `:password',
+except ERC will instead use the \"session password\" on file, if
+any, which often originates from the entry-point commands `erc'
+or `erc-tls'. As with auth-source, ERC will prompt for input as
+a fallback.
Note that, with `:password', ERC will forgo sending a traditional
server password via the IRC \"PASS\" command. Also, when
@@ -95,15 +94,18 @@ option should hold the file name of the key."
(defcustom erc-sasl-auth-source-function nil
"Function to query auth-source for an SASL password.
-Called with keyword params known to `auth-source-search', which
-includes `erc-sasl-user' for the `:user' field and
-`erc-sasl-password' for the `:host' field, when the latter option
-is a non-nil, non-keyword symbol. In return, ERC expects a
-string to send as the SASL password, or nil, to move on to the
-next approach, as described in the doc string for the option
-`erc-sasl-password'. See info node `(erc) Connecting' for
-details on ERC's auth-source integration."
- :type '(choice (function-item erc-auth-source-search)
+If provided, this function should expect to be called with any
+number of keyword params known to `auth-source-search', even
+though ERC itself only specifies `:user' paired with a
+\"resolved\" `erc-sasl-user' value. When calling this function,
+ERC binds all options defined in this library, such as
+`erc-sasl-password', to their values from entry-point invocation.
+In return, ERC expects a string to send as the SASL password, or
+nil, in which case, ERC will prompt the for input. See info
+node `(erc) Connecting' for details on ERC's auth-source
+integration."
+ :type '(choice (function-item erc-sasl-auth-source-password-as-host)
+ (function-item erc-auth-source-search)
(const nil)
function))
@@ -130,19 +132,35 @@ details on ERC's auth-source integration."
(:nick (erc-downcase (erc-current-nick)))
(v v)))
+(defun erc-sasl-auth-source-password-as-host (&rest plist)
+ "Call `erc-auth-source-search' with `erc-sasl-password' as `:host'.
+But only do so when it's a string or a non-nil symbol, unless
+that symbol is `:password', in which case, use a non-nil
+`erc-session-password' instead. Otherwise, just defer to
+`erc-auth-source-search' to pick a suitable `:host'. Expect
+PLIST to contain keyword params known to `auth-source-search'."
+ (when erc-sasl-password
+ (when-let ((host (if (eq :password erc-sasl-password)
+ (and (not (functionp erc-session-password))
+ erc-session-password)
+ erc-sasl-password)))
+ (setq plist `(,@plist :host ,(format "%s" host)))))
+ (apply #'erc-auth-source-search plist))
+
(defun erc-sasl--read-password (prompt)
"Return configured option or server password.
-PROMPT is passed to `read-passwd' if necessary."
- (if-let
- ((found (pcase (alist-get 'password erc-sasl--options)
- (:password erc-session-password)
- ((and (pred stringp) v) (unless (string-empty-p v) v))
- ((and (guard erc-sasl-auth-source-function)
- v (let host
- (or v (erc-networks--id-given erc-networks--id))))
- (apply erc-sasl-auth-source-function
- :user (erc-sasl--get-user)
- (and host (list :host (symbol-name host))))))))
+If necessary, pass PROMPT to `read-passwd'."
+ (if-let ((found (pcase (alist-get 'password erc-sasl--options)
+ ((guard (alist-get 'authfn erc-sasl--options))
+ (let-alist erc-sasl--options
+ (let ((erc-sasl-user .user)
+ (erc-sasl-password .password)
+ (erc-sasl-mechanism .mechanism)
+ (erc-sasl-authzid .authzid)
+ (erc-sasl-auth-source-function .authfn))
+ (funcall .authfn :user (erc-sasl--get-user)))))
+ (:password erc-session-password)
+ ((and (pred stringp) v) (unless (string-empty-p v) v)))))
(copy-sequence (erc--unfun found))
(read-passwd prompt)))
@@ -293,6 +311,7 @@ PROMPT is passed to `read-passwd' if necessary."
`((user . ,erc-sasl-user)
(password . ,erc-sasl-password)
(mechanism . ,erc-sasl-mechanism)
+ (authfn . ,erc-sasl-auth-source-function)
(authzid . ,erc-sasl-authzid)))))
(defun erc-sasl--mechanism-offered-p (offered)
diff --git a/lisp/files.el b/lisp/files.el
index f1f890430f1..d785d4fd75d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2308,7 +2308,8 @@ it returns nil or exits non-locally."
"Warn if an attempt to open file of SIZE bytes may run out of memory."
(when (and (numberp size) (not (zerop size))
(integerp out-of-memory-warning-percentage))
- (let ((meminfo (memory-info)))
+ (let* ((default-directory temporary-file-directory)
+ (meminfo (memory-info)))
(when (consp meminfo)
(let ((total-free-memory (float (+ (nth 1 meminfo) (nth 3 meminfo)))))
(when (> (/ size 1024)
@@ -7440,7 +7441,7 @@ The \"sibling\" file is defined by the `find-sibling-rules' variable."
relatives nil t nil nil (car relatives))))))))
(defun find-sibling-file-search (file &optional rules)
- "Return a list of FILE's \"siblings\"
+ "Return a list of FILE's \"siblings\".
RULES should be a list on the form defined by `find-sibling-rules' (which
see), and if nil, defaults to `find-sibling-rules'."
(let ((results nil))
diff --git a/lisp/gnus/ChangeLog.3 b/lisp/gnus/ChangeLog.3
index c55d6225e3f..3b41e9edc94 100644
--- a/lisp/gnus/ChangeLog.3
+++ b/lisp/gnus/ChangeLog.3
@@ -22675,7 +22675,8 @@
* nnspool.el (nnspool-spool-directory): Use news-directory instead
of news-path.
- * spam-stat.el (spam-stat-unload-hook): Set as a variable w/ add-hook.
+ * spam-stat.el (spam-stat-unload-hook): Set as a variable with
+ add-hook.
* spam.el: Delete duplicate `provide'.
(spam-unload-hook): Set as a variable with add-hook.
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 449b73163f4..13c9c0130e0 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -137,7 +137,7 @@ it's not cached."
;; If possible, remove group's cache subdirectory.
(condition-case nil
;; FIXME: we can detect the error type and warn the user
- ;; of any inconsistencies (articles w/o nov entries?).
+ ;; of any inconsistencies (articles without nov entries?).
;; for now, just be conservative...delete only if safe -- sj
(delete-directory (file-name-directory overview-file))
(error))))
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 55899087642..e7d11b597b3 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2909,7 +2909,7 @@ Consider adding this function to `message-header-setup-hook'"
"C-c C-f s" #'message-change-subject
;;
"C-c C-f x" #'message-cross-post-followup-to
- ;; prefix+message-cross-post-followup-to = same w/o cross-post
+ ;; prefix+message-cross-post-followup-to = same without cross-post
"C-c C-f t" #'message-reduce-to-to-cc
"C-c C-f a" #'message-add-archive-header
;; mark inserted text
diff --git a/lisp/help.el b/lisp/help.el
index 8e1b325141e..b709062cb27 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -861,11 +861,13 @@ in the selected window."
(mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers)
(memq 'drag modifiers))
" at that spot" ""))
+ (click-pos (event-end event))
;; Use `posn-set-point' to handle the case when a menu item
;; is selected from the context menu that should describe KEY
;; at the position of mouse click that opened the context menu.
- ;; When no mouse was involved, don't use `posn-set-point'.
- (defn (if buffer
+ ;; When no mouse was involved, or the event doesn't provide a
+ ;; valid position, don't use `posn-set-point'.
+ (defn (if (or buffer (not (consp click-pos)))
(key-binding key t)
(save-excursion (posn-set-point (event-end event))
(key-binding key t)))))
diff --git a/lisp/info.el b/lisp/info.el
index 7d44a1cec1d..05ad27e1801 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3330,7 +3330,8 @@ If FILE is nil, check the current Info file."
(Info-goto-node node)))
(defun info--ensure-not-in-directory-node ()
- (if (equal Info-current-file "dir")
+ (if (equal (downcase (file-name-nondirectory Info-current-file))
+ "dir")
(error (substitute-command-keys
(concat "The Info directory node has no index; "
"type \\[Info-menu] to select a manual")))))
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index 3f36cfbba58..938859c6916 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -1028,7 +1028,8 @@ Like (documentation-property SYMBOL PROPERTY RAW) but handle errors.
(autoload 'apropos "apropos" "\
Show all meaningful Lisp symbols whose names match PATTERN.
Symbols are shown if they are defined as functions, variables, or
-faces, or if they have nonempty property lists.
+faces, or if they have nonempty property lists, or if they are
+known keywords.
PATTERN can be a word, a list of words (separated by spaces),
or a regexp (using some regexp special characters). If it is a word,
@@ -2308,7 +2309,7 @@ This is used by the `browse-url-at-point', `browse-url-at-mouse', and
Also see `browse-url-secondary-browser-function' and
`browse-url-handlers'.")
(custom-autoload 'browse-url-browser-function "browse-url" t)
-(defvar browse-url-default-handlers '(("\\`mailto:" . browse-url--mailto) ("\\`man:" . browse-url--man) (browse-url--non-html-file-url-p . browse-url-emacs)) "\
+(defvar browse-url-default-handlers '(("\\`mailto:" . browse-url--mailto) ("\\`man:" . browse-url--man) ("\\`irc6?s?://" . browse-url--irc) (browse-url--non-html-file-url-p . browse-url-emacs)) "\
Like `browse-url-handlers' but populated by Emacs and packages.
Emacs and external packages capable of browsing certain URLs
@@ -2544,6 +2545,11 @@ When called non-interactively, optional second argument NEW-WINDOW is
used instead of `browse-url-new-window-flag'.
(fn URL &optional NEW-BUFFER)" t)
+(autoload 'browse-url-irc "browse-url" "\
+Call `url-irc' directly after parsing URL.
+This function is a fit for options like `gnus-button-alist'.
+
+(fn URL &rest _)")
(autoload 'browse-url-mail "browse-url" "\
Open a new mail message buffer within Emacs for the RFC 2368 URL.
Default to using the mailto: URL around or before point as the
@@ -2833,6 +2839,23 @@ and corresponding effects.
(register-definition-prefixes "semantic/bovine/c" '("semantic"))
+;;; Generated autoloads from progmodes/c-ts-mode.el
+
+(autoload 'c-ts-mode--base-mode "c-ts-mode" "\
+Major mode for editing C, powered by tree-sitter.
+
+(fn)" t)
+(autoload 'c-ts-mode "c-ts-mode" "\
+Major mode for editing C, powered by tree-sitter.
+
+(fn)" t)
+(autoload 'c++-ts-mode "c-ts-mode" "\
+Major mode for editing C++, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "c-ts-mode" '("c-ts-"))
+
+
;;; Generated autoloads from calendar/cal-bahai.el
(register-definition-prefixes "cal-bahai" '("calendar-bahai-" "diary-bahai-" "holiday-bahai"))
@@ -5498,8 +5521,50 @@ with empty strings removed.
(register-definition-prefixes "semantic/symref/cscope" '("semantic-symref-cscope--line-re"))
+;;; Generated autoloads from progmodes/csharp-mode.el
+
+(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
+(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
+(autoload 'csharp-mode "csharp-mode" "\
+Major mode for editing Csharp code.
+
+Key bindings:
+\\{csharp-mode-map}
+
+(fn)" t)
+(autoload 'csharp-ts-mode "csharp-mode" "\
+Major mode for editing C# code.
+
+(fn)" t)
+(register-definition-prefixes "csharp-mode" '("codedoc-font-lock-" "csharp-"))
+
+
;;; Generated autoloads from textmodes/css-mode.el
+(autoload 'css-ts-mode "css-mode" "\
+Major mode to edit Cascading Style Sheets (CSS).
+\\<css-ts-mode-map>
+
+This mode provides syntax highlighting, indentation, completion,
+and documentation lookup for CSS, based on the tree-sitter
+library.
+
+Use `\\[completion-at-point]' to complete CSS properties,
+property values, pseudo-elements, pseudo-classes, at-rules,
+bang-rules, and HTML tags, classes and IDs. Completion
+candidates for HTML class names and IDs are found by looking
+through open HTML mode buffers.
+
+Use `\\[info-lookup-symbol]' to look up documentation of CSS
+properties, at-rules, pseudo-classes, and pseudo-elements on the
+Mozilla Developer Network (MDN).
+
+Use `\\[fill-paragraph]' to reformat CSS declaration blocks. It
+can also be used to fill comments.
+
+\\{css-mode-map}
+
+(fn)" t)
(autoload 'css-mode "css-mode" "\
Major mode to edit Cascading Style Sheets (CSS).
\\<css-mode-map>
@@ -10003,13 +10068,16 @@ symbol composed of letters from the Latin alphabet.) This option is
generally unneeded, however. See info node `(erc) Connecting' for use
cases. Not available interactively.
-(fn &key (SERVER (erc-compute-server)) (PORT (erc-compute-port)) (NICK (erc-compute-nick)) (USER (erc-compute-user)) PASSWORD (FULL-NAME (erc-compute-full-name)) CLIENT-CERTIFICATE ID)" t)
+(fn &key (SERVER (erc-compute-server)) (PORT (erc-compute-port \\='ircs-u)) (NICK (erc-compute-nick)) (USER (erc-compute-user)) PASSWORD (FULL-NAME (erc-compute-full-name)) CLIENT-CERTIFICATE ID)" t)
(autoload 'erc-handle-irc-url "erc" "\
-Use ERC to IRC on HOST:PORT in CHANNEL as USER with PASSWORD.
+Use ERC to IRC on HOST:PORT in CHANNEL.
If ERC is already connected to HOST:PORT, simply /join CHANNEL.
-Otherwise, connect to HOST:PORT as USER and /join CHANNEL.
+Otherwise, connect to HOST:PORT as NICK and /join CHANNEL.
-(fn HOST PORT CHANNEL USER PASSWORD)")
+Beginning with ERC 5.5, new connections require human intervention.
+Customize `erc-url-connect-function' to override this.
+
+(fn HOST PORT CHANNEL NICK PASSWORD &optional SCHEME)")
(register-definition-prefixes "erc" '("erc-"))
@@ -10155,6 +10223,11 @@ Interactively select a server to connect to using `erc-server-alist'." t)
(register-definition-prefixes "erc-ring" '("erc-"))
+;;; Generated autoloads from erc/erc-sasl.el
+
+(register-definition-prefixes "erc-sasl" '("erc-sasl-"))
+
+
;;; Generated autoloads from erc/erc-services.el
(register-definition-prefixes "erc-services" '("erc-"))
@@ -10222,7 +10295,7 @@ is run. If a macro (possibly with side effects) is to be tested,
it has to be wrapped in `(eval (quote ...))'.
If NAME is already defined as a test and Emacs is running
-in batch mode, an error is signalled.
+in batch mode, an error is signaled.
(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] [:tags \\='(TAG...)] BODY...)" nil t)
(function-put 'ert-deftest 'doc-string-elt 3)
@@ -10649,6 +10722,8 @@ for \\[find-tag] (which see)." t)
(autoload 'ethio-sera-to-fidel-buffer "ethio-util" "\
Convert the current buffer from SERA to FIDEL.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
The variable `ethio-primary-language' specifies the primary
language and `ethio-secondary-language' specifies the secondary.
@@ -10666,6 +10741,8 @@ See also the descriptions of the variables
(autoload 'ethio-sera-to-fidel-region "ethio-util" "\
Convert the characters in region from SERA to FIDEL.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
The variable `ethio-primary-language' specifies the primary
language and `ethio-secondary-language' specifies the secondary.
@@ -10681,13 +10758,17 @@ See also the descriptions of the variables
(fn BEGIN END &optional SECONDARY FORCE)" t)
(autoload 'ethio-sera-to-fidel-marker "ethio-util" "\
-Convert the regions surrounded by \"<sera>\" and \"</sera>\" from SERA to FIDEL.
+Convert regions surrounded by \"<sera>\" and \"</sera>\" from SERA to FIDEL.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
Assume that each region begins with `ethio-primary-language'.
The markers \"<sera>\" and \"</sera>\" themselves are not deleted.
(fn &optional FORCE)" t)
(autoload 'ethio-fidel-to-sera-buffer "ethio-util" "\
-Replace all the FIDEL characters in the current buffer to the SERA format.
+Convert all the FIDEL characters in the current buffer to the SERA format.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
The variable `ethio-primary-language' specifies the primary
language and `ethio-secondary-language' specifies the secondary.
@@ -10704,8 +10785,10 @@ See also the descriptions of the variables
(fn &optional SECONDARY FORCE)" t)
(autoload 'ethio-fidel-to-sera-region "ethio-util" "\
-Replace all the FIDEL characters in the region to the SERA format.
+Convert all the FIDEL characters in the region to the SERA format.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
The variable `ethio-primary-language' specifies the primary
language and `ethio-secondary-language' specifies the secondary.
@@ -10723,11 +10806,14 @@ See also the descriptions of the variables
(fn BEGIN END &optional SECONDARY FORCE)" t)
(autoload 'ethio-fidel-to-sera-marker "ethio-util" "\
Convert the regions surrounded by \"<sera>\" and \"</sera>\" from FIDEL to SERA.
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.
The markers \"<sera>\" and \"</sera>\" themselves are not deleted.
(fn &optional FORCE)" t)
(autoload 'ethio-modify-vowel "ethio-util" "\
-Modify the vowel of the FIDEL that is under the cursor." t)
+Modify the vowel of the FIDEL that is under the cursor.
+FIDEL is the Amharic/Ethiopic alphabet." t)
(autoload 'ethio-replace-space "ethio-util" "\
Replace ASCII spaces with Ethiopic word separators in the region.
@@ -10747,11 +10833,13 @@ This function is deprecated.
(fn ARG)" t)
(autoload 'ethio-fidel-to-tex-buffer "ethio-util" "\
-Convert each fidel characters in the current buffer into a fidel-tex command." t)
+Convert each FIDEL characters in the current buffer into a fidel-tex command.
+FIDEL is the Amharic/Ethiopic alphabet." t)
(autoload 'ethio-tex-to-fidel-buffer "ethio-util" "\
-Convert fidel-tex commands in the current buffer into fidel chars." t)
+Convert fidel-tex commands in the current buffer into FIDEL chars.
+FIDEL is the Amharic/Ethiopic alphabet." t)
(autoload 'ethio-fidel-to-java-buffer "ethio-util" "\
-Convert Ethiopic characters into the Java escape sequences.
+Convert Ethiopic characters in the buffer into the Java escape sequences.
Each escape sequence is of the form \\uXXXX, where XXXX is the
character's codepoint (in hex) in Unicode.
@@ -10759,11 +10847,31 @@ character's codepoint (in hex) in Unicode.
If `ethio-java-save-lowercase' is non-nil, use [0-9a-f].
Otherwise, [0-9A-F].")
(autoload 'ethio-java-to-fidel-buffer "ethio-util" "\
-Convert the Java escape sequences into corresponding Ethiopic characters.")
+Convert the Java escape sequences in the buffer into Ethiopic characters.")
(autoload 'ethio-find-file "ethio-util" "\
-Transliterate file content into Ethiopic depending on filename suffix.")
+Transliterate file content into Ethiopic depending on filename suffix.
+If the file-name extension is \".sera\", convert from SERA to FIDEL.
+If the file-name extension is \".html\", convert regions enclosed
+by \"<sera>..</sera>\" from SERA to FIDEL.
+If the file-name extension is \".tex\", convert fidel-tex commands
+to FIDEL characters.
+If the file-name extension is \".java\", convert Java escape sequences
+to FIDEL characters.
+
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.")
(autoload 'ethio-write-file "ethio-util" "\
-Transliterate Ethiopic characters in ASCII depending on the file extension.")
+Transliterate Ethiopic characters to ASCII depending on the file extension.
+If the file-name extension is \".sera\", convert from FIDEL to SERA.
+If the file-name extension is \".html\", convert FIDEL characters to
+SERA regions enclosed by \"<sera>..</sera>\".
+If the file-name extension is \".tex\", convert FIDEL characters
+to fidel-tex commands.
+If the file-name extension is \".java\", convert FIDEL characters to
+Java escape sequences.
+
+FIDEL is the Amharic alphabet; SERA (System for Ethiopic Representation
+in ASCII) is the Latin representation of Ethiopic script.")
(autoload 'ethio-insert-ethio-space "ethio-util" "\
Insert the Ethiopic word delimiter (the colon-like character).
With ARG, insert that many delimiters.
@@ -11352,7 +11460,11 @@ that have an explicit `:height' setting. The two exceptions to
this are the `default' and `header-line' faces: they will both be
scaled even if they have an explicit `:height' setting.
-See also the related command `global-text-scale-adjust'.
+See also the related command `global-text-scale-adjust'. Unlike
+that command, which scales the font size with a increment,
+`text-scale-adjust' scales the font size with a factor,
+`text-scale-mode-step'. With a small `text-scale-mode-step'
+factor, the two commands behave similarly.
(fn INC)" t)
(define-key global-map [pinch] 'text-scale-pinch)
@@ -11389,7 +11501,10 @@ The variable `global-text-scale-adjust-resizes-frames' controls
whether the frames are resized to keep the same number of lines
and characters per line when the font size is adjusted.
-See also the related command `text-scale-adjust'.
+See also the related command `text-scale-adjust'. Unlike that
+command, which scales the font size with a factor,
+`global-text-scale-adjust' scales the font size with an
+increment.
(fn INCREMENT)" t)
(autoload 'buffer-face-mode "face-remap" "\
@@ -14149,10 +14264,14 @@ Use \\[describe-mode] for more info.
;;; Generated autoloads from net/goto-addr.el
(autoload 'goto-address-at-point "goto-addr" "\
-Send to the e-mail address or load the URL at point.
-Send mail to address at point. See documentation for
-`goto-address-find-address-at-point'. If no address is found
-there, then load the URL at or before point.
+Compose a new message to the e-mail address or open URL at point.
+
+Compose message to address at point. See documentation for
+`goto-address-find-address-at-point'.
+
+If no e-mail address is found at point, open the URL at or before
+point using `browse-url'. With a prefix argument, open the URL
+using `browse-url-secondary-browser-function' instead.
(fn &optional EVENT)" t)
(autoload 'goto-address "goto-addr" "\
@@ -15536,7 +15655,7 @@ START, END and COMMENT-START are regular expressions. A block is
defined as text surrounded by START and END.
As a special case, START may be a list of the form (COMPLEX-START
-MDATA-SELECTOR), where COMPLEX-START is a regexp w/ multiple parts and
+MDATA-SELECTOR), where COMPLEX-START is a regexp with multiple parts and
MDATA-SELECTOR an integer that specifies which sub-match is the proper
place to adjust point, before calling `hs-forward-sexp-func'. Point
is adjusted to the beginning of the specified match. For example,
@@ -18306,6 +18425,15 @@ If non-nil, second arg INITIAL-INPUT is a string to insert before reading.
(register-definition-prefixes "semantic/wisent/java-tags" '("semantic-" "wisent-java-parse-error"))
+;;; Generated autoloads from progmodes/java-ts-mode.el
+
+(autoload 'java-ts-mode "java-ts-mode" "\
+Major mode for editing Java, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "java-ts-mode" '("java-ts-mode-"))
+
+
;;; Generated autoloads from cedet/semantic/wisent/javascript.el
(register-definition-prefixes "semantic/wisent/javascript" '("semantic-" "wisent-javascript-jv-expand-tag"))
@@ -18332,10 +18460,23 @@ by `jka-compr-install'.")
;;; Generated autoloads from progmodes/js.el
(push (purecopy '(js 9)) package--builtin-versions)
+(autoload 'js-base-mode "js" "\
+Generic major mode for editing JavaScript.
+
+This mode is intended to be inherited by concrete major modes.
+Currently there are `js-mode' and `js-ts-mode'.
+
+(fn)" t)
(autoload 'js-mode "js" "\
Major mode for editing JavaScript.
(fn)" t)
+(autoload 'js-ts-mode "js" "\
+Major mode for editing JavaScript.
+
+\\<js-ts-mode-map>
+
+(fn)" t)
(autoload 'js-json-mode "js" "\
@@ -18365,6 +18506,15 @@ one of the aforementioned options instead of using this mode.
(register-definition-prefixes "json" '("json-"))
+;;; Generated autoloads from progmodes/json-ts-mode.el
+
+(autoload 'json-ts-mode "json-ts-mode" "\
+Major mode for editing JSON, powered by tree-sitter.
+
+(fn)" t)
+(register-definition-prefixes "json-ts-mode" '("json-ts-"))
+
+
;;; Generated autoloads from jsonrpc.el
(push (purecopy '(jsonrpc 1 0 15)) package--builtin-versions)
@@ -21892,6 +22042,11 @@ ARG is the prefix argument received when calling interactively the function.
(register-definition-prefixes "oc-biblatex" '("org-cite-biblatex-"))
+;;; Generated autoloads from org/oc-bibtex.el
+
+(register-definition-prefixes "oc-bibtex" '("org-cite-bibtex-export-"))
+
+
;;; Generated autoloads from org/oc-csl.el
(register-definition-prefixes "oc-csl" '("org-cite-csl-"))
@@ -22050,7 +22205,7 @@ Coloring:
;;; Generated autoloads from org/org.el
-(push (purecopy '(org 9 5 5)) package--builtin-versions)
+(push (purecopy '(org 9 6)) package--builtin-versions)
(autoload 'org-babel-do-load-languages "org" "\
Load the languages defined in `org-babel-load-languages'.
@@ -22097,63 +22252,6 @@ The following commands are available:
\\{org-mode-map}
(fn)" t)
-(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)
-(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)
(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
@@ -22442,7 +22540,7 @@ 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
+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.
@@ -22468,7 +22566,7 @@ 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\")
+ ((headline \"IMPORTANT\")
(category \"Work\"))
will only add headlines containing IMPORTANT or headlines
@@ -22555,7 +22653,7 @@ Set `org-capture-templates' to be similar to `org-remember-templates'." t)
;;; Generated autoloads from org/org-compat.el
-(register-definition-prefixes "org-compat" '("org-"))
+(register-definition-prefixes "org-compat" '("org-" "outline-"))
;;; Generated autoloads from org/org-crypt.el
@@ -22575,7 +22673,69 @@ Add a hook to automatically encrypt entries before a file is saved to disk.")
;;; Generated autoloads from org/org-ctags.el
-(register-definition-prefixes "org-ctags" '("org-ctags-"))
+(register-definition-prefixes "org-ctags" '("org-"))
+
+
+;;; Generated autoloads from org/org-cycle.el
+
+(autoload 'org-cycle "org-cycle" "\
+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)
+(autoload 'org-cycle-global "org-cycle" "\
+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)
+(register-definition-prefixes "org-cycle" '("org-cycle-"))
;;; Generated autoloads from org/org-datetree.el
@@ -22608,6 +22768,16 @@ Add a hook to automatically encrypt entries before a file is saved to disk.")
(register-definition-prefixes "org-feed" '("org-feed-"))
+;;; Generated autoloads from org/org-fold.el
+
+(register-definition-prefixes "org-fold" '("org-fold-"))
+
+
+;;; Generated autoloads from org/org-fold-core.el
+
+(register-definition-prefixes "org-fold-core" '("org-fold-core-"))
+
+
;;; Generated autoloads from org/org-footnote.el
(register-definition-prefixes "org-footnote" '("org-footnote-"))
@@ -22670,7 +22840,7 @@ Add a hook to automatically encrypt entries before a file is saved to disk.")
;;; Generated autoloads from org/org-mouse.el
-(register-definition-prefixes "org-mouse" '("org-mouse-"))
+(register-definition-prefixes "org-mouse" '("org-"))
;;; Generated autoloads from org/org-num.el
@@ -22683,6 +22853,11 @@ Add a hook to automatically encrypt entries before a file is saved to disk.")
(register-definition-prefixes "org-pcomplete" '("org-" "pcomplete/org-mode/"))
+;;; Generated autoloads from org/org-persist.el
+
+(register-definition-prefixes "org-persist" '("org-persist-"))
+
+
;;; Generated autoloads from org/org-plot.el
(register-definition-prefixes "org-plot" '("org-"))
@@ -22690,7 +22865,7 @@ Add a hook to automatically encrypt entries before a file is saved to disk.")
;;; Generated autoloads from org/org-protocol.el
-(register-definition-prefixes "org-protocol" '("org-protocol-"))
+(register-definition-prefixes "org-protocol" '("org-"))
;;; Generated autoloads from org/org-refile.el
@@ -22777,12 +22952,19 @@ The mode's hook is called both when the mode is enabled and when
it is disabled.
(fn &optional ARG)" t)
+(autoload 'outline-search-level "outline" "\
+Search for the next text property `outline-level'.
+The arguments are the same as in `outline-search-text-property',
+except the hard-coded property name `outline-level'.
+This function is intended to be used in `outline-search-function'.
+
+(fn &optional BOUND MOVE BACKWARD LOOKING-AT)")
(register-definition-prefixes "outline" '("outline-"))
;;; Generated autoloads from org/ox.el
-(register-definition-prefixes "ox" '("org-export-"))
+(register-definition-prefixes "ox" '("org-"))
;;; Generated autoloads from org/ox-ascii.el
@@ -22904,7 +23086,7 @@ Return PDF file's name.
;;; Generated autoloads from org/ox-latex.el
-(register-definition-prefixes "ox-latex" '("org-latex-"))
+(register-definition-prefixes "ox-latex" '("org-"))
;;; Generated autoloads from org/ox-man.el
@@ -23115,6 +23297,8 @@ Location of the file used to speed up activation of packages at startup." :type
;;; Generated autoloads from emacs-lisp/package-vc.el
+(autoload 'package-vc-install-selected-packages "package-vc" "\
+Ensure packages specified in `package-vc-selected-packages' are installed." t)
(defvar package-vc-selected-packages 'nil "\
List of packages that must be installed.
Each member of the list is of the form (NAME . SPEC), where NAME
@@ -23122,34 +23306,74 @@ is a symbol designating the package and SPEC is one of:
- nil, if any package version can be installed;
- a version string, if that specific revision is to be installed;
-- a property list of the form described in
- `package-vc-archive-spec-alist', giving a package
- specification.
+- a property list, describing a package specification. Valid
+ key/value pairs are
+
+ `:url' (string)
+ The URL of the repository used to fetch the package source.
+
+ `:branch' (string)
+ If given, the name of the branch to checkout after cloning the directory.
+
+ `:lisp-dir' (string)
+ The repository-relative name of the directory to use for loading the Lisp
+ sources. If not given, the value defaults to the root directory
+ of the repository.
+
+ `:main-file' (string)
+ The main file of the project, relevant to gather package metadata.
+ If not given, the assumed default is the package name with \".el\"
+ appended to it.
+
+ `:vc-backend' (symbol)
+ A symbol of the VC backend to use for cloning the package. The
+ value ought to be a member of `vc-handled-backends'. If omitted,
+ `vc-clone' will fall back onto the archive default or on
+ `package-vc-default-backend'.
+
+ All other keys are ignored.
This user option differs from `package-selected-packages' in that
-it is meant to be specified manually. You can also use the
-function `package-vc-selected-packages' to apply the changes.")
+it is meant to be specified manually. If you want to install all
+the packages in the list, you cal also use
+`package-vc-install-selected-packages'.
+
+Note that this option will not override an existing source
+package installation or revert the checked out revision.")
(custom-autoload 'package-vc-selected-packages "package-vc" nil)
+(autoload 'package-vc-update-all "package-vc" "\
+Attempt to update all installed VC packages." t)
+(autoload 'package-vc-update "package-vc" "\
+Attempt to update the package PKG-DESC.
+
+(fn PKG-DESC)" t)
(autoload 'package-vc-install "package-vc" "\
-Fetch a package NAME-OR-URL and set it up for using with Emacs.
-If NAME-OR-URL is a URL, download the package from the repository
-at that URL; the function will try to guess the name of the package
-from the URL. Otherwise NAME-OR-URL should be a symbol whose name
-is the package name, and the URL for the package will be taken from
-the package's metadata.
+Fetch a PACKAGE and set it up for using with Emacs.
+
+If PACKAGE is a string containing an URL, download the package
+from the repository at that URL; the function will try to guess
+the name of the package from the URL. This can be overridden by
+passing the optional argument NAME. If PACKAGE is a cons-cell,
+it should have the form (NAME . SPEC), where NAME is a symbol
+indicating the package name and SPEC is a plist as described in
+`package-vc-selected-packages'. Otherwise PACKAGE should be a
+symbol whose name is the package name, and the URL for the
+package will be taken from the package's metadata.
+
By default, this function installs the last version of the package
available from its repository, but if REV is given and non-nil, it
specifies the revision to install. If REV has the special value
`:last-release' (interactively, the prefix argument), that stands
for the last released version of the package.
-When calling from Lisp, optional argument NAME overrides the package
-name as deduced from NAME-OR-URL.
+
Optional argument BACKEND specifies the VC backend to use for cloning
the package's repository; this is only possible if NAME-OR-URL is a URL,
a string. If BACKEND is omitted or nil, the function
-uses `package-vc--guess-backend' to guess the backend.
+uses `package-vc-heuristic-alist' to guess the backend.
+Note that by default, a VC package will be prioritized over a
+regular package, but it will not remove a VC package.
-(fn NAME-OR-URL &optional NAME REV BACKEND)" t)
+(fn PACKAGE &optional NAME REV BACKEND)" t)
(autoload 'package-vc-checkout "package-vc" "\
Clone the sources for PKG-DESC into DIRECTORY and visit that directory.
Unlike `package-vc-install', this does not yet set up the package
@@ -23171,20 +23395,26 @@ for the NAME of the package to set up. Otherwise infer the package
name from the base name of DIR.
(fn DIR NAME)" t)
-(autoload 'package-vc-refresh "package-vc" "\
-Refresh the installation for package given by PKG-DESC.
-Interactively, prompt for the name of the package to refresh.
+(autoload 'package-vc-rebuild "package-vc" "\
+Rebuild the installation for package given by PKG-DESC.
+Rebuilding an installation means scraping for new autoload
+cookies, re-compiling Emacs Lisp files, building and installing
+any documentation, downloading any missing dependencies. This
+command does not fetch new revisions from a remote server. That
+is the responsibility of `package-vc-update'. Interactively,
+prompt for the name of the package to rebuild.
(fn PKG-DESC)" t)
(autoload 'package-vc-prepare-patch "package-vc" "\
Send patch for REVISIONS to maintainer of the package PKG using SUBJECT.
-SUBJECT and REVISIONS are passed on to `vc-prepare-patch', which see.
-PKG must be a package description.
-Interactively, prompt for PKG, SUBJECT, and REVISIONS. However,
-if the current buffer has marked commit log entries, REVISIONS
-are the tags of the marked entries, see `log-view-get-marked'.
-
-(fn PKG SUBJECT REVISIONS)" t)
+The function uses `vc-prepare-patch', passing SUBJECT and
+REVISIONS directly. PKG-DESC must be a package description.
+Interactively, prompt for PKG-DESC, SUBJECT, and REVISIONS. When
+invoked with a numerical prefix argument, use the last N
+revisions. When invoked interactively in a Log View buffer with
+marked revisions, use those.
+
+(fn PKG-DESC SUBJECT REVISIONS)" t)
(register-definition-prefixes "package-vc" '("package-vc-"))
@@ -24740,7 +24970,7 @@ Open profile FILENAME.
;;; Generated autoloads from progmodes/project.el
-(push (purecopy '(project 0 8 3)) package--builtin-versions)
+(push (purecopy '(project 0 9 0)) package--builtin-versions)
(autoload 'project-current "project" "\
Return the project instance in DIRECTORY, defaulting to `default-directory'.
@@ -24752,14 +24982,14 @@ project instance.
The \"transient\" project instance is a special kind of value
which denotes a project rooted in that directory and includes all
-the files under the directory except for those that should be
-ignored (per `project-ignores').
+the files under the directory except for those that match entries
+in `vc-directory-exclusion-list' or `grep-find-ignored-files'.
See the doc string of `project-find-functions' for the general form
of the project instance object.
(fn &optional MAYBE-PROMPT DIRECTORY)")
-(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map "!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) (define-key map "f" 'project-find-file) (define-key map "F" 'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) (define-key map "s" 'project-shell) (define-key map "d" 'project-find-dir) (define-key map "D" 'project-dired) (define-key map "v" 'project-vc-dir) (define-key map "c" 'project-compile) (define-key map "e" 'project-eshell) (define-key map "k" 'project-kill-buffers) (define-key map "p" 'project-switch-project) (define-key map "g" 'project-find-regexp) (define-key map "G" 'project-or-external-find-regexp) (define-key map "r" 'project-query-replace-regexp) (define-key map "x" 'project-execute-extended-command) map) "\
+(defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map "!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) (define-key map "f" 'project-find-file) (define-key map "F" 'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) (define-key map "s" 'project-shell) (define-key map "d" 'project-find-dir) (define-key map "D" 'project-dired) (define-key map "v" 'project-vc-dir) (define-key map "c" 'project-compile) (define-key map "e" 'project-eshell) (define-key map "k" 'project-kill-buffers) (define-key map "p" 'project-switch-project) (define-key map "g" 'project-find-regexp) (define-key map "G" 'project-or-external-find-regexp) (define-key map "r" 'project-query-replace-regexp) (define-key map "x" 'project-execute-extended-command) (define-key map "\2" 'project-list-buffers) map) "\
Keymap for project commands.")
(define-key ctl-x-map "p" project-prefix-map)
(autoload 'project-other-window-command "project" "\
@@ -24899,6 +25129,15 @@ which see for how it is determined where the buffer will be
displayed.
(fn BUFFER-OR-NAME)" t)
+(autoload 'project-list-buffers "project" "\
+Display a list of project buffers.
+The list is displayed in a buffer named \"*Buffer List*\".
+
+By default, all project buffers are listed except those whose names
+start with a space (which are for internal use). With prefix argument
+ARG, show only buffers that are visiting files.
+
+(fn &optional ARG)" t)
(autoload 'project-kill-buffers "project" "\
Kill the buffers belonging to the current project.
Two buffers belong to the same project if their project
@@ -25282,12 +25521,26 @@ asking.
Sort Python imports in the current buffer." t)
(autoload 'python-fix-imports "python" "\
Add missing imports and remove unused ones from the current buffer." t)
+(autoload 'python-base-mode "python" "\
+Generic major mode for editing Python files.
+
+This is a generic major mode intended to be inherited by
+concrete implementations. Currently there are two concrete
+implementations: `python-mode' and `python-ts-mode'.
+
+(fn)" t)
(autoload 'python-mode "python" "\
Major mode for editing Python files.
\\{python-mode-map}
(fn)" t)
+(autoload 'python-ts-mode "python" "\
+Major mode for editing Python files, using tree-sitter library.
+
+\\{python-ts-mode-map}
+
+(fn)" t)
(register-definition-prefixes "python" '("inferior-python-mode" "python-" "run-python-internal"))
@@ -26661,6 +26914,13 @@ If prefix argument REVERSE is non-nil, sorts in reverse order.
(autoload 'rmail-summary "rmailsum" "\
Display a summary of all messages, one line per message." t)
+(autoload 'rmail-summary-by-thread "rmailsum" "\
+Display a summary of messages in the same discussion thread as MSGNUM.
+Interactively, prompt for MSGNUM, defaulting to the current message.
+Threads are based on the \"Subject\", \"References\" and \"In-reply-to\"
+headers of the messages.
+
+(fn &optional MSGNUM)" t)
(autoload 'rmail-summary-by-labels "rmailsum" "\
Display a summary of all messages with one or more LABELS.
LABELS should be a string containing the desired labels, separated by commas.
@@ -27990,6 +28250,14 @@ To work around that, do:
;;; Generated autoloads from progmodes/sh-script.el
(put 'sh-shell 'safe-local-variable 'symbolp)
+(autoload 'sh-base-mode "sh-script" "\
+Generic major mode for editing shell scripts.
+
+This is a generic major mode intended to be inherited by concrete
+implementations. Currently there are two: `sh-mode' and
+`bash-ts-mode'.
+
+(fn)" t)
(autoload 'sh-mode "sh-script" "\
Major mode for editing shell scripts.
This mode works for many shells, since they all have roughly the same syntax,
@@ -28044,6 +28312,12 @@ with your script for an edit-interpret-debug cycle.
(fn)" t)
(defalias 'shell-script-mode 'sh-mode)
+(autoload 'bash-ts-mode "sh-script" "\
+Major mode for editing Bash shell scripts.
+This mode automatically falls back to `sh-mode' if the buffer is
+not written in Bash or sh.
+
+(fn)" t)
(register-definition-prefixes "sh-script" '("sh-"))
@@ -32188,14 +32462,13 @@ It must be supported by libarchive(3).")
List of suffixes which indicate a compressed file.
It must be supported by libarchive(3).")
(defmacro tramp-archive-autoload-file-name-regexp nil "\
-Regular expression matching archive file names." `(rx bos (group (+ nonl) "." ,(cons '| tramp-archive-suffixes) (32 "." ,(cons '| tramp-archive-compression-suffixes))) (group "/" (* nonl)) eos))
-(autoload 'tramp-archive-file-name-handler "tramp-archive")
+Regular expression matching archive file names." (if (<= emacs-major-version 26) '(concat "\\`" "\\(" ".+" "\\." (regexp-opt tramp-archive-suffixes) "\\(?:" "\\." (regexp-opt tramp-archive-compression-suffixes) "\\)*" "\\)" "\\(" "/" ".*" "\\)" "\\'") `(rx bos (group (+ nonl) "." (| ,@tramp-archive-suffixes) (32 "." (| ,@tramp-archive-compression-suffixes))) (group "/" (* nonl)) eos)))
(defun tramp-archive-autoload-file-name-handler (operation &rest args) "\
Load Tramp archive file name handler, and perform OPERATION." (defvar tramp-archive-autoload) (let ((default-directory temporary-file-directory) (tramp-archive-autoload tramp-archive-enabled)) (apply #'tramp-autoload-file-name-handler operation args)))
-(defun tramp-register-archive-file-name-handler nil "\
-Add archive file name handler to `file-name-handler-alist'." (when (and tramp-archive-enabled (not (rassq #'tramp-archive-file-name-handler file-name-handler-alist))) (add-to-list 'file-name-handler-alist (cons (tramp-archive-autoload-file-name-regexp) #'tramp-archive-autoload-file-name-handler)) (put #'tramp-archive-autoload-file-name-handler 'safe-magic t)))
-(add-hook 'after-init-hook #'tramp-register-archive-file-name-handler)
-(add-hook 'tramp-archive-unload-hook (lambda nil (remove-hook 'after-init-hook #'tramp-register-archive-file-name-handler)))
+(defun tramp-register-archive-autoload-file-name-handler nil "\
+Add archive file name handler to `file-name-handler-alist'." (when (and tramp-archive-enabled (not (rassq 'tramp-archive-file-name-handler file-name-handler-alist))) (add-to-list 'file-name-handler-alist (cons (tramp-archive-autoload-file-name-regexp) #'tramp-archive-autoload-file-name-handler)) (put #'tramp-archive-autoload-file-name-handler 'safe-magic t)))
+(add-hook 'after-init-hook #'tramp-register-archive-autoload-file-name-handler)
+(add-hook 'tramp-archive-unload-hook (lambda nil (remove-hook 'after-init-hook #'tramp-register-archive-autoload-file-name-handler)))
(register-definition-prefixes "tramp-archive" '("tramp-" "with-parsed-tramp-archive-file-name"))
@@ -32383,6 +32656,11 @@ See info node `(transient)Modifying Existing Transients'.
(register-definition-prefixes "tree-widget" '("tree-widget-"))
+;;; Generated autoloads from treesit.el
+
+(register-definition-prefixes "treesit" '("treesit-"))
+
+
;;; Generated autoloads from tutorial.el
(autoload 'help-with-tutorial "tutorial" "\
@@ -32594,6 +32872,17 @@ FRAC should be the inverse of the fractional value; for example, a value of
(register-definition-prefixes "type-break" '("type-break-"))
+;;; Generated autoloads from progmodes/typescript-ts-mode.el
+
+(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
+(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode))
+(autoload 'typescript-ts-mode "typescript-ts-mode" "\
+Major mode for editing TypeScript.
+
+(fn)" t)
+(register-definition-prefixes "typescript-ts-mode" '("typescript-ts-mode-"))
+
+
;;; Generated autoloads from international/ucs-normalize.el
(autoload 'string-glyph-compose "ucs-normalize" "\
@@ -32989,6 +33278,9 @@ Insert the data retrieved from URL literally in the current buffer.
(fn URL)")
+(defconst url-ircs-default-port 6697 "\
+Default port for IRCS connections.")
+(defalias 'url-ircs 'url-irc)
(register-definition-prefixes "url-irc" '("url-irc-"))
@@ -33792,16 +34084,17 @@ log entries should be gathered.
Request editing the next VC shell command before execution.
This is a prefix command. It affects only a VC command executed
immediately after this one." t)
+ (put 'vc-prepare-patches-separately 'safe-local-variable 'booleanp)
(autoload 'vc-prepare-patch "vc" "\
Compose an Email sending patches for REVISIONS to ADDRESSEE.
-If `vc-prepare-patches-separately' is nil, SUBJECT will be used
-as the default subject for the message (and it will be prompted
-for when called interactively). Otherwise a separate message
-will be composed for each revision, with SUBJECT derived from the
-invidividual commits.
-
-When invoked interactively in a Log View buffer with marked
-revisions, those revisions will be used.
+If `vc-prepare-patches-separately' is nil, use SUBJECT as the
+default subject for the message, or prompt a subject when invoked
+interactively. Otherwise compose a separate message for each
+revision, with SUBJECT derived from each revision subject.
+When invoked with a numerical prefix argument, use the last N
+revisions.
+When invoked interactively in a Log View buffer with
+marked revisions, use those these.
(fn ADDRESSEE SUBJECT REVISIONS)" t)
(register-definition-prefixes "vc" '("vc-" "with-vc-properties"))
@@ -36143,7 +36436,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT.
;;; Generated autoloads from progmodes/xref.el
-(push (purecopy '(xref 1 5 1)) package--builtin-versions)
+(push (purecopy '(xref 1 6 0)) package--builtin-versions)
(autoload 'xref-find-backend "xref")
(define-obsolete-function-alias 'xref-pop-marker-stack #'xref-go-back "29.1")
(autoload 'xref-go-back "xref" "\
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 6bb0fa3ae98..5faa3c8d4e8 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2025,8 +2025,8 @@ Runs of equal candidate strings are eliminated. GROUP-FUN is a
(window (get-buffer-window (current-buffer) 0))
(wwidth (if window (1- (window-width window)) 79))
(columns (min
- ;; At least 2 columns; at least 2 spaces between columns.
- (max 2 (/ wwidth (+ 2 length)))
+ ;; At least 2 spaces between columns.
+ (max 1 (/ wwidth (+ 2 length)))
;; Don't allocate more columns than we can fill.
;; Windows can't show less than 3 lines anyway.
(max 1 (/ (length strings) 2))))
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d6d0fb9a259..6e17e417ea3 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -218,7 +218,7 @@
;; ange-ftp-smart-gateway and ange-ftp-smart-gateway-port.
;;
;; Otherwise, if there is an alternate ftp program that implements proxy in
-;; a transparent way (i.e. w/o specifying the proxy host), that will
+;; a transparent way (i.e. without specifying the proxy host), that will
;; connect you directly to the desired destination host:
;; Set ange-ftp-gateway-ftp-program-name to that program's name.
;; Set ange-ftp-local-host-regexp to a value as stated earlier on.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 49cbf526ec3..90020fbb1b6 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -168,6 +168,7 @@ It is used for TCP/IP devices."
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . tramp-adb-handle-make-process)
(make-symbolic-link . tramp-handle-make-symbolic-link)
+ (memory-info . tramp-handle-memory-info)
(process-attributes . tramp-handle-process-attributes)
(process-file . tramp-adb-handle-process-file)
(rename-file . tramp-adb-handle-rename-file)
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 0a8c574d84c..9c1e78d6b0b 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -297,6 +297,7 @@ It must be supported by libarchive(3).")
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-archive-handle-not-implemented)
+ (memory-info . ignore)
(process-attributes . ignore)
(process-file . ignore)
(rename-file . tramp-archive-handle-not-implemented)
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 09732581574..fa40f968180 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -219,6 +219,7 @@ If NAME doesn't belong to an encrypted remote directory, return nil."
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-handle-make-symbolic-link)
+ (memory-info . ignore)
(process-attributes . ignore)
(process-file . ignore)
(rename-file . tramp-crypt-handle-rename-file)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 477f8fb3fdd..73f773e8f4d 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -813,6 +813,7 @@ It has been changed in GVFS 1.14.")
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-handle-make-symbolic-link)
+ (memory-info . ignore)
(process-attributes . ignore)
(process-file . ignore)
(rename-file . tramp-gvfs-handle-rename-file)
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 9e379da8c1e..8e583cc4025 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -133,6 +133,7 @@
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-handle-make-symbolic-link)
+ (memory-info . ignore)
(process-attributes . ignore)
(process-file . ignore)
(rename-file . tramp-rclone-handle-rename-file)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index cfecd32aba5..df5800f4e9d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1103,6 +1103,7 @@ Format specifiers \"%s\" are replaced before the script is used.")
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . tramp-sh-handle-make-process)
(make-symbolic-link . tramp-sh-handle-make-symbolic-link)
+ (memory-info . tramp-handle-memory-info)
(process-attributes . tramp-handle-process-attributes)
(process-file . tramp-sh-handle-process-file)
(rename-file . tramp-sh-handle-rename-file)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index e55f6bb6ee5..c720b33b5f2 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -284,6 +284,7 @@ See `tramp-actions-before-shell' for more info.")
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-smb-handle-make-symbolic-link)
+ (memory-info . ignore)
(process-attributes . ignore)
(process-file . tramp-smb-handle-process-file)
(rename-file . tramp-smb-handle-rename-file)
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 3c67fa6ea2f..44c55041ff8 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -139,6 +139,7 @@
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . tramp-handle-make-process)
(make-symbolic-link . tramp-handle-make-symbolic-link)
+ (memory-info . tramp-handle-memory-info)
(process-attributes . tramp-handle-process-attributes)
(process-file . tramp-sshfs-handle-process-file)
(rename-file . tramp-sshfs-handle-rename-file)
@@ -214,7 +215,8 @@ arguments to pass to the OPERATION."
(with-parsed-tramp-file-name default-directory nil
(with-tramp-connection-property (tramp-get-process v) "remote-path"
(with-temp-buffer
- (process-file "getconf" nil t nil "PATH")
+ (let (process-file-side-effects)
+ (process-file "getconf" nil t nil "PATH"))
(split-string
(progn
;; Read the expression.
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index bc8739c4d6c..fcc27dd8343 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -129,6 +129,7 @@ See `tramp-actions-before-shell' for more info.")
(make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
(make-process . ignore)
(make-symbolic-link . tramp-sudoedit-handle-make-symbolic-link)
+ (memory-info . ignore)
(process-attributes . ignore)
(process-file . ignore)
(rename-file . tramp-sudoedit-handle-rename-file)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e9f30bea7bf..9b7117cb875 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2656,7 +2656,7 @@ Must be handled by the callers."
;; Emacs 27+ only.
exec-path make-process
;; Emacs 29+ only.
- list-system-processes process-attributes))
+ list-system-processes memory-info process-attributes))
default-directory)
;; PROC.
((member operation '(file-notify-rm-watch file-notify-valid-p))
@@ -2949,7 +2949,7 @@ They are completed by \"M-x TAB\" only if the current buffer is remote."
(tramp-tramp-file-p (tramp-get-default-directory buffer)))
(defun tramp-connectable-p (vec-or-filename)
- "Check, whether it is possible to connect the remote host w/o side-effects.
+ "Check if it is possible to connect the remote host without side-effects.
This is true, if either the remote host is already connected, or if we are
not in completion mode."
(let ((tramp-verbose 0)
@@ -3999,7 +3999,7 @@ Let-bind it when necessary.")
((not (file-exists-p file1)) nil)
((not (file-exists-p file2)) t)
;; Tramp reads and writes timestamps on second level. So we round
- ;; the timestamps to seconds w/o fractions.
+ ;; the timestamps to seconds without fractions.
;; `time-convert' has been introduced with Emacs 27.1.
((fboundp 'time-convert)
(time-less-p
@@ -4884,6 +4884,84 @@ support symbolic links."
(tramp-dissect-file-name (expand-file-name linkname)) 'file-error
"make-symbolic-link not supported"))
+(defun tramp-handle-memory-info ()
+ "Like `memory-info' for Tramp files."
+ (let ((result '(0 0 0 0))
+ process-file-side-effects)
+ (with-temp-buffer
+ (cond
+ ;; GNU/Linux.
+ ((zerop (process-file "cat" nil '(t) nil "/proc/meminfo"))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "MemTotal:" (* space) (group (+ digit)) (* space) "kB" eol)
+ nil 'noerror)
+ (setcar (nthcdr 0 result) (string-to-number (match-string 1))))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "MemFree:" (* space) (group (+ digit)) (* space) "kB" eol)
+ nil 'noerror)
+ (setcar (nthcdr 1 result) (string-to-number (match-string 1))))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "SwapTotal:" (* space) (group (+ digit)) (* space) "kB" eol)
+ nil 'noerror)
+ (setcar (nthcdr 2 result) (string-to-number (match-string 1))))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "SwapFree:" (* space) (group (+ digit)) (* space) "kB" eol)
+ nil 'noerror)
+ (setcar (nthcdr 3 result) (string-to-number (match-string 1)))))
+
+ ;; BSD.
+ ;; https://raw.githubusercontent.com/ocochard/myscripts/master/FreeBSD/freebsd-memory.sh
+ ((zerop (process-file "sysctl" nil '(t) nil "-a"))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "hw.pagesize:" (* space) (group (+ digit)) eol)
+ nil 'noerror)
+ (let ((pagesize (string-to-number (match-string 1))))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "vm.stats.vm.v_page_count:" (* space)
+ (group (+ digit)) eol)
+ nil 'noerror)
+ (setcar
+ (nthcdr 0 result)
+ (/ (* (string-to-number (match-string 1)) pagesize) 1024)))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "vm.stats.vm.v_free_count:" (* space)
+ (group (+ digit)) eol)
+ nil 'noerror)
+ (setcar
+ (nthcdr 1 result)
+ (/ (* (string-to-number (match-string 1)) pagesize) 1024)))))
+ (erase-buffer)
+ (when (zerop (process-file "swapctl" nil '(t) nil "-sk"))
+ (goto-char (point-min))
+ (when
+ (re-search-forward
+ (rx bol "Total:" (* space)
+ (group (+ digit)) (* space) (group (+ digit)) eol)
+ nil 'noerror)
+ (setcar (nthcdr 2 result) (string-to-number (match-string 1)))
+ (setcar
+ (nthcdr 3 result)
+ (- (string-to-number (match-string 1))
+ (string-to-number (match-string 2)))))))))
+
+ ;; Return result.
+ (unless (equal result '(0 0 0 0))
+ result)))
+
(defun tramp-handle-process-attributes (pid)
"Like `process-attributes' for Tramp files."
(catch 'result
diff --git a/lisp/obsolete/rfc2368.el b/lisp/obsolete/rfc2368.el
index 5e7320a793c..0a75296e7dd 100644
--- a/lisp/obsolete/rfc2368.el
+++ b/lisp/obsolete/rfc2368.el
@@ -27,7 +27,7 @@
;;
;; -repeat after me: "the colon is not part of the header name..."
;; -if w3 becomes part of emacs, then it may make sense to have this
-;; file depend on w3 -- the maintainer of w3 says merging w/ Emacs
+;; file depend on w3 -- the maintainer of w3 says merging with Emacs
;; is planned!
;;
;; historical note:
@@ -36,8 +36,8 @@
;;
;; acknowledgments:
;;
-;; the functions that deal w/ unhexifying in this file were basically
-;; taken from w3 -- i hope to replace them w/ something else soon OR
+;; the functions that deal with unhexifying in this file were basically
+;; taken from w3 -- i hope to replace them with something else soon OR
;; perhaps if w3 becomes a part of emacs soon, use the functions from w3.
;;; History:
@@ -85,9 +85,9 @@
(defun rfc2368-parse-mailto-url (mailto-url)
"Parse MAILTO-URL, and return an alist of header-name, header-value pairs.
-MAILTO-URL should be a RFC 2368 (mailto) compliant url. A cons cell w/ a
+MAILTO-URL should be a RFC 2368 (mailto) compliant url. A cons cell with a
key of `Body' is a special case and is considered a header for this purpose.
-The returned alist is intended for use w/ the `compose-mail' interface.
+The returned alist is intended for use with the `compose-mail' interface.
Note: make sure MAILTO-URL has been \"unhtmlized\" (e.g., &amp; -> &), before
calling this function."
(let ((case-fold-search t)
@@ -114,7 +114,7 @@ calling this function."
(rfc2368-unhexify-string header-value))))
(split-string query "&"))))
- ;; deal w/ multiple 'To' recipients
+ ;; deal with multiple 'To' recipients
(if prequery
(progn
(setq prequery (rfc2368-unhexify-string prequery))
diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1
index 1491a4645aa..f79d8bf6743 100644
--- a/lisp/org/ChangeLog.1
+++ b/lisp/org/ChangeLog.1
@@ -23889,7 +23889,7 @@
2010-11-11 Eric Schulte <schulte.eric@gmail.com>
* ob-sqlite.el (org-babel-sqlite-expand-vars): Now inserts string
- arguments w/o quotes.
+ arguments without quotes.
2010-11-11 Bernt Hansen <bernt@norang.ca>
@@ -23909,7 +23909,7 @@
2010-11-11 Eric Schulte <schulte.eric@gmail.com>
* ob-lob.el (org-babel-lob-one-liner-regexp): Fix error in lob
- regexp -- it wasn't matching lob lines w/o indices.
+ regexp -- it wasn't matching lob lines without indices.
2010-11-11 Eric Schulte <schulte.eric@gmail.com>
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el
index 2be5e28dc83..74309a0e979 100644
--- a/lisp/org/ob-C.el
+++ b/lisp/org/ob-C.el
@@ -4,9 +4,9 @@
;; Author: Eric Schulte
;; Thierry Banel
-;; Maintainer: Thierry Banel
+;; Maintainer: Thierry Banel <tbanelwebmin@free.fr>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -33,6 +33,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cc-mode)
(require 'ob)
(require 'org-macs)
@@ -182,7 +185,7 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
(setq results (org-remove-indentation results))
(org-babel-reassemble-table
(org-babel-result-cond (cdr (assq :result-params params))
- (org-babel-read results t)
+ results
(let ((tmp-file (org-babel-temp-file "c-")))
(with-temp-file tmp-file (insert results))
(org-babel-import-elisp-from-file tmp-file)))
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el
index 93d1d34229b..f68b5b44e4d 100644
--- a/lisp/org/ob-R.el
+++ b/lisp/org/ob-R.el
@@ -4,9 +4,9 @@
;; Author: Eric Schulte
;; Dan Davison
-;; Maintainer: Jeremie Juste
+;; Maintainer: Jeremie Juste <jeremiejuste@gmail.com>
;; Keywords: literate programming, reproducible research, R, statistics
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -29,6 +29,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ob)
@@ -40,13 +43,6 @@
(declare-function ess-wait-for-process "ext:ess-inf"
(&optional proc sec-prompt wait force-redisplay))
-;; FIXME: Temporary declaration to silence the byte-compiler
-(defvar user-inject-src-param)
-(defvar ess-eval-visibly-tmp)
-(defvar ess-eval-visibly)
-(defvar ess-inject-source)
-(defvar user-inject-src-param)
-
(defconst org-babel-header-args:R
'((width . :any)
(height . :any)
@@ -385,7 +381,7 @@ Has four %s escapes to be filled in:
(if session
(if async
(ob-session-async-org-babel-R-evaluate-session
- session body result-type result-params column-names-p row-names-p)
+ session body result-type column-names-p row-names-p)
(org-babel-R-evaluate-session
session body result-type result-params column-names-p row-names-p))
(org-babel-R-evaluate-external-process
@@ -486,7 +482,7 @@ Insert hline if column names in output have been requested."
(defconst ob-session-async-R-indicator "'ob_comint_async_R_%s_%s'")
(defun ob-session-async-org-babel-R-evaluate-session
- (session body result-type _ column-names-p row-names-p)
+ (session body result-type column-names-p row-names-p)
"Asynchronously evaluate BODY in SESSION.
Returns a placeholder string for insertion, to later be replaced
by `org-babel-comint-async-filter'."
@@ -525,7 +521,8 @@ by `org-babel-comint-async-filter'."
(output
(let ((uuid (md5 (number-to-string (random 100000000))))
(ess-local-process-name
- (process-name (get-buffer-process session))))
+ (process-name (get-buffer-process session)))
+ (ess-eval-visibly-p nil))
(with-temp-buffer
(insert (format ob-session-async-R-indicator
"start" uuid))
@@ -534,13 +531,7 @@ by `org-babel-comint-async-filter'."
(insert "\n")
(insert (format ob-session-async-R-indicator
"end" uuid))
- (setq ess-eval-visibly-tmp ess-eval-visibly)
- (setq user-inject-src-param ess-inject-source)
- (setq ess-eval-visibly nil)
- (setq ess-inject-source 'function-and-buffer)
- (ess-eval-buffer nil))
- (setq ess-eval-visibly ess-eval-visibly-tmp)
- (setq ess-inject-source user-inject-src-param)
+ (ess-eval-buffer nil ))
uuid))))
(defun ob-session-async-R-value-callback (params tmp-file)
diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el
index 1d5a6f24eb7..1db9c6b00c5 100644
--- a/lisp/org/ob-awk.el
+++ b/lisp/org/ob-awk.el
@@ -5,7 +5,7 @@
;; Author: Eric Schulte
;; Maintainer: Tyler Smith <tyler@plantarum.ca>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -32,6 +32,10 @@
;; which will be passed to the awk process through STDIN
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-compat)
@@ -51,7 +55,7 @@
(defun org-babel-execute:awk (body params)
"Execute a block of Awk code with org-babel.
This function is called by `org-babel-execute-src-block'."
- (message "executing Awk source code block")
+ (message "Executing Awk 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)))
diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el
index 9cf16a04c38..2d52da34417 100644
--- a/lisp/org/ob-calc.el
+++ b/lisp/org/ob-calc.el
@@ -5,7 +5,7 @@
;; Author: Eric Schulte
;; Maintainer: Tom Gillespie <tgbugs@gmail.com>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,6 +27,10 @@
;; Org-Babel support for evaluating calc code
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
(require 'calc)
diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el
index 5a44b648750..b424cf48ff9 100644
--- a/lisp/org/ob-clojure.el
+++ b/lisp/org/ob-clojure.el
@@ -3,10 +3,10 @@
;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson
-;; Maintainer: Bastien Guerry <bzg@gnu.org>
+;; Maintainer: Daniel Kraus <daniel@kraus.my>
;;
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -25,23 +25,30 @@
;;; Commentary:
-;; Support for evaluating clojure code
+;; Support for evaluating Clojure code
;; Requirements:
-;; - clojure (at least 1.2.0)
+;; - Clojure (at least 1.2.0)
;; - clojure-mode
-;; - inf-clojure, cider or SLIME
+;; - inf-clojure, Cider, SLIME, babashka or nbb
;; For clojure-mode, see https://github.com/clojure-emacs/clojure-mode
-;; For cider, see https://github.com/clojure-emacs/cider
-;; For inf-clojure, see https://github.com/clojure-emacs/cider
+;; For inf-clojure, see https://github.com/clojure-emacs/inf-clojure
+;; For Cider, see https://github.com/clojure-emacs/cider
+;; For SLIME, see https://slime.common-lisp.dev
+;; For babashka, see https://github.com/babashka/babashka
+;; For nbb, see https://github.com/babashka/nbb
-;; For SLIME, the best way to install these components is by following
+;; For SLIME, the best way to install its components is by following
;; the directions as set out by Phil Hagelberg (Technomancy) on the
;; web page: https://technomancy.us/126
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(declare-function cider-current-connection "ext:cider-client" (&optional type))
@@ -62,17 +69,29 @@
(add-to-list 'org-babel-tangle-lang-exts '("clojurescript" . "cljs"))
(defvar org-babel-default-header-args:clojure '())
-(defvar org-babel-header-args:clojure '((ns . :any) (package . :any)))
+(defvar org-babel-header-args:clojure
+ '((ns . :any)
+ (package . :any)
+ (backend . ((inf-clojure cider slime babashka nbb)))))
(defvar org-babel-default-header-args:clojurescript '())
(defvar org-babel-header-args:clojurescript '((package . :any)))
-(defcustom org-babel-clojure-backend nil
+(defcustom org-babel-clojure-backend (cond
+ ((executable-find "bb") 'babashka)
+ ((executable-find "nbb") 'nbb)
+ ((featurep 'cider) 'cider)
+ ((featurep 'inf-clojure) 'inf-clojure)
+ ((featurep 'slime) 'slime)
+ (t nil))
"Backend used to evaluate Clojure code blocks."
:group 'org-babel
+ :package-version '(Org . "9.6")
:type '(choice
(const :tag "inf-clojure" inf-clojure)
(const :tag "cider" cider)
(const :tag "slime" slime)
+ (const :tag "babashka" babashka)
+ (const :tag "nbb" nbb)
(const :tag "Not configured yet" nil)))
(defcustom org-babel-clojure-default-ns "user"
@@ -80,9 +99,28 @@
:type 'string
:group 'org-babel)
+(defcustom ob-clojure-babashka-command (executable-find "bb")
+ "Path to the babashka executable."
+ :type '(choice file (const nil))
+ :group 'org-babel
+ :package-version '(Org . "9.6"))
+
+(defcustom ob-clojure-nbb-command (executable-find "nbb")
+ "Path to the nbb executable."
+ :type '(choice file (const nil))
+ :group 'org-babel
+ :package-version '(Org . "9.6"))
+
(defun org-babel-expand-body:clojure (body params)
"Expand BODY according to PARAMS, return the expanded body."
(let* ((vars (org-babel--get-vars params))
+ (backend-override (cdr (assq :backend params)))
+ (org-babel-clojure-backend
+ (cond
+ (backend-override (intern backend-override))
+ (org-babel-clojure-backend org-babel-clojure-backend)
+ (t (user-error "You need to customize `org-babel-clojure-backend'
+or set the `:backend' header argument"))))
(ns (or (cdr (assq :ns params))
(if (eq org-babel-clojure-backend 'cider)
(or cider-buffer-ns
@@ -104,7 +142,7 @@
(format "(let [%s]\n%s)"
(mapconcat
(lambda (var)
- (format "%S %S" (car var) (cdr var)))
+ (format "%S '%S" (car var) (cdr var)))
vars
"\n ")
body))))))
@@ -210,8 +248,10 @@
"value")))
result0)))
(ob-clojure-string-or-list
+ ;; Filter out s-expressions that return `nil' (string "nil"
+ ;; from nrepl eval) or comment forms (actual `nil' from nrepl)
(reverse (delete "" (mapcar (lambda (r)
- (replace-regexp-in-string "nil" "" r))
+ (replace-regexp-in-string "nil" "" (or r "")))
result0)))))))
(defun ob-clojure-eval-with-slime (expanded params)
@@ -225,25 +265,43 @@
,(buffer-substring-no-properties (point-min) (point-max)))
(cdr (assq :package params)))))
+(defun ob-clojure-eval-with-babashka (bb expanded)
+ "Evaluate EXPANDED code block using BB (babashka or nbb)."
+ (let ((script-file (org-babel-temp-file "clojure-bb-script-" ".clj")))
+ (with-temp-file script-file
+ (insert expanded))
+ (org-babel-eval
+ (format "%s %s" bb (org-babel-process-file-name script-file))
+ "")))
+
(defun org-babel-execute:clojure (body params)
- "Execute a block of Clojure code with Babel."
- (unless org-babel-clojure-backend
- (user-error "You need to customize org-babel-clojure-backend"))
- (let* ((expanded (org-babel-expand-body:clojure body params))
- (result-params (cdr (assq :result-params params)))
- result)
- (setq result
- (cond
- ((eq org-babel-clojure-backend 'inf-clojure)
- (ob-clojure-eval-with-inf-clojure expanded params))
- ((eq org-babel-clojure-backend 'cider)
- (ob-clojure-eval-with-cider expanded params))
- ((eq org-babel-clojure-backend 'slime)
- (ob-clojure-eval-with-slime expanded params))))
- (org-babel-result-cond result-params
- result
- (condition-case nil (org-babel-script-escape result)
- (error result)))))
+ "Execute the BODY block of Clojure code with PARAMS using Babel."
+ (let* ((backend-override (cdr (assq :backend params)))
+ (org-babel-clojure-backend
+ (cond
+ (backend-override (intern backend-override))
+ (org-babel-clojure-backend org-babel-clojure-backend)
+ (t (user-error "You need to customize `org-babel-clojure-backend'
+or set the `:backend' header argument")))))
+ (let* ((expanded (org-babel-expand-body:clojure body params))
+ (result-params (cdr (assq :result-params params)))
+ result)
+ (setq result
+ (cond
+ ((eq org-babel-clojure-backend 'inf-clojure)
+ (ob-clojure-eval-with-inf-clojure expanded params))
+ ((eq org-babel-clojure-backend 'babashka)
+ (ob-clojure-eval-with-babashka ob-clojure-babashka-command expanded))
+ ((eq org-babel-clojure-backend 'nbb)
+ (ob-clojure-eval-with-babashka ob-clojure-nbb-command expanded))
+ ((eq org-babel-clojure-backend 'cider)
+ (ob-clojure-eval-with-cider expanded params))
+ ((eq org-babel-clojure-backend 'slime)
+ (ob-clojure-eval-with-slime expanded params))))
+ (org-babel-result-cond result-params
+ result
+ (condition-case nil (org-babel-script-escape result)
+ (error result))))))
(defun org-babel-execute:clojurescript (body params)
"Evaluate BODY with PARAMS as ClojureScript code."
diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el
index c99d6a8ba71..e8d83670767 100644
--- a/lisp/org/ob-comint.el
+++ b/lisp/org/ob-comint.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research, comint
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -30,6 +30,10 @@
;; org-babel at large.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob-core)
(require 'org-compat)
(require 'comint)
@@ -70,11 +74,26 @@ or user `keyboard-quit' during execution of body."
(let ((buffer (nth 0 meta))
(eoe-indicator (nth 1 meta))
(remove-echo (nth 2 meta))
- (full-body (nth 3 meta)))
+ (full-body (nth 3 meta))
+ (org-babel-comint-prompt-separator
+ "org-babel-comint-prompt-separator"))
`(org-babel-comint-in-buffer ,buffer
(let* ((string-buffer "")
(comint-output-filter-functions
- (cons (lambda (text) (setq string-buffer (concat string-buffer text)))
+ (cons (lambda (text)
+ (setq string-buffer
+ (concat
+ string-buffer
+ ;; Upon concatenation, the prompt may no
+ ;; longer match `comint-prompt-regexp'.
+ ;; In particular, when the regexp has ^
+ ;; and the output does not contain
+ ;; trailing newline. Use more reliable
+ ;; match to split the output later.
+ (replace-regexp-in-string
+ comint-prompt-regexp
+ ,org-babel-comint-prompt-separator
+ text))))
comint-output-filter-functions))
dangling-text)
;; got located, and save dangling text
@@ -105,7 +124,9 @@ or user `keyboard-quit' during execution of body."
"\n" "[\r\n]+" (regexp-quote (or ,full-body "")))
string-buffer))
(setq string-buffer (substring string-buffer (match-end 0))))
- (split-string string-buffer comint-prompt-regexp)))))
+ (delete "" (split-string
+ string-buffer
+ ,org-babel-comint-prompt-separator))))))
(defun org-babel-comint-input-command (buffer cmd)
"Pass CMD to BUFFER.
@@ -124,9 +145,7 @@ statement (not large blocks of code)."
(while (progn
(goto-char comint-last-input-end)
(not (and (re-search-forward comint-prompt-regexp nil t)
- (goto-char (match-beginning 0))
- (string= (face-name (face-at-point))
- "comint-highlight-prompt"))))
+ (goto-char (match-beginning 0)))))
(accept-process-output (get-buffer-process buffer)))))
(defun org-babel-comint-eval-invisibly-and-wait-for-file
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 41b7a2a9713..5b78ee946ff 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -5,7 +5,7 @@
;; Authors: Eric Schulte
;; Dan Davison
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -23,10 +23,16 @@
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ob-eval)
(require 'org-macs)
+(require 'org-fold)
(require 'org-compat)
+(require 'org-cycle)
(defconst org-babel-exeext
(if (memq system-type '(windows-nt cygwin))
@@ -40,6 +46,7 @@
(defvar org-src-preserve-indentation)
(defvar org-babel-tangle-uncomment-comments)
+(declare-function org-attach-dir "org-attach" (&optional create-if-not-exists-p no-fs-check))
(declare-function org-at-item-p "org-list" ())
(declare-function org-at-table-p "org" (&optional table-type))
(declare-function org-babel-lob-execute-maybe "ob-lob" ())
@@ -50,10 +57,11 @@
(declare-function org-babel-ref-split-args "ob-ref" (arg-string))
(declare-function org-babel-tangle-comment-links "ob-tangle" (&optional info))
(declare-function org-current-level "org" ())
-(declare-function org-cycle "org" (&optional arg))
+(declare-function org-cycle "org-cycle" (&optional arg))
(declare-function org-edit-src-code "org-src" (&optional code edit-buffer-name))
(declare-function org-edit-src-exit "org-src" ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
+(declare-function org-element-at-point-no-context "org-element" (&optional pom))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-normalize-string "org-element" (s))
(declare-function org-element-property "org-element" (property element))
@@ -68,13 +76,14 @@
(declare-function org-list-struct "org-list" ())
(declare-function org-list-to-generic "org-list" (LIST PARAMS))
(declare-function org-list-to-lisp "org-list" (&optional delete))
+(declare-function org-list-to-org "org-list" (list &optional params))
(declare-function org-macro-escape-arguments "org-macro" (&rest args))
(declare-function org-mark-ring-push "org" (&optional pos buffer))
-(declare-function org-narrow-to-subtree "org" ())
+(declare-function org-narrow-to-subtree "org" (&optional element))
(declare-function org-next-block "org" (arg &optional backward block-regexp))
(declare-function org-open-at-point "org" (&optional in-emacs reference-buffer))
(declare-function org-previous-block "org" (arg &optional block-regexp))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&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-get-lang-mode "org-src" (lang))
@@ -136,7 +145,7 @@ used."
:type 'string
:safe (lambda (v)
(and (stringp v)
- (string-equal-ignore-case "RESULTS" v))))
+ (org-string-equal-ignore-case "RESULTS" v))))
(defcustom org-babel-noweb-wrap-start "<<"
"String used to begin a noweb reference in a code block.
@@ -331,7 +340,7 @@ then run `org-babel-execute-src-block'."
This includes header arguments, language and name, and is largely
a window into the `org-babel-get-src-block-info' function."
(interactive)
- (let ((info (org-babel-get-src-block-info 'light))
+ (let ((info (org-babel-get-src-block-info 'no-eval))
(full (lambda (it) (> (length it) 0)))
(printf (lambda (fmt &rest args) (princ (apply #'format fmt args)))))
(when info
@@ -406,16 +415,17 @@ then run `org-babel-switch-to-session'."
(mkdirp . ((yes no)))
(no-expand)
(noeval)
- (noweb . ((yes no tangle no-export strip-export)))
+ (noweb . ((yes no tangle strip-tangle no-export strip-export)))
(noweb-ref . :any)
(noweb-sep . :any)
+ (noweb-prefix . ((no yes)))
(output-dir . :any)
(padline . ((yes no)))
(post . :any)
(prologue . :any)
(results . ((file list vector table scalar verbatim)
(raw html latex org code pp drawer link graphics)
- (replace silent none append prepend)
+ (replace silent none discard append prepend)
(output value)))
(rownames . ((no yes)))
(sep . :any)
@@ -434,8 +444,8 @@ specific header arguments as well.")
(defconst org-babel-safe-header-args
'(:cache :colnames :comments :exports :epilogue :hlines :noeval
- :noweb :noweb-ref :noweb-sep :padline :prologue :rownames
- :sep :session :tangle :wrap
+ :noweb :noweb-ref :noweb-sep :noweb-prefix :padline
+ :prologue :rownames :sep :session :tangle :wrap
(:eval . ("never" "query"))
(:results . (lambda (str) (not (string-match "file" str)))))
"A list of safe header arguments for babel source blocks.
@@ -476,12 +486,14 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'."
This is a list in which each element is an alist. Each key
corresponds to a header argument, and each value to that header's
value. The value can either be a string or a closure that
-evaluates to a string. The closure is evaluated when the source
-block is being evaluated (e.g. during execution or export), with
-point at the source block. It is not possible to use an
-arbitrary function symbol (e.g. `some-func'), since org uses
-lexical binding. To achieve the same functionality, call the
-function within a closure (e.g. (lambda () (some-func))).
+evaluates to a string.
+
+A closure is evaluated when the source block is being
+evaluated (e.g. during execution or export), with point at the
+source block. It is not possible to use an arbitrary function
+symbol (e.g. `some-func'), since org uses lexical binding. To
+achieve the same functionality, call the function within a
+closure (e.g. (lambda () (some-func))).
To understand how closures can be used as default header
arguments, imagine you'd like to set the file name output of a
@@ -498,7 +510,16 @@ this with:
Because the closure is evaluated with point at the source block,
the call to `org-element-at-point' above will always retrieve
-information about the current source block.")
+information about the current source block.
+
+Some header arguments can be provided multiple times for a source
+block. An example of such a header argument is :var. This
+functionality is also supported for default header arguments by
+providing the header argument multiple times in the alist. For
+example:
+
+ ((:var . \"foo=\\\"bar\\\"\")
+ (:var . \"bar=\\\"foo\\\"\"))")
(put 'org-babel-default-header-args 'safe-local-variable
(org-babel-header-args-safe-fn org-babel-safe-header-args))
@@ -620,10 +641,10 @@ the list of header arguments."
(push elem lst)))
(reverse lst)))
-(defun org-babel-get-src-block-info (&optional light datum)
+(defun org-babel-get-src-block-info (&optional no-eval datum)
"Extract information from a source block or inline source block.
-When optional argument LIGHT is non-nil, Babel does not resolve
+When optional argument NO-EVAL is non-nil, Babel does not resolve
remote variable references; a process which could likely result
in the execution of other code blocks, and do not evaluate Lisp
values in parameters.
@@ -657,9 +678,9 @@ a list with the following pattern:
;; properties applicable to its location within
;; the document.
(org-with-point-at (org-element-property :begin datum)
- (org-babel-params-from-properties lang light))
+ (org-babel-params-from-properties lang no-eval))
(mapcar (lambda (h)
- (org-babel-parse-header-arguments h light))
+ (org-babel-parse-header-arguments h no-eval))
(cons (org-element-property :parameters datum)
(org-element-property :header datum)))))
(or (org-element-property :switches datum) "")
@@ -667,7 +688,7 @@ a list with the following pattern:
(org-element-property (if inline :begin :post-affiliated)
datum)
(and (not inline) (org-src-coderef-format datum)))))
- (unless light
+ (unless no-eval
(setf (nth 2 info) (org-babel-process-params (nth 2 info))))
(setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info)))
info))))
@@ -694,8 +715,8 @@ a list with the following pattern:
; and `org-babel-read'
;;;###autoload
-(defun org-babel-execute-src-block (&optional arg info params)
- "Execute the current source code block.
+(defun org-babel-execute-src-block (&optional arg info params executor-type)
+ "Execute the current source code block and return the result.
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.
@@ -708,13 +729,33 @@ Optionally supply a value for INFO in the form returned by
Optionally supply a value for PARAMS which will be merged with
the header arguments specified at the front of the source code
-block."
+block.
+
+EXECUTOR-TYPE is the type of the org element responsible for the
+execution of the source block. If not provided then informed
+guess will be made."
(interactive)
(let* ((org-babel-current-src-block-location
- (or org-babel-current-src-block-location
- (nth 5 info)
- (org-babel-where-is-src-block-head)))
- (info (if info (copy-tree info) (org-babel-get-src-block-info))))
+ (or org-babel-current-src-block-location
+ (nth 5 info)
+ (org-babel-where-is-src-block-head)))
+ (info (if info (copy-tree info) (org-babel-get-src-block-info)))
+ (executor-type
+ (or executor-type
+ ;; If `executor-type' is unset, then we will make an
+ ;; informed guess.
+ (pcase (and
+ ;; When executing virtual src block, no location
+ ;; is known.
+ org-babel-current-src-block-location
+ (char-after org-babel-current-src-block-location))
+ (?s 'inline-src-block)
+ (?c 'inline-babel-call)
+ (?# (pcase (char-after (+ 2 org-babel-current-src-block-location))
+ (?b 'src-block)
+ (?c 'call-block)
+ (_ 'unknown)))
+ (_ 'unknown)))))
;; Merge PARAMS with INFO before considering source block
;; evaluation since both could disagree.
(cl-callf org-babel-merge-params (nth 2 info) params)
@@ -733,7 +774,8 @@ block."
(forward-line)
(skip-chars-forward " \t")
(let ((result (org-babel-read-result)))
- (message (replace-regexp-in-string "%" "%%" (format "%S" result)))
+ (message (format "Cached: %s"
+ (replace-regexp-in-string "%" "%%" (format "%S" result))))
result)))
((org-babel-confirm-evaluate info)
(let* ((lang (nth 0 info))
@@ -751,57 +793,67 @@ block."
(make-directory d 'parents)
d))))
(cmd (intern (concat "org-babel-execute:" lang)))
- result)
+ result exec-start-time)
(unless (fboundp cmd)
(error "No org-babel-execute function for %s!" lang))
- (message "executing %s code block%s..."
+ (message "Executing %s %s %s..."
(capitalize lang)
+ (pcase executor-type
+ ('src-block "code block")
+ ('inline-src-block "inline code block")
+ ('babel-call "call")
+ ('inline-babel-call "inline call")
+ (e (symbol-name e)))
(let ((name (nth 4 info)))
- (if name (format " (%s)" name) "")))
- (if (member "none" result-params)
- (progn (funcall cmd body params)
- (message "result silenced"))
- (setq result
- (let ((r (funcall cmd body params)))
- (if (and (eq (cdr (assq :result-type params)) 'value)
- (or (member "vector" result-params)
- (member "table" result-params))
- (not (listp r)))
- (list (list r))
- r)))
- (let ((file (and (member "file" result-params)
- (cdr (assq :file params)))))
- ;; If non-empty result and :file then write to :file.
- (when file
- ;; If `:results' are special types like `link' or
- ;; `graphics', don't write result to `:file'. Only
- ;; insert a link to `:file'.
- (when (and result
- (not (or (member "link" result-params)
- (member "graphics" result-params))))
- (with-temp-file file
- (insert (org-babel-format-result
- result
- (cdr (assq :sep params)))))
- ;; Set file permissions if header argument
- ;; `:file-mode' is provided.
- (when (assq :file-mode params)
- (set-file-modes file (cdr (assq :file-mode params)))))
- (setq result file))
- ;; Possibly perform post process provided its
- ;; appropriate. Dynamically bind "*this*" to the
- ;; actual results of the block.
- (let ((post (cdr (assq :post params))))
- (when post
- (let ((*this* (if (not file) result
- (org-babel-result-to-file
- file
- (org-babel--file-desc params result)))))
- (setq result (org-babel-ref-resolve post))
- (when file
- (setq result-params (remove "file" result-params))))))
- (org-babel-insert-result
- result result-params info new-hash lang)))
+ (if name
+ (format "(%s)" name)
+ (format "at position %S" (nth 5 info)))))
+ (setq exec-start-time (current-time)
+ result
+ (let ((r (save-current-buffer (funcall cmd body params))))
+ (if (and (eq (cdr (assq :result-type params)) 'value)
+ (or (member "vector" result-params)
+ (member "table" result-params))
+ (not (listp r)))
+ (list (list r))
+ r)))
+ (let ((file (and (member "file" result-params)
+ (cdr (assq :file params)))))
+ ;; If non-empty result and :file then write to :file.
+ (when file
+ ;; If `:results' are special types like `link' or
+ ;; `graphics', don't write result to `:file'. Only
+ ;; insert a link to `:file'.
+ (when (and result
+ (not (or (member "link" result-params)
+ (member "graphics" result-params))))
+ (with-temp-file file
+ (insert (org-babel-format-result
+ result
+ (cdr (assq :sep params)))))
+ ;; Set file permissions if header argument
+ ;; `:file-mode' is provided.
+ (when (assq :file-mode params)
+ (set-file-modes file (cdr (assq :file-mode params)))))
+ (setq result file))
+ ;; Possibly perform post process provided its
+ ;; appropriate. Dynamically bind "*this*" to the
+ ;; actual results of the block.
+ (let ((post (cdr (assq :post params))))
+ (when post
+ (let ((*this* (if (not file) result
+ (org-babel-result-to-file
+ file
+ (org-babel--file-desc params result)
+ 'attachment))))
+ (setq result (org-babel-ref-resolve post))
+ (when file
+ (setq result-params (remove "file" result-params))))))
+ (if (member "none" result-params)
+ (message "result silenced")
+ (org-babel-insert-result
+ result result-params info new-hash lang
+ (time-subtract (current-time) exec-start-time))))
(run-hooks 'org-babel-after-execute-hook)
result)))))))
@@ -886,7 +938,7 @@ arguments and pop open the results in a preview buffer."
(defun org-babel-insert-header-arg (&optional header-arg value)
"Insert a header argument selecting from lists of common args and values."
(interactive)
- (let* ((info (org-babel-get-src-block-info 'light))
+ (let* ((info (org-babel-get-src-block-info 'no-eval))
(lang (car info))
(begin (nth 5 info))
(lang-headers (intern (concat "org-babel-header-args:" lang)))
@@ -943,7 +995,7 @@ arguments and pop open the results in a preview buffer."
(insert (concat header " " (or arg "")))
(cons header arg)))
-(add-hook 'org-tab-first-hook 'org-babel-header-arg-expand)
+(add-hook 'org-cycle-tab-first-hook 'org-babel-header-arg-expand)
;;;###autoload
(defun org-babel-load-in-session (&optional _arg info)
@@ -1083,7 +1135,7 @@ code block, otherwise return nil. With optional prefix argument
RE-RUN the source-code block is evaluated even if results already
exist."
(interactive "P")
- (pcase (org-babel-get-src-block-info 'light)
+ (pcase (org-babel-get-src-block-info 'no-eval)
(`(,_ ,_ ,arguments ,_ ,_ ,start ,_)
(save-excursion
;; Go to the results, if there aren't any then run the block.
@@ -1293,7 +1345,7 @@ CONTEXT specifies the context of evaluation. It can be `:eval',
(lambda (a b) (string< (car a) (car b)))))
(let* ((rm (lambda (lst)
(dolist (p '("replace" "silent" "none"
- "append" "prepend"))
+ "discard" "append" "prepend"))
(setq lst (remove p lst)))
lst))
(norm (lambda (arg)
@@ -1301,8 +1353,8 @@ CONTEXT specifies the context of evaluation. It can be `:eval',
(copy-sequence (cdr arg))
(cdr arg))))
(when (and v (not (and (sequencep v)
- (not (consp v))
- (= (length v) 0))))
+ (not (consp v))
+ (= (length v) 0))))
(cond
((and (listp v) ; lists are sorted
(member (car arg) '(:result-params)))
@@ -1330,10 +1382,10 @@ CONTEXT specifies the context of evaluation. It can be `:eval',
(mapconcat
#'identity
(delq nil (mapcar (lambda (arg)
- (let ((normalized (funcall norm arg)))
- (when normalized
- (format "%S" normalized))))
- (nth 2 info))) ":")
+ (let ((normalized (funcall norm arg)))
+ (when normalized
+ (format "%S" normalized))))
+ (nth 2 info))) ":")
expanded))
(hash (sha1 it)))
(when (called-interactively-p 'interactive) (message hash))
@@ -1467,7 +1519,7 @@ portions of results lines."
(push ov org-babel-hide-result-overlays)))))
;; org-tab-after-check-for-cycling-hook
-(add-hook 'org-tab-first-hook #'org-babel-hide-result-toggle-maybe)
+(add-hook 'org-cycle-tab-first-hook #'org-babel-hide-result-toggle-maybe)
;; Remove overlays when changing major mode
(add-hook 'org-mode-hook
(lambda () (add-hook 'change-major-mode-hook
@@ -1766,7 +1818,8 @@ its current beginning instead.
Return the point at the beginning of the current source block.
Specifically at the beginning of the #+BEGIN_SRC line. Also set
match-data relatively to `org-babel-src-block-regexp', which see.
-If the point is not on a source block then return nil."
+If the point is not on a source block or within blank lines after an
+src block, then return nil."
(let ((element (or src-block (org-element-at-point))))
(when (eq (org-element-type element) 'src-block)
(let ((end (org-element-property :end element)))
@@ -1815,7 +1868,7 @@ If the point is not on a source block then return nil."
(let ((point (org-babel-find-named-block name)))
(if point
;; Taken from `org-open-at-point'.
- (progn (org-mark-ring-push) (goto-char point) (org-show-context))
+ (progn (org-mark-ring-push) (goto-char point) (org-fold-show-context))
(message "source-code block `%s' not found in this buffer" name))))
(defun org-babel-find-named-block (name)
@@ -1855,7 +1908,7 @@ to `org-babel-named-src-block-regexp'."
(let ((point (org-babel-find-named-result name)))
(if point
;; taken from `org-open-at-point'
- (progn (goto-char point) (org-show-context))
+ (progn (goto-char point) (org-fold-show-context))
(message "result `%s' not found in this buffer" name))))
(defun org-babel-find-named-result (name)
@@ -1918,48 +1971,53 @@ With optional prefix argument ARG, jump backward ARG many source blocks."
When called from inside of a code block the current block is
split. When called from outside of a code block a new code block
is created. In both cases if the region is demarcated and if the
-region is not active then the point is demarcated."
+region is not active then the point is demarcated.
+
+When called within blank lines after a code block, create a new code
+block of the same language with the previous."
(interactive "P")
- (let* ((info (org-babel-get-src-block-info 'light))
+ (let* ((info (org-babel-get-src-block-info 'no-eval))
(start (org-babel-where-is-src-block-head))
+ ;; `start' will be nil when within space lines after src block.
(block (and start (match-string 0)))
(headers (and start (match-string 4)))
(stars (concat (make-string (or (org-current-level) 1) ?*) " "))
(upper-case-p (and block
(let (case-fold-search)
(string-match-p "#\\+BEGIN_SRC" block)))))
- (if info
+ (if (and info start) ;; At src block, but not within blank lines after it.
(mapc
(lambda (place)
(save-excursion
(goto-char place)
(let ((lang (nth 0 info))
- (indent (make-string (current-indentation) ?\s)))
+ (indent (make-string (org-current-text-indentation) ?\s)))
(when (string-match "^[[:space:]]*$"
(buffer-substring (line-beginning-position)
(line-end-position)))
(delete-region (line-beginning-position) (line-end-position)))
(insert (concat
- (if (looking-at "^") "" "\n")
- indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
- (if arg stars indent) "\n"
- indent (if upper-case-p "#+BEGIN_SRC " "#+begin_src ")
- lang
- (if (> (length headers) 1)
+ (if (looking-at "^") "" "\n")
+ indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
+ (if arg stars indent) "\n"
+ indent (if upper-case-p "#+BEGIN_SRC " "#+begin_src ")
+ lang
+ (if (> (length headers) 1)
(concat " " headers) headers)
- (if (looking-at "[\n\r]")
+ (if (looking-at "[\n\r]")
""
(concat "\n" (make-string (current-column) ? )))))))
(move-end-of-line 2))
(sort (if (org-region-active-p) (list (mark) (point)) (list (point))) #'>))
(let ((start (point))
- (lang (completing-read
- "Lang: "
- (mapcar #'symbol-name
- (delete-dups
- (append (mapcar #'car org-babel-load-languages)
- (mapcar (lambda (el) (intern (car el)))
- org-src-lang-modes))))))
+ (lang (or (car info) ; Reuse language from previous block.
+ (completing-read
+ "Lang: "
+ (mapcar #'symbol-name
+ (delete-dups
+ (append (mapcar #'car org-babel-load-languages)
+ (mapcar (lambda (el) (intern (car el)))
+ org-src-lang-modes)))))))
(body (delete-and-extract-region
(if (org-region-active-p) (mark) (point)) (point))))
(insert (concat (if (looking-at "^") "" "\n")
@@ -2054,8 +2112,11 @@ to HASH."
((or `inline-babel-call `inline-src-block)
;; Results for inline objects are located right after them.
;; There is no RESULTS line to insert either.
- (let ((limit (org-element-property
- :contents-end (org-element-property :parent context))))
+ (let ((limit (pcase (org-element-type (org-element-property :parent context))
+ (`section (org-element-property
+ :end (org-element-property :parent context)))
+ (_ (org-element-property
+ :contents-end (org-element-property :parent context))))))
(goto-char (org-element-property :end context))
(skip-chars-forward " \t\n" limit)
(throw :found
@@ -2088,8 +2149,11 @@ to HASH."
;; No possible anonymous results at the very end of
;; buffer or outside CONTEXT parent.
((eq (point)
- (or (org-element-property
- :contents-end (org-element-property :parent context))
+ (or (pcase (org-element-type (org-element-property :parent context))
+ ((or `section `org-data) (org-element-property
+ :end (org-element-property :parent context)))
+ (_ (org-element-property
+ :contents-end (org-element-property :parent context))))
(point-max))))
;; Check if next element is an anonymous result below
;; the current block.
@@ -2132,7 +2196,7 @@ Return nil if ELEMENT cannot be read."
(or (org-babel--string-to-number v) v)))
(`table (org-babel-read-table))
(`plain-list (org-babel-read-list))
- (`example-block
+ ((or `example-block `src-block)
(let ((v (org-element-property :value element)))
(if (or org-src-preserve-indentation
(org-element-property :preserve-indent element))
@@ -2175,8 +2239,15 @@ Return nil if ELEMENT cannot be read."
(org-table-to-lisp)))
(defun org-babel-read-list ()
- "Read the list at point into emacs-lisp."
- (mapcar (lambda (el) (org-babel-read el 'inhibit-lisp-eval))
+ "Read the list at point into emacs-lisp.
+
+Return the list of strings representing top level items:
+
+ (item1 item2 ...)
+
+Only consider top level items. See Info node
+`(org)Environment of a Code Block'."
+ (mapcar (lambda (el) (org-babel-read (car el) 'inhibit-lisp-eval))
(cdr (org-list-to-lisp))))
(defvar org-link-types-re)
@@ -2206,7 +2277,7 @@ If the path of the link is a file path it is expanded using
;; scalar result
(funcall echo-res result))))
-(defun org-babel-insert-result (result &optional result-params info hash lang)
+(defun org-babel-insert-result (result &optional result-params info hash lang exec-time)
"Insert RESULT into the current buffer.
By default RESULT is inserted after the end of the current source
@@ -2214,7 +2285,8 @@ block. The RESULT of an inline source block usually will be
wrapped inside a `results' macro and placed on the same line as
the inline source block. The macro is stripped upon export.
Multiline and non-scalar RESULTS from inline source blocks are
-not allowed. With optional argument RESULT-PARAMS controls
+not allowed. When EXEC-TIME is provided it may be included in a
+generated message. With optional argument RESULT-PARAMS controls
insertion of results in the Org mode file. RESULT-PARAMS can
take the following values:
@@ -2287,11 +2359,14 @@ INFO may provide the values of these header arguments (in the
(cond ((stringp result)
(setq result (org-no-properties result))
(when (member "file" result-params)
- (setq result (org-babel-result-to-file
- result
- (org-babel--file-desc (nth 2 info) result)))))
+ (setq result
+ (org-babel-result-to-file
+ result
+ (org-babel--file-desc (nth 2 info) result)
+ 'attachment))))
((listp result))
(t (setq result (format "%S" result))))
+
(if (and result-params (member "silent" result-params))
(progn (message (replace-regexp-in-string "%" "%%" (format "%S" result)))
result)
@@ -2302,8 +2377,8 @@ INFO may provide the values of these header arguments (in the
(when inline
(let ((warning
(or (and (member "table" result-params) "`:results table'")
- (and (listp result) "list result")
- (and (string-match-p "\n." result) "multiline result")
+ (and result (listp result) "list result")
+ (and result (string-match-p "\n." result) "multiline result")
(and (member "list" result-params) "`:results list'"))))
(when warning
(user-error "Inline error: %s cannot be used" warning))))
@@ -2385,7 +2460,7 @@ INFO may provide the values of these header arguments (in the
((member "list" result-params)
(insert
(org-trim
- (org-list-to-generic
+ (org-list-to-org
(cons 'unordered
(mapcar
(lambda (e)
@@ -2434,7 +2509,7 @@ INFO may provide the values of these header arguments (in the
;; Escape contents from "export" wrap. Wrap
;; inline results within an export snippet with
;; appropriate value.
- ((string-equal-ignore-case type "export")
+ ((org-string-equal-ignore-case type "export")
(let ((backend (pcase split
(`(,_) "none")
(`(,_ ,b . ,_) b))))
@@ -2445,14 +2520,14 @@ INFO may provide the values of these header arguments (in the
backend) "@@)}}}")))
;; Escape contents from "example" wrap. Mark
;; inline results as verbatim.
- ((string-equal-ignore-case type "example")
+ ((org-string-equal-ignore-case type "example")
(funcall wrap
opening-line closing-line
nil nil
"{{{results(=" "=)}}}"))
;; Escape contents from "src" wrap. Mark
;; inline results as inline source code.
- ((string-equal-ignore-case type "src")
+ ((org-string-equal-ignore-case type "src")
(let ((inline-open
(pcase split
(`(,_)
@@ -2516,12 +2591,19 @@ INFO may provide the values of these header arguments (in the
(not (and (listp result)
(member "append" result-params))))
(indent-rigidly beg end indent))
- (if (null result)
- (if (member "value" result-params)
- (message "Code block returned no value.")
- (message "Code block produced no output."))
- (message "Code block evaluation complete.")))
- (set-marker end nil)
+ (let ((time-info
+ ;; Only show the time when something other than
+ ;; 0s will be shown, i.e. check if the time is at
+ ;; least half of the displayed precision.
+ (if (and exec-time (> (float-time exec-time) 0.05))
+ (format " (took %.1fs)" (float-time exec-time))
+ "")))
+ (if (null result)
+ (if (member "value" result-params)
+ (message "Code block returned no value%s." time-info)
+ (message "Code block produced no output%s." time-info))
+ (message "Code block evaluation complete%s." time-info))))
+ (when end (set-marker end nil))
(when outside-scope (narrow-to-region visible-beg visible-end))
(set-marker visible-beg nil)
(set-marker visible-end nil)))))))
@@ -2594,27 +2676,49 @@ in the buffer."
(line-beginning-position 2))
(point))))))
-(defun org-babel-result-to-file (result &optional description)
+(defun org-babel-result-to-file (result &optional description type)
"Convert RESULT into an Org link with optional DESCRIPTION.
If the `default-directory' is different from the containing
-file's directory then expand relative links."
+file's directory then expand relative links.
+
+If the optional TYPE is passed as `attachment' and the path is a
+descendant of the DEFAULT-DIRECTORY, the generated link will be
+specified as an an \"attachment:\" style link."
(when (stringp result)
- (let ((same-directory?
- (and (buffer-file-name (buffer-base-buffer))
- (not (string= (expand-file-name default-directory)
- (expand-file-name
- (file-name-directory
- (buffer-file-name (buffer-base-buffer)))))))))
- (format "[[file:%s]%s]"
- (if (and default-directory
- (buffer-file-name (buffer-base-buffer)) same-directory?)
- (if (eq org-link-file-path-type 'adaptive)
- (file-relative-name
- (expand-file-name result default-directory)
- (file-name-directory
- (buffer-file-name (buffer-base-buffer))))
- (expand-file-name result default-directory))
- result)
+ (let* ((result-file-name (expand-file-name result))
+ (base-file-name (buffer-file-name (buffer-base-buffer)))
+ (base-directory (and buffer-file-name
+ (file-name-directory base-file-name)))
+ (same-directory?
+ (and base-file-name
+ (not (string= (expand-file-name default-directory)
+ (expand-file-name
+ base-directory)))))
+ (request-attachment (eq type 'attachment))
+ (attach-dir (let* ((default-directory base-directory)
+ (dir (org-attach-dir nil t)))
+ (when dir
+ (expand-file-name dir))))
+ (in-attach-dir (and request-attachment
+ attach-dir
+ (string-prefix-p
+ attach-dir
+ result-file-name))))
+ (format "[[%s:%s]%s]"
+ (pcase type
+ ((and 'attachment (guard in-attach-dir)) "attachment")
+ (_ "file"))
+ (if (and request-attachment in-attach-dir)
+ (file-relative-name result-file-name)
+ (if (and default-directory
+ base-file-name same-directory?)
+ (if (eq org-link-file-path-type 'adaptive)
+ (file-relative-name
+ result-file-name
+ (file-name-directory
+ base-file-name))
+ result-file-name)
+ result))
(if description (concat "[" description "]") "")))))
(defun org-babel-examplify-region (beg end &optional results-switches inline)
@@ -2653,7 +2757,7 @@ file's directory then expand relative links."
(unless (eq (org-element-type element) 'src-block)
(error "Not in a source block"))
(goto-char (org-babel-where-is-src-block-head element))
- (let* ((ind (current-indentation))
+ (let* ((ind (org-current-text-indentation))
(body-start (line-beginning-position 2))
(body (org-element-normalize-string
(if (or org-src-preserve-indentation
@@ -2710,6 +2814,11 @@ parameters when merging lists."
(pcase pair
(`(:var . ,value)
(let ((name (cond
+ ;; Default header arguments can accept lambda
+ ;; functions. We uniquely identify the var
+ ;; according to the full string contents of
+ ;; the lambda function.
+ ((functionp value) value)
((listp value) (car value))
((string-match "^\\([^= \f\t\n\r\v]+\\)[ \t]*=" value)
(intern (match-string 1 value)))
@@ -2745,10 +2854,17 @@ parameters when merging lists."
(setq exports (funcall merge
exports-exclusive-groups
exports
- (split-string
+ (split-string
(cond ((and value (functionp value)) (funcall value))
(value value)
(t ""))))))
+ ((or '(:dir . attach) '(:dir . "'attach"))
+ (unless (org-attach-dir nil t)
+ (error "No attachment directory for element (add :ID: or :DIR: property)"))
+ (setq params (append
+ `((:dir . ,(org-attach-dir nil t))
+ (:mkdirp . "yes"))
+ (assq-delete-all :dir (assq-delete-all :mkdir params)))))
;; Regular keywords: any value overwrites the previous one.
(_ (setq params (cons pair (assq-delete-all (car pair) params)))))))
;; Handle `:var' and clear out colnames and rownames for replaced
@@ -2776,12 +2892,17 @@ parameters when merging lists."
"Check if PARAMS require expansion in CONTEXT.
CONTEXT may be one of :tangle, :export or :eval."
(let ((allowed-values (cl-case context
- (:tangle '("yes" "tangle" "no-export" "strip-export"))
- (:eval '("yes" "no-export" "strip-export" "eval"))
- (:export '("yes")))))
+ (:tangle '("yes" "tangle" "no-export" "strip-export" "strip-tangle"))
+ (:eval '("yes" "no-export" "strip-export" "eval" "strip-tangle"))
+ (:export '("yes" "strip-tangle")))))
(cl-some (lambda (v) (member v allowed-values))
(split-string (or (cdr (assq :noweb params)) "")))))
+(defvar org-babel-expand-noweb-references--cache nil
+ "Noweb reference cache used during expansion.")
+(defvar org-babel-expand-noweb-references--cache-buffer nil
+ "Cons (BUFFER . MODIFIED-TICK) for cached noweb references.
+See `org-babel-expand-noweb-references--cache'.")
(defun org-babel-expand-noweb-references (&optional info parent-buffer)
"Expand Noweb references in the body of the current source code block.
@@ -2813,110 +2934,143 @@ would set the value of argument \"a\" equal to \"9\". Note that
these arguments are not evaluated in the current source-code
block but are passed literally to the \"example-block\"."
(let* ((parent-buffer (or parent-buffer (current-buffer)))
- (info (or info (org-babel-get-src-block-info 'light)))
+ (info (or info (org-babel-get-src-block-info 'no-eval)))
(lang (nth 0 info))
(body (nth 1 info))
(comment (string= "noweb" (cdr (assq :comments (nth 2 info)))))
+ (noweb-prefix (let ((v (assq :noweb-prefix (nth 2 info))))
+ (or (not v)
+ (and (org-not-nil (cdr v))
+ (not (equal (cdr v) "no"))))))
(noweb-re (format "\\(.*?\\)\\(%s\\)"
(with-current-buffer parent-buffer
- (org-babel-noweb-wrap))))
- (cache nil)
- (c-wrap
- (lambda (s)
- ;; Comment string S, according to LANG mode. Return new
- ;; string.
- (unless org-babel-tangle-uncomment-comments
- (with-temp-buffer
- (funcall (org-src-get-lang-mode lang))
- (comment-region (point)
- (progn (insert s) (point)))
- (org-trim (buffer-string))))))
- (expand-body
- (lambda (i)
- ;; Expand body of code represented by block info I.
- (let ((b (if (org-babel-noweb-p (nth 2 i) :eval)
- (org-babel-expand-noweb-references i)
- (nth 1 i))))
- (if (not comment) b
- (let ((cs (org-babel-tangle-comment-links i)))
- (concat (funcall c-wrap (car cs)) "\n"
- b "\n"
- (funcall c-wrap (cadr cs))))))))
- (expand-references
- (lambda (ref cache)
- (pcase (gethash ref cache)
- (`(,last . ,previous)
- ;; Ignore separator for last block.
- (let ((strings (list (funcall expand-body last))))
- (dolist (i previous)
- (let ((parameters (nth 2 i)))
- ;; Since we're operating in reverse order, first
- ;; push separator, then body.
- (push (or (cdr (assq :noweb-sep parameters)) "\n")
- strings)
- (push (funcall expand-body i) strings)))
- (mapconcat #'identity strings "")))
- ;; Raise an error about missing reference, or return the
- ;; empty string.
- ((guard (or org-babel-noweb-error-all-langs
- (member lang org-babel-noweb-error-langs)))
- (error "Cannot resolve %s (see `org-babel-noweb-error-langs')"
- (org-babel-noweb-wrap ref)))
- (_ "")))))
- (replace-regexp-in-string
- noweb-re
- (lambda (m)
- (with-current-buffer parent-buffer
- (save-match-data
- (let* ((prefix (match-string 1 m))
- (id (match-string 3 m))
- (evaluate (string-match-p "(.*)" id))
- (expansion
- (cond
- (evaluate
- ;; Evaluation can potentially modify the buffer
- ;; and invalidate the cache: reset it.
- (setq cache nil)
- (let ((raw (org-babel-ref-resolve id)))
- (if (stringp raw) raw (format "%S" raw))))
- ;; Return the contents of headlines literally.
- ((org-babel-ref-goto-headline-id id)
- (org-babel-ref-headline-body))
- ;; Look for a source block named SOURCE-NAME. If
- ;; found, assume it is unique; do not look after
- ;; `:noweb-ref' header argument.
- ((org-with-point-at 1
- (let ((r (org-babel-named-src-block-regexp-for-name id)))
- (and (re-search-forward r nil t)
- (not (org-in-commented-heading-p))
- (funcall expand-body
- (org-babel-get-src-block-info t))))))
- ;; Retrieve from the Library of Babel.
- ((nth 2 (assoc-string id org-babel-library-of-babel)))
- ;; All Noweb references were cached in a previous
- ;; run. Extract the information from the cache.
- ((hash-table-p cache)
- (funcall expand-references id cache))
- ;; Though luck. We go into the long process of
- ;; checking each source block and expand those
- ;; with a matching Noweb reference. Since we're
- ;; going to visit all source blocks in the
- ;; document, cache information about them as well.
- (t
- (setq cache (make-hash-table :test #'equal))
- (org-with-wide-buffer
- (org-babel-map-src-blocks nil
- (if (org-in-commented-heading-p)
- (org-forward-heading-same-level nil t)
- (let* ((info (org-babel-get-src-block-info t))
- (ref (cdr (assq :noweb-ref (nth 2 info)))))
- (push info (gethash ref cache))))))
- (funcall expand-references id cache)))))
- ;; Interpose PREFIX between every line.
- (mapconcat #'identity
- (split-string expansion "[\n\r]")
- (concat "\n" prefix))))))
- body t t 2)))
+ (org-babel-noweb-wrap)))))
+ (unless (equal (cons parent-buffer
+ (with-current-buffer parent-buffer
+ (buffer-chars-modified-tick)))
+ org-babel-expand-noweb-references--cache-buffer)
+ (setq org-babel-expand-noweb-references--cache nil
+ org-babel-expand-noweb-references--cache-buffer
+ (cons parent-buffer
+ (with-current-buffer parent-buffer
+ (buffer-chars-modified-tick)))))
+ (cl-macrolet ((c-wrap
+ (s)
+ ;; Comment string S, according to LANG mode. Return new
+ ;; string.
+ `(unless org-babel-tangle-uncomment-comments
+ (with-temp-buffer
+ (funcall (org-src-get-lang-mode lang))
+ (comment-region (point)
+ (progn (insert ,s) (point)))
+ (org-trim (buffer-string)))))
+ (expand-body
+ (i)
+ ;; Expand body of code represented by block info I.
+ `(let ((b (if (org-babel-noweb-p (nth 2 ,i) :eval)
+ (org-babel-expand-noweb-references ,i)
+ (nth 1 ,i))))
+ (if (not comment) b
+ (let ((cs (org-babel-tangle-comment-links ,i)))
+ (concat (c-wrap (car cs)) "\n"
+ b "\n"
+ (c-wrap (cadr cs)))))))
+ (expand-references
+ (ref)
+ `(pcase (gethash ,ref org-babel-expand-noweb-references--cache)
+ (`(,last . ,previous)
+ ;; Ignore separator for last block.
+ (let ((strings (list (expand-body last))))
+ (dolist (i previous)
+ (let ((parameters (nth 2 i)))
+ ;; Since we're operating in reverse order, first
+ ;; push separator, then body.
+ (push (or (cdr (assq :noweb-sep parameters)) "\n")
+ strings)
+ (push (expand-body i) strings)))
+ (mapconcat #'identity strings "")))
+ ;; Raise an error about missing reference, or return the
+ ;; empty string.
+ ((guard (or org-babel-noweb-error-all-langs
+ (member lang org-babel-noweb-error-langs)))
+ (error "Cannot resolve %s (see `org-babel-noweb-error-langs')"
+ (org-babel-noweb-wrap ,ref)))
+ (_ ""))))
+ (replace-regexp-in-string
+ noweb-re
+ (lambda (m)
+ (with-current-buffer parent-buffer
+ (save-match-data
+ (let* ((prefix (match-string 1 m))
+ (id (match-string 3 m))
+ (evaluate (string-match-p "(.*)" id))
+ (expansion
+ (cond
+ (evaluate
+ (prog1
+ (let ((raw (org-babel-ref-resolve id)))
+ (if (stringp raw) raw (format "%S" raw)))
+ ;; Evaluation can potentially modify the buffer
+ ;; and invalidate the cache: reset it.
+ (unless (equal org-babel-expand-noweb-references--cache-buffer
+ (cons parent-buffer
+ (buffer-chars-modified-tick)))
+ (setq org-babel-expand-noweb-references--cache nil
+ org-babel-expand-noweb-references--cache-buffer
+ (cons parent-buffer
+ (with-current-buffer parent-buffer
+ (buffer-chars-modified-tick)))))))
+ ;; Already cached.
+ ((and (hash-table-p org-babel-expand-noweb-references--cache)
+ (gethash id org-babel-expand-noweb-references--cache))
+ (expand-references id))
+ ;; Return the contents of headlines literally.
+ ((org-babel-ref-goto-headline-id id)
+ (org-babel-ref-headline-body))
+ ;; Look for a source block named SOURCE-NAME. If
+ ;; found, assume it is unique; do not look after
+ ;; `:noweb-ref' header argument.
+ ((org-with-point-at 1
+ (let ((r (org-babel-named-src-block-regexp-for-name id)))
+ (and (re-search-forward r nil t)
+ (not (org-in-commented-heading-p))
+ (let ((info (org-babel-get-src-block-info t)))
+ (unless (hash-table-p org-babel-expand-noweb-references--cache)
+ (setq org-babel-expand-noweb-references--cache (make-hash-table :test #'equal)))
+ (push info (gethash id org-babel-expand-noweb-references--cache))
+ (expand-body info))))))
+ ;; Retrieve from the Library of Babel.
+ ((nth 2 (assoc-string id org-babel-library-of-babel)))
+ ;; All Noweb references were cached in a previous
+ ;; run. Yet, ID is not in cache (see the above
+ ;; condition). Process missing reference in
+ ;; `expand-references'.
+ ((and (hash-table-p org-babel-expand-noweb-references--cache)
+ (gethash 'buffer-processed org-babel-expand-noweb-references--cache))
+ (expand-references id))
+ ;; Though luck. We go into the long process of
+ ;; checking each source block and expand those
+ ;; with a matching Noweb reference. Since we're
+ ;; going to visit all source blocks in the
+ ;; document, cache information about them as well.
+ (t
+ (setq org-babel-expand-noweb-references--cache (make-hash-table :test #'equal))
+ (org-with-wide-buffer
+ (org-babel-map-src-blocks nil
+ (if (org-in-commented-heading-p)
+ (org-forward-heading-same-level nil t)
+ (let* ((info (org-babel-get-src-block-info t))
+ (ref (cdr (assq :noweb-ref (nth 2 info)))))
+ (push info (gethash ref org-babel-expand-noweb-references--cache))))))
+ (puthash 'buffer-processed t org-babel-expand-noweb-references--cache)
+ (expand-references id)))))
+ ;; Interpose PREFIX between every line.
+ (if noweb-prefix
+ (mapconcat #'identity
+ (split-string expansion "[\n\r]")
+ (concat "\n" prefix))
+ expansion)))))
+ body t t 2))))
(defun org-babel--script-escape-inner (str)
(let (in-single in-double backslash out)
@@ -2988,7 +3142,7 @@ block but are passed literally to the \"example-block\"."
(error "`org-babel-script-escape' expects a string"))
(let ((escaped
(cond
- ((and (> (length str) 2)
+ ((and (>= (length str) 2)
(or (and (string-equal "[" (substring str 0 1))
(string-equal "]" (substring str -1)))
(and (string-equal "{" (substring str 0 1))
@@ -3023,8 +3177,20 @@ situations in which is it not appropriate."
((and (not inhibit-lisp-eval)
(or (memq (string-to-char cell) '(?\( ?' ?` ?\[))
(string= cell "*this*")))
- (eval (read cell) t))
- ((eq (string-to-char cell) ?\") (read cell))
+ ;; Prevent arbitrary function calls.
+ (if (and (memq (string-to-char cell) '(?\( ?`))
+ (not (org-babel-confirm-evaluate
+ ;; See `org-babel-get-src-block-info'.
+ (list "emacs-lisp" (format "%S" cell)
+ '((:eval . yes)) nil (format "%S" cell)
+ nil nil))))
+ ;; Not allowed.
+ (user-error "Evaluation of elisp code %S aborted." cell)
+ (eval (read cell) t)))
+ ((save-match-data
+ (and (string-match "^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$" cell)
+ (not (string-match "[^\\]\"" (match-string 1 cell)))))
+ (read cell))
(t (org-no-properties cell))))
(defun org-babel--string-to-number (string)
@@ -3069,7 +3235,7 @@ If the table is trivial, then return it as a scalar."
(defun org-babel-string-read (cell)
"Strip nested \"s from around strings."
(org-babel-read (or (and (stringp cell)
- (string-match "\"\\(.+\\)\"" cell)
+ (string-match "^[[:space:]]*\"\\(.+\\)\"[[:space:]]*$" cell)
(match-string 1 cell))
cell) t))
@@ -3093,16 +3259,25 @@ additionally processed by `shell-quote-argument'."
(let ((f (org-babel-local-file-name (expand-file-name name))))
(if no-quote-p f (shell-quote-argument f))))
-(defvar org-babel-temporary-directory)
-(unless (or noninteractive (boundp 'org-babel-temporary-directory))
- (defvar org-babel-temporary-directory
- (or (and (boundp 'org-babel-temporary-directory)
- (file-exists-p org-babel-temporary-directory)
- org-babel-temporary-directory)
- (make-temp-file "babel-" t))
- "Directory to hold temporary files created to execute code blocks.
+(defvar org-babel-temporary-directory
+ (unless noninteractive
+ (make-temp-file "babel-" t))
+ "Directory to hold temporary files created to execute code blocks.
+Used by `org-babel-temp-file'. This directory will be removed on
+Emacs shutdown.")
+
+(defvar org-babel-temporary-stable-directory
+ (unless noninteractive
+ (let (dir)
+ (while (or (not dir) (file-exists-p dir))
+ (setq dir (expand-file-name
+ (format "babel-stable-%d" (random 1000))
+ (temporary-file-directory))))
+ (make-directory dir)
+ dir))
+ "Directory to hold temporary files created to execute code blocks.
Used by `org-babel-temp-file'. This directory will be removed on
-Emacs shutdown."))
+Emacs shutdown.")
(defcustom org-babel-remote-temporary-directory "/tmp/"
"Directory to hold temporary files on remote hosts."
@@ -3114,14 +3289,14 @@ Emacs shutdown."))
(declare (indent 1) (debug t))
(org-with-gensyms (params)
`(let ((,params ,result-params))
- (unless (member "none" ,params)
- (if (or (member "scalar" ,params)
- (member "verbatim" ,params)
- (member "html" ,params)
- (member "code" ,params)
- (member "pp" ,params)
- (member "file" ,params)
- (and (or (member "output" ,params)
+ (unless (member "discard" ,params)
+ (if (or (member "scalar" ,params)
+ (member "verbatim" ,params)
+ (member "html" ,params)
+ (member "code" ,params)
+ (member "pp" ,params)
+ (member "file" ,params)
+ (and (or (member "output" ,params)
(member "raw" ,params)
(member "org" ,params)
(member "drawer" ,params))
@@ -3129,27 +3304,50 @@ Emacs shutdown."))
,scalar-form
,@table-forms)))))
+(defmacro org-babel-temp-directory ()
+ "Return temporary directory suitable for `default-directory'."
+ `(if (file-remote-p default-directory)
+ (concat (file-remote-p default-directory)
+ org-babel-remote-temporary-directory)
+ (or (and org-babel-temporary-directory
+ (file-exists-p org-babel-temporary-directory)
+ org-babel-temporary-directory)
+ temporary-file-directory)))
+
(defun org-babel-temp-file (prefix &optional suffix)
"Create a temporary file in the `org-babel-temporary-directory'.
Passes PREFIX and SUFFIX directly to `make-temp-file' with the
value of `temporary-file-directory' temporarily set to the value
of `org-babel-temporary-directory'."
- (if (file-remote-p default-directory)
- (let ((prefix
- (concat (file-remote-p default-directory)
- (expand-file-name
- prefix org-babel-remote-temporary-directory))))
- (make-temp-file prefix nil suffix))
- (let ((temporary-file-directory
- (or (and (boundp 'org-babel-temporary-directory)
- (file-exists-p org-babel-temporary-directory)
- org-babel-temporary-directory)
- temporary-file-directory)))
- (make-temp-file prefix nil suffix))))
+ (make-temp-file
+ (concat (file-name-as-directory (org-babel-temp-directory)) prefix)
+ nil
+ suffix))
+
+(defmacro org-babel-temp-stable-directory ()
+ "Return temporary stable directory."
+ `(let ((org-babel-temporary-directory org-babel-temporary-stable-directory))
+ (org-babel-temp-directory)))
+
+(defun org-babel-temp-stable-file (data prefix &optional suffix)
+ "Create a temporary file in the `org-babel-remove-temporary-stable-directory'.
+The file name is stable with respect to DATA. The file name is
+constructed like the following: PREFIXDATAhashSUFFIX."
+ (let ((path
+ (format
+ "%s%s%s%s"
+ (file-name-as-directory (org-babel-temp-stable-directory))
+ prefix
+ (sxhash data)
+ (or suffix ""))))
+ ;; Create file.
+ (with-temp-file path)
+ ;; Return it.
+ path))
(defun org-babel-remove-temporary-directory ()
"Remove `org-babel-temporary-directory' on Emacs shutdown."
- (when (and (boundp 'org-babel-temporary-directory)
+ (when (and org-babel-temporary-directory
(file-exists-p org-babel-temporary-directory))
;; taken from `delete-directory' in files.el
(condition-case nil
@@ -3166,11 +3364,19 @@ of `org-babel-temporary-directory'."
(delete-directory org-babel-temporary-directory))
(error
(message "Failed to remove temporary Org-babel directory %s"
- (if (boundp 'org-babel-temporary-directory)
- org-babel-temporary-directory
- "[directory not defined]"))))))
+ (or org-babel-temporary-directory
+ "[directory not defined]"))))))
+
+(defun org-babel-remove-temporary-stable-directory ()
+ "Remove `org-babel-temporary-stable-directory' and on Emacs shutdown."
+ (when (and org-babel-temporary-stable-directory
+ (file-exists-p org-babel-temporary-stable-directory))
+ (let ((org-babel-temporary-directory
+ org-babel-temporary-stable-directory))
+ (org-babel-remove-temporary-directory))))
(add-hook 'kill-emacs-hook #'org-babel-remove-temporary-directory)
+(add-hook 'kill-emacs-hook #'org-babel-remove-temporary-stable-directory)
(defun org-babel-one-header-arg-safe-p (pair safe-list)
"Determine if the PAIR is a safe babel header arg according to SAFE-LIST.
diff --git a/lisp/org/ob-css.el b/lisp/org/ob-css.el
index 51efbb7d944..c132cb2c77b 100644
--- a/lisp/org/ob-css.el
+++ b/lisp/org/ob-css.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,6 +27,10 @@
;; CSS from Org files.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-default-header-args:css '())
diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el
index 20b5ce1fdb9..1f82aea6be4 100644
--- a/lisp/org/ob-ditaa.el
+++ b/lisp/org/ob-ditaa.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -36,6 +36,10 @@
;; 4) there are no variables (at least for now)
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-compat)
diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el
index b82a079b4c4..2d2003bf539 100644
--- a/lisp/org/ob-dot.el
+++ b/lisp/org/ob-dot.el
@@ -3,9 +3,9 @@
;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
;; Author: Eric Schulte
-;; Maintainer: Justin Abrahms
+;; Maintainer: Justin Abrahms <justin@abrah.ms>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -39,6 +39,10 @@
;; 4) there are no variables (at least for now)
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-default-header-args:dot
diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el
index 730eff69e8b..b8e6ef29854 100644
--- a/lisp/org/ob-emacs-lisp.el
+++ b/lisp/org/ob-emacs-lisp.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,6 +27,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob-core)
(declare-function org-babel--get-vars "ob" (params))
@@ -55,7 +58,7 @@ by `org-edit-src-code'.")
(format "(let (%s)\n%s\n)"
(mapconcat
(lambda (var)
- (format "%S" (print `(,(car var) ',(cdr var)))))
+ (format "%S" `(,(car var) ',(cdr var))))
vars "\n ")
body))))
diff --git a/lisp/org/ob-eshell.el b/lisp/org/ob-eshell.el
index 135deb4a4b8..937db69dc5a 100644
--- a/lisp/org/ob-eshell.el
+++ b/lisp/org/ob-eshell.el
@@ -4,7 +4,7 @@
;; Author: stardiviner <numbchild@gmail.com>
;; Maintainer: stardiviner <numbchild@gmail.com>
-;; Homepage: https://github.com/stardiviner/ob-eshell
+;; URL: https://github.com/stardiviner/ob-eshell
;; Keywords: literate programming, reproducible research
;; This file is part of GNU Emacs.
@@ -27,6 +27,10 @@
;; Org Babel support for evaluating Eshell source code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'eshell)
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index be1ba549122..f57566079d7 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research, comint
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,7 +27,11 @@
;; shell commands.
;;; Code:
+
(require 'org-macs)
+(org-assert-version)
+
+(eval-when-compile (require 'subr-x)) ; For `string-empty-p', Emacs < 29
(defvar org-babel-error-buffer-name "*Org-Babel Error Output*")
(declare-function org-babel-temp-file "ob-core" (prefix &optional suffix))
@@ -37,36 +41,45 @@
(let ((buf (get-buffer-create org-babel-error-buffer-name)))
(with-current-buffer buf
(goto-char (point-max))
- (save-excursion (insert stderr)))
+ (save-excursion
+ (unless (bolp) (insert "\n"))
+ (insert stderr)
+ (insert (format "[ Babel evaluation exited with code %S ]" exit-code))))
(display-buffer buf))
(message "Babel evaluation exited with code %S" exit-code))
(defun org-babel-eval (command query)
"Run COMMAND on QUERY.
+Return standard output produced by COMMAND. If COMMAND exits
+with a non-zero code or produces error output, show it with
+`org-babel-eval-error-notify'.
+
Writes QUERY into a temp-buffer that is processed with
-`org-babel--shell-command-on-region'. If COMMAND succeeds then return
-its results, otherwise display STDERR with
-`org-babel-eval-error-notify'."
+`org-babel--shell-command-on-region'."
(let ((error-buffer (get-buffer-create " *Org-Babel Error*")) exit-code)
(with-current-buffer error-buffer (erase-buffer))
(with-temp-buffer
(insert query)
(setq exit-code
- (org-babel--shell-command-on-region
- command error-buffer))
- (if (or (not (numberp exit-code)) (> exit-code 0))
- (progn
- (with-current-buffer error-buffer
- (org-babel-eval-error-notify exit-code (buffer-string)))
- (save-excursion
- (when (get-buffer org-babel-error-buffer-name)
- (with-current-buffer org-babel-error-buffer-name
- (unless (derived-mode-p 'compilation-mode)
- (compilation-mode))
- ;; Compilation-mode enforces read-only, but Babel expects the buffer modifiable.
- (setq buffer-read-only nil))))
- nil)
- (buffer-string)))))
+ (org-babel--shell-command-on-region
+ command error-buffer))
+ (let ((stderr (with-current-buffer error-buffer (buffer-string))))
+ (if (or (not (numberp exit-code))
+ (> exit-code 0)
+ (not (string-empty-p stderr)))
+ (progn
+ (org-babel-eval-error-notify exit-code stderr)
+ (save-excursion
+ (when (get-buffer org-babel-error-buffer-name)
+ (with-current-buffer org-babel-error-buffer-name
+ (unless (derived-mode-p 'compilation-mode)
+ (compilation-mode))
+ ;; Compilation-mode enforces read-only, but
+ ;; Babel expects the buffer modifiable.
+ (setq buffer-read-only nil))))
+ ;; Return output, if any.
+ (buffer-string))
+ (buffer-string))))))
(defun org-babel-eval-read-file (file)
"Return the contents of FILE as a string."
@@ -146,7 +159,8 @@ This buffer is named by `org-babel-error-buffer-name'."
"Return system `shell-file-name', defaulting to /bin/sh.
Unfortunately, `executable-find' does not support file name
handlers. Therefore, we could use it in the local case only."
- ;; FIXME: This is generic enough that it should probably be in emacs, not org-mode
+ ;; FIXME: Since Emacs 27, `executable-find' accepts optional second
+ ;; argument supporting remote hosts.
(cond ((and (not (file-remote-p default-directory))
(executable-find shell-file-name))
shell-file-name)
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index d41c40c8daf..60f2a931588 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -5,7 +5,7 @@
;; Authors: Eric Schulte
;; Dan Davison
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -23,17 +23,24 @@
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob-core)
-(declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-babel-lob-get-info "ob-lob" (&optional datum no-eval))
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
(declare-function org-escape-code-in-string "org-src" (s))
-(declare-function org-export-copy-buffer "ox" ())
-(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
-(declare-function org-in-archived-heading-p "org" (&optional no-inheritance))
+(declare-function org-export-copy-buffer "ox"
+ (&optional buffer drop-visibility
+ drop-narrowing drop-contents
+ drop-locals))
+(declare-function org-in-commented-heading-p "org" (&optional no-inheritance element))
+(declare-function org-in-archived-heading-p "org" (&optional no-inheritance element))
(defvar org-src-preserve-indentation)
@@ -66,7 +73,7 @@ point is at the beginning of the Babel block."
(when source (goto-char source))
,@body))))
-(defun org-babel-exp-src-block ()
+(defun org-babel-exp-src-block (&optional element)
"Process source block for export.
Depending on the \":export\" header argument, replace the source
code block like this:
@@ -81,10 +88,12 @@ results - just like none only the block is run on export ensuring
none ---- do not display either code or results upon export
+Optional argument ELEMENT must contain source block element at point.
+
Assume point is at block opening line."
(interactive)
(save-excursion
- (let* ((info (org-babel-get-src-block-info))
+ (let* ((info (org-babel-get-src-block-info nil element))
(lang (nth 0 info))
(raw-params (nth 2 info))
hash)
@@ -137,7 +146,8 @@ this template."
;; Get a pristine copy of current buffer so Babel
;; references are properly resolved and source block
;; context is preserved.
- (org-babel-exp-reference-buffer (org-export-copy-buffer)))
+ (org-babel-exp-reference-buffer (org-export-copy-buffer))
+ element)
(unwind-protect
(save-excursion
;; First attach to every source block their original
@@ -157,133 +167,167 @@ this template."
;; Evaluate from top to bottom every Babel block
;; encountered.
(goto-char (point-min))
- (while (re-search-forward regexp nil t)
- (unless (save-match-data (or (org-in-commented-heading-p)
- (org-in-archived-heading-p)))
- (let* ((object? (match-end 1))
- (element (save-match-data
- (if object? (org-element-context)
- ;; No deep inspection if we're
- ;; just looking for an element.
- (org-element-at-point))))
- (type
- (pcase (org-element-type element)
- ;; Discard block elements if we're looking
- ;; for inline objects. False results
- ;; happen when, e.g., "call_" syntax is
- ;; located within affiliated keywords:
- ;;
- ;; #+name: call_src
- ;; #+begin_src ...
- ((and (or `babel-call `src-block) (guard object?))
- nil)
- (type type)))
- (begin
- (copy-marker (org-element-property :begin element)))
- (end
- (copy-marker
- (save-excursion
- (goto-char (org-element-property :end element))
- (skip-chars-backward " \r\t\n")
- (point)))))
- (pcase type
- (`inline-src-block
- (let* ((info
- (org-babel-get-src-block-info nil element))
- (params (nth 2 info)))
- (setf (nth 1 info)
- (if (and (cdr (assq :noweb params))
- (string= "yes"
- (cdr (assq :noweb params))))
- (org-babel-expand-noweb-references
- info org-babel-exp-reference-buffer)
- (nth 1 info)))
- (goto-char begin)
- (let ((replacement
- (org-babel-exp-do-export info 'inline)))
- (if (equal replacement "")
- ;; Replacement code is empty: remove
- ;; inline source block, including extra
- ;; white space that might have been
- ;; created when inserting results.
- (delete-region begin
- (progn (goto-char end)
- (skip-chars-forward " \t")
- (point)))
- ;; Otherwise: remove inline source block
- ;; but preserve following white spaces.
- ;; Then insert value.
- (delete-region begin end)
- (insert replacement)))))
- ((or `babel-call `inline-babel-call)
- (org-babel-exp-do-export
- (or (org-babel-lob-get-info element)
- (user-error "Unknown Babel reference: %s"
- (org-element-property :call element)))
- 'lob)
- (let ((rep
- (org-fill-template
- org-babel-exp-call-line-template
- `(("line" .
- ,(org-element-property :value element))))))
- ;; If replacement is empty, completely remove
- ;; the object/element, including any extra
- ;; white space that might have been created
- ;; when including results.
- (if (equal rep "")
- (delete-region
- begin
- (progn (goto-char end)
- (if (not (eq type 'babel-call))
- (progn (skip-chars-forward " \t")
- (point))
- (skip-chars-forward " \r\t\n")
- (line-beginning-position))))
- ;; Otherwise, preserve trailing
- ;; spaces/newlines and then, insert
- ;; replacement string.
+ ;; We are about to do a large number of changes in
+ ;; buffer, but we do not care about folding in this
+ ;; buffer.
+ (org-fold-core-ignore-modifications
+ (while (re-search-forward regexp nil t)
+ (setq element (org-element-at-point))
+ (unless (save-match-data
+ (or (org-in-commented-heading-p nil element)
+ (org-in-archived-heading-p nil element)))
+ (let* ((object? (match-end 1))
+ (element (save-match-data
+ (if object?
+ (org-element-context element)
+ ;; No deep inspection if we're
+ ;; just looking for an element.
+ element)))
+ (type
+ (pcase (org-element-type element)
+ ;; Discard block elements if we're looking
+ ;; for inline objects. False results
+ ;; happen when, e.g., "call_" syntax is
+ ;; located within affiliated keywords:
+ ;;
+ ;; #+name: call_src
+ ;; #+begin_src ...
+ ((and (or `babel-call `src-block) (guard object?))
+ nil)
+ (type type)))
+ (begin
+ (copy-marker (org-element-property :begin element)))
+ (end
+ (copy-marker
+ (save-excursion
+ (goto-char (org-element-property :end element))
+ (skip-chars-backward " \r\t\n")
+ (point)))))
+ (pcase type
+ (`inline-src-block
+ (let* ((info
+ (org-babel-get-src-block-info nil element))
+ (params (nth 2 info)))
+ (setf (nth 1 info)
+ (if (and (cdr (assq :noweb params))
+ (string= "yes"
+ (cdr (assq :noweb params))))
+ (org-babel-expand-noweb-references
+ info org-babel-exp-reference-buffer)
+ (nth 1 info)))
(goto-char begin)
- (delete-region begin end)
- (insert rep))))
- (`src-block
- (let ((match-start (copy-marker (match-beginning 0)))
- (ind (current-indentation)))
- ;; Take care of matched block: compute
- ;; replacement string. In particular, a nil
- ;; REPLACEMENT means the block is left as-is
- ;; while an empty string removes the block.
- (let ((replacement
- (progn (goto-char match-start)
- (org-babel-exp-src-block))))
- (cond ((not replacement) (goto-char end))
- ((equal replacement "")
- (goto-char end)
- (skip-chars-forward " \r\t\n")
- (beginning-of-line)
- (delete-region begin (point)))
- (t
- (goto-char match-start)
- (delete-region (point)
- (save-excursion
- (goto-char end)
- (line-end-position)))
- (insert replacement)
- (if (or org-src-preserve-indentation
- (org-element-property
- :preserve-indent element))
- ;; Indent only code block
- ;; markers.
- (save-excursion
- (skip-chars-backward " \r\t\n")
- (indent-line-to ind)
- (goto-char match-start)
- (indent-line-to ind))
- ;; Indent everything.
- (indent-rigidly
- match-start (point) ind)))))
- (set-marker match-start nil))))
- (set-marker begin nil)
- (set-marker end nil)))))
+ (let ((replacement
+ (org-babel-exp-do-export info 'inline)))
+ (if (equal replacement "")
+ ;; Replacement code is empty: remove
+ ;; inline source block, including extra
+ ;; white space that might have been
+ ;; created when inserting results.
+ (delete-region begin
+ (progn (goto-char end)
+ (skip-chars-forward " \t")
+ (point)))
+ ;; Otherwise: remove inline source block
+ ;; but preserve following white spaces.
+ ;; Then insert value.
+ (unless (string= replacement
+ (buffer-substring begin end))
+ (delete-region begin end)
+ (insert replacement))))))
+ ((or `babel-call `inline-babel-call)
+ (org-babel-exp-do-export
+ (or (org-babel-lob-get-info element)
+ (user-error "Unknown Babel reference: %s"
+ (org-element-property :call element)))
+ 'lob)
+ (let ((rep
+ (org-fill-template
+ org-babel-exp-call-line-template
+ `(("line" .
+ ,(org-element-property :value element))))))
+ ;; If replacement is empty, completely remove
+ ;; the object/element, including any extra
+ ;; white space that might have been created
+ ;; when including results.
+ (if (equal rep "")
+ (delete-region
+ begin
+ (progn (goto-char end)
+ (if (not (eq type 'babel-call))
+ (progn (skip-chars-forward " \t")
+ (point))
+ (skip-chars-forward " \r\t\n")
+ (line-beginning-position))))
+ ;; Otherwise, preserve trailing
+ ;; spaces/newlines and then, insert
+ ;; replacement string.
+ (goto-char begin)
+ (delete-region begin end)
+ (insert rep))))
+ (`src-block
+ (let ((match-start (copy-marker (match-beginning 0)))
+ (ind (org-current-text-indentation)))
+ ;; Take care of matched block: compute
+ ;; replacement string. In particular, a nil
+ ;; REPLACEMENT means the block is left as-is
+ ;; while an empty string removes the block.
+ (let ((replacement
+ (progn (goto-char match-start)
+ (org-babel-exp-src-block element))))
+ (cond ((not replacement) (goto-char end))
+ ((equal replacement "")
+ (goto-char end)
+ (skip-chars-forward " \r\t\n")
+ (beginning-of-line)
+ (delete-region begin (point)))
+ (t
+ (if (or org-src-preserve-indentation
+ (org-element-property
+ :preserve-indent element))
+ ;; Indent only code block
+ ;; markers.
+ (with-temp-buffer
+ ;; Do not use tabs for block
+ ;; indentation.
+ (when (fboundp 'indent-tabs-mode)
+ (indent-tabs-mode -1)
+ ;; FIXME: Emacs 26
+ ;; compatibility.
+ (setq-local indent-tabs-mode nil))
+ (insert replacement)
+ (skip-chars-backward " \r\t\n")
+ (indent-line-to ind)
+ (goto-char 1)
+ (indent-line-to ind)
+ (setq replacement (buffer-string)))
+ ;; Indent everything.
+ (with-temp-buffer
+ ;; Do not use tabs for block
+ ;; indentation.
+ (when (fboundp 'indent-tabs-mode)
+ (indent-tabs-mode -1)
+ ;; FIXME: Emacs 26
+ ;; compatibility.
+ (setq-local indent-tabs-mode nil))
+ (insert replacement)
+ (indent-rigidly
+ 1 (point) ind)
+ (setq replacement (buffer-string))))
+ (goto-char match-start)
+ (let ((rend (save-excursion
+ (goto-char end)
+ (line-end-position))))
+ (if (string-equal replacement
+ (buffer-substring match-start rend))
+ (goto-char rend)
+ (delete-region match-start
+ (save-excursion
+ (goto-char end)
+ (line-end-position)))
+ (insert replacement))))))
+ (set-marker match-start nil))))
+ (set-marker begin nil)
+ (set-marker end nil))))))
(kill-buffer org-babel-exp-reference-buffer)
(remove-text-properties (point-min) (point-max)
'(org-reference nil)))))))
@@ -306,7 +350,7 @@ The function respects the value of the :exports header argument."
(org-babel-exp-code info type)))))
(defcustom org-babel-exp-code-template
- "#+BEGIN_SRC %lang%switches%flags\n%body\n#+END_SRC"
+ "#+begin_src %lang%switches%flags\n%body\n#+end_src"
"Template used to export the body of code blocks.
This template may be customized to include additional information
such as the code block name, or the values of particular header
@@ -323,7 +367,8 @@ In addition to the keys mentioned above, every header argument
defined for the code block may be used as a key and will be
replaced with its value."
:group 'org-babel
- :type 'string)
+ :type 'string
+ :package-version '(Org . "9.6"))
(defcustom org-babel-exp-inline-code-template
"src_%lang[%switches%flags]{%body}"
diff --git a/lisp/org/ob-forth.el b/lisp/org/ob-forth.el
index 53088b07060..a67d3384f60 100644
--- a/lisp/org/ob-forth.el
+++ b/lisp/org/ob-forth.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research, forth
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -32,6 +32,10 @@
;; `forth-mode' which is distributed with gforth (in gforth.el).
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 9c49aa887c4..ad84314fcfb 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -5,7 +5,7 @@
;; Authors: Sergey Litvinov
;; Eric Schulte
;; Keywords: literate programming, reproducible research, fortran
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
;;
@@ -27,6 +27,10 @@
;; Org-Babel support for evaluating fortran code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
(require 'cc-mode)
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el
index 895738822de..59913e70fc6 100644
--- a/lisp/org/ob-gnuplot.el
+++ b/lisp/org/ob-gnuplot.el
@@ -5,7 +5,7 @@
;; Author: Eric Schulte
;; Maintainer: Ihor Radchenko <yantar92@gmail.com>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -39,6 +39,10 @@
;; - gnuplot-mode :: you can search the web for the latest active one.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
@@ -94,12 +98,15 @@ code."
(let* ((first (car val))
(tablep (or (listp first) (symbolp first))))
(if tablep val (mapcar 'list val)))
- (org-babel-temp-file "gnuplot-") params)
+ ;; Make temporary file name stable with respect to data.
+ ;; If we do not do it, :cache argument becomes useless.
+ (org-babel-temp-stable-file (cons val params) "gnuplot-")
+ params)
(if (and (stringp val)
(file-remote-p val) ;; check if val is a remote file
(file-exists-p val)) ;; call to file-exists-p is slow, maybe remove it
(let* ((local-name (concat ;; create a unique filename to avoid multiple downloads
- org-babel-temporary-directory
+ (org-babel-temp-directory)
"/gnuplot/"
(file-remote-p val 'host)
(org-babel-local-file-name val))))
@@ -135,8 +142,7 @@ code."
(timefmt (cdr (assq :timefmt params)))
(time-ind (or (cdr (assq :timeind params))
(when timefmt 1)))
- (directory (and (buffer-file-name)
- (file-name-directory (buffer-file-name))))
+ (directory default-directory)
(add-to-body (lambda (text) (setq body (concat text "\n" body)))))
;; append header argument settings to body
(when missing (funcall add-to-body (format "set datafile missing '%s'" missing)))
diff --git a/lisp/org/ob-groovy.el b/lisp/org/ob-groovy.el
index e0e2f2cd2e8..f1689ef12d6 100644
--- a/lisp/org/ob-groovy.el
+++ b/lisp/org/ob-groovy.el
@@ -2,10 +2,10 @@
;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
-;; Author: Miro Bezjak
-;; Maintainer: Palak Mathur
+;; Author: Miro Bezjak <bezjak.miro@gmail.com>
+;; Maintainer: Palak Mathur <palakmathur@gmail.com>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -31,6 +31,10 @@
;; https://github.com/russel/Emacs-Groovy-Mode
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-tangle-lang-exts) ;; Autoloaded
@@ -48,7 +52,7 @@ parameters may be used, like groovy -v"
(defun org-babel-execute:groovy (body params)
"Execute a block of Groovy code with org-babel.
This function is called by `org-babel-execute-src-block'."
- (message "executing Groovy source code block")
+ (message "Executing Groovy source code block")
(let* ((processed-params (org-babel-process-params params))
(session (org-babel-groovy-initiate-session (nth 0 processed-params)))
(result-params (nth 2 processed-params))
diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index 45f70fa878e..095286c79aa 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -5,7 +5,7 @@
;; Author: Eric Schulte
;; Maintainer: Lawrence Bottorff <borgauf@gmail.com>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -39,6 +39,10 @@
;; - (optionally) lhs2tex: https://people.cs.uu.nl/andres/lhs2tex/
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
(require 'comint)
@@ -132,7 +136,7 @@ a parameter, such as \"ghc -v\"."
(comint-preoutput-filter-functions
(cons 'ansi-color-filter-apply comint-preoutput-filter-functions))
(raw (org-babel-comint-with-output
- (session org-babel-haskell-eoe t full-body)
+ (session org-babel-haskell-eoe nil full-body)
(insert (org-trim full-body))
(comint-send-input nil t)
(insert org-babel-haskell-eoe)
@@ -146,7 +150,7 @@ a parameter, such as \"ghc -v\"."
(`output (mapconcat #'identity (reverse results) "\n"))
(`value (car results)))))
(org-babel-result-cond (cdr (assq :result-params params))
- result (org-babel-script-escape result)))
+ result (when result (org-babel-script-escape result))))
(org-babel-pick-name (cdr (assq :colname-names params))
(cdr (assq :colname-names params)))
(org-babel-pick-name (cdr (assq :rowname-names params))
diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el
index 0f6faf446f1..59bd487880d 100644
--- a/lisp/org/ob-java.el
+++ b/lisp/org/ob-java.el
@@ -6,7 +6,7 @@
;; Dan Davison
;; Maintainer: Ian Martins <ianxm@jhu.edu>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -28,6 +28,10 @@
;; Org-Babel support for evaluating java source code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-tangle-lang-exts)
@@ -49,7 +53,13 @@ directory, so we keep that as the default behavior.
[1] https://orgmode.org/manual/Results-of-Evaluation.html")
-(defconst org-babel-header-args:java '((imports . :any))
+(defconst org-babel-header-args:java
+ '((dir . :any)
+ (classname . :any)
+ (imports . :any)
+ (cmpflag . :any)
+ (cmdline . :any)
+ (cmdarg . :any))
"Java-specific header arguments.")
(defcustom org-babel-java-command "java"
@@ -184,13 +194,10 @@ replaced in this string.")
(packagename (if (string-match-p "\\." fullclassname)
(file-name-base fullclassname)))
;; the base dir that contains the top level package dir
- (basedir (file-name-as-directory (if run-from-temp
- (if (file-remote-p default-directory)
- (concat
- (file-remote-p default-directory)
- org-babel-remote-temporary-directory)
- org-babel-temporary-directory)
- default-directory)))
+ (basedir (file-name-as-directory
+ (if run-from-temp
+ (org-babel-temp-directory)
+ default-directory)))
;; the dir to write the source file
(packagedir (if (and (not run-from-temp) packagename)
(file-name-as-directory
diff --git a/lisp/org/ob-js.el b/lisp/org/ob-js.el
index 4bb379b0b8a..04eb77bd4ae 100644
--- a/lisp/org/ob-js.el
+++ b/lisp/org/ob-js.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research, js
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -38,6 +38,10 @@
;; configuration instructions
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(declare-function run-mozilla "ext:moz" (arg))
diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el
index de69f25fc30..314d24596f4 100644
--- a/lisp/org/ob-julia.el
+++ b/lisp/org/ob-julia.el
@@ -4,7 +4,7 @@
;; Authors: G. Jay Kerns
;; Maintainer: Pedro Bruel <pedro.bruel@gmail.com>
;; Keywords: literate programming, reproducible research, scientific computing
-;; Homepage: https://github.com/phrb/ob-julia
+;; URL: https://github.com/phrb/ob-julia
;; This file is part of GNU Emacs.
@@ -31,6 +31,10 @@
;; Julia packages.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ob)
diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el
index 7253803af9e..332ace765bb 100644
--- a/lisp/org/ob-latex.el
+++ b/lisp/org/ob-latex.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -30,6 +30,10 @@
;; be created directly form the latex source code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
@@ -37,6 +41,9 @@
(declare-function org-latex-compile "ox-latex" (texfile &optional snippet))
(declare-function org-latex-guess-inputenc "ox-latex" (header))
(declare-function org-splice-latex-header "org" (tpl def-pkg pkg snippets-p &optional extra))
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
(defvar org-babel-tangle-lang-exts)
(add-to-list 'org-babel-tangle-lang-exts '("latex" . "tex"))
@@ -61,7 +68,6 @@
(pdfpng . :any)
(pdfwidth . :any)
(headers . :any)
- (packages . :any)
(buffer . ((yes no))))
"LaTeX-specific header arguments.")
@@ -104,10 +110,17 @@ exporting the literal LaTeX source."
:type 'function)
(defcustom org-babel-latex-pdf-svg-process
- "inkscape --pdf-poppler %f -T -l -o %O"
+ "inkscape \
+--pdf-poppler \
+--export-area-drawing \
+--export-text-to-path \
+--export-plain-svg \
+--export-filename=%O \
+%f"
"Command to convert a PDF file to an SVG file."
:group 'org-babel
- :type 'string)
+ :type 'string
+ :package-version '(Org . "9.6"))
(defcustom org-babel-latex-htlatex-packages
'("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}")
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el
index f1ea803ba31..d8016641ceb 100644
--- a/lisp/org/ob-lilypond.el
+++ b/lisp/org/ob-lilypond.el
@@ -4,7 +4,7 @@
;; Author: Martyn Jago
;; Keywords: babel language, literate programming
-;; Homepage: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
+;; URL: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
;; This file is part of GNU Emacs.
@@ -32,9 +32,13 @@
;; This depends on epstopdf --- See https://www.ctan.org/pkg/epstopdf.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
-(declare-function org-show-all "org" (&optional types))
+(declare-function org-fold-show-all "org-fold" (&optional types))
;; FIXME: Doesn't this rather belong in lilypond-mode.el?
(defalias 'lilypond-mode 'LilyPond-mode)
@@ -108,7 +112,7 @@ you can leave the string empty on this case."
:package-version '(Org . "8.2.7")
:set
(lambda (symbol value)
- (set symbol value)
+ (set-default-toplevel-value symbol value)
(setq
org-babel-lilypond-ly-command (nth 0 value)
org-babel-lilypond-pdf-command (nth 1 value)
@@ -280,7 +284,7 @@ LINE is the erroneous line."
(setq case-fold-search nil)
(if (search-forward line nil t)
(progn
- (org-show-all)
+ (org-fold-show-all)
(set-mark (point))
(goto-char (- (point) (length line))))
(goto-char temp))))
diff --git a/lisp/org/ob-lisp.el b/lisp/org/ob-lisp.el
index f9d5fed0c8b..d3ed569ecde 100644
--- a/lisp/org/ob-lisp.el
+++ b/lisp/org/ob-lisp.el
@@ -6,7 +6,7 @@
;; Eric Schulte
;; David T. O'Toole <dto@gnu.org>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -36,6 +36,10 @@
;; - https://common-lisp.net/project/slime/
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el
index eecb5c402a2..fb279975555 100644
--- a/lisp/org/ob-lob.el
+++ b/lisp/org/ob-lob.el
@@ -5,7 +5,7 @@
;; Authors: Eric Schulte
;; Dan Davison
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -23,12 +23,16 @@
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ob-core)
(require 'ob-table)
(declare-function org-babel-ref-split-args "ob-ref" (arg-string))
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
@@ -50,7 +54,7 @@ should not be inherited from a source block.")
(interactive "fFile: ")
(let ((lob-ingest-count 0))
(org-babel-map-src-blocks file
- (let* ((info (org-babel-get-src-block-info 'light))
+ (let* ((info (org-babel-get-src-block-info 'no-eval))
(source-name (nth 4 info)))
(when source-name
(setf (nth 1 info)
@@ -74,9 +78,10 @@ should not be inherited from a source block.")
Detect if this is context for a Library Of Babel source block and
if so then run the appropriate source block from the Library."
(interactive)
- (let ((info (org-babel-lob-get-info)))
+ (let* ((datum (org-element-context))
+ (info (org-babel-lob-get-info datum)))
(when info
- (org-babel-execute-src-block nil info)
+ (org-babel-execute-src-block nil info nil (org-element-type datum))
t)))
(defun org-babel-lob--src-info (ref)
@@ -114,11 +119,16 @@ after REF in the Library of Babel."
(cdr (assoc-string ref org-babel-library-of-babel))))))))
;;;###autoload
-(defun org-babel-lob-get-info (&optional datum)
+(defun org-babel-lob-get-info (&optional datum no-eval)
"Return internal representation for Library of Babel function call.
Consider DATUM, when provided, or element at point otherwise.
+When optional argument NO-EVAL is non-nil, Babel does not resolve
+remote variable references; a process which could likely result
+in the execution of other code blocks, and do not evaluate Lisp
+values in parameters.
+
Return nil when not on an appropriate location. Otherwise return
a list compatible with `org-babel-get-src-block-info', which
see."
@@ -139,16 +149,16 @@ see."
org-babel-default-lob-header-args
(append
(org-with-point-at begin
- (org-babel-params-from-properties language))
+ (org-babel-params-from-properties language no-eval))
(list
(org-babel-parse-header-arguments
- (org-element-property :inside-header context))
+ (org-element-property :inside-header context) no-eval)
(let ((args (org-element-property :arguments context)))
(and args
(mapcar (lambda (ref) (cons :var ref))
(org-babel-ref-split-args args))))
(org-babel-parse-header-arguments
- (org-element-property :end-header context)))))
+ (org-element-property :end-header context) no-eval))))
nil
(org-element-property :name context)
begin
diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el
index b6e78fb7fd8..52aa0599aed 100644
--- a/lisp/org/ob-lua.el
+++ b/lisp/org/ob-lua.el
@@ -4,7 +4,7 @@
;; Authors: Dieter Schoen
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -35,6 +35,10 @@
;; However, sessions are not yet working.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
(require 'cl-lib)
@@ -395,7 +399,7 @@ fd:close()"
(org-babel-lua-table-or-string results)))))
(defun org-babel-lua-read-string (string)
- "Strip \\=' characters from around Lua string."
+ "Strip single quotes from around Lua string."
(org-unbracket-string "'" "'" string))
(provide 'ob-lua)
diff --git a/lisp/org/ob-makefile.el b/lisp/org/ob-makefile.el
index 142e760ea27..194fcdb01ba 100644
--- a/lisp/org/ob-makefile.el
+++ b/lisp/org/ob-makefile.el
@@ -5,7 +5,7 @@
;; Author: Eric Schulte
;; Thomas S. Dye
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,6 +27,10 @@
;; This file exists solely for tangling a Makefile from Org files.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-default-header-args:makefile '())
diff --git a/lisp/org/ob-matlab.el b/lisp/org/ob-matlab.el
index f50da0ea434..8e4d02b2a83 100644
--- a/lisp/org/ob-matlab.el
+++ b/lisp/org/ob-matlab.el
@@ -4,7 +4,7 @@
;; Author: Dan Davison
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -35,6 +35,10 @@
;; https://matlab-emacs.sourceforge.net/
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'ob-octave)
diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el
index 6bc3427eaf8..e3dfbb6684e 100644
--- a/lisp/org/ob-maxima.el
+++ b/lisp/org/ob-maxima.el
@@ -5,7 +5,7 @@
;; Author: Eric S Fraga
;; Eric Schulte
;; Keywords: literate programming, reproducible research, maxima
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -31,6 +31,10 @@
;; 2) we are adding the "cmdline" header argument
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-tangle-lang-exts)
@@ -72,13 +76,16 @@
(defun org-babel-execute:maxima (body params)
"Execute a block of Maxima entries with org-babel.
This function is called by `org-babel-execute-src-block'."
- (message "executing Maxima source code block")
+ (message "Executing Maxima source code block")
(let ((result-params (split-string (or (cdr (assq :results params)) "")))
(result
(let* ((cmdline (or (cdr (assq :cmdline params)) ""))
(in-file (org-babel-temp-file "maxima-" ".max"))
- (cmd (format "%s --very-quiet -r 'batchload(%S)$' %s"
- org-babel-maxima-command in-file cmdline)))
+ (cmd (format "%s --very-quiet -r %s %s"
+ org-babel-maxima-command
+ (shell-quote-argument
+ (format "batchload(%S)$" in-file))
+ cmdline)))
(with-temp-file in-file (insert (org-babel-maxima-expand body params)))
(message cmd)
;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' "
diff --git a/lisp/org/ob-ocaml.el b/lisp/org/ob-ocaml.el
index 80df79581fb..804551ba57e 100644
--- a/lisp/org/ob-ocaml.el
+++ b/lisp/org/ob-ocaml.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -35,6 +35,10 @@
;; - tuareg-mode :: https://elpa.nongnu.org/nongnu/tuareg.html
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'comint)
(require 'org-macs)
diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el
index 9be8f5ad3eb..b0a7767ec3e 100644
--- a/lisp/org/ob-octave.el
+++ b/lisp/org/ob-octave.el
@@ -4,7 +4,7 @@
;; Author: Dan Davison
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -29,6 +29,10 @@
;; octave-mode.el and octave-inf.el come with GNU emacs
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
@@ -57,7 +61,7 @@ delete('%s')
")
(defvar org-babel-octave-wrapper-method
"%s
-if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid);
+if ischar(ans), fid = fopen('%s', 'w'); fdisp(fid, ans); fclose(fid);
else, dlmwrite('%s', ans, '\\t')
end")
diff --git a/lisp/org/ob-org.el b/lisp/org/ob-org.el
index 965b0984ec0..df7f85d0803 100644
--- a/lisp/org/ob-org.el
+++ b/lisp/org/ob-org.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,6 +27,10 @@
;; contents of the code block are returned in a raw result.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(declare-function org-export-string-as "ox"
diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el
index f01feaf294f..5762642b78c 100644
--- a/lisp/org/ob-perl.el
+++ b/lisp/org/ob-perl.el
@@ -4,9 +4,9 @@
;; Authors: Dan Davison
;; Eric Schulte
-;; Maintainer: Corwin Brust
+;; Maintainer: Corwin Brust <corwin@bru.st>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -28,6 +28,10 @@
;; Org-Babel support for evaluating perl source code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-tangle-lang-exts)
diff --git a/lisp/org/ob-plantuml.el b/lisp/org/ob-plantuml.el
index 7a495e8e7f4..e95db50cd59 100644
--- a/lisp/org/ob-plantuml.el
+++ b/lisp/org/ob-plantuml.el
@@ -4,7 +4,7 @@
;; Author: Zhang Weize
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -34,6 +34,10 @@
;; plantuml.jar | `org-plantuml-jar-path' should point to the jar file (when exec mode is `jar')
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-default-header-args:plantuml
@@ -65,8 +69,8 @@ You can also configure extra arguments via `org-plantuml-executable-args'."
:package-version '(Org . "9.4")
:type 'string)
-(defcustom org-plantuml-executable-args (list "-headless")
- "The arguments passed to plantuml executable when executing PlantUML."
+(defcustom org-plantuml-args (list "-headless")
+ "The arguments passed to plantuml when executing PlantUML."
:group 'org-babel
:package-version '(Org . "9.4")
:type '(repeat string))
@@ -109,21 +113,25 @@ If BODY does not contain @startXXX ... @endXXX clauses, @startuml
(defun org-babel-execute:plantuml (body params)
"Execute a block of plantuml code with org-babel.
This function is called by `org-babel-execute-src-block'."
- (let* ((out-file (or (cdr (assq :file params))
- (error "PlantUML requires a \":file\" header argument")))
+ (let* ((do-export (member "file" (cdr (assq :result-params params))))
+ (out-file (if do-export
+ (or (cdr (assq :file params))
+ (error "No :file provided but :results set to file. For plain text output, set :results to verbatim"))
+ (org-babel-temp-file "plantuml-" ".txt")))
(cmdline (cdr (assq :cmdline params)))
(in-file (org-babel-temp-file "plantuml-"))
(java (or (cdr (assq :java params)) ""))
(executable (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-path)
(t "java")))
- (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-executable-args)
+ (executable-args (cond ((eq org-plantuml-exec-mode 'plantuml) org-plantuml-args)
((string= "" org-plantuml-jar-path)
(error "`org-plantuml-jar-path' is not set"))
((not (file-exists-p org-plantuml-jar-path))
(error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
- (t (list java
- "-jar"
- (shell-quote-argument (expand-file-name org-plantuml-jar-path))))))
+ (t `(,java
+ "-jar"
+ ,(shell-quote-argument (expand-file-name org-plantuml-jar-path))
+ ,@org-plantuml-args))))
(full-body (org-babel-plantuml-make-body body params))
(cmd (mapconcat #'identity
(append
@@ -154,7 +162,10 @@ This function is called by `org-babel-execute-src-block'."
(if (and (string= (file-name-extension out-file) "svg")
org-babel-plantuml-svg-text-to-path)
(org-babel-eval (format "inkscape %s -T -l %s" out-file out-file) ""))
- nil)) ;; signal that output has already been written to file
+ (unless do-export (with-temp-buffer
+ (insert-file-contents out-file)
+ (buffer-substring-no-properties
+ (point-min) (point-max))))))
(defun org-babel-prep-session:plantuml (_session _params)
"Return an error because plantuml does not support sessions."
diff --git a/lisp/org/ob-processing.el b/lisp/org/ob-processing.el
index f961a99076c..644006b9ce2 100644
--- a/lisp/org/ob-processing.el
+++ b/lisp/org/ob-processing.el
@@ -3,8 +3,9 @@
;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
;; Author: Jarmo Hurri (adapted from ob-asymptote.el written by Eric Schulte)
+;; Maintainer: Jarmo Hurri <jarmo.hurri@iki.fi>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -50,6 +51,10 @@
;; - Processing.js module :: https://processingjs.org/
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'sha1)
@@ -88,7 +93,7 @@
;; make-temp-file is repeated until no hyphen is in the
;; name; also sketch dir name must be the same as the
;; basename of the sketch file.
- (let* ((temporary-file-directory org-babel-temporary-directory)
+ (let* ((temporary-file-directory (org-babel-temp-directory))
(sketch-dir
(let (sketch-dir-candidate)
(while
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 3e9049e73fb..1829ab149a2 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -6,7 +6,7 @@
;; Dan Davison
;; Maintainer: Jack Kamm <jackkamm@gmail.com>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -28,12 +28,16 @@
;; Org-Babel support for evaluating python source code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(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-choose-shell "ext:python-mode" (&optional shell))
(declare-function py-shell-send-string "ext:python-mode" (strg &optional process))
(defvar org-babel-tangle-lang-exts)
@@ -178,9 +182,10 @@ Emacs-lisp table, otherwise return the results as a string."
(substring name 1 (- (length name) 1))
name)))
-(defvar py-default-interpreter)
(defvar py-which-bufname)
(defvar python-shell-buffer-name)
+(defvar-local org-babel-python--initialized nil
+ "Flag used to mark that python session has been initialized.")
(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
@@ -198,14 +203,20 @@ then create. Return the initialized session."
(let ((python-shell-buffer-name
(org-babel-python-without-earmuffs py-buffer)))
(run-python cmd)
- (sleep-for 0 10)))
+ (with-current-buffer py-buffer
+ (add-hook
+ 'python-shell-first-prompt-hook
+ (lambda ()
+ (setq-local org-babel-python--initialized t)
+ (message "I am running!!!"))
+ nil 'local))))
((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-choose-shell)
;; `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))
@@ -217,6 +228,15 @@ then create. Return the initialized session."
(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")))
+ ;; Wait until Python initializes.
+ (if (eq 'python org-babel-python-mode) ; python.el
+ ;; This is more reliable compared to
+ ;; `org-babel-comint-wait-for-output' as python may emit
+ ;; multiple prompts during initialization.
+ (with-current-buffer py-buffer
+ (while (not org-babel-python--initialized)
+ (org-babel-comint-wait-for-output py-buffer)))
+ (org-babel-comint-wait-for-output py-buffer))
(setq org-babel-python-buffers
(cons (cons session py-buffer)
(assq-delete-all session org-babel-python-buffers)))
diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el
index 21076b67b24..2bba2071ee3 100644
--- a/lisp/org/ob-ref.el
+++ b/lisp/org/ob-ref.el
@@ -5,7 +5,7 @@
;; Authors: Eric Schulte
;; Dan Davison
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -49,12 +49,16 @@
;; #+end_src
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(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-babel-lob-get-info "ob-lob" (&optional datum no-eval))
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(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))
@@ -62,8 +66,8 @@
(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))
+(declare-function org-narrow-to-subtree "org" (&optional element))
+(declare-function org-fold-show-context "org-fold" (&optional key))
(defvar org-babel-update-intermediate nil
"Update the in-buffer results of code blocks executed to resolve references.")
@@ -104,7 +108,7 @@ Emacs Lisp representation of the value of the variable."
(pop-to-buffer-same-window (marker-buffer m))
(goto-char m)
(move-marker m nil)
- (org-show-context)
+ (org-fold-show-context)
t))))
(defun org-babel-ref-headline-body ()
@@ -124,12 +128,14 @@ Emacs Lisp representation of the value of the variable."
(save-excursion
(let ((case-fold-search t)
args new-refere new-header-args new-referent split-file split-ref
- index)
+ index contents)
;; if ref is indexed grab the indices -- beware nested indices
- (when (and (string-match "\\[\\([^\\[]+\\)\\]$" ref)
+ (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))
+ (if (> (length (match-string 1 ref)) 0)
+ (setq index (match-string 1 ref))
+ (setq contents t))
(setq ref (substring ref 0 (match-beginning 0))))
;; assign any arguments to pass to source block
(when (string-match
@@ -153,7 +159,7 @@ Emacs Lisp representation of the value of the variable."
(setq ref split-ref))
(org-with-wide-buffer
(goto-char (point-min))
- (let* ((params (append args '((:results . "silent"))))
+ (let* ((params (append args '((:results . "none"))))
(regexp (org-babel-named-data-regexp-for-name ref))
(result
(catch :found
@@ -171,7 +177,7 @@ Emacs Lisp representation of the value of the variable."
(throw :found
(org-babel-execute-src-block
nil (org-babel-lob-get-info e) params)))
- (`src-block
+ ((and `src-block (guard (not contents)))
(throw :found
(org-babel-execute-src-block
nil nil
@@ -193,7 +199,7 @@ Emacs Lisp representation of the value of the variable."
(org-babel-execute-src-block nil info params))))
(error "Reference `%s' not found in this buffer" ref))))
(cond
- ((symbolp result) (format "%S" result))
+ ((and result (symbolp result)) (format "%S" result))
((and index (listp result))
(org-babel-ref-index-list index result))
(t result)))))))))
diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el
index d35b55ca591..6ece63b4dca 100644
--- a/lisp/org/ob-ruby.el
+++ b/lisp/org/ob-ruby.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -36,6 +36,10 @@
;; https://github.com/eschulte/rinari/raw/master/util/inf-ruby.el
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
diff --git a/lisp/org/ob-sass.el b/lisp/org/ob-sass.el
index c0f63a9b664..400f9b326e0 100644
--- a/lisp/org/ob-sass.el
+++ b/lisp/org/ob-sass.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -38,6 +38,10 @@
;; - sass-mode :: https://github.com/nex3/haml/blob/master/extra/sass-mode.el
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-default-header-args:sass '())
diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index 72d2e029e13..cfeb1a0adcb 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -5,7 +5,7 @@
;; Authors: Eric Schulte
;; Michael Gauland
;; Keywords: literate programming, reproducible research, scheme
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -38,6 +38,10 @@
;; ELPA.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'geiser nil t)
(require 'geiser-impl nil t)
@@ -52,9 +56,12 @@
(defvar geiser-repl-window-allow-split) ; Defined in geiser-repl.el
(declare-function run-geiser "ext:geiser-repl" (impl))
+(declare-function 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-eval-region/wait "ext:geiser-mode"
+ (start end &optional timeout))
(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))
@@ -114,7 +121,10 @@
(let ((buffer (org-babel-scheme-get-session-buffer name)))
(or buffer
(progn
- (run-geiser impl)
+ (if (fboundp 'geiser)
+ (geiser impl)
+ ;; Obsolete since Geiser 0.26.
+ (run-geiser impl))
(when name
(rename-buffer name t)
(org-babel-scheme-set-session-buffer name (current-buffer)))
@@ -176,7 +186,13 @@ is true; otherwise returns the last value."
(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))))
+ ;; `geiser-eval-region/wait' was introduced to await the
+ ;; result of async evaluation in geiser version 0.22.
+ (let ((ret (funcall (if (fboundp 'geiser-eval-region/wait)
+ #'geiser-eval-region/wait
+ #'geiser-eval-region)
+ (point-min)
+ (point-max))))
(setq result (if output
(or (geiser-eval--retort-output ret)
"Geiser Interpreter produced no output")
diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el
index 1fc1a34fdf4..294a40cbfeb 100644
--- a/lisp/org/ob-screen.el
+++ b/lisp/org/ob-screen.el
@@ -3,9 +3,9 @@
;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
;; Author: Benjamin Andresen
-;; Maintainer: Ken Mankoff
+;; Maintainer: Ken Mankoff <mankoff@gmail.com>
;; Keywords: literate programming, interactive shell
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -34,6 +34,10 @@
;; M-x org-babel-screen-test RET
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-screen-location "screen"
diff --git a/lisp/org/ob-sed.el b/lisp/org/ob-sed.el
index 02c2a017422..f9ea2ac0cb6 100644
--- a/lisp/org/ob-sed.el
+++ b/lisp/org/ob-sed.el
@@ -35,11 +35,15 @@
;; 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
+;; file passed 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 'org-macs)
+(org-assert-version)
+
(require 'ob)
(defvar org-babel-sed-command "sed"
@@ -61,7 +65,7 @@
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")
+ (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)))
diff --git a/lisp/org/ob-shell.el b/lisp/org/ob-shell.el
index c25941a44d7..d38d2d33530 100644
--- a/lisp/org/ob-shell.el
+++ b/lisp/org/ob-shell.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -26,6 +26,10 @@
;; Org-Babel support for evaluating shell source code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'org-macs)
(require 'shell)
@@ -42,6 +46,28 @@
(defvar org-babel-default-header-args:shell '())
(defvar org-babel-shell-names)
+(defconst org-babel-shell-set-prompt-commands
+ '(;; Fish has no PS2 equivalent.
+ ("fish" . "function fish_prompt\n\techo \"%s\"\nend")
+ ;; prompt2 is like PS2 in POSIX shells.
+ ("csh" . "set prompt=\"%s\"\nset prompt2=\"\"")
+ ;; PowerShell, similar to fish, does not have PS2 equivalent.
+ ("posh" . "function prompt { \"%s\" }")
+ ;; PROMPT_COMMAND can override PS1 settings. Disable it.
+ ;; Disable PS2 to avoid garbage in multi-line inputs.
+ (t . "PROMPT_COMMAND=;PS1=\"%s\";PS2="))
+ "Alist assigning shells with their prompt setting command.
+
+Each element of the alist associates a shell type from
+`org-babel-shell-names' with a template used to create a command to
+change the default prompt. The template is an argument to `format'
+that will be called with a single additional argument: prompt string.
+
+The fallback association template is defined in (t . \"template\")
+alist element.")
+
+(defvar org-babel-prompt-command)
+
(defun org-babel-shell-initialize ()
"Define execution functions associated to shell names.
This function has to be called whenever `org-babel-shell-names'
@@ -51,7 +77,10 @@ is modified outside the Customize interface."
(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))
+ (let ((shell-file-name ,name)
+ (org-babel-prompt-command
+ (or (alist-get ,name org-babel-shell-set-prompt-commands)
+ (alist-get t org-babel-shell-set-prompt-commands))))
(org-babel-execute:shell body params))))
(eval `(defalias ',(intern (concat "org-babel-variable-assignments:" name))
'org-babel-variable-assignments:shell
@@ -68,7 +97,7 @@ outside the Customize interface."
:group 'org-babel
:type '(repeat (string :tag "Shell name: "))
:set (lambda (symbol value)
- (set-default symbol value)
+ (set-default-toplevel-value symbol value)
(org-babel-shell-initialize)))
(defcustom org-babel-shell-results-defaults-to-output t
@@ -206,6 +235,13 @@ var of the same value."
(mapconcat echo-var var "\n"))
(t (funcall echo-var var)))))
+(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.")
+(defvar org-babel-sh-prompt "org_babel_sh_prompt> "
+ "String to set prompt in session shell.")
+
(defun org-babel-sh-initiate-session (&optional session _params)
"Initiate a session named SESSION according to PARAMS."
(when (and session (not (string= session "none")))
@@ -213,17 +249,20 @@ var of the same value."
(or (org-babel-comint-buffer-livep session)
(progn
(shell session)
+ ;; Set unique prompt for easier analysis of the output.
+ (org-babel-comint-wait-for-output (current-buffer))
+ (org-babel-comint-input-command
+ (current-buffer)
+ (format org-babel-prompt-command org-babel-sh-prompt))
+ (setq-local comint-prompt-regexp
+ (concat "^" (regexp-quote org-babel-sh-prompt)
+ " *"))
;; 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
@@ -249,32 +288,30 @@ return the value of the last statement in 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))
+ (with-connection-local-variables
+ (apply #'process-file
+ (if shebang (file-local-name script-file)
+ shell-file-name)
+ stdin-file
+ (current-buffer)
+ nil
+ (if shebang (when cmdline (list cmdline))
+ (list shell-command-switch
+ (concat (file-local-name script-file) " " cmdline)))))
(buffer-string))))
(session ; session evaluation
(mapconcat
#'org-babel-sh-strip-weird-long-prompt
(mapcar
#'org-trim
- (butlast
+ (butlast ; Remove eoe indicator
(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))
+ (insert (org-trim body) "\n"
+ org-babel-sh-eoe-indicator)
+ (comint-send-input nil t))
+ ;; Remove `org-babel-sh-eoe-indicator' output line.
+ 1))
"\n"))
;; External shell script, with or without a predefined
;; shebang.
@@ -288,7 +325,7 @@ return the value of the last statement in 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
+ (when (and results value-is-exit-status)
(setq results (car (reverse (split-string results "\n" t)))))
(when results
(let ((result-params (cdr (assq :result-params params))))
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index 5f7c0de0000..9f4fa1d7863 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -3,8 +3,9 @@
;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
;; Author: Eric Schulte
+;; Maintainer: Daniel Kraus <daniel@kraus.my>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -69,6 +70,10 @@
;;
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(declare-function org-table-import "org-table" (file arg))
@@ -218,18 +223,18 @@ 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))))
+ (or (cdr (assq name params))
+ (and (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))))))))
(defun org-babel-execute:sql (body params)
"Execute a block of Sql code with Babel.
diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el
index aeda6faaa35..f22f9883f1f 100644
--- a/lisp/org/ob-sqlite.el
+++ b/lisp/org/ob-sqlite.el
@@ -3,9 +3,9 @@
;; Copyright (C) 2010-2022 Free Software Foundation, Inc.
;; Author: Eric Schulte
-;; Maintainer: Nick Savage
+;; Maintainer: Nick Savage <nick@nicksavage.ca>
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,6 +27,10 @@
;; Org-Babel support for evaluating sqlite source code.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob)
(require 'ob-sql)
diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el
index f6729e0ece7..e14117cd3bb 100644
--- a/lisp/org/ob-table.el
+++ b/lisp/org/ob-table.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -53,6 +53,10 @@
;; are optional.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'ob-core)
(require 'org-macs)
@@ -108,44 +112,43 @@ as shown in the example below.
;; 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)))))
+ (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)))))))
+ `(let ((result
+ (if ,(and source-block (> (length source-block) 0))
+ (let ((params
+ ',(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)
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el
index d9814a7aa64..bd17bda32ba 100644
--- a/lisp/org/ob-tangle.el
+++ b/lisp/org/ob-tangle.el
@@ -4,7 +4,7 @@
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -27,6 +27,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-src)
(require 'org-macs)
@@ -37,7 +40,10 @@
(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--cache-active-p "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-element-at-point "org-element" (&optional pom cached-only))
(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))
@@ -45,6 +51,11 @@
(declare-function outline-previous-heading "outline" ())
(defvar org-id-link-to-org-use-id) ; Dynamically scoped
+(defgroup org-babel-tangle nil
+ "Options for extracting source code from code blocks."
+ :tag "Org Babel Tangle"
+ :group 'org-babel)
+
(defcustom org-babel-tangle-lang-exts
'(("emacs-lisp" . "el")
("elisp" . "el"))
@@ -67,22 +78,29 @@ then the name of the language is used."
(defcustom org-babel-post-tangle-hook nil
"Hook run in code files tangled by `org-babel-tangle'."
- :group 'org-babel
+ :group 'org-babel-tangle
: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
+ "Hook run at the beginning of `org-babel-tangle' in the original buffer."
+ :group 'org-babel-tangle
: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
+ :group 'org-babel-tangle
:version "24.1"
:type 'hook)
+(defcustom org-babel-tangle-finished-hook nil
+ "Hook run at the very end of `org-babel-tangle' in the original buffer.
+In this way, it is the counterpart to `org-babel-pre-tangle-hook'."
+ :group 'org-babel-tangle
+ :package-version '(Org . "9.6")
+ :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
@@ -99,7 +117,7 @@ non-nil value.
Whether or not comments are inserted during tangling is
controlled by the :comments header argument."
- :group 'org-babel
+ :group 'org-babel-tangle
:version "24.1"
:type 'string)
@@ -119,7 +137,7 @@ non-nil value.
Whether or not comments are inserted during tangling is
controlled by the :comments header argument."
- :group 'org-babel
+ :group 'org-babel-tangle
:version "24.1"
:type 'string)
@@ -128,7 +146,7 @@ controlled by the :comments header argument."
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
+ :group 'org-babel-tangle
:type 'boolean)
(defcustom org-babel-process-comment-text 'org-remove-indentation
@@ -136,10 +154,18 @@ of tangled comments."
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
+ :group 'org-babel-tangle
:version "24.1"
:type 'function)
+(defcustom org-babel-tangle-default-file-mode #o544
+ "The default mode used for tangled files, as an integer.
+The default value 356 correspands to the octal #o544, which is
+read-write permissions for the user, read-only for everyone else."
+ :group 'org-babel-tangle
+ :package-version '(Org . "9.6")
+ :type 'integer)
+
(defun org-babel-find-file-noselect-refresh (file)
"Find file ensuring that the latest changes on disk are
represented in the file."
@@ -177,7 +203,7 @@ 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."
+Return list of the tangled file names."
(interactive "fFile to tangle: \nP")
(let* ((visited (find-buffer-visiting file))
(buffer (or visited (find-file-noselect file))))
@@ -199,7 +225,7 @@ Return a list whose CAR is the tangled file name."
(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.
+file into their own source-specific files. Return the list of 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.
@@ -225,7 +251,7 @@ matching a regular expression."
org-babel-default-header-args))
(tangle-file
(when (equal arg '(16))
- (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 'light))))
+ (or (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info 'no-eval))))
(user-error "Point is not in a source code block"))))
path-collector)
(mapc ;; map over file-names
@@ -254,7 +280,7 @@ matching a regular expression."
(when she-bang
(unless tangle-mode (setq tangle-mode #o755)))
(when tangle-mode
- (add-to-list 'modes tangle-mode))
+ (add-to-list 'modes (org-babel-interpret-file-mode tangle-mode)))
;; Possibly create the parent directories for file.
(let ((m (funcall get-spec :mkdirp)))
(and m fnd (not (string= m "no"))
@@ -271,11 +297,24 @@ matching a regular expression."
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)
+ (unless
+ (and (file-exists-p file-name)
+ (let ((tangle-buf (current-buffer)))
+ (with-temp-buffer
+ (insert-file-contents file-name)
+ (and
+ (equal (buffer-size)
+ (buffer-size tangle-buf))
+ (= 0
+ (let (case-fold-search)
+ (compare-buffer-substrings
+ nil nil nil
+ tangle-buf nil nil)))))))
+ ;; 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)
@@ -295,8 +334,39 @@ matching a regular expression."
(org-babel-with-temp-filebuffer file
(run-hooks 'org-babel-post-tangle-hook)))
path-collector))
+ (run-hooks 'org-babel-tangle-finished-hook)
path-collector))))
+(defun org-babel-interpret-file-mode (mode)
+ "Determine the integer representation of a file MODE specification.
+The following forms are currently recognized:
+- an integer (returned without modification)
+- \"o755\" (chmod style octal)
+- \"rwxrw-r--\" (ls style specification)
+- \"a=rw,u+x\" (chmod style) *
+
+* The interpretation of these forms relies on `file-modes-symbolic-to-number',
+ and uses `org-babel-tangle-default-file-mode' as the base mode."
+ (cond
+ ((integerp mode)
+ (if (string-match-p "^[0-7][0-7][0-7]$" (format "%o" mode))
+ mode
+ (user-error "%1$o is not a valid file mode octal. \
+Did you give the decimal value %1$d by mistake?" mode)))
+ ((not (stringp mode))
+ (error "File mode %S not recognized as a valid format." mode))
+ ((string-match-p "^o0?[0-7][0-7][0-7]$" mode)
+ (string-to-number (replace-regexp-in-string "^o" "" mode) 8))
+ ((string-match-p "^[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\)*$" mode)
+ ;; Match regexp taken from `file-modes-symbolic-to-number'.
+ (file-modes-symbolic-to-number mode org-babel-tangle-default-file-mode))
+ ((string-match-p "^[r-][w-][xs-][r-][w-][xs-][r-][w-][x-]$" mode)
+ (file-modes-symbolic-to-number (concat "u=" (substring mode 0 3)
+ ",g=" (substring mode 3 6)
+ ",o=" (substring mode 6 9))
+ 0))
+ (t (error "File mode %S not recognized as a valid format. See `org-babel-interpret-file-mode'." mode))))
+
(defun org-babel-tangle-clean ()
"Remove comments inserted by `org-babel-tangle'.
Call this function inside of a source-code file generated by
@@ -387,14 +457,16 @@ 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 (org-element--cache-active-p)
+ (or (org-element-property :begin (org-element-lineage (org-element-at-point) '(headline) t)) 1)
+ (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))
+ (let* ((info (org-babel-get-src-block-info 'no-eval))
(src-lang (nth 0 info))
(src-tfile (cdr (assq :tangle (nth 2 info)))))
(unless (or (string= src-tfile "no")
@@ -413,6 +485,33 @@ code blocks by target file."
(mapcar (lambda (b) (cons (car b) (nreverse (cdr b))))
(nreverse blocks))))
+(defun org-babel-tangle--unbracketed-link (params)
+ "Get a raw link to the src block at point, without brackets.
+
+The PARAMS are the 3rd element of the info for the same src block."
+ (unless (string= "no" (cdr (assq :comments params)))
+ (save-match-data
+ (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 creating unexpected file
+ ;; modifications.
+ (org-id-link-to-org-use-id nil)
+ (l (org-no-properties
+ (cl-letf (((symbol-function 'org-store-link-functions)
+ (lambda () nil)))
+ (org-store-link nil))))
+ (bare (and (string-match org-link-bracket-re l)
+ (match-string 1 l))))
+ (when bare
+ (if (and org-babel-tangle-use-relative-file-links
+ (string-match org-link-types-re bare)
+ (string= (match-string 1 bare) "file"))
+ (concat "file:"
+ (file-relative-name (substring bare (match-end 0))
+ (file-name-directory
+ (cdr (assq :tangle params)))))
+ bare))))))
+
(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
@@ -429,16 +528,7 @@ non-nil, return the full association list to be used by
(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 creating 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))))
+ (link (org-babel-tangle--unbracketed-link params))
(source-name
(or (nth 4 info)
(format "%s:%d"
@@ -451,7 +541,9 @@ non-nil, return the full association list to be used by
(body
;; Run the tangle-body-hook.
(let ((body (if (org-babel-noweb-p params :tangle)
- (org-babel-expand-noweb-references info)
+ (if (string= "strip-tangle" (cdr (assq :noweb (nth 2 info))))
+ (replace-regexp-in-string (org-babel-noweb-wrap) "" (nth 1 info))
+ (org-babel-expand-noweb-references info))
(nth 1 info))))
(with-temp-buffer
(insert
@@ -486,19 +578,13 @@ non-nil, return the full association list to be used by
(match-end 0)
(point-min))))
(point)))))
+ (src-tfile (cdr (assq :tangle params)))
(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)
+ link
source-name
params
(if org-src-preserve-indentation
@@ -506,8 +592,7 @@ non-nil, return the full association list to be used by
(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
+ (let* ((file-name (org-babel-effective-tangled-filename
(nth 1 result) src-lang src-tfile)))
(list (cons file-name (list (cons src-lang result)))))
result)))
@@ -516,19 +601,13 @@ non-nil, return the full association list to be used by
"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 ,_)
+ (let ((link-data (pcase (or info (org-babel-get-src-block-info 'no-eval))
+ (`(,_ ,_ ,params ,_ ,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 creating unexpected file
- ;; modifications.
- (org-id-link-to-org-use-id nil))
- (org-no-properties (org-store-link nil))))
+ ("link" . ,(org-babel-tangle--unbracketed-link params))
("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))))
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index 785eccf9645..83fc5b23e12 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -4,7 +4,7 @@
;; Authors: Eric Schulte
;; Keywords: literate programming, reproducible research
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -22,6 +22,10 @@
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'org-macs)
(require 'org-compat)
(require 'org-keys)
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index 398d2e2d3fa..3ef7a37e3b3 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -66,6 +66,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'bibtex)
(require 'json)
(require 'map)
@@ -222,6 +225,10 @@ 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)
+ ;; Throw an error if bibliography is malformed.
+ (unless (bibtex-validate)
+ (user-error "Malformed bibliography at %S"
+ (or (buffer-file-name) (current-buffer))))
(bibtex-map-entries
(lambda (key &rest _)
;; Normalize entries: field names are turned into symbols
@@ -237,7 +244,11 @@ Return a hash table with citation references as keys and fields alist as values.
(cons
(intern (downcase field))
(replace-regexp-in-string "[ \t\n]+" " " value)))))
- (bibtex-parse-entry t))
+ ;; Parse, substituting the @string replacements.
+ ;; See Emacs bug#56475 discussion.
+ (let ((bibtex-string-files `(,(buffer-file-name)))
+ (bibtex-expand-strings t))
+ (bibtex-parse-entry t)))
entries)))
entries))
@@ -266,21 +277,26 @@ Optional argument INFO is the export state, as a property list."
(when (or (org-file-has-changed-p file)
(not (gethash file org-cite-basic--file-id-cache)))
(insert-file-contents file)
+ (set-visited-file-name file t)
(puthash file (org-buffer-hash) org-cite-basic--file-id-cache))
- (let* ((file-id (cons file (gethash file org-cite-basic--file-id-cache)))
- (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)))))
+ (condition-case nil
+ (unwind-protect
+ (let* ((file-id (cons file (gethash file org-cite-basic--file-id-cache)))
+ (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))
+ (set-visited-file-name nil t))
+ (error (setq org-cite-basic--file-id-cache nil))))))
(when info (plist-put info :cite-basic/bibliography results))
results)))
@@ -333,6 +349,20 @@ non-nil."
(org-export-raw-string value)
value)))
+(defun org-cite-basic--shorten-names (names)
+ "Return a list of family names from a list of full NAMES.
+
+To better accomomodate corporate names, this will only shorten
+personal names of the form \"family, given\"."
+ (when (stringp names)
+ (mapconcat
+ (lambda (name)
+ (if (eq 1 (length name))
+ (cdr (split-string name))
+ (car (split-string name ", "))))
+ (split-string names " and ")
+ ", ")))
+
(defun org-cite-basic--number-to-suffix (n)
"Compute suffix associated to number N.
This is used for disambiguation."
@@ -349,6 +379,17 @@ This is used for disambiguation."
((= n 27) (throw :complete (cons 0 (cons 0 result))))
(t nil))))))))
+(defun org-cite-basic--get-author (entry-or-key &optional info raw)
+ "Return author associated to ENTRY-OR-KEY.
+
+ENTRY-OR-KEY, INFO and RAW arguments are the same arguments as
+used in `org-cite-basic--get-field', which see.
+
+Author is obtained from the \"author\" field, if available, or
+from the \"editor\" field otherwise."
+ (or (org-cite-basic--get-field 'author entry-or-key info raw)
+ (org-cite-basic--get-field 'editor entry-or-key info raw)))
+
(defun org-cite-basic--get-year (entry-or-key info &optional no-suffix)
"Return year associated to ENTRY-OR-KEY.
@@ -372,7 +413,7 @@ necessary, unless optional argument NO-SUFFIX is non-nil."
;; 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))
+ (let* ((author (org-cite-basic--get-author entry-or-key info 'raw))
(year
(or (org-cite-basic--get-field 'year entry-or-key info 'raw)
(let ((date
@@ -408,7 +449,7 @@ necessary, unless optional argument NO-SUFFIX is non-nil."
"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))
+ (let ((author (org-cite-basic--get-author entry info))
(title (org-cite-basic--get-field 'title entry info))
(from
(or (org-cite-basic--get-field 'publisher entry info)
@@ -419,7 +460,8 @@ Optional argument INFO is the export state, as a property list."
("plain"
(let ((year (org-cite-basic--get-year entry info 'no-suffix)))
(org-cite-concat
- author ". " title (and from (list ", " from)) ", " year ".")))
+ (org-cite-basic--shorten-names 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)))
@@ -460,13 +502,15 @@ substitutes for the unknown key. Finally, it may be the symbol
(_
(lambda ()
(interactive)
- (goto-char beg)
- (delete-region beg end)
- (insert "@"
- (if (= 1 (length suggestions))
- (car suggestions)
- (completing-read "Did you mean: "
- suggestions nil t)))))))
+ (save-excursion
+ (goto-char beg)
+ (delete-region beg end)
+ (insert
+ "@"
+ (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)
@@ -536,7 +580,7 @@ INFO is the export state, as a property list."
(suffix (org-element-property :suffix ref)))
(funcall format-ref
prefix
- (org-cite-basic--get-field 'author k info)
+ (org-cite-basic--get-author k info)
(org-cite-basic--get-year k info)
suffix)))
(org-cite-get-references citation)
@@ -575,7 +619,7 @@ INFO is the export state as a property list."
INFO is the export state, as a property list."
(and field
(lambda (a b)
- (org-string-collate-lessp
+ (string-collate-lessp
(org-cite-basic--get-field field a info 'raw)
(org-cite-basic--get-field field b info 'raw)
nil t))))
@@ -608,7 +652,7 @@ export communication channel, as a property list."
(org-export-data
(mapconcat
(lambda (key)
- (let ((author (org-cite-basic--get-field 'author key info)))
+ (let ((author (org-cite-basic--get-author key info)))
(if caps (capitalize author) author)))
(org-cite-get-references citation t)
org-cite-basic-author-year-separator)
@@ -669,15 +713,17 @@ 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)
+ (lambda (entry)
+ (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))
+ (delq nil
+ (mapcar
+ (lambda (k) (org-cite-basic--get-entry k info))
+ (org-cite-basic--sort-keys keys info)))
"\n"))
@@ -750,7 +796,7 @@ Return nil if there are no bibliography files or no entries."
(list :cite-basic/bibliography entries)))
(completion
(concat
- (let ((author (org-cite-basic--get-field 'author entry nil 'raw)))
+ (let ((author (org-cite-basic--get-author entry nil 'raw)))
(if author
(truncate-string-to-width
(replace-regexp-in-string " and " "; " author)
diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el
index 174725b4244..e8f677b7a05 100644
--- a/lisp/org/oc-biblatex.el
+++ b/lisp/org/oc-biblatex.el
@@ -41,7 +41,7 @@
;;
;; - 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),
+;; - noauthor (na), including bare (b) variant,
;; - nocite (n),
;; - text (t), including caps (c) variant,
;; - default style, including bare (b), caps (c) and bare-caps (bc) variants.
@@ -62,12 +62,16 @@
;; #+print_bibliography: :keyword abc,xyz :title "Primary Sources"
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'map)
(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
@@ -82,6 +86,100 @@ If \"biblatex\" package is already required in the document, e.g., through
(const :tag "No option" nil))
:safe #'string-or-null-p)
+(defcustom org-cite-biblatex-styles
+ '(("author" "caps" "Citeauthor*" nil nil)
+ ("author" "full" "citeauthor" nil nil)
+ ("author" "caps-full" "Citeauthor" nil nil)
+ ("author" nil "citeauthor*" nil nil)
+ ("locators" "bare" "notecite" nil nil)
+ ("locators" "caps" "Pnotecite" nil nil)
+ ("locators" "bare-caps" "Notecite" nil nil)
+ ("locators" nil "pnotecite" nil nil)
+ ("noauthor" "bare" "cite*" nil nil)
+ ("noauthor" nil "autocite*" nil nil)
+ ("nocite" nil "nocite" nil t)
+ ("text" "caps" "Textcite" "Textcites" nil)
+ ("text" nil "textcite" "textcites" nil)
+ (nil "bare" "cite" "cites" nil)
+ (nil "caps" "Autocite" "Autocites" nil)
+ (nil "bare-caps" "Cite" "Cites" nil)
+ (nil nil "autocite" "autocites" nil))
+ "List of styles and variants, with associated BibLaTeX commands.
+
+Each style follows the pattern
+
+ (NAME VARIANT COMMAND MULTI-COMMAND NO-OPTION)
+
+where:
+
+ NAME is the name of the style, as a string, or nil. The nil
+ style is the default style. As such, it must have an entry in
+ the list.
+
+ VARIANT is the name of the style variant, as a string or nil.
+ The nil variant is the default variant for the current style.
+ As such, each style name must be associated to a nil variant.
+
+ COMMAND is the LaTeX command to use, as a string. It should
+ not contain the leading backslash character.
+
+ MULTI-COMMAND is the LaTeX command to use when a multi-cite
+ command is appropriate. When nil, the style is deemed
+ inappropriate for multi-cites. The command should not contain
+ the leading backslash character.
+
+ NO-OPTION is a boolean. When non-nil, no optional argument
+ should be added to the LaTeX command.
+
+Each NAME-VARIANT pair should be unique in the list.
+
+It is also possible to provide shortcuts for style and variant
+names. See `org-cite-biblatex-style-shortcuts'."
+ :group 'org-cite
+ :package-version '(Org . "9.6")
+ :type '(repeat
+ (list :tag "Style/variant combination"
+ ;; Name part.
+ (choice :tag "Style"
+ (string :tag "Name")
+ (const :tag "Default style" nil))
+ ;; Variant part.
+ (choice :tag "Variant"
+ (string :tag "Name")
+ (const :tag "Default variant" nil))
+ ;; Command part.
+ (string :tag "Command name")
+ (choice :tag "Multicite command"
+ (string :tag "Command name")
+ (const :tag "No multicite support" nil))
+ (choice :tag "Skip optional arguments"
+ (const :tag "Yes" t)
+ (const :tag "No" nil)))))
+
+(defcustom org-cite-biblatex-style-shortcuts
+ '(("a" . "author")
+ ("b" . "bare")
+ ("bc" . "bare-caps")
+ ("c" . "caps")
+ ("cf" . "caps-full")
+ ("f" . "full")
+ ("l" . "locators")
+ ("n" . "nocite")
+ ("na" . "noauthor")
+ ("t" . "text"))
+ "List of shortcuts associated to style or variant names.
+
+Each entry is a pair (NAME . STYLE-NAME) where NAME is the name
+of the shortcut, as a string, and STYLE-NAME is the name of
+a style in `org-cite-biblatex-styles'."
+ :group 'org-cite
+ :package-version '(Org . "9.6")
+ :type '(repeat
+ (cons :tag "Shortcut"
+ (string :tag "Name")
+ (string :tag "Full name")))
+ :safe t)
+
;;; Internal functions
(defun org-cite-biblatex--package-options (initial style)
@@ -166,21 +264,51 @@ INFO is the export state, as a property list."
(org-cite-get-references citation)
""))))
-(defun org-cite-biblatex--command (citation info base &optional multi no-opt)
- "Return biblatex command using BASE name for CITATION object.
+(defun org-cite-biblatex--command (citation info name &optional multi no-opt)
+ "Return BibLaTeX command 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))
+When optional argument MULTI is non-nil, use it as a multicite
+command name when appropriate. When optional argument NO-OPT is
+non-nil, do not add optional arguments to the command."
+ (if (and multi (org-cite-biblatex--multicite-p citation))
+ (format "\\%s%s" multi (org-cite-biblatex--multi-arguments citation info))
+ (format "\\%s%s"
+ name
(org-cite-biblatex--atomic-arguments
(org-cite-get-references citation) info no-opt))))
+(defun org-cite-biblatex--expand-shortcuts (style)
+ "Return STYLE pair with shortcuts expanded."
+ (pcase style
+ (`(,style . ,variant)
+ (cons (or (alist-get style org-cite-biblatex-style-shortcuts
+ nil nil #'equal)
+ style)
+ (or (alist-get variant org-cite-biblatex-style-shortcuts
+ nil nil #'equal)
+ variant)))
+ (_ (error "This should not happen"))))
+
+(defun org-cite-biblatex-list-styles ()
+ "List styles and variants supported in `biblatex' citation processor.
+The output format is appropriate as a value for `:cite-styles' keyword
+in `org-cite-register-processor', which see."
+ (let ((shortcuts (make-hash-table :test #'equal))
+ (variants (make-hash-table :test #'equal)))
+ (pcase-dolist (`(,name . ,full-name) org-cite-biblatex-style-shortcuts)
+ (push name (gethash full-name shortcuts)))
+ (pcase-dolist (`(,name ,variant . ,_) org-cite-biblatex-styles)
+ (unless (null variant) (push variant (gethash name variants))))
+ (map-apply (lambda (style-name variants)
+ (cons (cons (or style-name "nil")
+ (gethash style-name shortcuts))
+ (mapcar (lambda (v)
+ (cons v (gethash v shortcuts)))
+ variants)))
+ variants)))
+
;;; Export capability
(defun org-cite-biblatex-export-bibliography (_keys _files _style props &rest _)
@@ -210,41 +338,42 @@ PROPS is the local properties of the bibliography, as a property list."
"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)))))
+ (pcase-let* ((`(,name . ,variant) (org-cite-biblatex--expand-shortcuts style))
+ (candidates nil)
+ (style-match-flag nil))
+ (catch :match
+ ;; Walk `org-cite-biblatex-styles' and prioritize matching
+ ;; candidates. At the end of the process, the optimal candidate
+ ;; should appear in front of CANDIDATES.
+ (dolist (style org-cite-biblatex-styles)
+ (pcase style
+ ;; A matching style-variant pair trumps anything else.
+ ;; Return it.
+ (`(,(pred (equal name)) ,(pred (equal variant)) . ,_)
+ (throw :match (setq candidates (list style))))
+ ;; nil-nil style-variant is the fallback value. Consider it
+ ;; only if nothing else matches.
+ (`(nil nil . ,_)
+ (unless candidates (push style candidates)))
+ ;; A matching style with default variant trumps a matching
+ ;; variant without the adequate style. Ensure the former
+ ;; appears first in the list.
+ (`(,(pred (equal name)) nil . ,_)
+ (push style candidates)
+ (setq style-match-flag t))
+ (`(nil ,(pred (equal variant)) . ,_)
+ (unless style-match-flag (push style candidates)))
+ ;; Discard anything else.
+ (_ nil))))
+ (apply
+ #'org-cite-biblatex--command citation info
+ (pcase (seq-elt candidates 0) ;; `seq-first' is not available in Emacs 26.
+ (`(,_ ,_ . ,command-parameters) command-parameters)
+ ('nil
+ (user-error
+ "Missing default style or variant in `org-cite-biblatex-styles'"))
+ (other
+ (user-error "Invalid entry %S in `org-cite-biblatex-styles'" other))))))
(defun org-cite-biblatex-prepare-preamble (output _keys files style &rest _)
"Prepare document preamble for \"biblatex\" usage.
@@ -301,13 +430,7 @@ to the document, and set styles."
: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"))))
+ :cite-styles #'org-cite-biblatex-list-styles)
(provide 'oc-biblatex)
;;; oc-biblatex.el ends here
diff --git a/lisp/org/oc-bibtex.el b/lisp/org/oc-bibtex.el
new file mode 100644
index 00000000000..33fba8c4016
--- /dev/null
+++ b/lisp/org/oc-bibtex.el
@@ -0,0 +1,87 @@
+;;; oc-bibtex.el --- Vanilla citation processor for LaTeX -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
+
+;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
+
+;; 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 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This library registers the `bibtex' citation processor, which
+;; provides the "export" capability for citations. It doesn't require
+;; any LaTeX package.
+;;
+;; It supports the following citation styles:
+;;
+;; - nocite (n),
+;; - default.
+;;
+;; Only suffixes are supported. Prefixes are ignored.
+;;
+;; Bibliography should consist of ".bib" files only.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'oc)
+
+(declare-function org-element-property "org-element" (property element))
+
+(declare-function org-export-data "org-export" (data info))
+
+
+;;; Export capability
+(defun org-cite-bibtex-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-bibtex-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."
+ (let ((references (org-cite-get-references citation)))
+ (format "\\%s%s{%s}"
+ (pcase style
+ (`(,(or "nocite" "n") . ,_) "nocite")
+ (_ "cite"))
+ (let ((suffix (cdr (org-cite-main-affixes citation))))
+ (if suffix
+ (format "[%s]" (org-trim (org-export-data suffix info)))
+ ""))
+ (mapconcat (lambda (r) (org-element-property :key r))
+ references
+ ","))))
+
+
+;;; Register `bibtex' processor
+(org-cite-register-processor 'bibtex
+ :export-bibliography #'org-cite-bibtex-export-bibliography
+ :export-citation #'org-cite-bibtex-export-citation
+ :cite-styles
+ '((("nocite" "n"))
+ (("nil"))))
+
+(provide 'oc-bibtex)
+;;; oc-bibtex.el ends here
diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el
index 82a9b8afced..1ccb74e925f 100644
--- a/lisp/org/oc-csl.el
+++ b/lisp/org/oc-csl.el
@@ -3,6 +3,7 @@
;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;; Maintainer: András Simonyi <andras.simonyi@gmail.com>
;; This file is part of GNU Emacs.
@@ -56,11 +57,21 @@
;; The library supports the following citation styles:
;;
-;; - author (a), including caps (c), full (f), and caps-full (cf) variants,
+;; - author (a), including bare (b), caps (c), bare-caps (bc), full (f),
+;; caps-full (cf), and bare-caps-full (bcf) variants,
;; - noauthor (na), including bare (b), caps (c) and bare-caps (bc) variants,
+;; - nocite (n),
;; - year (y), including a bare (b) variant,
-;; - text (t). including caps (c), full (f), and caps-full (cf) variants,
+;; - text (t), including caps (c), full (f), and caps-full (cf) variants,
+;; - title (ti), including a bare (b) variant,
+;; - locators (l), including a bare (b) variant,
+;; - bibentry (b), including a bare (b) variant,
;; - default style, including bare (b), caps (c) and bare-caps (bc) variants.
+;;
+;; Using "*" as a key in a nocite citation includes all available
+;; items in the printed bibliography. The "bibentry" citation style,
+;; similarly to biblatex's \fullcite, creates a citation which is
+;; similar to the bibliography entry.
;; CSL styles recognize "locator" in citation references' suffix. For example,
;; in the citation
@@ -85,11 +96,27 @@
;; 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.
+;; Filtered sub-bibliographies can be printed by passing filtering
+;; options to the "print_bibliography" keywords. E.g.,
+;;
+;; #+print_bibliography: :type book keyword: emacs
+;;
+;; 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 :type article
+
;; This library was heavily inspired by and borrows from András Simonyi's
;; Citeproc Org (<https://github.com/andras-simonyi/citeproc-org>) library.
;; Many thanks to him!
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'cl-lib)
+(require 'map)
(require 'bibtex)
(require 'json)
(require 'oc)
@@ -102,9 +129,11 @@
(declare-function citeproc-create "ext:citeproc")
(declare-function citeproc-citation-create "ext:citeproc")
(declare-function citeproc-append-citations "ext:citeproc")
+(declare-function citeproc-add-uncited "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 citeproc-add-subbib-filters "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))
@@ -133,13 +162,15 @@ If nil then only the fallback en-US locale will be available."
(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."
+
+Relative style file names are expanded according to document's
+default directory. If it fails and the variable is non-nil, Org
+looks for style files in this directory, too."
:group 'org-cite
:package-version '(Org . "9.5")
:type '(choice
(directory :tag "Styles directory")
- (const :tag "Use absolute file names" nil))
+ (const :tag "No central directory for style files" nil))
;; It's not obvious to me that arbitrary locations are safe.
;;; :safe #'string-or-null-p
)
@@ -293,6 +324,12 @@ INFO is the export state, as a property list."
(citeproc-proc-style
(org-cite-csl--processor info))))
+(defun org-cite-csl--nocite-p (citation info)
+ "Non-nil when CITATION object's style is nocite.
+INFO is the export state, as a property list."
+ (member (car (org-cite-citation-style citation info))
+ '("nocite" "n")))
+
(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
@@ -302,9 +339,13 @@ a property list."
;; "author" style.
(`(,(or "author" "a") . ,variant)
(pcase variant
+ ((or "bare" "b") '(:mode author-only :suppress-affixes t))
((or "caps" "c") '(:mode author-only :capitalize-first t))
((or "full" "f") '(:mode author-only :ignore-et-al t))
+ ((or "bare-caps" "bc") '(:mode author-only :suppress-affixes t :capitalize-first t))
+ ((or "bare-full" "bf") '(:mode author-only :suppress-affixes t :ignore-et-al t))
((or "caps-full" "cf") '(:mode author-only :capitalize-first t :ignore-et-al t))
+ ((or "bare-caps-full" "bcf") '(:mode author-only :suppress-affixes t :capitalize-first t :ignore-et-al t))
(_ '(:mode author-only))))
;; "noauthor" style.
(`(,(or "noauthor" "na") . ,variant)
@@ -319,6 +360,21 @@ a property list."
(pcase variant
((or "bare" "b") '(:mode year-only :suppress-affixes t))
(_ '(:mode year-only))))
+ ;; "bibentry" style.
+ (`(,(or "bibentry" "b") . ,variant)
+ (pcase variant
+ ((or "bare" "b") '(:mode bib-entry :suppress-affixes t))
+ (_ '(:mode bib-entry))))
+ ;; "locators" style.
+ (`(,(or "locators" "l") . ,variant)
+ (pcase variant
+ ((or "bare" "b") '(:mode locator-only :suppress-affixes t))
+ (_ '(:mode locator-only))))
+ ;; "title" style.
+ (`(,(or "title" "ti") . ,variant)
+ (pcase variant
+ ((or "bare" "b") '(:mode title-only :suppress-affixes t))
+ (_ '(:mode title-only))))
;; "text" style.
(`(,(or "text" "t") . ,variant)
(pcase variant
@@ -365,15 +421,21 @@ corresponding to one of the output formats supported by Citeproc: `html',
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."
+When file name is relative, look for it in buffer's default
+directory, failing that in `org-cite-csl-styles-dir' if non-nil.
+Raise an error if no style file can be found."
(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)
+ ((and (pred file-exists-p) file) (expand-file-name file))
+ ((and (guard org-cite-csl-styles-dir)
+ (pred (lambda (f)
+ (file-exists-p
+ (expand-file-name f 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))))
+ (user-error "CSL style file not found: %S" other))))
(defun org-cite-csl--locale-getter ()
"Return a locale getter.
@@ -522,20 +584,91 @@ 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))))
+ (let ((citations (org-cite-list-citations info))
+ (processor (org-cite-csl--processor info))
+ normal-citations nocite-ids)
+ (dolist (citation citations)
+ (if (org-cite-csl--nocite-p citation info)
+ (setq nocite-ids (append (org-cite-get-references citation t) nocite-ids))
+ (push citation normal-citations)))
+ (let ((structures
+ (mapcar (lambda (c) (org-cite-csl--create-structure c info))
+ (nreverse normal-citations))))
+ (citeproc-append-citations structures processor))
+ (when nocite-ids
+ (citeproc-add-uncited nocite-ids processor))
+ ;; All bibliographies have to be rendered in order to have
+ ;; correct citation numbers even if there are several
+ ;; sub-bibliograhies.
+ (org-cite-csl--rendered-bibliographies info)
+ (let (result
+ (rendered (citeproc-render-citations
+ processor
+ (org-cite-csl--output-format info)
+ (org-cite-csl--no-citelinks-p info))))
+ (dolist (citation citations)
+ (push (cons citation
+ (if (org-cite-csl--nocite-p citation info) "" (pop rendered)))
+ result))
+ (setq result (nreverse result))
+ (plist-put info :cite-citeproc-rendered-citations result)
+ result))))
+
+(defun org-cite-csl--bibliography-filter (bib-props)
+ "Return the sub-bibliography filter corresponding to bibliography properties.
+
+BIB-PROPS should be a plist representing the properties
+associated with a \"print_bibliography\" keyword, as returned by
+`org-cite-bibliography-properties'."
+ (let (result
+ (remove-keyword-colon (lambda (x) (intern (substring (symbol-name x) 1)))))
+ (map-do
+ (lambda (key value)
+ (pcase key
+ ((or :keyword :notkeyword :nottype :notcsltype :filter)
+ (dolist (v (split-string value ","))
+ (push (cons (funcall remove-keyword-colon key) v) result)))
+ ((or :type :csltype)
+ (if (string-match-p "," value)
+ (user-error "The \"%s\" print_bibliography option does not support comma-separated values" key)
+ (push (cons (funcall remove-keyword-colon key) value) result)))))
+ bib-props)
+ result))
+
+(defun org-cite-csl--rendered-bibliographies (info)
+ "Return the rendered bibliographies.
+
+INFO is the export state, as a property list.
+
+Return an (OUTPUTS PARAMETERS) list where OUTPUTS is an alist
+of (BIB-PROPS . OUTPUT) pairs where each key is a property list
+of a \"print_bibliography\" keyword and the corresponding OUTPUT
+value is the bibliography as rendered by Citeproc."
+ (or (plist-get info :cite-citeproc-rendered-bibliographies)
+ (let (bib-plists bib-filters)
+ ;; Collect bibliography property lists and the corresponding
+ ;; Citeproc sub-bib filters.
+ (org-element-map (plist-get info :parse-tree) 'keyword
+ (lambda (keyword)
+ (when (equal "PRINT_BIBLIOGRAPHY" (org-element-property :key keyword))
+ (let ((bib-plist (org-cite-bibliography-properties keyword)))
+ (push bib-plist bib-plists)
+ (push (org-cite-csl--bibliography-filter bib-plist) bib-filters)))))
+ (setq bib-filters (nreverse bib-filters)
+ bib-plists (nreverse bib-plists))
+ ;; Render and return all bibliographies.
+ (let ((processor (org-cite-csl--processor info)))
+ (citeproc-add-subbib-filters bib-filters processor)
+ (pcase-let* ((format (org-cite-csl--output-format info))
+ (`(,rendered-bibs . ,parameters)
+ (citeproc-render-bib
+ (org-cite-csl--processor info)
+ format
+ (org-cite-csl--no-citelinks-p info)))
+ (outputs (cl-mapcar #'cons bib-plists rendered-bibs))
+ (result (list outputs parameters)))
+ (plist-put info :cite-citeproc-rendered-bibliographies result)
+ result)))))
;;; Export capability
@@ -550,16 +683,13 @@ INFO is the export state, as a property list."
;; process.
(org-cite-parse-objects output))))
-(defun org-cite-csl-render-bibliography (_keys _files _style _props _backend info)
+(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-let* ((format (org-cite-csl--output-format info))
+ (`(,outputs ,parameters) (org-cite-csl--rendered-bibliographies info))
+ (output (cdr (assoc props outputs))))
(pcase format
('html
(concat
@@ -621,11 +751,15 @@ property list."
:export-bibliography #'org-cite-csl-render-bibliography
:export-finalizer #'org-cite-csl-finalizer
:cite-styles
- '((("author" "a") ("full" "f") ("caps" "c") ("caps-full" "cf"))
+ '((("author" "a") ("bare" "b") ("caps" "c") ("full" "f") ("bare-caps" "bc") ("caps-full" "cf") ("bare-caps-full" "bcf"))
(("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"))))
+ (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
+ (("nocite" "n"))
+ (("title" "ti") ("bare" "b"))
+ (("bibentry" "b") ("bare" "b"))
+ (("locators" "l") ("bare" "b"))))
(provide 'oc-csl)
;;; oc-csl.el ends here
diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el
index 2193a070eb6..00c069e157e 100644
--- a/lisp/org/oc-natbib.el
+++ b/lisp/org/oc-natbib.el
@@ -42,6 +42,10 @@
;; Bibliography accepts any style supported by "natbib" package.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(require 'oc)
(declare-function org-element-property "org-element" (property element))
diff --git a/lisp/org/oc.el b/lisp/org/oc.el
index c4cd0268c7c..43eb86224f9 100644
--- a/lisp/org/oc.el
+++ b/lisp/org/oc.el
@@ -61,6 +61,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org-compat)
(require 'org-macs)
(require 'seq)
@@ -323,12 +326,6 @@ place note numbers according to rules defined in `org-cite-note-rules'."
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.
@@ -415,14 +412,30 @@ optional keys can be set:
The \"nil\" style denotes the processor fall-back style. It
should have a corresponding entry in the value.
+ The value can also be a function. It will be called without
+ any argument and should return a list structured as the above.
+
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))
+ (setq org-cite--processors
+ (cons (apply #'org-cite--make-processor :name name body)
+ (seq-remove (lambda (p) (eq name (org-cite-processor-name p)))
+ org-cite--processors))))
+
+(defun org-cite-try-load-processor (name)
+ "Try loading citation processor NAME if unavailable.
+NAME is a symbol. When the NAME processor is unregistered, try
+loading \"oc-NAME\" library beforehand, then cross fingers."
+ (unless (org-cite-get-processor name)
+ (require (intern (format "oc-%s" name)) nil t)))
+
+(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-unregister-processor (name)
"Unregister citation processor NAME.
@@ -430,7 +443,7 @@ 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)
+ (pcase (org-cite-get-processor name)
('nil (error "Processor %S not registered" name))
(processor
(setq org-cite--processors (delete processor org-cite--processors))))
@@ -440,7 +453,7 @@ Return a non-nil value on a successful operation."
"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)))
+ (let ((p (org-cite-get-processor processor)))
(pcase capability
((guard (not p)) nil) ;undefined processor
('activate (functionp (org-cite-processor-activate p)))
@@ -673,7 +686,10 @@ strings."
(let ((collection
(seq-mapcat
(lambda (name)
- (org-cite-processor-cite-styles (org-cite--get-processor name)))
+ (pcase (org-cite-processor-cite-styles
+ (org-cite-get-processor name))
+ ((and (pred functionp) f) (funcall f))
+ (static-data static-data)))
(or processors
(mapcar (pcase-lambda (`(,_ . (,name . ,_))) name)
org-cite-export-processors))))
@@ -789,6 +805,39 @@ INFO is a plist used as a communication channel."
(cons (org-not-nil (car global))
(or (cdr local) (cdr global)))))))
+(defun org-cite-read-processor-declaration (s)
+ "Read processor declaration from string S.
+
+Return (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) triplet, when
+NAME is the processor name, as a symbol, and both
+BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings or nil. Those
+strings may contain spaces if they are enclosed within double
+quotes.
+
+String S is expected to contain between 1 and 3 tokens. The
+function raises an error when it contains too few or too many
+tokens. Spurious spaces are ignored."
+ (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))
+ (push (org-not-nil (read (current-buffer)))
+ result))
+ (t
+ (let ((origin (point)))
+ (skip-chars-forward "^ \t")
+ (push (org-not-nil (buffer-substring origin (point)))
+ result)))))
+ (skip-chars-forward " \t")
+ (unless (eobp)
+ (error "Trailing garbage following cite export processor declaration %S"
+ s))
+ (nreverse result))))
+
(defun org-cite-bibliography-style (info)
"Return expected bibliography style.
INFO is a plist used as a communication channel."
@@ -1177,7 +1226,7 @@ from the processor set in `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-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)
@@ -1204,40 +1253,22 @@ INFO is the communication channel, as a plist. It is modified by side-effect."
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.
+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."
+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)))
+ (user-error "Invalid cite export processor declaration: %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.
+ ;; keyword.
((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))))
+ (org-cite-read-processor-declaration s))
;; Value is an alist. It must come from
;; `org-cite-export-processors' variable. Find the most
;; appropriate processor according to current export
@@ -1274,8 +1305,9 @@ INFO is the communication channel, as a plist. It is modified by side-effect."
(pcase processor
('nil nil)
(`(,name . ,_)
+ (org-cite-try-load-processor name)
(cond
- ((not (org-cite--get-processor name))
+ ((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)))))
@@ -1288,7 +1320,7 @@ selected citation processor."
(pcase (plist-get info :cite-export)
('nil nil)
(`(,p ,_ ,_)
- (funcall (org-cite-processor-export-citation (org-cite--get-processor p))
+ (funcall (org-cite-processor-export-citation (org-cite-get-processor p))
citation
(org-cite-citation-style citation info)
(plist-get info :back-end)
@@ -1304,7 +1336,7 @@ used as a communication channel."
(`(,p ,_ ,_)
(let ((export-bibilography
(org-cite-processor-export-bibliography
- (org-cite--get-processor p))))
+ (org-cite-get-processor p))))
(when export-bibilography
(funcall export-bibilography
(org-cite-list-keys info)
@@ -1405,7 +1437,7 @@ channel, as a property list."
('nil output)
(`(,p ,_ ,_)
(let ((finalizer
- (org-cite-processor-export-finalizer (org-cite--get-processor p))))
+ (org-cite-processor-export-finalizer (org-cite-get-processor p))))
(if (not finalizer)
output
(funcall finalizer
@@ -1423,16 +1455,17 @@ channel, as a property list."
"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."
+ (unless org-cite-follow-processor
+ (user-error "No processor set to follow citations"))
+ (org-cite-try-load-processor org-cite-follow-processor)
(let ((name org-cite-follow-processor))
(cond
- ((null name)
- (user-error "No processor set to follow citations"))
- ((not (org-cite--get-processor name))
+ ((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))))
+ (let ((follow (org-cite-processor-follow (org-cite-get-processor name))))
(funcall follow datum arg))))))
@@ -1474,8 +1507,15 @@ CONTEXT is the element or object at point, as returned by `org-element-context'.
(not (looking-at-p "\\*+ END[ \t]*$")))
(let ((case-fold-search nil))
(looking-at org-complex-heading-regexp))))
- (match-beginning 4)
- (>= (point) (match-beginning 4))
+ (>= (point) (or
+ ;; Real heading.
+ (match-beginning 4)
+ ;; If no heading, end of priority.
+ (match-end 3)
+ ;; ... end of todo keyword.
+ (match-end 2)
+ ;; ... after stars.
+ (1+ (match-end 1))))
(or (not (match-beginning 5))
(< (point) (match-beginning 5))))))
;; White spaces after an object or blank lines after an element
@@ -1492,7 +1532,7 @@ CONTEXT is the element or object at point, as returned by `org-element-context'.
;; unaffected.
((eq type 'item)
(> (point) (+ (org-element-property :begin context)
- (current-indentation)
+ (org-current-text-indentation)
(if (org-element-property :checkbox context)
5 1))))
;; Other elements are invalid.
@@ -1537,38 +1577,42 @@ Citation keys are strings without the leading \"@\"."
(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-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.
+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 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,
+The generated function inserts or edits 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 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.
+ 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,
+ - 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."
+ 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)
@@ -1589,7 +1633,7 @@ The generated function inserts or edit a citation at point. More specifically,
(if (>= style-end (point))
;; On style part, edit the style.
(let ((style-start (+ 5 begin))
- (style (funcall select-style)))
+ (style (funcall select-style context)))
(unless style (user-error "Aborted"))
(org-with-point-at style-start
(delete-region style-start style-end)
@@ -1640,17 +1684,18 @@ The generated function inserts or edit a citation at point. More specifically,
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")
+ (unless org-cite-insert-processor
+ (user-error "No processor set to insert citations"))
+ (org-cite-try-load-processor org-cite-insert-processor)
(let ((name org-cite-insert-processor))
(cond
- ((null name)
- (user-error "No processor set to insert citations"))
- ((not (org-cite--get-processor name))
+ ((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))))
+ (insert (org-cite-processor-insert (org-cite-get-processor name))))
(cond
((memq (org-element-type context) '(citation citation-reference))
(funcall insert context arg))
diff --git a/lisp/org/ol-bbdb.el b/lisp/org/ol-bbdb.el
index ffca4384807..ec1d755e826 100644
--- a/lisp/org/ol-bbdb.el
+++ b/lisp/org/ol-bbdb.el
@@ -5,7 +5,7 @@
;; Authors: Carsten Dominik <carsten.dominik@gmail.com>
;; Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -93,6 +93,9 @@
;;
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-compat)
(require 'org-macs)
@@ -132,7 +135,7 @@
(defgroup org-bbdb-anniversaries nil
"Customizations for including anniversaries from BBDB into Agenda."
- :group 'org-bbdb)
+ :group 'org-agenda)
(defcustom org-bbdb-default-anniversary-format "birthday"
"Default anniversary class."
diff --git a/lisp/org/ol-bibtex.el b/lisp/org/ol-bibtex.el
index 81b99167b8e..313b1cde88c 100644
--- a/lisp/org/ol-bibtex.el
+++ b/lisp/org/ol-bibtex.el
@@ -107,6 +107,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'bibtex)
(require 'cl-lib)
(require 'org-compat)
@@ -133,9 +136,10 @@
(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-narrow-to-subtree "org" (&optional element))
(declare-function org-set-property "org" (property value))
(declare-function org-toggle-tag "org" (tag &optional onoff))
+(declare-function org-indent-region "org" (start end))
(declare-function org-search-view "org-agenda" (&optional todo-only string edit-at))
@@ -232,6 +236,11 @@
(defvar org-bibtex-entries nil
"List to hold parsed bibtex entries.")
+(defgroup org-bibtex nil
+ "Options for translating between Org headlines and BibTeX entries."
+ :tag "Org BibTeX"
+ :group 'org)
+
(defcustom org-bibtex-autogen-keys nil
"Set to a truth value to use `bibtex-generate-autokey' to generate keys."
:group 'org-bibtex
@@ -344,14 +353,20 @@ and `org-tags-exclude-from-inheritance'."
(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-put (property value &optional insert-raw)
+ "Set PROPERTY of headline at point to VALUE.
+The PROPERTY will be prefixed with `org-bibtex-prefix' when necessary.
+With non-nil optional argument INSERT-RAW, insert node property string
+at point."
+ (let* ((prop (upcase (if (keywordp property)
+ (substring (symbol-name property) 1)
+ property)))
+ (prop (concat (unless (string= org-bibtex-key-property prop)
+ org-bibtex-prefix)
+ prop)))
+ (if insert-raw
+ (insert (format ":%s: %s\n" prop value))
+ (org-set-property prop value))))
(defun org-bibtex-headline ()
"Return a bibtex entry of the given headline as a string."
@@ -703,10 +718,12 @@ Return the number of saved entries."
(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'."
+(defun org-bibtex-write (&optional noindent)
+ "Insert a heading built from the first element of `org-bibtex-entries'.
+When optional argument NOINDENT is non-nil, do not indent the properties
+drawer."
(interactive)
- (when (= (length org-bibtex-entries) 0)
+ (unless org-bibtex-entries
(error "No entries in `org-bibtex-entries'"))
(let* ((entry (pop org-bibtex-entries))
(org-special-properties nil) ; avoids errors with `org-entry-put'
@@ -714,14 +731,16 @@ Return the number of saved entries."
(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))
+ (insert "\n:PROPERTIES:\n")
+ (org-bibtex-put "TITLE" (funcall val :title) 'insert)
(org-bibtex-put org-bibtex-type-property-name
- (downcase (funcall val :type)))
+ (downcase (funcall val :type))
+ 'insert)
(dolist (pair entry)
(pcase (car pair)
(:title nil)
(:type nil)
- (:key (org-bibtex-put org-bibtex-key-property (cdr pair)))
+ (:key (org-bibtex-put org-bibtex-key-property (cdr pair) 'insert))
(:keywords (if org-bibtex-tags-are-keywords
(dolist (kw (split-string (cdr pair) ", *"))
(funcall
@@ -729,9 +748,14 @@ Return the number of saved entries."
(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)))
+ (org-bibtex-put (car pair) (cdr pair) 'insert)))
+ (_ (org-bibtex-put (car pair) (cdr pair) 'insert))))
+ (insert ":END:\n")
+ (mapc togtag org-bibtex-tags)
+ (unless noindent
+ (org-indent-region
+ (save-excursion (org-back-to-heading t) (point))
+ (point)))))
(defun org-bibtex-yank ()
"If kill ring holds a bibtex entry yank it as an Org headline."
@@ -745,10 +769,12 @@ Return the number of saved entries."
(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)))
+ (let ((pos (point)))
+ (dotimes (_ (org-bibtex-read-file file))
+ (save-excursion (org-bibtex-write 'noindent))
+ (re-search-forward org-property-end-re)
+ (insert "\n"))
+ (org-indent-region pos (point))))
(defun org-bibtex-export-to-kill-ring ()
"Export current headline to kill ring as bibtex entry."
diff --git a/lisp/org/ol-docview.el b/lisp/org/ol-docview.el
index 6ea224c76c8..7dbeb0ada5c 100644
--- a/lisp/org/ol-docview.el
+++ b/lisp/org/ol-docview.el
@@ -4,7 +4,7 @@
;; Author: Jan Böcker <jan.boecker at jboecker dot de>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -42,6 +42,8 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
(require 'doc-view)
(require 'ol)
@@ -75,7 +77,9 @@
(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)
+ (if (file-exists-p path)
+ (org-open-file path 1)
+ (error "No such file: %s" path))
(when page (doc-view-goto-page page))))
(defun org-docview-store-link ()
diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el
index 56239f65d43..93be1d90abc 100644
--- a/lisp/org/ol-doi.el
+++ b/lisp/org/ol-doi.el
@@ -26,6 +26,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ol)
(defcustom org-link-doi-server-url "https://doi.org/"
diff --git a/lisp/org/ol-eshell.el b/lisp/org/ol-eshell.el
index 1ca2aa2b28b..3be63601ddd 100644
--- a/lisp/org/ol-eshell.el
+++ b/lisp/org/ol-eshell.el
@@ -23,6 +23,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'eshell)
(require 'esh-mode)
(require 'ol)
@@ -46,7 +49,11 @@ followed by a colon."
(eshell-buffer-name (car buffer-and-command))
(command (cadr buffer-and-command)))
(if (get-buffer eshell-buffer-name)
- (pop-to-buffer eshell-buffer-name display-comint-buffer-action)
+ (pop-to-buffer
+ eshell-buffer-name
+ (if (boundp 'display-comint-buffer-action) ; Emacs >= 29
+ display-comint-buffer-action
+ '(display-buffer-same-window (inhibit-same-window))))
(eshell))
(goto-char (point-max))
(eshell-kill-input)
diff --git a/lisp/org/ol-eww.el b/lisp/org/ol-eww.el
index d1bb5195107..c3992fa0767 100644
--- a/lisp/org/ol-eww.el
+++ b/lisp/org/ol-eww.el
@@ -4,7 +4,7 @@
;; Author: Marco Wahl <marcowahlsoft>a<gmailcom>
;; Keywords: link, eww
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -44,14 +44,14 @@
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(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"
@@ -67,14 +67,10 @@
(when (eq major-mode 'eww-mode)
(org-link-store-props
:type "eww"
- :link (if (< emacs-major-version 25)
- eww-current-url
- (eww-current-url))
+ :link (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))))))
+ :description (or (plist-get eww-data :title)
+ (eww-current-url)))))
;; Some auxiliary functions concerning links in Eww buffers
diff --git a/lisp/org/ol-gnus.el b/lisp/org/ol-gnus.el
index 3a3857fbf92..185218ab772 100644
--- a/lisp/org/ol-gnus.el
+++ b/lisp/org/ol-gnus.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Tassilo Horn <tassilo at member dot fsf dot org>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -31,6 +31,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'gnus-sum)
(require 'gnus-util)
(require 'nnheader)
@@ -71,7 +74,7 @@ negates this setting for the duration of the command."
(defcustom org-gnus-no-server nil
"Should Gnus be started using `gnus-no-server'?"
- :group 'org-gnus
+ :group 'org-link-follow
:version "24.4"
:package-version '(Org . "8.0")
:type 'boolean)
diff --git a/lisp/org/ol-info.el b/lisp/org/ol-info.el
index 3730ff5ad4e..d332b2837bd 100644
--- a/lisp/org/ol-info.el
+++ b/lisp/org/ol-info.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -30,6 +30,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ol)
;; Declare external functions and variables
@@ -43,7 +46,8 @@
(org-link-set-parameters "info"
:follow #'org-info-open
:export #'org-info-export
- :store #'org-info-store-link)
+ :store #'org-info-store-link
+ :insert-description #'org-info-description-as-command)
;; Implementation
(defun org-info-store-link ()
@@ -63,24 +67,65 @@
"Follow an Info file and node link specified by PATH."
(org-info-follow-link path))
+(defun org-info--link-file-node (path)
+ "Extract file name and node from info link PATH.
+
+Return cons consisting of file name and node name or \"Top\" if node
+part is not specified. Components may be separated by \":\" or by \"#\".
+File may be a virtual one, see `Info-virtual-files'."
+ (if (not path)
+ '("dir" . "Top")
+ (string-match "\\`\\([^#:]*\\)\\(?:[#:]:?\\(.*\\)\\)?\\'" path)
+ (let* ((node (match-string 2 path))
+ ;; Do not reorder, `org-trim' modifies match.
+ (file (org-trim (match-string 1 path))))
+ (cons
+ (if (org-string-nw-p file) file "dir")
+ (if (org-string-nw-p node) (org-trim node) "Top")))))
+
+(defun org-info-description-as-command (link desc)
+ "Info link description that can be pasted as command.
+
+For the following LINK
+
+ \"info:elisp#Non-ASCII in Strings\"
+
+the result is
+
+ info \"(elisp) Non-ASCII in Strings\"
+
+that may be executed as shell command or evaluated by
+\\[eval-expression] (wrapped with parenthesis) to read the manual
+in Emacs.
+
+Calling convention is similar to `org-link-make-description-function'.
+DESC has higher priority and returned when it is not nil or empty string.
+If LINK is not an info link then DESC is returned."
+ (let* ((prefix "info:")
+ (need-file-node (and (not (org-string-nw-p desc))
+ (string-prefix-p prefix link))))
+ (pcase (and need-file-node
+ (org-info--link-file-node (org-unbracket-string prefix "" link)))
+ ;; Unlike (info "dir"), "info dir" shell command opens "(coreutils)dir invocation".
+ (`("dir" . "Top") "info \"(dir)\"")
+ (`(,file . "Top") (format "info %s" file))
+ (`(,file . ,node) (format "info \"(%s) %s\"" file node))
+ (_ desc))))
(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)))
+ (pcase-let ((`(,filename . ,nodename-or-index)
+ (org-info--link-file-node name)))
+ (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))))))
(defconst org-info-emacs-documents
'("ada-mode" "auth" "autotype" "bovine" "calc" "ccmode" "cl" "dbus" "dired-x"
@@ -95,7 +140,8 @@
Taken from <https://www.gnu.org/software/emacs/manual/html_mono/.>")
(defconst org-info-other-documents
- '(("libc" . "https://www.gnu.org/software/libc/manual/html_mono/libc.html")
+ '(("dir" . "https://www.gnu.org/manual/manual.html") ; index
+ ("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
@@ -129,9 +175,7 @@ See `org-info-emacs-documents' and `org-info-other-documents' for details."
(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-let ((`(,manual . ,node) (org-info--link-file-node path)))
(pcase format
(`html
(format "<a href=\"%s#%s\">%s</a>"
diff --git a/lisp/org/ol-irc.el b/lisp/org/ol-irc.el
index e36c44ff704..25d11ca13e4 100644
--- a/lisp/org/ol-irc.el
+++ b/lisp/org/ol-irc.el
@@ -48,6 +48,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ol)
(declare-function erc-buffer-filter "erc" (predicate &optional proc))
diff --git a/lisp/org/ol-man.el b/lisp/org/ol-man.el
index beed216acf9..a85ed9badfb 100644
--- a/lisp/org/ol-man.el
+++ b/lisp/org/ol-man.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Maintainer: Bastien Guerry <bzg@gnu.org>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -24,6 +24,9 @@
;;
;;; Commentary:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ol)
(org-link-set-parameters "man"
@@ -43,12 +46,22 @@ 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)
+ (search (match-string 2 path))
+ (buffer (funcall org-man-command command)))
(when search
- (with-current-buffer (concat "*Man " command "*")
- (goto-char (point-min))
- (search-forward search)))))
+ (with-current-buffer buffer
+ (goto-char (point-min))
+ (unless (search-forward search nil t)
+ (let ((process (get-buffer-process buffer)))
+ (while (process-live-p process)
+ (accept-process-output process)))
+ (goto-char (point-min))
+ (search-forward search))
+ (forward-line -1)
+ (let ((point (point)))
+ (let ((window (get-buffer-window buffer)))
+ (set-window-point window point)
+ (set-window-start window point)))))))
(defun org-man-store-link ()
"Store a link to a README file."
diff --git a/lisp/org/ol-mhe.el b/lisp/org/ol-mhe.el
index 49104d392aa..8bd8aa6bfdc 100644
--- a/lisp/org/ol-mhe.el
+++ b/lisp/org/ol-mhe.el
@@ -4,7 +4,7 @@
;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -31,6 +31,9 @@
;;; Code:
(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
(require 'ol)
;; Customization variables
diff --git a/lisp/org/ol-rmail.el b/lisp/org/ol-rmail.el
index 8a28d720bb0..4d6f82c9b4d 100644
--- a/lisp/org/ol-rmail.el
+++ b/lisp/org/ol-rmail.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -30,6 +30,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ol)
;; Declare external functions and variables
diff --git a/lisp/org/ol-w3m.el b/lisp/org/ol-w3m.el
index 80d6811a5c5..7bd241080bd 100644
--- a/lisp/org/ol-w3m.el
+++ b/lisp/org/ol-w3m.el
@@ -4,7 +4,7 @@
;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
@@ -41,6 +41,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ol)
(defvar w3m-current-url)
diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index 108f031cde4..cd52e9cf4df 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -27,8 +27,12 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org-compat)
(require 'org-macs)
+(require 'org-fold)
(defvar clean-buffer-list-kill-buffer-names)
(defvar org-agenda-buffer-name)
@@ -38,7 +42,6 @@
(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))
@@ -47,7 +50,7 @@
(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-at-point "org-element" (&optional pom cached-only))
(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))
@@ -66,10 +69,10 @@
(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-cycle-overview "org-cycle" ())
(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-fold-show-context "org-fold" (&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))
@@ -140,6 +143,19 @@ link.
Function that inserts a link with completion. The function
takes one optional prefix argument.
+`:insert-description'
+
+ String or function used as a default when prompting users for a
+ link's description. A string is used as-is, a function is
+ called with two arguments: the link location (a string such as
+ \"~/foobar\", \"id:some-org-id\" or \"https://www.foo.com\")
+ and the description generated by `org-insert-link'. It should
+ return the description to use (this reflects the behavior of
+ `org-link-make-description-function'). If it returns nil, no
+ default description is used, but no error is thrown (from the
+ user's perspective, this is equivalent to a default description
+ of \"\").
+
`:display'
Value for `invisible' text property on the hidden parts of the
@@ -199,7 +215,9 @@ You can interactively set the value of this variable by calling
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."
+use. If it returns nil, no default description is used, but no
+error is thrown (from the user’s perspective, this is equivalent
+to a default description of \"\")."
:group 'org-link
:type '(choice (const nil) (function))
:safe #'null)
@@ -604,6 +622,22 @@ exact and fuzzy text search.")
(defvar org-link--search-failed nil
"Non-nil when last link search failed.")
+
+(defvar-local org-link--link-folding-spec '(org-link
+ (:global t)
+ (:ellipsis . nil)
+ (:isearch-open . t)
+ (:fragile . org-link--reveal-maybe))
+ "Folding spec used to hide invisible parts of links.")
+
+(defvar-local org-link--description-folding-spec '(org-link-description
+ (:global t)
+ (:ellipsis . nil)
+ (:visible . t)
+ (:isearch-open . nil)
+ (:fragile . org-link--reveal-maybe))
+ "Folding spec used to reveal link description.")
+
;;; Internal Functions
@@ -700,7 +734,7 @@ followed by another \"%[A-F0-9]{2}\" group."
(make-indirect-buffer (current-buffer)
indirect-buffer-name
'clone))))
- (with-current-buffer indirect-buffer (org-overview))
+ (with-current-buffer indirect-buffer (org-cycle-overview))
indirect-buffer))))
(defun org-link--search-radio-target (target)
@@ -718,7 +752,7 @@ White spaces are not significant."
(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)
+ (org-fold-show-context 'link-search)
(throw :radio-match nil))))
(goto-char origin)
(user-error "No match for radio target: %s" target))))
@@ -761,6 +795,13 @@ syntax around the string."
(t nil))))
string))
+(defun org-link--reveal-maybe (region _)
+ "Reveal folded link in REGION when needed.
+This function is intended to be used as :fragile property of a folding
+spec."
+ (org-with-point-at (car region)
+ (not (org-in-regexp org-link-any-re))))
+
;;; Public API
@@ -975,7 +1016,9 @@ LINK is escaped with backslashes for inclusion in buffer."
(replace-regexp-in-string "]\\'"
(concat "\\&" zero-width-space)
(org-trim description))))))
- (if (not (org-string-nw-p link)) description
+ (if (not (org-string-nw-p link))
+ (or description
+ (error "Empty link"))
(format "[[%s]%s]"
(org-link-escape link)
(if description (format "[%s]" description) "")))))
@@ -1257,7 +1300,7 @@ of matched result, which is either `dedicated' or `fuzzy'."
(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))
+ (org-fold-show-context 'link-search))
type))
(defun org-link-heading-search-string (&optional string)
@@ -1322,7 +1365,7 @@ PATH is the sexp to evaluate, as a string."
(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? "
+ (format "Execute %s as Elisp? "
(org-add-props path nil 'face 'org-warning))))
(message "%s => %s" path
(if (eq ?\( (string-to-char path))
@@ -1377,7 +1420,7 @@ PATH is the command to execute, as a string."
(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? "
+ (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)
@@ -1430,7 +1473,7 @@ is non-nil, move backward."
(`nil nil)
(link
(goto-char (org-element-property :begin link))
- (when (org-invisible-p) (org-show-context))
+ (when (org-invisible-p) (org-fold-show-context 'link-search))
(throw :found t)))))
(goto-char pos)
(setq org-link--search-failed t)
@@ -1443,14 +1486,18 @@ If the link is in hidden text, expose it."
(interactive)
(org-next-link t))
+(defun org-link-descriptive-ensure ()
+ "Toggle the literal or descriptive display of links in current buffer if needed."
+ (if org-link-descriptive
+ (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible nil)
+ (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible t)))
+
;;;###autoload
(defun org-toggle-link-display ()
- "Toggle the literal or descriptive display of links."
+ "Toggle the literal or descriptive display of links in current buffer."
(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)))
+ (setq org-link-descriptive (not org-link-descriptive))
+ (org-link-descriptive-ensure))
;;;###autoload
(defun org-store-link (arg &optional interactive?)
@@ -1519,10 +1566,8 @@ non-nil."
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)))
+ ;; it, even if it is nil. Otherwise, fallback to nil (ask user).
+ (setq desc (plist-get org-store-link-plist :description)))
;; Store a link from a remote editing buffer.
((org-src-edit-buffer-p)
@@ -1563,7 +1608,7 @@ non-nil."
(t (setq link nil)))))
;; We are in the agenda, link to referenced location
- ((equal (bound-and-true-p org-agenda-buffer-name) (buffer-name))
+ ((eq major-mode 'org-agenda-mode)
(let ((m (or (get-text-property (point) 'org-hd-marker)
(get-text-property (point) 'org-marker))))
(when m
@@ -1574,10 +1619,8 @@ non-nil."
(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-time-stamp-format)
+ (org-encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
(org-link-store-props :type "calendar" :date cd)))
((eq major-mode 'image-mode)
@@ -1592,7 +1635,7 @@ non-nil."
(setq file (if file
(abbreviate-file-name
(expand-file-name (dired-get-filename nil t)))
- ;; otherwise, no file so use current directory.
+ ;; Otherwise, no file so use current directory.
default-directory))
(setq cpltxt (concat "file:" file)
link cpltxt)))
@@ -1605,24 +1648,23 @@ non-nil."
((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.
+ (setq custom-id (org-entry-get nil "CUSTOM_ID"))
+ (cond
+ ;; Store a link using the target at point
((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1)
- (setq cpltxt
+ (setq link
(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.
+ ;; Target may be shortened when link is inserted.
+ ;; Avoid [[target][file:~/org/test.org::target]]
+ ;; links. Maybe the case of identical target and
+ ;; description should be handled by `org-insert-link'.
+ cpltxt nil
+ desc nil
+ ;; Do not append #CUSTOM_ID link below.
+ custom-id nil))
((and (featurep 'org-id)
(or (eq org-id-link-to-org-use-id t)
(and interactive?
@@ -1631,13 +1673,12 @@ non-nil."
'create-if-interactive-and-no-custom-id)
(not custom-id))))
(and org-id-link-to-org-use-id (org-entry-get nil "ID"))))
+ ;; Store a link using the ID at point
(setq link (condition-case nil
(prog1 (org-id-store-link)
- (setq desc (or (plist-get org-store-link-plist
- :description)
- "")))
+ (setq desc (plist-get org-store-link-plist :description)))
(error
- ;; Probably before first headline, link only to file.
+ ;; Probably before first headline, link only to file
(concat "file:"
(abbreviate-file-name
(buffer-file-name (buffer-base-buffer))))))))
@@ -1697,8 +1738,7 @@ non-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))
+ (setq link (or link cpltxt))
(cond ((not desc))
((equal desc "NONE") (setq desc nil))
(t (setq desc (org-link-display-format desc))))
@@ -1728,6 +1768,9 @@ The history can be used to select a link previously stored with
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.
+Completion candidates include link descriptions.
+
+If there is a link under cursor then edit it.
You will also be prompted for a description, and if one is given, it will
be displayed in the buffer instead of the link.
@@ -1753,11 +1796,14 @@ 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."
+If the DESCRIPTION parameter is non-nil, this value will be used
+as the default description. If not, and the chosen link type has
+a non-nil `:insert-description' parameter, that is used to
+generate a description as described in `org-link-parameters'
+docstring. Otherwise, if `org-link-make-description-function' is
+non-nil, this function will be called with the link target, and
+the result will be the default link description. When called
+non-interactively, don't allow to edit the default description."
(interactive "P")
(let* ((wcf (current-window-configuration))
(origbuf (current-buffer))
@@ -1767,7 +1813,10 @@ don't allow to edit the default description."
(desc region)
(link link-location)
(abbrevs org-link-abbrev-alist-local)
- entry all-prefixes auto-desc)
+ (all-prefixes (append (mapcar #'car abbrevs)
+ (mapcar #'car org-link-abbrev-alist)
+ (org-link-types)))
+ entry)
(cond
(link-location) ; specified by arg, just use it.
((org-in-regexp org-link-bracket-re 1)
@@ -1808,9 +1857,6 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(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
@@ -1821,15 +1867,19 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
"Link: "
(append
(mapcar (lambda (x) (concat x ":")) all-prefixes)
- (mapcar #'car org-stored-links))
+ (mapcar #'car org-stored-links)
+ ;; Allow description completion. Avoid "nil" option
+ ;; in the case of `completing-read-default' and
+ ;; an error in `ido-completing-read' when some links
+ ;; have no description.
+ (delq nil (mapcar 'cadr 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)))
+ (setq link (car l))))
(when (or (member link all-prefixes)
(and (equal ":" (substring link -1))
(member (substring link 0 -1) all-prefixes)
@@ -1906,21 +1956,40 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(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))))
+ (let* ((type
+ (cond
+ ((and all-prefixes
+ (string-match (rx-to-string `(: string-start (submatch (or ,@all-prefixes)) ":")) link))
+ (match-string 1 link))
+ ((file-name-absolute-p link) "file")
+ ((string-match "\\`\\.\\.?/" link) "file")))
+ (initial-input
+ (cond
+ (description)
+ (desc)
+ ((org-link-get-parameter type :insert-description)
+ (let ((def (org-link-get-parameter type :insert-description)))
+ (condition-case nil
+ (cond
+ ((stringp def) def)
+ ((functionp def)
+ (funcall def link desc)))
+ (error
+ (message "Can't get link description from org link parameter `:insert-description': %S"
+ def)
+ (sit-for 2)
+ nil))))
+ (org-link-make-description-function
+ (condition-case nil
+ (funcall org-link-make-description-function link desc)
+ (error
+ (message "Can't get link description from %S"
+ 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))
@@ -1989,6 +2058,10 @@ Also refresh fontification if needed."
(cl-pushnew (org-element-property :value obj) rtn
:test #'equal))))
rtn))))
+ (setq targets
+ (sort targets
+ (lambda (a b)
+ (> (length a) (length b)))))
(setq org-target-link-regexp
(and targets
(concat before-re
@@ -2012,7 +2085,8 @@ Also refresh fontification if needed."
(list old-regexp org-target-link-regexp)
"\\|")
after-re)))))
- (when (featurep 'org-element)
+ (when (and (featurep 'org-element)
+ (not (bound-and-true-p org-mode-loading)))
(org-with-point-at 1
(while (re-search-forward regexp nil t)
(org-element-cache-refresh (match-beginning 1))))))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index e43950f13a3..eda24893843 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -45,8 +45,12 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ol)
+(require 'org-fold-core)
(require 'org)
(require 'org-macs)
(require 'org-refile)
@@ -76,6 +80,11 @@
(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-element-property "org-element" (property element))
+(declare-function org-element--cache-active-p "org-element"
+ (&optional called-from-cache-change-func-p))
+(declare-function org-element-lineage "org-element"
+ (datum &optional types with-self))
(declare-function org-habit-insert-consistency-graphs
"org-habit" (&optional line))
(declare-function org-is-habit-p "org-habit" (&optional pom))
@@ -127,13 +136,18 @@ name and week number or the separator lines."
:group 'org-agenda
:type 'boolean)
-(defcustom org-agenda-block-separator ?=
+(defcustom org-agenda-block-separator
+ (if (and (display-graphic-p)
+ (char-displayable-p ?─))
+ ?─
+ ?=)
"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
+ :package-version '(Org . "9.6")
:type '(choice
(const :tag "Disabled" nil)
(character)
@@ -458,10 +472,11 @@ agenda dispatcher `\\[org-agenda]'. Each entry is a list like this:
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
+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.
+ agenda* Appointments for current week/day.
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.
@@ -469,6 +484,8 @@ type The command type, any of the following symbols:
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.
+ alltodo The global TODO list.
+ stuck Stuck projects.
... A user-defined function.
match What to search for:
- a single keyword for TODO keyword searches
@@ -482,7 +499,7 @@ settings A list of option settings, similar to that in a let form, so like
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
+ 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.
@@ -494,9 +511,9 @@ 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:
+ are not allowed. Valid commands for a set are:
(agenda \"\" settings)
+ (agenda* \"\" settings)
(alltodo \"\" settings)
(stuck \"\" settings)
(todo \"match\" settings files)
@@ -516,7 +533,9 @@ should provide a description for the prefix, like
\\='((\"h\" . \"HOME + Name tag searches\") ; describe prefix \"h\"
(\"hl\" tags \"+HOME+Lisa\")
(\"hp\" tags \"+HOME+Peter\")
- (\"hk\" tags \"+HOME+Kim\")))"
+ (\"hk\" tags \"+HOME+Kim\")))
+
+See also Info node `(org) Custom Agenda Views'."
:group 'org-agenda-custom-commands
:type `(repeat
(choice :value ("x" "Describe command here" tags "" nil)
@@ -595,13 +614,17 @@ you can then use it to define a custom command."
'("+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.
+ See Info node `(org) Matching tags and properties' 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
@@ -609,6 +632,7 @@ This is a list of four items:
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
@@ -1044,9 +1068,16 @@ current item's tree, in an indirect buffer."
:type 'boolean)
(defcustom org-agenda-show-outline-path t
- "Non-nil means show outline path in echo area after line motion."
+ "Non-nil means show outline path in echo area after line motion.
+
+If set to `title', show outline path with prepended document
+title. Fallback to file name is no title is present."
:group 'org-agenda-startup
- :type 'boolean)
+ :type '(choice
+ (const :tag "Don't show outline path in agenda view." nil)
+ (const :tag "Show outline path with prepended file name." t)
+ (const :tag "Show outline path with prepended document title." title))
+ :package-version '(Org . "9.6"))
(defcustom org-agenda-start-with-entry-text-mode nil
"The initial value of entry-text-mode in a newly created agenda window."
@@ -1216,6 +1247,17 @@ For example, 9:30am would become 09:30 rather than 9:30."
:version "24.1"
:type 'boolean)
+(defcustom org-agenda-clock-report-header nil
+ "Header inserted before the table in Org agenda clock report mode.
+
+See Info node `(org) Agenda Commands' for more details."
+ :group 'org-agenda
+ :type '(choice
+ (string :tag "Header")
+ (const :tag "No header" nil))
+ :safe #'stringp
+ :package-version '(Org . "9.6"))
+
(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)))
@@ -1516,11 +1558,12 @@ the variable `org-agenda-time-grid'."
:type 'boolean)
(defcustom org-agenda-time-grid
- '((daily today require-timed)
- (800 1000 1200 1400 1600 1800 2000)
- "......"
- "----------------")
-
+ (let ((graphical (and (display-graphic-p)
+ (char-displayable-p ?┄))))
+ `((daily today require-timed)
+ (800 1000 1200 1400 1600 1800 2000)
+ ,(if graphical " ┄┄┄┄┄ " "......")
+ ,(if graphical "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄" "----------------")))
"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:
@@ -1540,6 +1583,7 @@ 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
+ :package-version '(Org . "9.6")
:type
'(list
(set :greedy t :tag "Grid Display Options"
@@ -1561,10 +1605,14 @@ will align with agenda items."
:type 'boolean)
(defcustom org-agenda-current-time-string
- "now - - - - - - - - - - - - - - - - - - - - - - - - -"
+ (if (and (display-graphic-p)
+ (char-displayable-p ?←)
+ (char-displayable-p ?─))
+ "← now ───────────────────────────────────────────────"
+ "now - - - - - - - - - - - - - - - - - - - - - - - - -")
"The string for the current time marker in the agenda."
:group 'org-agenda-time-grid
- :version "24.1"
+ :package-version '(Org . "9.6")
:type 'string)
(defgroup org-agenda-sorting nil
@@ -1614,8 +1662,9 @@ 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)'
+if one comparison returns a \"not-equal\". For example,
+ (setq org-agenda-sorting-strategy
+ \\='(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
@@ -2078,10 +2127,11 @@ the lower-case version of all tags."
(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:
+For example, this makes those two functions available:
- \\='((?R set-category)
- (?C bulk-cut))
+ (setq org-agenda-bulk-custom-functions
+ \\='((?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.
@@ -2092,7 +2142,8 @@ 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))
+ (setq org-agenda-bulk-custom-functions
+ \\='((?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
@@ -2111,7 +2162,7 @@ argument to `set-category' for each entry it's called against."
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))
+ (declare (debug t) (indent 1))
(org-with-gensyms (marker)
`(let ((,marker (get-text-property (if ,string 0 (line-beginning-position))
'org-hd-marker ,string)))
@@ -2158,7 +2209,17 @@ string that it returns."
(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)
+(defvar org-agenda-restrict nil
+ "Non-nil means agenda restriction is active.
+This is an internal flag indicating either temporary or extended
+agenda restriction. Specifically, it is set to t if the agenda
+is restricted to an entire file, and is set to the corresponding
+buffer if the agenda is restricted to a part of a file, e.g. a
+region or a substree. In the latter case,
+`org-agenda-restrict-begin' and `org-agenda-restrict-end' are set
+to the beginning and the end of the part.
+
+See also `org-agenda-set-restriction-lock'.")
(defvar org-agenda-follow-mode nil)
(defvar org-agenda-entry-text-mode nil)
(defvar org-agenda-clockreport-mode nil)
@@ -2237,6 +2298,7 @@ When nil, `q' will kill the single agenda buffer."
org-agenda-top-headline-filter
org-agenda-regexp-filter
org-agenda-effort-filter
+ org-agenda-filters-preset
org-agenda-markers
org-agenda-last-search-view-search-was-boolean
org-agenda-last-indirect-buffer
@@ -2312,7 +2374,8 @@ The following commands are available:
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))
+ (org-fold-core-initialize `(,org-link--description-folding-spec
+ ,org-link--link-folding-spec))
(easy-menu-change
'("Agenda") "Agenda Files"
(append
@@ -2688,10 +2751,15 @@ that have been changed along."
;;; 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)
+(defvar org-agenda-restrict-begin (make-marker)
+ "Internal variable used to mark the restriction beginning.
+It is only relevant when `org-agenda-restrict' is a buffer.")
+(defvar org-agenda-restrict-end (make-marker)
+ "Internal variable used to mark the restriction end.
+It is only relevant when `org-agenda-restrict' is a buffer.")
+(defvar org-agenda-overriding-restriction nil
+ "Non-nil means extended agenda restriction is active.
+This is an internal flag set by `org-agenda-set-restriction-lock'.")
(defcustom org-agenda-custom-commands-contexts nil
"Alist of custom agenda keys and contextual rules.
@@ -2700,7 +2768,8 @@ 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\\\\'\"))))
+ (setq org-agenda-custom-commands-contexts
+ \\='((\"p\" ((in-file . \"\\\\.txt\\\\'\")))))
Here are the available contexts definitions:
@@ -2718,7 +2787,8 @@ 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\\\\'\"))))
+ (setq org-agenda-custom-commands-contexts
+ \\='((\"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
@@ -2887,12 +2957,6 @@ Pressing `<' twice means to restrict to the current subtree or region
(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)
@@ -2918,12 +2982,12 @@ Pressing `<' twice means to restrict to the current subtree or region
(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)))))
+ ((eq restriction 'buffer)
+ (if (not (buffer-narrowed-p))
+ (setq org-agenda-restrict t)
+ (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
@@ -2939,30 +3003,29 @@ Pressing `<' twice means to restrict to the current subtree or region
(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))
+ (org-agenda-list arg))
(`agenda*
- (org-agenda-list current-prefix-arg nil nil t))
+ (org-agenda-list arg nil nil t))
(`alltodo
- (org-todo-list current-prefix-arg))
+ (org-todo-list arg))
(`search
- (org-search-view current-prefix-arg org-match nil))
+ (org-search-view arg org-match nil))
(`stuck
- (org-agenda-list-stuck-projects current-prefix-arg))
+ (org-agenda-list-stuck-projects arg))
(`tags
- (org-tags-view current-prefix-arg org-match))
+ (org-tags-view 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))
+ (org-match-sparse-tree arg org-match))
(`todo-tree
(org-check-for-org-mode)
(org-occur (concat "^" org-outline-regexp "[ \t]*"
@@ -2974,7 +3037,10 @@ Pressing `<' twice means to restrict to the current subtree or region
(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)))))
+ (_ (user-error "Invalid custom agenda command type %s" type))))
+ (let ((inhibit-read-only t))
+ (add-text-properties (point-min) (point-max)
+ `(org-lprops ,lprops))))
(org-agenda-run-series (nth 1 entry) (cddr entry))))
((equal org-keys "C")
(setq org-agenda-custom-commands org-agenda-custom-commands-orig)
@@ -3252,14 +3318,6 @@ s Search for keywords M Like m, but only TODO entries
(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))
@@ -3706,10 +3764,10 @@ removed from the entry content. Currently only `planning' is allowed here."
;; find and remove min common indentation
(goto-char (point-min))
(untabify (point-min) (point-max))
- (setq ind (current-indentation))
+ (setq ind (org-current-text-indentation))
(while (not (eobp))
(unless (looking-at "[ \t]*$")
- (setq ind (min ind (current-indentation))))
+ (setq ind (min ind (org-current-text-indentation))))
(beginning-of-line 2))
(goto-char (point-min))
(while (not (eobp))
@@ -3766,6 +3824,10 @@ 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-filters-preset nil
+ "Alist of filter types and associated preset of filters.
+This variable is local in `org-agenda' buffers. See `org-agenda-local-vars'.")
+
(defconst org-agenda-filter-variables
'((category . org-agenda-category-filter)
(tag . org-agenda-tag-filter)
@@ -3776,7 +3838,7 @@ the global options and expect it to be applied to the entire view.")
"Is any filter active?"
(cl-some (lambda (x)
(or (symbol-value (cdr x))
- (get :preset-filter x)))
+ (assoc-default (car x) org-agenda-filters-preset)))
org-agenda-filter-variables))
(defvar org-agenda-category-filter-preset nil
@@ -3885,10 +3947,6 @@ FILTER-ALIST is an alist of filters we need to apply when
(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)
@@ -3896,14 +3954,6 @@ FILTER-ALIST is an alist of filters we need to apply when
(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)
@@ -3913,7 +3963,7 @@ FILTER-ALIST is an alist of filters we need to apply when
(insert "\n"
(if (stringp org-agenda-block-separator)
org-agenda-block-separator
- (make-string (window-width) org-agenda-block-separator))
+ (make-string (window-max-chars-per-line) org-agenda-block-separator))
"\n"))
(narrow-to-region (point) (point-max)))
(setq org-done-keywords-for-agenda nil)
@@ -3928,7 +3978,12 @@ FILTER-ALIST is an alist of filters we need to apply when
(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-agenda-filters-preset
+ `((tag . ,org-agenda-tag-filter-preset)
+ (category . ,org-agenda-category-filter-preset)
+ (regexp . ,org-agenda-regexp-filter-preset)
+ (effort . ,org-agenda-effort-filter-preset)))
+ (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
@@ -3998,24 +4053,24 @@ agenda display, configure `org-agenda-finalize-hook'."
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)
+ (when (assoc-default 'tag org-agenda-filters-preset)
(org-agenda-filter-apply
- (get 'org-agenda-tag-filter :preset-filter) 'tag t))
+ (assoc-default 'tag org-agenda-filters-preset) 'tag t))
(when org-agenda-category-filter
(org-agenda-filter-apply org-agenda-category-filter 'category))
- (when (get 'org-agenda-category-filter :preset-filter)
+ (when (assoc-default 'category org-agenda-filters-preset)
(org-agenda-filter-apply
- (get 'org-agenda-category-filter :preset-filter) 'category))
+ (assoc-default 'category org-agenda-filters-preset) 'category))
(when org-agenda-regexp-filter
(org-agenda-filter-apply org-agenda-regexp-filter 'regexp))
- (when (get 'org-agenda-regexp-filter :preset-filter)
+ (when (assoc-default 'regexp org-agenda-filters-preset)
(org-agenda-filter-apply
- (get 'org-agenda-regexp-filter :preset-filter) 'regexp))
+ (assoc-default 'regexp org-agenda-filters-preset) 'regexp))
(when org-agenda-effort-filter
(org-agenda-filter-apply org-agenda-effort-filter 'effort))
- (when (get 'org-agenda-effort-filter :preset-filter)
+ (when (assoc-default 'effort org-agenda-filters-preset)
(org-agenda-filter-apply
- (get 'org-agenda-effort-filter :preset-filter) 'effort))
+ (assoc-default 'effort org-agenda-filters-preset) 'effort))
(add-hook 'kill-buffer-hook #'org-agenda-reset-markers 'append 'local))
(run-hooks 'org-agenda-finalize-hook))))
@@ -4157,34 +4212,46 @@ to t."
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.
+
+This may also be a Lisp form that will be evaluated. Useful
+forms include `org-agenda-skip-entry-if' and
+`org-agenda-skip-subtree-if'. See the Info node `(org) Special
+Agenda Views' for more details and examples.
+
+Never set this variable using `setq' or similar, because then it
+will apply to all future agenda commands. If you want a global
+skipping condition, use the option `org-agenda-skip-function-global'
+instead.
+
+The correct way to use `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 ()
+(defun org-agenda-skip (&optional element)
"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 (line-beginning-position)) 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))))
+continue from there.
+
+Optional argument ELEMENT contains element at point."
+ (when (or
+ (if element
+ (eq (org-element-type element) 'comment)
+ (save-excursion
+ (goto-char (line-beginning-position))
+ (looking-at comment-start-skip)))
+ (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
+ (or (and (save-match-data (org-in-archived-heading-p nil element))
+ (org-end-of-subtree t element))
+ (and (member org-archive-tag org-file-tags)
+ (goto-char (point-max)))))
+ (and org-agenda-skip-comment-trees
+ (org-in-commented-heading-p nil element)
+ (org-end-of-subtree t element))
+ (let ((to (or (org-agenda-skip-eval org-agenda-skip-function-global)
+ (org-agenda-skip-eval org-agenda-skip-function))))
+ (and to (goto-char to)))
+ (org-in-src-block-p t element))
+ (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.
@@ -4212,8 +4279,8 @@ 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
+ (if (and org-agenda-buffer (buffer-live-p org-agenda-buffer))
+ (with-current-buffer org-agenda-buffer
(push m org-agenda-markers))
(push m org-agenda-markers))
m))
@@ -4354,6 +4421,9 @@ items if they have an hour specification like [h]h:mm."
(- sd (+ (if (< d 0) 7 0) d)))))
(day-numbers (list start))
(day-cnt 0)
+ ;; FIXME: This may cause confusion when users are trying to
+ ;; debug agenda. The debugger will not trigger without
+ ;; redisplay.
(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
@@ -4471,6 +4541,10 @@ items if they have an hour specification like [h]h:mm."
(setq p (plist-put p :tend clocktable-end))
(setq p (plist-put p :scope 'agenda))
(setq tbl (apply #'org-clock-get-clocktable p))
+ (when org-agenda-clock-report-header
+ (insert (propertize org-agenda-clock-report-header 'face 'org-agenda-structure))
+ (unless (string-suffix-p "\n" org-agenda-clock-report-header)
+ (insert "\n")))
(insert tbl)))
(goto-char (point-min))
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
@@ -4929,7 +5003,7 @@ 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))
+ (when (> (+ (current-column) (string-width s) 1) (window-max-chars-per-line))
(insert "\n "))
(insert " " s))))
(insert "\n"))
@@ -5066,12 +5140,18 @@ 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."
+See `org-agenda-skip-if' for details about CONDITIONS.
+
+This function can be put into `org-agenda-skip-function' for the
+duration of a command."
(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."
+See `org-agenda-skip-if' for details about CONDITIONS.
+
+This function can be put into `org-agenda-skip-function' for the
+duration of a command."
(org-agenda-skip-if t conditions))
(defun org-agenda-skip-if (subtree conditions)
@@ -5093,8 +5173,8 @@ 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.
+The regexp is taken from the conditions list, and 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.
@@ -5553,7 +5633,8 @@ and the timestamp type relevant for the sorting strategy in
(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)
+ ee txt beg end inherited-tags todo-state-end-pos
+ effort effort-minutes)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -5572,6 +5653,9 @@ and the timestamp type relevant for the sorting strategy in
(goto-char (match-beginning 2))
(setq marker (org-agenda-new-marker (match-beginning 0))
category (org-get-category)
+ effort (save-match-data (or (get-text-property (point) 'effort)
+ (org-entry-get (point) org-effort-property)))
+ effort-minutes (when effort (save-match-data (org-duration-to-minutes effort)))
ts-date-pair (org-agenda-entry-get-agenda-timestamp (point))
ts-date (car ts-date-pair)
ts-date-type (cdr ts-date-pair)
@@ -5585,11 +5669,16 @@ and the timestamp type relevant for the sorting strategy in
(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)
+ txt (org-agenda-format-item ""
+ (org-add-props txt nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ level category tags t)
priority (1+ (org-get-priority txt)))
(org-add-props txt props
'org-marker marker 'org-hd-marker marker
'priority priority
+ 'effort effort 'effort-minutes effort-minutes
'level level
'ts-date ts-date
'type (concat "todo" ts-date-type) 'todo-state todo-state)
@@ -5713,8 +5802,8 @@ displayed in agenda view."
(regexp-quote
(substring
(format-time-string
- (car org-time-stamp-formats)
- (encode-time ; DATE bound by calendar
+ (org-time-stamp-format)
+ (org-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]>\\)"
@@ -5735,7 +5824,7 @@ displayed in agenda view."
(org-at-clock-log-p))
(not (org-at-timestamp-p 'agenda)))
(throw :skip nil))
- (org-agenda-skip))
+ (org-agenda-skip (org-element-at-point)))
(let* ((pos (match-beginning 0))
(repeat (match-string 1))
(sexp-entry (match-string 3))
@@ -5793,6 +5882,8 @@ displayed in agenda view."
(assq (point) deadline-position-alist))
(throw :skip nil))
(let* ((category (org-get-category pos))
+ (effort (org-entry-get pos org-effort-property))
+ (effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
(inherited-tags
(or (eq org-agenda-show-inherited-tags 'always)
(and (consp org-agenda-show-inherited-tags)
@@ -5811,7 +5902,10 @@ displayed in agenda view."
(item
(org-agenda-format-item
(and inactive? org-agenda-inactive-leader)
- head level category tags time-stamp org-ts-regexp habit?)))
+ (org-add-props head nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ 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))
@@ -5820,6 +5914,7 @@ displayed in agenda view."
'org-hd-marker (org-agenda-new-marker)
'date date
'level level
+ 'effort effort 'effort-minutes effort-minutes
'ts-date (if repeat (org-agenda--timestamp-to-absolute repeat)
current)
'todo-state todo-state
@@ -5843,24 +5938,38 @@ displayed in agenda view."
;; 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)
+ result beg b sexp sexp-entry todo-state warntime inherited-tags
+ effort effort-minutes)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
- (org-agenda-skip)
+ ;; We do not run `org-agenda-skip' right away because every single sexp
+ ;; in the buffer is matched here, unlike day-specific search
+ ;; in ordinary timestamps. Most of the sexps will not match
+ ;; the agenda day and it is quicker to run `org-agenda-skip' only for
+ ;; matching sexps later on.
(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))
+ (buffer-substring
+ (match-beginning 1)
+ (save-excursion
+ (goto-char (match-end 1))
+ (skip-chars-backward "[:blank:]")
+ (point)))
""))
(setq result (org-diary-sexp-entry sexp sexp-entry date))
(when result
+ ;; Only check if entry should be skipped on matching sexps.
+ (org-agenda-skip (org-element-at-point))
(setq marker (org-agenda-new-marker beg)
level (make-string (org-reduced-level (org-outline-level)) ? )
category (org-get-category beg)
+ effort (save-match-data (or (get-text-property (point) 'effort)
+ (org-entry-get (point) org-effort-property)))
inherited-tags
(or (eq org-agenda-show-inherited-tags 'always)
(and (listp org-agenda-show-inherited-tags)
@@ -5872,6 +5981,7 @@ displayed in agenda view."
todo-state (org-get-todo-state)
warntime (get-text-property (point) 'org-appt-warntime)
extra nil)
+ (setq effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
(dolist (r (if (stringp result)
(list result)
@@ -5883,9 +5993,14 @@ displayed in agenda view."
(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))
+ (setq txt (org-agenda-format-item extra
+ (org-add-props txt nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ level category tags 'time))
(org-add-props txt props 'org-marker marker
'date date 'todo-state todo-state
+ 'effort effort 'effort-minutes effort-minutes
'level level 'type "sexp" 'warntime warntime)
(push txt ee)))))
(nreverse ee)))
@@ -5970,13 +6085,14 @@ then those holidays will be skipped."
(regexp-quote
(substring
(format-time-string
- (car org-time-stamp-formats)
- (encode-time ; DATE bound by calendar
+ (org-time-stamp-format)
+ (org-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)
+ statep clockp state ee txt extra timestr rest clocked inherited-tags
+ effort effort-minutes)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -5987,7 +6103,10 @@ then those holidays will be skipped."
clockp (not (or closedp statep))
state (and statep (match-string 2))
category (org-get-category (match-beginning 0))
- timestr (buffer-substring (match-beginning 0) (line-end-position)))
+ timestr (buffer-substring (match-beginning 0) (line-end-position))
+ effort (save-match-data (or (get-text-property (point) 'effort)
+ (org-entry-get (point) org-effort-property))))
+ (setq effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
(when (string-match "\\]" timestr)
;; substring should only run to end of time stamp
(setq rest (substring timestr (match-end 0))
@@ -6034,7 +6153,10 @@ then those holidays will be skipped."
(closedp "Closed: ")
(statep (concat "State: (" state ")"))
(t (concat "Clocked: (" clocked ")")))
- txt level category tags timestr)))
+ (org-add-props txt nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ level category tags timestr)))
(setq type (cond (closedp "closed")
(statep "state")
(t "clock")))
@@ -6042,6 +6164,7 @@ then those holidays will be skipped."
(org-add-props txt props
'org-marker marker 'org-hd-marker hdmarker 'face 'org-agenda-done
'priority priority 'level level
+ 'effort effort 'effort-minutes effort-minutes
'type type 'date date
'undone-face 'org-warning 'done-face 'org-agenda-done)
(push txt ee))
@@ -6151,8 +6274,8 @@ See also the user option `org-agenda-clock-consistency-checks'."
(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))
+ (let* ((t1dec (decode-time t1))
+ (t2dec (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)))))
@@ -6190,137 +6313,313 @@ specification like [h]h:mm."
(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)))
+ (if (org-element--cache-active-p)
+ (org-element-cache-map
+ (lambda (el)
+ (when (and (org-element-property :deadline el)
+ (or (not with-hour)
+ (org-element-property
+ :hour-start
+ (org-element-property :deadline el))
+ (org-element-property
+ :hour-end
+ (org-element-property :deadline el))))
+ (goto-char (org-element-property :contents-begin el))
+ (catch :skip
+ (org-agenda-skip el)
+ (let* ((s (substring (org-element-property
+ :raw-value
+ (org-element-property :deadline el))
+ 1 -1))
+ (pos (save-excursion
+ (goto-char (org-element-property :contents-begin el))
+ ;; We intentionally leave NOERROR
+ ;; argument in `re-search-forward' nil. If
+ ;; the search fails here, something went
+ ;; wrong and we are looking at
+ ;; non-matching headline.
+ (re-search-forward regexp (line-end-position))
+ (1- (match-beginning 1))))
+ (todo-state (org-element-property :todo-keyword el))
+ (done? (eq 'done (org-element-property :todo-type el)))
+ (sexp? (eq 'diary
+ (org-element-property
+ :type (org-element-property :deadline el))))
+ ;; 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-element-property
+ :raw-value
+ (org-element-property :scheduled el)))))
+ (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
+ (goto-char (org-element-property :begin el))
+ (let* ((category (org-get-category))
+ (effort (save-match-data (or (get-text-property (point) 'effort)
+ (org-element-property (intern (concat ":" (upcase org-effort-property))) el))))
+ (effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
+ (level (make-string (org-element-property :level el)
+ ?\s))
+ (head (save-excursion
+ (goto-char (org-element-property :begin el))
+ (re-search-forward org-outline-regexp-bol)
+ (buffer-substring-no-properties (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 el (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)))
+ (org-add-props head nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ 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
+ 'effort effort 'effort-minutes effort-minutes
+ '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)))))))
+ :next-re regexp
+ :fail-re regexp
+ :narrow t)
+ (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 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"))))
+ 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
- ((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
+ (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
- ;; 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))))))
+ ((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))
+ (effort (save-match-data (or (get-text-property (point) 'effort)
+ (org-entry-get (point) org-effort-property))))
+ (effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
+ (level (make-string (org-reduced-level (org-outline-level))
+ ?\s))
+ (head (buffer-substring-no-properties
+ (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)))
+ (org-add-props head nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ 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
+ 'effort effort 'effort-minutes effort-minutes
+ '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)
@@ -6355,181 +6654,404 @@ scheduled items with an hour specification like [h]h:mm."
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)))
+ (if (org-element--cache-active-p)
+ (org-element-cache-map
+ (lambda (el)
+ (when (and (org-element-property :scheduled el)
+ (or (not with-hour)
+ (org-element-property
+ :hour-start
+ (org-element-property :scheduled el))
+ (org-element-property
+ :hour-end
+ (org-element-property :scheduled el))))
+ (goto-char (org-element-property :contents-begin el))
+ (catch :skip
+ (org-agenda-skip el)
+ (let* ((s (substring (org-element-property
+ :raw-value
+ (org-element-property :scheduled el))
+ 1 -1))
+ (pos (save-excursion
+ (goto-char (org-element-property :contents-begin el))
+ ;; We intentionally leave NOERROR
+ ;; argument in `re-search-forward' nil. If
+ ;; the search fails here, something went
+ ;; wrong and we are looking at
+ ;; non-matching headline.
+ (re-search-forward regexp (line-end-position))
+ (1- (match-beginning 1))))
+ (todo-state (org-element-property :todo-keyword el))
+ (donep (eq 'done (org-element-property :todo-type el)))
+ (sexp? (eq 'diary
+ (org-element-property
+ :type (org-element-property :scheduled el))))
+ ;; 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)
+ (string= "habit" (org-element-property :STYLE el))))
+ (suppress-delay
+ (let ((deadline (and org-agenda-skip-scheduled-delay-if-deadline
+ (org-element-property
+ :raw-value
+ (org-element-property :deadline el)))))
+ (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
+ (when (org-element-property :deadline el)
+ (org-time-string-to-time
+ (org-element-property :deadline el))))))
+ (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
+ (goto-char (org-element-property :begin el))
+ (let* ((category (org-get-category))
+ (effort (save-match-data
+ (or (get-text-property (point) 'effort)
+ (org-element-property (intern (concat ":" (upcase org-effort-property))) el))))
+ (effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
+ (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 el (not inherited-tags)))
+ (level (make-string (org-element-property :level el)
+ ?\s))
+ (head (save-excursion
+ (goto-char (org-element-property :begin el))
+ (re-search-forward org-outline-regexp-bol)
+ (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))
+ (org-add-props head nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ 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-element-property :begin el)))))
+ (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
+ 'effort effort 'effort-minutes effort-minutes
+ '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)))))))
+ :next-re regexp
+ :fail-re regexp
+ :narrow t)
+ (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 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"))))
+ 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
- ((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
+ (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
- ;; 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))))))
+ ((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))
+ (effort (save-match-data (or (get-text-property (point) 'effort)
+ (org-entry-get (point) org-effort-property))))
+ (effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
+ (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))
+ (org-add-props head nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ 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
+ 'effort effort 'effort-minutes effort-minutes
+ '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 ()
@@ -6546,7 +7068,8 @@ scheduled items with an hour specification like [h]h:mm."
(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)
+ level todo-state tags pos head donep inherited-tags
+ effort effort-minutes)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -6586,6 +7109,9 @@ scheduled items with an hour specification like [h]h:mm."
(throw :skip t))
(setq marker (org-agenda-new-marker (point))
category (org-get-category))
+ (setq effort (save-match-data (or (get-text-property (point) 'effort)
+ (org-entry-get (point) org-effort-property))))
+ (setq effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))
(if (not (re-search-backward org-outline-regexp-bol nil t))
(throw :skip nil)
(goto-char (match-beginning 0))
@@ -6613,7 +7139,10 @@ scheduled items with an hour specification like [h]h:mm."
(nth (if (= d1 d2) 0 1)
org-agenda-timerange-leaders)
(1+ (- d0 d1)) (1+ (- d2 d1)))
- head level category tags
+ (org-add-props head nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ level category tags
(save-match-data
(let ((hhmm1 (and (string-match org-ts-regexp1 s1)
(match-string 6 s1)))
@@ -6632,6 +7161,7 @@ scheduled items with an hour specification like [h]h:mm."
'org-marker marker 'org-hd-marker hdmarker
'type "block" 'date date
'level level
+ 'effort effort 'effort-minutes effort-minutes
'todo-state todo-state
'priority (org-get-priority txt))
(push txt ee))))
@@ -6920,6 +7450,7 @@ TODAYP is t when the current agenda view is on today."
(defun org-compile-prefix-format (key)
"Compile the prefix format into a Lisp form that can be evaluated.
+KEY is the agenda type (see `org-agenda-prefix-format').
The resulting form and associated variable bindings is returned
and stored in the variable `org-prefix-format-compiled'."
(setq org-prefix-has-time nil
@@ -7403,7 +7934,7 @@ Argument ARG is the prefix argument."
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
+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")
@@ -7439,7 +7970,7 @@ subtree."
(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-restrict t)
(setq org-agenda-overriding-restriction 'file)
(move-marker org-agenda-restrict-begin nil)
(move-marker org-agenda-restrict-end nil)
@@ -7593,19 +8124,19 @@ in the agenda."
org-agenda-buffer-name))
(org-agenda-keep-modes t)
(tag-filter org-agenda-tag-filter)
- (tag-preset (get 'org-agenda-tag-filter :preset-filter))
+ (tag-preset (assoc-default 'tag org-agenda-filters-preset))
(top-hl-filter org-agenda-top-headline-filter)
(cat-filter org-agenda-category-filter)
- (cat-preset (get 'org-agenda-category-filter :preset-filter))
+ (cat-preset (assoc-default 'category org-agenda-filters-preset))
(re-filter org-agenda-regexp-filter)
- (re-preset (get 'org-agenda-regexp-filter :preset-filter))
+ (re-preset (assoc-default 'regexp org-agenda-filters-preset))
(effort-filter org-agenda-effort-filter)
- (effort-preset (get 'org-agenda-effort-filter :preset-filter))
+ (effort-preset (assoc-default 'effort org-agenda-filters-preset))
(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))
+ (lprops (get-text-property p '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))
@@ -7616,10 +8147,6 @@ in the agenda."
((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
@@ -7627,7 +8154,9 @@ in the agenda."
(cl-progv
(mapcar #'car lprops)
(mapcar (lambda (binding) (eval (cadr binding) t)) lprops)
- (eval redo-cmd t)))
+ (eval redo-cmd t))
+ (let ((inhibit-read-only t))
+ (add-text-properties (point-min) (point-max) `(org-lprops ,lprops))))
(setq org-agenda-undo-list nil
org-agenda-pending-undo-list nil
org-agenda-tag-filter tag-filter
@@ -7636,10 +8165,6 @@ in the agenda."
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))
@@ -8035,7 +8560,7 @@ also press `-' or `+' to switch between filtering and excluding."
(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)
+ (when (assoc-default 'tag org-agenda-filters-preset)
(org-agenda-filter-apply org-agenda-tag-filter 'tag expand)))
((eq char ?.)
(setq org-agenda-tag-filter
@@ -8108,7 +8633,7 @@ grouptags."
((eq type 'tag)
(setq filter
(delete-dups
- (append (get 'org-agenda-tag-filter :preset-filter)
+ (append (assoc-default 'tag org-agenda-filters-preset)
filter)))
(dolist (x filter)
(let ((op (string-to-char x)))
@@ -8120,7 +8645,7 @@ grouptags."
((eq type 'category)
(setq filter
(delete-dups
- (append (get 'org-agenda-category-filter :preset-filter)
+ (append (assoc-default 'category org-agenda-filters-preset)
filter)))
(dolist (x filter)
(if (equal "-" (substring x 0 1))
@@ -8131,7 +8656,7 @@ grouptags."
((eq type 'regexp)
(setq filter
(delete-dups
- (append (get 'org-agenda-regexp-filter :preset-filter)
+ (append (assoc-default 'regexp org-agenda-filters-preset)
filter)))
(dolist (x filter)
(if (equal "-" (substring x 0 1))
@@ -8142,7 +8667,7 @@ grouptags."
((eq type 'effort)
(setq filter
(delete-dups
- (append (get 'org-agenda-effort-filter :preset-filter)
+ (append (assoc-default 'effort org-agenda-filters-preset)
filter)))
(dolist (x filter)
(push (org-agenda-filter-effort-form x) f))))
@@ -8343,7 +8868,16 @@ Negative selection means regexp must not match for selection of an entry."
(set var (concat (symbol-value var) string)))
(defun org-agenda-goto-date (date)
- "Jump to DATE in agenda."
+ "Jump to DATE in the agenda buffer.
+
+When called interactively, prompt for the date.
+When called from Lisp, DATE should be a date as returned by
+`org-read-date'.
+
+See also:
+ `org-agenda-earlier' (\\[org-agenda-earlier])
+ `org-agenda-later' (\\[org-agenda-later])
+ `org-agenda-goto-today' (\\[org-agenda-goto-today])"
(interactive
(list
(let ((org-read-date-prefer-future org-agenda-jump-prefer-future))
@@ -8375,7 +8909,12 @@ Negative selection means regexp must not match for selection of an entry."
org-agenda-this-buffer-is-sticky org-agenda-sticky))))
(defun org-agenda-goto-today ()
- "Go to today."
+ "Go to today's date in the agenda buffer.
+
+See also:
+ `org-agenda-later' (\\[org-agenda-later])
+ `org-agenda-earlier' (\\[org-agenda-earlier])
+ `org-agenda-goto-date' (\\[org-agenda-goto-date])"
(interactive)
(org-agenda-check-type t 'agenda)
(let* ((args (get-text-property (min (1- (point-max)) (point)) 'org-last-args))
@@ -8434,8 +8973,13 @@ When optional argument BACKWARD is set, go backward."
(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."
+ "Go forward in time by the current span in the agenda buffer.
+With prefix ARG, go forward that many times the current span.
+
+See also:
+ `org-agenda-earlier' (\\[org-agenda-earlier])
+ `org-agenda-goto-today' (\\[org-agenda-goto-today])
+ `org-agenda-goto-date' (\\[org-agenda-goto-date])"
(interactive "p")
(org-agenda-check-type t 'agenda)
(let* ((wstart (window-start))
@@ -8476,8 +9020,13 @@ With prefix ARG, go forward that many times the current span."
(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."
+ "Go backward in time by the current span in the agenda buffer.
+With prefix ARG, go backward that many times the current span.
+
+See also:
+ `org-agenda-later' (\\[org-agenda-later])
+ `org-agenda-goto-today' (\\[org-agenda-goto-today])
+ `org-agenda-goto-date' (\\[org-agenda-goto-date])"
(interactive "p")
(org-agenda-later (- arg)))
@@ -8811,13 +9360,13 @@ When called with a prefix argument, include all archive files as well."
(t ""))
(if (org-agenda-filter-any) " " "")
(if (or org-agenda-category-filter
- (get 'org-agenda-category-filter :preset-filter))
+ (assoc-default 'category org-agenda-filters-preset))
'(:eval (propertize
(concat "["
(mapconcat
#'identity
(append
- (get 'org-agenda-category-filter :preset-filter)
+ (assoc-default 'category org-agenda-filters-preset)
org-agenda-category-filter)
"")
"]")
@@ -8825,36 +9374,36 @@ When called with a prefix argument, include all archive files as well."
'help-echo "Category used in filtering"))
"")
(if (or org-agenda-tag-filter
- (get 'org-agenda-tag-filter :preset-filter))
+ (assoc-default 'tag org-agenda-filters-preset))
'(:eval (propertize
(concat (mapconcat
#'identity
(append
- (get 'org-agenda-tag-filter :preset-filter)
+ (assoc-default 'tag org-agenda-filters-preset)
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))
+ (assoc-default 'effort org-agenda-filters-preset))
'(:eval (propertize
(concat (mapconcat
#'identity
(append
- (get 'org-agenda-effort-filter :preset-filter)
+ (assoc-default 'effort org-agenda-filters-preset)
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))
+ (assoc-default 'regexp org-agenda-filters-preset))
'(:eval (propertize
(concat (mapconcat
(lambda (x) (concat (substring x 0 1) "/" (substring x 1) "/"))
(append
- (get 'org-agenda-regexp-filter :preset-filter)
+ (assoc-default 'regexp org-agenda-filters-preset)
org-agenda-regexp-filter)
""))
'face 'org-agenda-filter-regexp
@@ -8918,7 +9467,7 @@ When called with a prefix argument, include all archive files as well."
(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))))))
+ (org-with-point-at m (org-display-outline-path org-agenda-show-outline-path))))))
(defun org-agenda-show-tags ()
"Show the tags applicable to the current item."
@@ -8942,7 +9491,7 @@ When called with a prefix argument, include all archive files as well."
(push-mark)
(goto-char pos)
(when (derived-mode-p 'org-mode)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(recenter (/ (window-height) 2))
(org-back-to-heading t)
(let ((case-fold-search nil))
@@ -8975,8 +9524,8 @@ deletes the agenda entry and don't move to the next entry."
(while (< (point) mend)
(let ((ov (make-overlay (point) (line-end-position))))
(if (not (or all
- (and match (looking-at-p match))
- (eq level (org-get-at-bol 'level))))
+ (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))
@@ -9031,8 +9580,8 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'."
(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))))
+ (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))))
@@ -9234,7 +9783,7 @@ displayed Org file fills the frame."
(widen)
(goto-char pos)
(when (derived-mode-p 'org-mode)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(run-hooks 'org-agenda-after-show-hook)))))
(defun org-agenda-goto-mouse (ev)
@@ -9250,7 +9799,7 @@ if it was hidden in the outline."
(interactive "P")
(let ((win (selected-window)))
(org-agenda-goto t)
- (when full-entry (org-show-entry))
+ (when full-entry (org-fold-show-entry 'hide-drawers))
(select-window win)))
(defvar org-agenda-show-window nil)
@@ -9269,12 +9818,12 @@ fold drawers."
(select-window org-agenda-show-window)
(ignore-errors (scroll-up)))
(org-agenda-goto t)
- (org-show-entry)
+ (org-fold-show-entry 'hide-drawers)
(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))))
+ (org-fold-show-all '(drawers))))
(setq org-agenda-show-window (selected-window)))
(select-window win)))
@@ -9305,7 +9854,7 @@ if it was hidden in the outline."
(set-window-start (selected-window) (line-beginning-position))
(cond
((= more 0)
- (org-flag-subtree t)
+ (org-fold-subtree t)
(save-excursion
(org-back-to-heading)
(run-hook-with-args 'org-cycle-hook 'folded))
@@ -9313,20 +9862,20 @@ if it was hidden in the outline."
((and (called-interactively-p 'any) (= more 1))
(message "Remote: show with default settings"))
((= more 2)
- (outline-show-entry)
- (org-show-children)
+ (org-fold-show-entry 'hide-drawers)
+ (org-fold-show-children)
(save-excursion
(org-back-to-heading)
(run-hook-with-args 'org-cycle-hook 'children))
(message "Remote: CHILDREN"))
((= more 3)
- (outline-show-subtree)
+ (org-fold-show-subtree)
(save-excursion
(org-back-to-heading)
(run-hook-with-args 'org-cycle-hook 'subtree))
(message "Remote: SUBTREE"))
((> more 3)
- (outline-show-subtree)
+ (org-fold-show-subtree)
(message "Remote: SUBTREE AND ALL DRAWERS")))
(select-window win)))
@@ -9458,7 +10007,7 @@ the same tree node, and the headline of the tree node in the Org file."
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(let ((current-prefix-arg arg))
(call-interactively 'org-todo)
;; Make sure that log is recorded in current undo.
@@ -9499,11 +10048,11 @@ the same tree node, and the headline of the tree node in the Org file."
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(org-add-note))))
(defun org-agenda-change-all-lines (newhead hdmarker
- &optional fixface just-this)
+ &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
@@ -9517,7 +10066,8 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
(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
+ props m undone-face done-face finish new dotime level cat tags
+ effort effort-minutes) ;; pl
(save-excursion
(goto-char (point-max))
(beginning-of-line 1)
@@ -9531,6 +10081,8 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
cat (org-agenda-get-category)
level (org-get-at-bol 'level)
tags thetags
+ effort (org-get-at-bol 'effort)
+ effort-minutes (org-get-at-bol 'effort-minutes)
new
(let ((org-prefix-format-compiled
(or (get-text-property (min (1- (point-max)) (point)) 'format)
@@ -9538,7 +10090,11 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
(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))))
+ (org-agenda-format-item extra
+ (org-add-props newhead nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ level cat tags dotime))))
;; pl (text-property-any (line-beginning-position)
;; (line-end-position) 'org-heading t)
undone-face (org-get-at-bol 'undone-face)
@@ -9579,34 +10135,35 @@ 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))
+ (- (window-max-chars-per-line))
+ 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
+ (org-fold-core-ignore-modifications
+ (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)
+ (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)))))
+ (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."
@@ -9643,7 +10200,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(org-priority force-direction)
(end-of-line 1)
(setq newhead (org-get-heading)))
@@ -9667,7 +10224,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(if tag
(org-toggle-tag tag onoff)
(call-interactively #'org-set-tags-command))
@@ -9692,7 +10249,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(call-interactively 'org-set-property))))))
(defun org-agenda-set-effort ()
@@ -9711,7 +10268,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(call-interactively 'org-set-effort)
(end-of-line 1)
(setq newhead (org-get-heading)))
@@ -9733,7 +10290,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(call-interactively 'org-toggle-archive-tag)
(end-of-line 1)
(setq newhead (org-get-heading)))
@@ -9849,10 +10406,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(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))
+ (- (window-max-chars-per-line)
(length stamp))
t)
(add-text-properties
@@ -9944,7 +10498,7 @@ ARG is passed through to `org-deadline'."
(with-current-buffer (marker-buffer marker)
(widen)
(goto-char pos)
- (org-show-context 'agenda)
+ (org-fold-show-context 'agenda)
(org-clock-in arg)
(setq newhead (org-get-heading)))
(org-agenda-change-all-lines newhead hdmarker))
@@ -10033,7 +10587,7 @@ buffer, display it in another window."
(find-file-noselect org-agenda-diary-file))
(require 'org-datetree)
(org-datetree-find-date-create d1)
- (org-reveal t))
+ (org-fold-reveal t))
(t (user-error "Invalid selection character `%c'" char)))))
(defcustom org-agenda-insert-diary-strategy 'date-tree
@@ -10075,7 +10629,7 @@ the resulting entry will not be shown. When TEXT is empty, switch to
(anniversary
(or (re-search-forward "^\\*[ \t]+Anniversaries" nil t)
(progn
- (or (org-at-heading-p t)
+ (or (org-at-heading-p)
(progn
(outline-next-heading)
(insert "* Anniversaries\n\n")
@@ -10135,7 +10689,7 @@ the resulting entry will not be shown. When TEXT is empty, switch to
(message "%s entry added to %s"
(capitalize (symbol-name type))
(abbreviate-file-name org-agenda-diary-file)))
- (org-reveal t)
+ (org-fold-reveal t)
(message "Please finish entry here"))))
(defun org-agenda-insert-diary-as-top-level (text)
@@ -10173,7 +10727,7 @@ a timestamp can be added there."
(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))
+ (org-fold-show-set-visibility 'lineage))
(defun org-agenda-diary-entry ()
"Make a diary entry, like the `i' command from the calendar.
@@ -10626,8 +11180,8 @@ The prefix arg is passed through to the command if possible."
(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))))
+ (time (org-encode-time
+ 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(org-agenda-schedule nil time))))))))
(?f
@@ -10701,10 +11255,10 @@ current HH:MM time."
(,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))))
+ (,(assoc-default 'tag org-agenda-filters-preset) tag)
+ (,(assoc-default 'category org-agenda-filters-preset) category)
+ (,(assoc-default 'effort org-agenda-filters-preset) effort)
+ (,(assoc-default 'regexp org-agenda-filters-preset) regexp))))
(defun org-agenda-drag-line-forward (arg &optional backward)
"Drag an agenda line forward by ARG lines.
@@ -10806,7 +11360,7 @@ 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\")
+ ((headline \"IMPORTANT\")
(category \"Work\"))
will only add headlines containing IMPORTANT or headlines
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el
index c490e4b48fa..d08afa457ae 100644
--- a/lisp/org/org-archive.el
+++ b/lisp/org/org-archive.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(require 'cl-lib)
@@ -35,6 +38,9 @@
(declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction))
(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
+;; From org-element.el
+(defvar org-element--cache-avoid-synchronous-headline-re-parsing)
+
(defcustom org-archive-default-command 'org-archive-subtree
"The default archiving command."
:group 'org-archive
@@ -233,7 +239,7 @@ direct children of this heading."
(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)))
+ (org-time-stamp-format 'with-time 'no-brackets)))
(file (abbreviate-file-name
(or (buffer-file-name (buffer-base-buffer))
(error "No file associated to buffer"))))
@@ -253,7 +259,9 @@ direct children of this heading."
(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)
+ level datetree-date datetree-subheading-p
+ ;; Suppress on-the-fly headline updates.
+ (org-element--cache-avoid-synchronous-headline-re-parsing t))
(when (string-match "\\`datetree/\\(\\**\\)" heading)
;; "datetree/" corresponds to 3 levels of headings.
(let ((nsub (length (match-string 1 heading))))
@@ -319,7 +327,7 @@ direct children of this heading."
(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))
+ (org-fold-show-all '(headings blocks))
(if (and heading (not (and datetree-date (not datetree-subheading-p))))
(progn
(if (re-search-forward
@@ -334,7 +342,7 @@ direct children of this heading."
(insert (if datetree-date "" "\n") heading "\n")
(end-of-line 0))
;; Make the subtree visible
- (outline-show-subtree)
+ (org-fold-show-subtree)
(if org-archive-reversed-order
(progn
(org-back-to-heading t)
@@ -412,7 +420,7 @@ direct children of this heading."
(if (eq this-buffer buffer)
(concat "under heading: " heading)
(concat "in file: " (abbreviate-file-name afile)))))))
- (org-reveal)
+ (org-fold-reveal)
(if (looking-at "^[ \t]*$")
(outline-next-visible-heading 1))))
@@ -448,6 +456,8 @@ Archiving time is retained in the ARCHIVE_TIME node property."
(setq leader (match-string 0)
level (funcall outline-level))
(setq pos (point-marker))
+ ;; Advance POS upon insertion in front of it.
+ (set-marker-insertion-type pos t)
(condition-case nil
(outline-up-heading 1 t)
(error (setq e (point-max)) (goto-char (point-min))))
@@ -480,15 +490,15 @@ Archiving time is retained in the ARCHIVE_TIME node property."
(org-set-property
"ARCHIVE_TIME"
(format-time-string
- (substring (cdr org-time-stamp-formats) 1 -1)))
+ (org-time-stamp-format 'with-time 'no-brackets)))
(outline-up-heading 1 t)
- (org-flag-subtree t)
+ (org-fold-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)
+ (org-fold-reveal)
(if (looking-at "^[ \t]*$")
(outline-next-visible-heading 1))))
@@ -597,7 +607,7 @@ the children that do not contain any open TODO items."
(save-excursion
(org-back-to-heading t)
(setq set (org-toggle-tag org-archive-tag))
- (when set (org-flag-subtree t)))
+ (when set (org-fold-subtree t)))
(and set (beginning-of-line 1))
(message "Subtree %s" (if set "archived" "unarchived"))))))
diff --git a/lisp/org/org-attach-git.el b/lisp/org/org-attach-git.el
index ddb2ee97a07..95a2359c3b7 100644
--- a/lisp/org/org-attach-git.el
+++ b/lisp/org/org-attach-git.el
@@ -29,6 +29,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org-attach)
(require 'vc-git)
@@ -43,7 +46,8 @@
(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."
+If this is the symbol `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"
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 36c21b7021c..41f3a568c0b 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -34,6 +34,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org)
(require 'ol)
@@ -123,8 +126,8 @@ lns create a symbol link. Note that this is not supported
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
+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
@@ -136,7 +139,10 @@ Selective means to respect the inheritance setting in
(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."
+ "Non-nil means store a link to a file when attaching it.
+When t, store the link to original file location.
+When `file', store link to the attached file location.
+When `attached', store attach: link to the attached file."
:group 'org-attach
:version "24.1"
:type '(choice
@@ -160,28 +166,57 @@ When set to `query', ask the user instead."
"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)))
+ (and (< 2 (length id))
+ (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."
+ (and (< 6 (length id))
+ (format "%s/%s"
+ (substring id 0 6)
+ (substring id 6))))
+
+(defun org-attach-id-fallback-folder-format (id)
+ "Return \"__/X/ID\" folder path as a dumb fallback.
+X is the first character in the ID string.
+
+This function may be appended to `org-attach-id-path-function-list' to
+provide a fallback for non-standard ID values that other functions in
+`org-attach-id-path-function-list' are unable to handle. For example,
+when the ID is too short for `org-attach-id-ts-folder-format'.
+
+However, we recommend to define a more specific function spreading
+entries over multiple folders. This function may create a large
+number of entries in a single folder, which may cause issues on some
+systems."
+ (format "__/%s/%s" (substring id 0 1) id))
+
+(defcustom org-attach-id-to-path-function-list
+ '(org-attach-id-uuid-folder-format
+ org-attach-id-ts-folder-format
+ org-attach-id-fallback-folder-format)
+ "List of functions used to derive attachment path from an ID string.
+The functions are called with a single ID argument until the return
+value is an existing folder. If no folder has been created yet for
+the given ID, then the first non-nil value defines the attachment
+dir to be created.
+
+Usually, the ID format passed to the functions is defined by
+`org-id-method'. It is advised that the first function in the list do
+not generate all the attachment dirs inside the same parent dir. Some
+file systems may have performance issues in such scenario.
+
+Care should be taken when customizing this variable. Previously
+created attachment folders might not be correctly mapped upon removing
+functions from the list. Then, Org will not be able to detect the
+existing attachments."
:group 'org-attach
- :package-version '(Org . "9.3")
+ :package-version '(Org . "9.6")
:type '(repeat (function :tag "Function with ID as input")))
(defvar org-attach-after-change-hook nil
@@ -314,16 +349,17 @@ Shows a list of commands and prompts for another key to execute a command."
(concat (mapcar #'caar org-attach-commands)))))
(message msg)
(while (and (setq c (read-char-exclusive))
- (memq c '(14 16 22 134217846)))
+ (memq c '(?\C-n ?\C-p ?\C-v ?\M-v)))
(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)
+ (if (commandp command)
+ (command-execute command)
(error "No such attachment command: %c" c))))))
+;;;###autoload
(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.
@@ -335,7 +371,7 @@ 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'
+If CREATE-IF-NOT-EXISTS-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.
@@ -353,7 +389,7 @@ If no attachment directory can be derived, return nil."
(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))))
+ (setq attach-dir (org-attach-dir-from-id id 'existing))))
(if no-fs-check
attach-dir
(when (and attach-dir (file-directory-p attach-dir))
@@ -374,38 +410,40 @@ If the attachment by some reason cannot be created an error will be raised."
(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))))
+ (let ((id (org-id-get nil t)))
+ (or (setq attach-dir (org-attach-dir-from-id id))
+ (error "Failed to get folder for id %s, \
+adjust `org-attach-id-to-path-function-list'"
+ id))))
((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")))))
+ (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)
+(defun org-attach-dir-from-id (id &optional existing)
"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)))
+Try id-to-path functions in `org-attach-id-to-path-function-list'
+ignoring nils. If EXISTING is non-nil, then return the first path
+found in the filesystem. Otherwise return the first non-nil value."
+ (let ((fun-list org-attach-id-to-path-function-list)
+ (base-dir (expand-file-name org-attach-id-dir))
+ preferred first)
+ (while (and fun-list
+ (not preferred))
+ (let* ((name (funcall (car fun-list) id))
+ (candidate (and name (expand-file-name name base-dir))))
+ (setq fun-list (cdr fun-list))
+ (when candidate
+ (if (or (not existing) (file-directory-p candidate))
+ (setq preferred candidate)
+ (unless first
+ (setq first candidate))))))
+ (or preferred first)))
(defun org-attach-check-absolute-path (dir)
"Check if we have enough information to root the attachment directory.
@@ -483,8 +521,11 @@ DIR-property exists (that is different from the unset one)."
(org-attach-tag 'off))
(defun org-attach-url (url)
+ "Attach URL."
(interactive "MURL of the file to attach: \n")
- (let ((org-attach-method 'url))
+ (let ((org-attach-method 'url)
+ (org-safe-remote-resources ; Assume safety if in an interactive session.
+ (if noninteractive org-safe-remote-resources '(""))))
(org-attach-attach url)))
(defun org-attach-buffer (buffer-name)
@@ -503,7 +544,7 @@ if it would overwrite an existing filename."
(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.
+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
@@ -516,15 +557,24 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
current-prefix-arg
nil))
(setq method (or method org-attach-method))
+ (when (file-directory-p file)
+ (setq file (directory-file-name file)))
(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 'cp)
+ (if (file-directory-p file)
+ (copy-directory file attach-file nil nil t)
+ (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)))
+ ((eq method 'lns) (make-symbolic-link file attach-file 1))
+ ((eq method 'url)
+ (if (org--should-fetch-remote-resource-p file)
+ (url-copy-file file attach-file)
+ (error "The remote resource %S is considered unsafe, and will not be downloaded."
+ file))))
(run-hook-with-args 'org-attach-after-change-hook attach-dir)
(org-attach-tag)
(cond ((eq org-attach-store-link-p 'attached)
@@ -574,27 +624,27 @@ The attachment is created as an Emacs buffer."
(find-file (expand-file-name file attach-dir))
(message "New attachment %s" file)))
-(defun org-attach-delete-one (&optional file)
- "Delete a single attachment."
+(defun org-attach-delete-one (&optional attachment)
+ "Delete a single ATTACHMENT."
(interactive)
(let* ((attach-dir (org-attach-dir))
(files (org-attach-file-list attach-dir))
- (file (or file
+ (attachment (or attachment
(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)
+ (setq attachment (expand-file-name attachment attach-dir))
+ (unless (file-exists-p attachment)
+ (error "No such attachment: %s" attachment))
+ (delete-file attachment)
(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.
+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."
@@ -629,12 +679,12 @@ empty attachment directories."
t))
(delete-directory attach-dir))))))
-(defun org-attach-file-list (dir)
- "Return a list of files in the attachment directory.
+(defun org-attach-file-list (directory)
+ "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 "[^~]\\'"))))
+ (directory-files directory nil "[^~]\\'"))))
(defun org-attach-reveal ()
"Show the attachment directory of the current outline node.
@@ -645,7 +695,7 @@ exist yet. Respects `org-attach-preferred-new-method'."
(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.
+ "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)
@@ -749,14 +799,14 @@ This function is called by `org-archive-hook'. The option
;;;###autoload
(defun org-attach-dired-to-subtree (files)
- "Attach FILES marked or current file in dired to subtree in other window.
+ "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.
+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"))
+ (user-error "This command must be triggered in a `dired' buffer"))
(let ((start-win (selected-window))
(other-win
(get-window-with-predicate
@@ -776,7 +826,7 @@ Idea taken from `gnus-dired-attach'."
(add-hook 'org-archive-hook 'org-attach-archive-delete-maybe)
-(add-hook 'org-export-before-parsing-hook 'org-attach-expand-links)
+(add-hook 'org-export-before-parsing-functions 'org-attach-expand-links)
(provide 'org-attach)
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index abf4f9610e7..b26afeb036a 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -47,6 +47,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org)
(require 'org-refile)
@@ -57,7 +60,7 @@
(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-at-point "org-element" (&optional pom cached-only))
(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" ())
@@ -83,7 +86,7 @@
(defvar org-table-hlines)
(defvar org-capture-clock-was-started nil
- "Internal flag, noting if the clock was started.")
+ "Internal flag, keeping marker to the started clock.")
(defvar org-capture-last-stored-marker (make-marker)
"Marker pointing to the entry most recently stored with `org-capture'.")
@@ -294,6 +297,21 @@ properties are:
:no-save Do not save the target file after finishing the capture.
+ :hook A nullary function or list of nullary functions run before
+ `org-capture-mode-hook' when the template is selected.
+
+ :prepare-finalize A nullary function or list of nullary functions run before
+ `org-capture-prepare-finalize-hook'
+ when the template is selected.
+
+ :before-finalize A nullary function or list of nullary functions run before
+ `org-capture-before-finalize-hook'
+ when the template is selected.
+
+ :after-finalize A nullary function or list of nullary functions run before
+ `org-capture-after-finalize-hook'
+ when the template is selected.
+
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
@@ -309,6 +327,8 @@ be replaced with content and expanded:
introduced with %[pathname] are expanded this way.
Since this happens after expanding non-interactive
%-escapes, those can be used to fill the expression.
+ The evaluation happens with Org mode set as major mode
+ in a temporary buffer.
%<...> The result of `format-time-string' on the ... format
specification.
%t Time stamp, date only. The time stamp is the current
@@ -373,8 +393,8 @@ 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)))
+ :package-version '(Org . "9.6")
+ :set (lambda (s v) (set-default-toplevel-value s (org-capture-upgrade-templates v)))
:type
(let ((file-variants '(choice :tag "Filename "
(file :tag "Literal")
@@ -558,7 +578,8 @@ 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\"))))
+ (setq org-capture-templates-contexts
+ \\='((\"c\" ((in-mode . \"message-mode\")))))
Here are the available contexts definitions:
@@ -576,7 +597,8 @@ 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\"))))
+ (setq org-capture-templates-contexts
+ \\='((\"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\".
@@ -712,7 +734,8 @@ of the day at point (if any) or the current HH:MM time."
(org-capture-put :interrupted-clock
(copy-marker org-clock-marker)))
(org-clock-in)
- (setq-local org-capture-clock-was-started t))
+ (setq-local org-capture-clock-was-started
+ (copy-marker org-clock-marker)))
(error "Could not start the clock in this capture buffer")))
(when (org-capture-get :immediate-finish)
(org-capture-finalize))))))))
@@ -733,6 +756,17 @@ of the day at point (if any) or the current HH:MM time."
(format "* Template function %S not found" f)))
(_ "* Invalid capture template"))))
+(defun org-capture--run-template-functions (keyword &optional local)
+ "Run functions associated with KEYWORD on template's plist.
+For valid values of KEYWORD see `org-capture-templates'.
+If LOCAL is non-nil use the buffer-local value of `org-capture-plist'."
+ ;; Used in place of `run-hooks' because these functions have no associated symbol.
+ ;; They are stored directly on `org-capture-plist'.
+ (let ((value (org-capture-get keyword local)))
+ (if (functionp value)
+ (funcall value)
+ (mapc #'funcall value))))
+
(defun org-capture-finalize (&optional stay-with-capture)
"Finalize the capture process.
With prefix argument STAY-WITH-CAPTURE, jump to the location of the
@@ -744,6 +778,7 @@ captured item after finalizing."
(buffer-base-buffer (current-buffer)))
(error "This does not seem to be a capture buffer for Org mode"))
+ (org-capture--run-template-functions :prepare-finalize 'local)
(run-hooks 'org-capture-prepare-finalize-hook)
;; Update `org-capture-plist' with the buffer-local value. Since
@@ -753,10 +788,7 @@ captured item after finalizing."
;; 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)))
+ (equal org-clock-marker org-capture-clock-was-started))
;; Looks like the clock we started is still running.
(if org-capture-clock-keep
;; User may have completed clocked heading from the template.
@@ -816,6 +848,7 @@ captured item after finalizing."
;; the indirect buffer has been killed.
(org-capture-store-last-position)
+ (org-capture--run-template-functions :before-finalize 'local)
;; Run the hook
(run-hooks 'org-capture-before-finalize-hook))
@@ -864,6 +897,9 @@ captured item after finalizing."
;; Restore the window configuration before capture
(set-window-configuration return-wconf))
+ ;; Do not use the local arg to `org-capture--run-template-functions' here.
+ ;; The buffer-local value has been stored on `org-capture-plist'.
+ (org-capture--run-template-functions :after-finalize)
(run-hooks 'org-capture-after-finalize-hook)
;; Special cases
(cond
@@ -1050,9 +1086,10 @@ Store them in the capture property list."
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)))))
+ (org-encode-time
+ (apply #'list
+ 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
@@ -1129,7 +1166,7 @@ may have been stored before."
(org-switch-to-buffer-other-window
(org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
(widen)
- (org-show-all)
+ (org-fold-show-all)
(goto-char (org-capture-get :pos))
(setq-local outline-level 'org-outline-level)
(pcase (org-capture-get :type)
@@ -1139,6 +1176,7 @@ may have been stored before."
(`item (org-capture-place-item))
(`checkitem (org-capture-place-item)))
(setq-local org-capture-current-plist org-capture-plist)
+ (org-capture--run-template-functions :hook 'local)
(org-capture-mode 1))
(defun org-capture-place-entry ()
@@ -1171,8 +1209,11 @@ may have been stored before."
(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)))
+ (t (goto-char (point-max))
+ ;; Make sure that last point is not folded.
+ (org-fold-core-cycle-over-indirect-buffers
+ (org-fold-region (max 1 (1- (point-max))) (point-max) nil))))
+ (let ((origin (point-marker)))
(unless (bolp) (insert "\n"))
(org-capture-empty-lines-before)
(let ((beg (point)))
@@ -1237,7 +1278,7 @@ may have been stored before."
(point))
beg)))))))
;; Insert template.
- (let ((origin (point)))
+ (let ((origin (point-marker)))
(unless (bolp) (insert "\n"))
;; When a new list is created, always obey to `:empty-lines' and
;; friends.
@@ -1264,7 +1305,7 @@ may have been stored before."
(when item
(let ((i (save-excursion
(goto-char (org-element-property :post-affiliated item))
- (current-indentation))))
+ (org-current-text-indentation))))
(save-excursion
(goto-char beg)
(save-excursion
@@ -1338,7 +1379,7 @@ may have been stored before."
;; No table found. Create it with an empty header.
(goto-char end)
(unless (bolp) (insert "\n"))
- (let ((origin (point)))
+ (let ((origin (point-marker)))
(insert "| |\n|---|\n")
(narrow-to-region origin (point))))
;; In the current table, find the appropriate location for TEXT.
@@ -1367,7 +1408,7 @@ may have been stored before."
(t
(goto-char (org-table-end))))
;; Insert text and position point according to template.
- (let ((origin (point)))
+ (let ((origin (point-marker)))
(unless (bolp) (insert "\n"))
(let ((beg (point))
(end (save-excursion
@@ -1399,7 +1440,7 @@ Of course, if exact position has been required, just put it there."
(t
;; Beginning or end of file.
(goto-char (if (org-capture-get :prepend) (point-min) (point-max)))))
- (let ((origin (point)))
+ (let ((origin (point-marker)))
(unless (bolp) (insert "\n"))
(org-capture-empty-lines-before)
(org-capture-position-for-last-stored (point))
@@ -1569,14 +1610,16 @@ Lisp programs can force the template by setting KEYS to a string."
"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."
+by their respective `org-store-link-plist' properties if present.
+
+Expansion occurs in a temporary Org mode buffer."
(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))
+ (org-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))
@@ -1642,6 +1685,7 @@ by their respective `org-store-link-plist' properties if present."
(setq buffer-file-name nil)
(setq mark-active nil)
(insert template)
+ (org-mode)
(goto-char (point-min))
;; %[] insert contents of a file.
(save-excursion
@@ -1817,12 +1861,7 @@ by their respective `org-store-link-plist' properties if present."
(setq org-capture--prompt-history
(gethash prompt org-capture--prompt-history-table))
(push (org-completing-read
- ;; `format-prompt' is new in Emacs 28.1.
- (if (fboundp 'format-prompt)
- (format-prompt (or prompt "Enter string") default)
- (concat (or prompt "Enter string")
- (and default (format " [%s]" default))
- ": "))
+ (org-format-prompt (or prompt "Enter string") default)
completions
nil nil nil 'org-capture--prompt-history default)
strings)
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 42de0a0cf97..f28805d5e6b 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org)
@@ -35,6 +38,8 @@
(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-element--cache-active-p "org-element" ())
+(defvar org-element-use-cache)
(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" ())
@@ -50,7 +55,6 @@
(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."
@@ -321,6 +325,7 @@ string as argument."
:link nil
:narrow '40!
:indent t
+ :filetitle nil
:hidefiles nil
:formula nil
:timestamp nil
@@ -329,7 +334,7 @@ string as argument."
:formatter nil)
"Default properties for clock tables."
:group 'org-clock
- :version "24.1"
+ :package-version '(Org . "9.6")
:type 'plist)
(defcustom org-clock-clocktable-formatter 'org-clocktable-write-default
@@ -439,8 +444,8 @@ This uses the same format as `frame-title-format', which see."
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"
+Alternatively, can find x11idle.c in
+https://orgmode.org/worg/code/scripts/x11idle.c"
:group 'org-clock
:version "24.4"
:package-version '(Org . "8.0")
@@ -489,7 +494,7 @@ This variable only has effect if set with \\[customize]."
(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))
+ (set-default-toplevel-value symbol value))
:type 'boolean
:package-version '(Org . "9.5"))
@@ -694,7 +699,10 @@ pointing to it."
org-odd-levels-only)
(length prefix))))))
(when (and cat task)
- (insert (format "[%c] %-12s %s\n" i cat task))
+ (if (string-match-p "[[:print:]]" (make-string 1 i))
+ (insert (format "[%c] %-12s %s\n" i cat task))
+ ;; Avoid non-printable characters.
+ (insert (format "[N/A] %-12s %s\n" cat task)))
(cons i marker)))))
(defvar org-clock-task-overrun nil
@@ -767,7 +775,7 @@ 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))
+ (time-since org-clock-start-time))
60)))
(+ currently-clocked-time (or org-clock-total-time 0))))
@@ -997,7 +1005,7 @@ CLOCK is a cons cell of the form (MARKER START-TIME)."
(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))
+ ((pred (time-less-p nil))
(error "RESOLVE-TO must refer to a time in the past"))
(_
(when restart (error "RESTART is not valid here"))
@@ -1030,7 +1038,7 @@ CLOCK is a cons cell of the form (MARKER START-TIME)."
(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))
+ (org-fold-hide-drawer-toggle 'off nil element))
(throw 'exit nil)))))))))))
(defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly)
@@ -1094,12 +1102,12 @@ to be CLOCKED OUT."))))
?j ?J ?i ?q ?t ?T)))
(or (ding) t)))
(setq char-pressed
- (read-char (concat (funcall prompt-fn clock)
- " [jkKtTgGSscCiq]? ")
- nil 45)))
+ (read-char-exclusive (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))
+ (floor (org-time-convert-to-integer (time-since last-valid))
60))
(keep
(or (and (memq ch '(?k ?K))
@@ -1107,14 +1115,14 @@ to be CLOCKED OUT."))))
(and (memq ch '(?t ?T))
(floor
(/ (float-time
- (org-time-subtract (org-read-date t t) last-valid))
+ (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))
+ (barely-started-p (time-less-p
+ (time-subtract last-valid (cdr clock))
45))
(start-over (and subtractp barely-started-p)))
(cond
@@ -1141,9 +1149,9 @@ to be CLOCKED OUT."))))
(and gotback (= gotback default)))
'now)
(keep
- (org-time-add last-valid (* 60 keep)))
+ (time-add last-valid (* 60 keep)))
(gotback
- (org-time-since (* 60 gotback)))
+ (time-since (* 60 gotback)))
(t
(error "Unexpected, please report this as a bug")))
(and gotback last-valid)
@@ -1173,7 +1181,7 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
(format
"Dangling clock started %d mins ago"
(floor (org-time-convert-to-integer
- (org-time-since (cdr clock)))
+ (time-since (cdr clock)))
60))))
(or last-valid
(cdr clock)))))))))))
@@ -1190,8 +1198,10 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
(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)
+ ;; Check that x11idle exists. But don't do that on DOS/Windows,
+ ;; since the command definitely does NOT exist there, and invoking
+ ;; COMMAND.COM on MS-Windows is a bad idea -- it hangs.
+ (and (null (memq system-type '(windows-nt ms-dos)))
(eq 0 (call-process-shell-command
(format "command -v %s" org-clock-x11idle-program-name)))
;; Check that x11idle can retrieve the idle time
@@ -1224,9 +1234,11 @@ so long."
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))
+ (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))
+ (when (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
+ (cancel-timer org-clock-idle-timer)
+ (setq org-clock-idle-timer nil)
(org-clock-resolve
(cons org-clock-marker
org-clock-start-time)
@@ -1235,7 +1247,10 @@ so long."
(/ (float-time
(time-since org-clock-user-idle-start))
60)))
- org-clock-user-idle-start)))))
+ org-clock-user-idle-start)
+ (when (and (org-clocking-p) (not org-clock-idle-timer))
+ (setq org-clock-idle-timer
+ (run-with-timer 60 60 #'org-resolve-clocks-if-idle)))))))
(defvar org-clock-current-task nil "Task currently clocked in.")
(defvar org-clock-out-time nil) ; store the time of the last clock-out
@@ -1262,7 +1277,8 @@ 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)
+ (unless org-element-use-cache
+ (org-refresh-effort-properties))
(catch 'abort
(let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
(org-clocking-p)))
@@ -1316,7 +1332,7 @@ the default behavior."
;; Clock in at which position?
(setq target-pos
(if (and (eobp) (not (org-at-heading-p)))
- (line-beginning-position 0)
+ (org-with-wide-buffer (line-beginning-position 0))
(point)))
(save-excursion
(when (and selected-task (marker-buffer selected-task))
@@ -1340,8 +1356,8 @@ the default behavior."
(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-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)
@@ -1367,14 +1383,14 @@ the default behavior."
(sit-for 2)
(throw 'abort nil))
(t
- (insert-before-markers "\n")
+ (insert-before-markers-and-inherit "\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 " ")
+ (insert-and-inherit 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)))
@@ -1385,7 +1401,7 @@ the default behavior."
(format
"You stopped another clock %d mins ago; start this one from then? "
(/ (org-time-convert-to-integer
- (org-time-subtract
+ (time-subtract
(org-current-time org-clock-rounding-minutes t)
leftover))
60)))
@@ -1514,7 +1530,7 @@ The time is always returned as UTC."
(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))))
+ (org-encode-time (apply #'list 0 0 (nthcdr 2 dt)))))
((or (equal cmt "all")
(and (or (not cmt) (equal cmt "auto"))
(not lr)))
@@ -1575,19 +1591,23 @@ line and position cursor in that line."
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))))
+ (org-fold-core-ignore-modifications
+ ;; Skip planning line and property drawer, if any.
+ (org-end-of-meta-data)
+ (unless (bolp) (insert-and-inherit "\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-and-inherit ":" drawer ":\n:END:\n")
+ (org-indent-region beg (point))
+ (if (eq org-fold-core-style 'text-properties)
+ (org-fold-region
+ (line-end-position -1) (1- (point)) t 'drawer)
+ (org-fold-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.
@@ -1596,28 +1616,29 @@ line and position cursor in that line."
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-fold-core-ignore-modifications
+ (let ((beg (point)))
+ (insert-and-inherit
+ (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-and-inherit ":" drawer ":\n"))
+ (org-fold-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))))))))
@@ -1665,25 +1686,26 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(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) (line-end-position))
- (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)
+ (delete-region (point) (line-end-position))
+ (org-fold-core-ignore-modifications
+ (insert-and-inherit "--")
+ (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-and-inherit " => " (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))
@@ -1705,9 +1727,11 @@ to, overriding the existing value of `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
- "\\>"))))
+ (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
@@ -1837,10 +1861,10 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
(pop-to-buffer-same-window (marker-buffer m))
(if (or (< m (point-min)) (> m (point-max))) (widen))
(goto-char m)
- (org-show-entry)
+ (org-fold-show-entry)
(org-back-to-heading t)
(recenter org-clock-goto-before-context)
- (org-reveal)
+ (org-fold-reveal)
(if recent
(message "No running clock, this is the most recently clocked task"))
(run-hooks 'org-clock-goto-hook)))
@@ -1898,65 +1922,66 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(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) (line-end-position)
- (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)))))))
+ (let ((element-type
+ (org-element-type
+ (save-match-data
+ (org-element-at-point)))))
+ (cond
+ ((and (eq element-type 'clock) (match-end 2))
+ ;; Two time stamps.
+ (let* ((ss (match-string 2))
+ (se (match-string 3))
+ (ts (org-time-string-to-seconds ss))
+ (te (org-time-string-to-seconds se))
+ (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))))))
+ ((memq element-type '(headline inlinetask)) ;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
+ (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) (line-end-position)
+ (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)
@@ -2109,7 +2134,7 @@ fontified, and then returned."
(org-mode)
(org-create-dblock props)
(org-update-dblock)
- (org-font-lock-ensure)
+ (font-lock-ensure)
(forward-line 2)
(buffer-substring (point) (progn
(re-search-forward "^[ \t]*#\\+END" nil t)
@@ -2123,10 +2148,12 @@ 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.
+`org-clock-clocktable-default-properties'.
+
+The scope of the clocktable, when not specified in the previous
+variable, is `subtree' of the current heading when the function is
+called from inside heading, and `file' elsewhere (before the first
+heading).
When called with a prefix argument, move to the first clock table
in the buffer and update it."
@@ -2134,7 +2161,7 @@ in the buffer and update it."
(org-clock-remove-overlays)
(when arg
(org-find-dblock "clocktable")
- (org-show-entry))
+ (org-fold-show-entry))
(pcase (org-in-clocktable-p)
(`nil
(org-create-dblock
@@ -2342,16 +2369,16 @@ have priority."
(let* ((start (pcase key
(`interactive (org-read-date nil t nil "Range start? "))
(`untilnow nil)
- (_ (encode-time 0 m h d month y))))
+ (_ (org-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)))))
+ (_ (org-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))
@@ -2364,7 +2391,7 @@ have priority."
(`interactive "(Range interactively set)")
(`untilnow "now"))))
(if (not as-strings) (list start end text)
- (let ((f (cdr org-time-stamp-formats)))
+ (let ((f (org-time-stamp-format 'with-time)))
(list (and start (format-time-string f start))
(format-time-string f end)
text))))))
@@ -2419,14 +2446,14 @@ the currently selected interval size."
(cond
(d (setq ins (format-time-string
"%Y-%m-%d"
- (encode-time 0 0 0 (+ d n) nil y)))) ;; m
+ (org-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)))))
+ (org-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
@@ -2443,11 +2470,11 @@ the currently selected interval size."
(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)))))
+ (org-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))))
+ (org-encode-time 0 0 0 1 (+ mw n) y))))
(y
(setq ins (number-to-string (+ y n))))))
(t (user-error "Cannot shift clocktable block")))
@@ -2574,6 +2601,7 @@ from the dynamic block definition."
(emph (plist-get params :emphasize))
(compact? (plist-get params :compact))
(narrow (or (plist-get params :narrow) (and compact? '40!)))
+ (filetitle (plist-get params :filetitle))
(level? (and (not compact?) (plist-get params :level)))
(timestamp (plist-get params :timestamp))
(tags (plist-get params :tags))
@@ -2713,7 +2741,10 @@ from the dynamic block definition."
(if (eq formula '%) " %s |" "")
"\n")
- (file-name-nondirectory file-name)
+ (if filetitle
+ (or (org-get-title file-name)
+ (file-name-nondirectory file-name))
+ (file-name-nondirectory file-name))
(if level? "| " "") ;level column, maybe
(if timestamp "| " "") ;timestamp column, maybe
(if tags "| " "") ;tags column, maybe
@@ -2819,6 +2850,7 @@ a number of clock tables."
(`semimonth "Semimonthly report starting on: ")
(`month "Monthly report starting on: ")
(`year "Annual report starting on: ")
+ (`quarter "Quarterly 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))
@@ -2835,7 +2867,7 @@ a number of clock tables."
(pcase (if range (car range) (plist-get params :tstart))
((and (pred numberp) n)
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
- (encode-time 0 0 org-extend-today-until d m y)))
+ (org-encode-time 0 0 org-extend-today-until d m y)))
(timestamp
(seconds-to-time
(org-matcher-time (or timestamp
@@ -2845,7 +2877,7 @@ a number of clock tables."
(pcase (if range (nth 1 range) (plist-get params :tend))
((and (pred numberp) n)
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
- (encode-time 0 0 org-extend-today-until d m y)))
+ (org-encode-time 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"))
@@ -2857,20 +2889,22 @@ a number of clock tables."
;; 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)))))))
+ ;; In Emacs-27 and Emacs-28 `encode-time' does not support 6 elements
+ ;; list argument so `org-encode-time' can not be outside of `pcase'.
+ (pcase-let
+ ((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start)))
+ (pcase step
+ (`day (org-encode-time 0 0 org-extend-today-until (1+ d) m y))
+ (`week
+ (let ((offset (if (= dow week-start) 7
+ (mod (- week-start dow) 7))))
+ (org-encode-time 0 0 org-extend-today-until (+ d offset) m y)))
+ (`semimonth (org-encode-time 0 0 0
+ (if (< d 16) 16 1)
+ (if (< d 16) m (1+ m)) y))
+ (`month (org-encode-time 0 0 0 month-start (1+ m) y))
+ (`quarter (org-encode-time 0 0 0 month-start (+ 3 m) y))
+ (`year (org-encode-time 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.
@@ -3035,20 +3069,31 @@ Otherwise, return nil."
(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)))
+ ;; Prevent recursive call from `org-timestamp-change'.
+ (cl-letf (((symbol-function 'org-clock-update-time-maybe) #'ignore))
+ ;; Update timestamps.
+ (save-excursion
+ (goto-char (match-beginning 1)) ; opening timestamp
+ (save-match-data (org-timestamp-change 0 'day)))
+ ;; Refresh match data.
+ (looking-at re)
+ (save-excursion
+ (goto-char (match-beginning 3)) ; closing timestamp
+ (save-match-data (org-timestamp-change 0 'day))))
+ ;; Refresh match data.
+ (looking-at re)
+ (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 (- (org-time-string-to-seconds te)
+ (org-time-string-to-seconds 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))))))
@@ -3119,7 +3164,7 @@ The details of what will be saved are regulated by the variable
(let ((org-clock-in-resume 'auto-restart)
(org-clock-auto-clock-resolution nil))
(org-clock-in)
- (when (org-invisible-p) (org-show-context))))))
+ (when (org-invisible-p) (org-fold-show-context))))))
(_ nil)))))
(defun org-clock-kill-emacs-query ()
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 829fcbbe3fb..20bf2b7e9c9 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org)
@@ -159,8 +162,8 @@ 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-cycle-overview)
+ (org-cycle-content))
(org-defkey org-columns-map "c" #'org-columns-content)
(org-defkey org-columns-map "o" #'org-overview)
@@ -377,7 +380,8 @@ This is needed to later remove this relative remapping.")
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))
+ (when (and (ignore-errors (require 'face-remap))
+ org-columns-header-line-remap)
(setq org-columns-header-line-remap
(face-remap-add-relative 'header-line '(:inherit default))))
(save-excursion
@@ -512,9 +516,9 @@ for the duration of the command.")
(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-header-line-remap
+ (face-remap-remove-relative org-columns-header-line-remap)
+ (setq org-columns-header-line-remap nil))
(when org-columns-overlays
(when (local-variable-p 'org-previous-header-line-format)
(setq header-line-format org-previous-header-line-format)
@@ -556,7 +560,7 @@ for the duration of the command.")
(defun org-columns-check-computed ()
"Throw an error if current column value is computed."
- (let ((spec (nth (current-column) org-columns-current-fmt-compiled)))
+ (let ((spec (nth (org-current-text-column) org-columns-current-fmt-compiled)))
(and
(nth 3 spec)
(assoc spec (get-text-property (line-beginning-position) 'org-summaries))
@@ -697,9 +701,9 @@ 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)))))
+ (org-at-heading-p)))))
(unwind-protect (funcall fun)
- (when hide-body (outline-hide-entry)))))
+ (when hide-body (org-fold-hide-entry)))))
(defun org-columns-previous-allowed-value ()
"Switch to the previous allowed value for this column."
@@ -712,7 +716,8 @@ 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))
+ (let* ((column (org-current-text-column))
+ (visible-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)
@@ -762,7 +767,7 @@ an integer, select that value."
;; the right place on the current line.
(let ((org-columns-inhibit-recalculation)) (org-columns-redo))
(org-columns-update key)
- (org-move-to-column column))))))
+ (org-move-to-column visible-column))))))
(defun org-colview-construct-allowed-dates (s)
"Construct a list of three dates around the date in S.
@@ -772,9 +777,8 @@ 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))
+ (fmt (org-time-stamp-format (nth 1 time) (not active)))
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))
@@ -782,7 +786,7 @@ around it."
(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)))
+ (mapcar (lambda (x) (format-time-string fmt (org-encode-time x)))
(list time-before time time-after)))))
(defun org-columns-open-link (&optional arg)
@@ -924,14 +928,14 @@ details."
(if spec
(progn (setcar spec (car new))
(setcdr spec (cdr new)))
- (push new (nthcdr (current-column) org-columns-current-fmt-compiled)))
+ (push new (nthcdr (org-current-text-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)))
+ (let ((spec (nth (org-current-text-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
@@ -941,18 +945,18 @@ details."
;; 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))
+ (when (>= (org-current-text-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)))
+ (org-columns-new (nth (org-current-text-column) org-columns-current-fmt-compiled)))
(defun org-columns-widen (arg)
"Make the column wider by ARG characters."
(interactive "p")
- (let* ((n (current-column))
+ (let* ((n (org-current-text-column))
(entry (nth n org-columns-current-fmt-compiled))
(width (aref org-columns-current-maxwidths n)))
(setq width (max 1 (+ width arg)))
@@ -968,7 +972,7 @@ details."
(defun org-columns-move-right ()
"Swap this column with the one to the right."
(interactive)
- (let* ((n (current-column))
+ (let* ((n (org-current-text-column))
(cell (nthcdr n org-columns-current-fmt-compiled))
e)
(when (>= n (1- (length org-columns-current-fmt-compiled)))
@@ -992,7 +996,7 @@ details."
(defun org-columns-move-left ()
"Swap this column with the one to the left."
(interactive)
- (let* ((n (current-column)))
+ (let* ((n (org-current-text-column)))
(when (= n 0)
(error "Cannot shift this column further to the left"))
(backward-char 1)
@@ -1024,7 +1028,7 @@ the current buffer."
;; 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))
+ (unless (org-at-heading-p) (outline-next-heading))
(let ((inhibit-read-only t))
(insert-before-markers "#+COLUMNS: " fmt "\n"))))
(setq-local org-columns-default-format fmt))))))
@@ -1038,7 +1042,7 @@ the current buffer."
(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))
+ (let* ((spec (nth (org-current-text-column) org-columns-current-fmt-compiled))
(value
(or (cdr (assoc spec
(get-text-property (line-beginning-position)
@@ -1048,7 +1052,7 @@ the current buffer."
(let ((displayed (org-columns--displayed-value spec value))
(format (overlay-get ov 'org-columns-format))
(width
- (aref org-columns-current-maxwidths (current-column))))
+ (aref org-columns-current-maxwidths (org-current-text-column))))
(overlay-put ov 'org-columns-value value)
(overlay-put ov 'org-columns-value-modified displayed)
(overlay-put ov
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 15f0daa91ae..483f8844c34 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -29,9 +29,17 @@
;;; Code:
+
(require 'cl-lib)
+(require 'seq)
(require 'org-macs)
+(eval-when-compile (require 'subr-x)) ; Emacs < 28
+
+;; We rely on org-compat when generating Org version. Checking Org
+;; version here will interfere with Org build process.
+;; (org-assert-version)
+
(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))
@@ -40,7 +48,9 @@
(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-table" ())
-(declare-function org-element-at-point "org-element" ())
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
+(declare-function org-element-at-point-no-context "org-element" (&optional pom))
(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))
@@ -48,18 +58,29 @@
(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-fold-hide-block-toggle "org-fold" (&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-next-visible-heading "org" (arg))
(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-fold-show-context "org-fold" (&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))
+(declare-function org-fold-folded-p "org-fold" (&optional pos spec-or-alias))
+(declare-function org-fold-hide-sublevels "org-fold" (levels))
+(declare-function org-fold-hide-subtree "org-fold" ())
+(declare-function org-fold-region "org-fold" (from to flag &optional spec))
+(declare-function org-fold-show-all "org-fold" (&optional types))
+(declare-function org-fold-show-children "org-fold" (&optional level))
+(declare-function org-fold-show-entry "org-fold" (&optional hide-drawers))
+;; `org-string-equal-ignore-case' is in _this_ file but isn't at the
+;; top-level.
+(declare-function org-string-equal-ignore-case "org-compat" (string1 string2))
(defvar calendar-mode-map)
(defvar org-complex-heading-regexp)
@@ -70,6 +91,7 @@
(defvar org-table-dataline-regexp)
(defvar org-table-tab-recognizes-table.el)
(defvar org-table1-hline-regexp)
+(defvar org-fold-core-style)
;;; Emacs < 29 compatibility
@@ -99,10 +121,39 @@ the symbol of the calling function, for example."
(when (not (equal attr cachedattr))
(puthash sym attr org-file-has-changed-p--hash-table)))))
+(if (fboundp 'string-equal-ignore-case)
+ (defalias 'org-string-equal-ignore-case #'string-equal-ignore-case)
+ ;; From Emacs subr.el.
+ (defun org-string-equal-ignore-case (string1 string2)
+ "Like `string-equal', but case-insensitive.
+Upper-case and lower-case letters are treated as equal.
+Unibyte strings are converted to multibyte for comparison."
+ (eq t (compare-strings string1 0 nil string2 0 nil t))))
;;; Emacs < 28.1 compatibility
+(if (fboundp 'file-name-concat)
+ (defalias 'org-file-name-concat #'file-name-concat)
+ (defun org-file-name-concat (directory &rest components)
+ "Append COMPONENTS to DIRECTORY and return the resulting string.
+
+Elements in COMPONENTS must be a string or nil.
+DIRECTORY or the non-final elements in COMPONENTS may or may not end
+with a slash -- if they don't end with a slash, a slash will be
+inserted before contatenating."
+ (save-match-data
+ (mapconcat
+ #'identity
+ (delq nil
+ (mapcar
+ (lambda (str)
+ (when (and str (not (seq-empty-p str))
+ (string-match "\\(.+\\)/?" str))
+ (match-string 1 str)))
+ (cons directory components)))
+ "/"))))
+
(if (fboundp 'directory-empty-p)
(defalias 'org-directory-empty-p #'directory-empty-p)
(defun org-directory-empty-p (dir)
@@ -110,9 +161,47 @@ the symbol of the calling function, for example."
(and (file-directory-p dir)
(null (directory-files dir nil directory-files-no-dot-files-regexp t)))))
+(if (fboundp 'string-clean-whitespace)
+ (defalias 'org-string-clean-whitespace #'string-clean-whitespace)
+ ;; From Emacs subr-x.el.
+ (defun org-string-clean-whitespace (string)
+ "Clean up whitespace in STRING.
+All sequences of whitespaces in STRING are collapsed into a
+single space character, and leading/trailing whitespace is
+removed."
+ (let ((blank "[[:blank:]\r\n]+"))
+ (string-trim (replace-regexp-in-string blank " " string t t)
+ blank blank))))
+
+(if (fboundp 'format-prompt)
+ (defalias 'org-format-prompt #'format-prompt)
+ ;; From Emacs minibuffer.el, inlining
+ ;; `minibuffer-default-prompt-format' value and replacing `length<'
+ ;; (both new in Emacs 28.1).
+ (defun org-format-prompt (prompt default &rest format-args)
+ "Compatibility substitute for `format-prompt'."
+ (concat
+ (if (null format-args)
+ prompt
+ (apply #'format prompt format-args))
+ (and default
+ (or (not (stringp default))
+ (> (length default) 0))
+ (format " (default %s)"
+ (if (consp default)
+ (car default)
+ default)))
+ ": ")))
+
;;; Emacs < 27.1 compatibility
+(unless (fboundp 'combine-change-calls)
+ ;; A stub when `combine-change-calls' was not yet there.
+ (defmacro combine-change-calls (_beg _end &rest body)
+ (declare (debug (form form def-body)) (indent 2))
+ `(progn ,@body)))
+
(if (version< emacs-version "27.1")
(defsubst org-replace-buffer-contents (source &optional _max-secs _max-costs)
(replace-buffer-contents source))
@@ -189,6 +278,16 @@ extension beyond end of line was not controllable."
(define-obsolete-function-alias 'org-babel-edit-distance 'org-string-distance
"9.5")
+(unless (fboundp 'with-connection-local-variables)
+ ;; Added in Emacs 27: commit:21f54feee8, 2019-03-09.
+ ;; Redefining it using the old function `with-connection-local-profiles'.
+ (defmacro with-connection-local-variables (&rest body)
+ "Apply connection-local variables according to `default-directory'.
+Execute BODY, and unwind connection-local variables."
+ (declare (debug t))
+ `(with-connection-local-profiles (connection-local-get-profiles nil)
+ ,@body)))
+
;;; Emacs < 26.1 compatibility
@@ -214,70 +313,6 @@ 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 &optional _ _)
- "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.
@@ -298,6 +333,11 @@ Case is significant."
(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")
+(define-obsolete-function-alias 'org-show-context 'org-fold-show-context "9.6")
+(define-obsolete-function-alias 'org-show-entry 'org-fold-show-entry "9.6")
+(define-obsolete-function-alias 'org-show-children 'org-fold-show-children "9.6")
+
+
(defmacro org-re (s)
"Replace posix classes in regular expression S."
(declare (debug (form))
@@ -322,6 +362,14 @@ Counting starts at 1."
"use cl-subseq (note the 0-based counting)."
"9.0")
+;;;; Functions available since Emacs 25.1
+(define-obsolete-function-alias 'org-string-collate-lessp 'string-collate-lessp "9.6")
+(define-obsolete-function-alias 'org-decode-time 'decode-time "9.6")
+(define-obsolete-function-alias 'org-format-time-string 'format-time-string "9.6")
+(define-obsolete-function-alias 'org-time-add 'time-add "9.6")
+(define-obsolete-function-alias 'org-time-subtract 'time-subtract "9.6")
+(define-obsolete-function-alias 'org-time-since 'time-since "9.6")
+(define-obsolete-function-alias 'org-time-less-p 'time-less-p "9.6")
;;;; Functions available since Emacs 24.3
(define-obsolete-function-alias 'org-buffer-narrowed-p 'buffer-narrowed-p "9.0")
@@ -336,12 +384,20 @@ Counting starts at 1."
(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-timestamp-format
+ 'org-format-timestamp "Org 9.6")
+(define-obsolete-variable-alias 'org-export-before-processing-hook
+ 'org-export-before-processing-functions "Org 9.6")
+(define-obsolete-variable-alias 'org-export-before-parsing-hook
+ 'org-export-before-parsing-functions "Org 9.6")
(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-variable-alias 'org-latex-listings
+ 'org-latex-src-block-backend "9.6")
(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")
@@ -399,6 +455,80 @@ Counting starts at 1."
(define-obsolete-function-alias 'org-remove-latex-fragment-image-overlays
'org-clear-latex-preview "9.3")
+(define-obsolete-function-alias 'org-hide-archived-subtrees
+ 'org-fold-hide-archived-subtrees "9.6")
+
+(define-obsolete-function-alias 'org-flag-region
+ 'org-fold-region "9.6")
+
+(define-obsolete-function-alias 'org-flag-subtree
+ 'org-fold-subtree "9.6")
+
+(define-obsolete-function-alias 'org-hide-entry
+ 'org-fold-hide-entry "9.6")
+
+(define-obsolete-function-alias 'org-show-subtree
+ 'org-fold-show-subtree "9.6")
+
+(define-obsolete-function-alias 'org--hide-wrapper-toggle
+ 'org-fold--hide-wrapper-toggle "9.6")
+
+(define-obsolete-function-alias 'org-hide-block-toggle
+ 'org-fold-hide-block-toggle "9.6")
+
+(define-obsolete-function-alias 'org-hide-drawer-toggle
+ 'org-fold-hide-drawer-toggle "9.6")
+
+(define-obsolete-function-alias 'org--hide-drawers
+ 'org-fold--hide-drawers "9.6")
+
+(define-obsolete-function-alias 'org-hide-block-all
+ 'org-fold-hide-block-all "9.6")
+
+(define-obsolete-function-alias 'org-hide-drawer-all
+ 'org-fold-hide-drawer-all "9.6")
+
+(define-obsolete-function-alias 'org-show-all
+ 'org-fold-show-all "9.6")
+
+(define-obsolete-function-alias 'org-set-startup-visibility
+ 'org-cycle-set-startup-visibility "9.6")
+
+(define-obsolete-function-alias 'org-show-set-visibility
+ 'org-fold-show-set-visibility "9.6")
+
+(define-obsolete-function-alias 'org-check-before-invisible-edit
+ 'org-fold-check-before-invisible-edit "9.6")
+
+(define-obsolete-function-alias 'org-flag-above-first-heading
+ 'org-fold-flag-above-first-heading "9.6")
+
+(define-obsolete-function-alias 'org-show-branches-buffer
+ 'org-fold-show-branches-buffer "9.6")
+
+(define-obsolete-function-alias 'org-show-siblings
+ 'org-fold-show-siblings "9.6")
+
+(define-obsolete-function-alias 'org-show-hidden-entry
+ 'org-fold-show-hidden-entry "9.6")
+
+(define-obsolete-function-alias 'org-flag-heading
+ 'org-fold-heading "9.6")
+
+(define-obsolete-function-alias 'org-set-startup-visibility
+ 'org-cycle-set-startup-visibility "9.6")
+
+(define-obsolete-function-alias 'org-set-visibility-according-to-property
+ 'org-cycle-set-visibility-according-to-property "9.6")
+
+(define-obsolete-variable-alias 'org-scroll-position-to-restore
+ 'org-cycle-scroll-position-to-restore "9.6")
+(define-obsolete-function-alias 'org-optimize-window-after-visibility-change
+ 'org-cycle-optimize-window-after-visibility-change "9.6")
+
+(define-obsolete-function-alias 'org-force-cycle-archived
+ 'org-cycle-force-archived "9.6")
+
(define-obsolete-variable-alias 'org-attach-directory
'org-attach-id-dir "9.3")
(make-obsolete 'org-attach-store-link "No longer used" "9.4")
@@ -406,6 +536,17 @@ Counting starts at 1."
(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.5")
+(define-obsolete-variable-alias 'org-show-context-detail
+ 'org-fold-show-context-detail "9.6")
+
+(define-obsolete-variable-alias 'org-catch-invisible-edits
+ 'org-fold-catch-invisible-edits "9.6")
+
+(define-obsolete-variable-alias 'org-reveal-start-hook
+ 'org-fold-reveal-start-hook "9.6")
+(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.6")
+(define-obsolete-variable-alias 'org-plantuml-executable-args 'org-plantuml-args
+ "Org 9.6")
(defun org-in-fixed-width-region-p ()
"Non-nil if point in a fixed-width region."
(save-match-data
@@ -414,6 +555,19 @@ Counting starts at 1."
"use `org-element' library"
"9.0")
+;; FIXME: Unused; obsoleted; to be removed.
+(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))))
+
+;; FIXME: Unused; obsoleted; to be removed.
+(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)))))))
+
+(make-obsolete 'org-let "to be removed" "9.6")
+(make-obsolete 'org-let2 "to be removed" "9.6")
+
(defun org-compatible-face (inherits specs)
"Make a compatible face specification.
If INHERITS is an existing face and if the Emacs version supports
@@ -682,7 +836,7 @@ use of this function is for the stuck project list."
(defun org-show-block-all ()
"Unfold all blocks in the current buffer."
(interactive)
- (remove-overlays nil nil 'invisible 'org-hide-block))
+ (org-fold-show-all '(blocks)))
(make-obsolete 'org-show-block-all
"use `org-show-all' instead."
@@ -725,7 +879,7 @@ When optional argument ELEMENT is a parsed drawer, as returned by
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)
+ (if (and beg end) (org-fold-region beg end flag (if (eq org-fold-core-style 'text-properties) 'drawer 'outline))
(let ((drawer
(or element
(and (save-excursion
@@ -734,12 +888,12 @@ region as a drawer without further ado."
(org-element-at-point)))))
(when (memq (org-element-type drawer) '(drawer property-drawer))
(let ((post (org-element-property :post-affiliated drawer)))
- (org-flag-region
+ (org-fold-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)
+ flag (if (eq org-fold-core-style 'text-properties) 'drawer '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)))
@@ -751,7 +905,7 @@ 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))
+ (org-fold-hide-block-toggle nil t))
(defun org-hide-block-toggle-all ()
"Toggle the visibility of all blocks in the current buffer."
@@ -767,7 +921,7 @@ an error. Return a non-nil value when toggling is successful."
(save-excursion
(save-match-data
(goto-char (match-beginning 0))
- (org-hide-block-toggle)))))))
+ (org-fold-hide-block-toggle)))))))
(defun org-return-indent ()
"Goto next table row or insert a newline and indent.
@@ -807,6 +961,159 @@ context. See the individual commands for more information."
(define-obsolete-function-alias 'org-get-last-sibling 'org-get-previous-sibling "9.4")
+(define-obsolete-function-alias 'org-publish-cache-ctime-of-src
+ 'org-publish-cache-mtime-of-src "9.6")
+
+(define-obsolete-function-alias 'org-truely-invisible-p
+ 'org-truly-invisible-p "9.6"
+ "Compatibility alias for legacy misspelling of `org-truly-invisible-p'.")
+
+
+(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.")
+
+(make-obsolete-variable 'org-latex-babel-language-alist
+ "set `org-latex-language-alist' instead." "9.6")
+
+(make-obsolete-variable 'org-latex-polyglossia-language-alist
+ "set `org-latex-language-alist' instead." "9.6")
+
;;;; Obsolete link types
(eval-after-load 'ol
@@ -815,6 +1122,8 @@ context. See the individual commands for more information."
(org-link-set-parameters "file+sys"))) ;since Org 9.0
+
+
;;; Miscellaneous functions
@@ -831,12 +1140,6 @@ context. See the individual commands for more information."
((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
@@ -888,13 +1191,6 @@ Pass COLUMN and FORCE to `move-to-column'."
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)
@@ -921,37 +1217,8 @@ Pass COLUMN and FORCE to `move-to-column'."
(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-equal-ignore-case)
- ;; From Emacs subr.el.
- (defun string-equal-ignore-case (string1 string2)
- "Like `string-equal', but case-insensitive.
-Upper-case and lower-case letters are treated as equal.
-Unibyte strings are converted to multibyte for comparison."
- (eq t (compare-strings string1 0 nil string2 0 nil t))))
-
-(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))))))
+(define-obsolete-function-alias 'org-define-error #'define-error "9.6")
+(define-obsolete-function-alias 'org-without-partial-completion 'progn "9.6")
;;; Integration with and fixes for other packages
@@ -964,7 +1231,6 @@ attention to case differences."
(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
@@ -1004,7 +1270,7 @@ This also applied for speedbar access."
(add-hook 'imenu-after-jump-hook
(lambda ()
(when (derived-mode-p 'org-mode)
- (org-show-context 'org-goto))))
+ (org-fold-show-context 'org-goto))))
(add-hook 'org-mode-hook
(lambda ()
(setq imenu-create-index-function 'org-imenu-get-tree)))))
@@ -1069,7 +1335,7 @@ To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
(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))))))
+ (lambda () (and (derived-mode-p 'org-mode) (org-fold-show-context 'org-goto))))))
;;;; Add Log
@@ -1117,8 +1383,8 @@ ELEMENT is the element at point."
(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))
+ (org--flyspell-object-check-p (org-element-at-point-no-context)))
+ (let* ((element (org-element-at-point-no-context))
(post-affiliated (org-element-property :post-affiliated element)))
(cond
;; Ignore checks in all affiliated keywords but captions.
@@ -1133,7 +1399,7 @@ ELEMENT is the element at point."
(and log
(let ((drawer (org-element-lineage element '(drawer))))
(and drawer
- (string-equal-ignore-case
+ (org-string-equal-ignore-case
log (org-element-property :drawer-name drawer))))))
nil)
(t
@@ -1175,16 +1441,16 @@ ELEMENT is the element at point."
;;;; Bookmark
-(defun org-bookmark-jump-unhide ()
+(defun org-bookmark-jump-unhide (&rest _)
"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)))
+ (org-fold-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)
+(add-hook 'bookmark-after-jump-hook #'org-bookmark-jump-unhide)
;;;; Calendar
@@ -1237,42 +1503,29 @@ key."
;;;; 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)))
+(advice-add 'save-place-find-file-hook :after #'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))))
+(advice-add 'ecb-method-clicked :after #'org--ecb-show-context)
+(defun org--ecb-show-context (&rest _)
+ "Make hierarchy visible when jumping into location from ECB tree buffer."
+ (when (derived-mode-p 'org-mode)
+ (org-fold-show-context)))
;;;; Simple
-(defun org-mark-jump-unhide ()
+(defun org-mark-jump-unhide (&rest _)
"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)))
+ (org-fold-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)))
+(advice-add 'pop-to-mark-command :after #'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)))
+(advice-add 'exchange-point-and-mark :after #'org-mark-jump-unhide)
+(advice-add 'pop-global-mark :after #'org-mark-jump-unhide)
;;;; Session
@@ -1281,11 +1534,82 @@ key."
(eval-after-load 'session
'(add-to-list 'session-globals-exclude 'org-mark-ring))
+;;;; outline-mode
+
+;; Folding in outline-mode is not compatible with org-mode folding
+;; anymore. Working around to avoid breakage of external packages
+;; assuming the compatibility.
+(define-advice outline-flag-region (:around (oldfun from to flag &rest extra) fix-for-org-fold)
+ "Run `org-fold-region' when in org-mode."
+ (if (derived-mode-p 'org-mode)
+ (org-fold-region (max from (point-min)) (min to (point-max)) flag 'headline)
+ ;; Apply EXTRA to avoid breakages if advised function definition
+ ;; changes.
+ (apply oldfun from to flag extra)))
+
+(define-advice outline-next-visible-heading (:around (oldfun arg &rest extra) fix-for-org-fold)
+ "Run `org-next-visible-heading' when in org-mode."
+ (if (derived-mode-p 'org-mode)
+ (org-next-visible-heading arg)
+ ;; Apply EXTRA to avoid breakages if advised function definition
+ ;; changes.
+ (apply oldfun arg extra)))
+
+(define-advice outline-back-to-heading (:around (oldfun &optional invisible-ok &rest extra) fix-for-org-fold)
+ "Run `org-back-to-heading' when in org-mode."
+ (if (derived-mode-p 'org-mode)
+ (progn
+ (beginning-of-line)
+ (or (org-at-heading-p (not invisible-ok))
+ (let (found)
+ (save-excursion
+ (while (not found)
+ (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
+ nil t)
+ (signal 'outline-before-first-heading nil))
+ (setq found (and (or invisible-ok (not (org-fold-folded-p)))
+ (point)))))
+ (goto-char found)
+ found)))
+ ;; Apply EXTRA to avoid breakages if advised function definition
+ ;; changes.
+ (apply oldfun invisible-ok extra)))
+
+(define-advice outline-on-heading-p (:around (oldfun &optional invisible-ok &rest extra) fix-for-org-fold)
+ "Run `org-at-heading-p' when in org-mode."
+ (if (derived-mode-p 'org-mode)
+ (org-at-heading-p (not invisible-ok))
+ ;; Apply EXTRA to avoid breakages if advised function definition
+ ;; changes.
+ (apply oldfun invisible-ok extra)))
+
+(define-advice outline-hide-sublevels (:around (oldfun levels &rest extra) fix-for-org-fold)
+ "Run `org-fold-hide-sublevels' when in org-mode."
+ (if (derived-mode-p 'org-mode)
+ (org-fold-hide-sublevels levels)
+ ;; Apply EXTRA to avoid breakages if advised function definition
+ ;; changes.
+ (apply oldfun levels extra)))
+
+(define-advice outline-toggle-children (:around (oldfun &rest extra) fix-for-org-fold)
+ "Run `org-fold-hide-sublevels' when in org-mode."
+ (if (derived-mode-p 'org-mode)
+ (save-excursion
+ (org-back-to-heading)
+ (if (not (org-fold-folded-p (line-end-position)))
+ (org-fold-hide-subtree)
+ (org-fold-show-children)
+ (org-fold-show-entry 'hide-drawers)))
+ ;; Apply EXTRA to avoid breakages if advised function definition
+ ;; changes.
+ (apply oldfun extra)))
+
+;; TODO: outline-headers-as-kill
+
;;;; Speed commands
(make-obsolete-variable 'org-speed-commands-user
"configure `org-speed-commands' instead." "9.5")
-
(provide 'org-compat)
;; Local variables:
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el
index 41813cb184b..0d2ce593d78 100644
--- a/lisp/org/org-crypt.el
+++ b/lisp/org/org-crypt.el
@@ -55,6 +55,9 @@
;;; Code:
(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
(require 'org-compat)
(declare-function epg-decrypt-string "epg" (context cipher))
@@ -73,7 +76,7 @@
(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-fold-subtree "org-fold" (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))
@@ -196,8 +199,9 @@ See `org-crypt-disable-auto-save'."
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))
+ (pcase (org-entry-get nil "CRYPTKEY" 'selective 'literal-nil)
+ ("nil" "")
+ (key (or key org-crypt-key ""))))
(bound-and-true-p epa-file-encrypt-to)
(progn
(message "No crypt key set, using symmetric encryption.")
@@ -243,7 +247,7 @@ Assume `epg-context' is set."
(error (error-message-string err)))))
(when folded-heading
(goto-char folded-heading)
- (org-flag-subtree t))
+ (org-fold-subtree t))
nil)))))
;;;###autoload
@@ -280,7 +284,7 @@ Assume `epg-context' is set."
'org-crypt-text encrypted-text))
(when folded-heading
(goto-char folded-heading)
- (org-flag-subtree t))
+ (org-fold-subtree t))
nil)))
(_ nil)))
@@ -313,7 +317,7 @@ Assume `epg-context' is set."
'org-mode-hook
(lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t))))
-(add-hook 'org-reveal-start-hook 'org-decrypt-entry)
+(add-hook 'org-fold-reveal-start-hook 'org-decrypt-entry)
(provide 'org-crypt)
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index b1ee32ab335..cba99fca218 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -135,6 +135,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(eval-when-compile (require 'cl-lib))
(require 'org)
@@ -155,7 +158,6 @@ 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)
@@ -164,7 +166,6 @@ See the ctags documentation for more information.")
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
@@ -186,7 +187,6 @@ Created as a local variable in each buffer.")
"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)
@@ -205,7 +205,8 @@ The following patterns are replaced in the string:
(visit-tags-table tags-filename))))))
-(defadvice visit-tags-table (after org-ctags-load-tag-list activate compile)
+(advice-add 'visit-tags-table :after #'org--ctags-load-tag-list)
+(defun org--ctags-load-tag-list (&rest _)
(when (and org-ctags-enabled-p tags-file-name)
(setq-local org-ctags-tag-list
(org-ctags-all-tags-in-current-tags-table))))
@@ -227,7 +228,7 @@ 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)))
+ (call-interactively #'visit-tags-table))
(save-excursion
(visit-tags-table-buffer 'same)
(when tags-file-name
@@ -254,7 +255,7 @@ Return the list."
(interactive)
(let ((taglist nil))
(unless tags-file-name
- (call-interactively (visit-tags-table)))
+ (call-interactively #'visit-tags-table))
(save-excursion
(visit-tags-table-buffer 'same)
(with-current-buffer (get-file-buffer tags-file-name)
@@ -293,8 +294,9 @@ The new topic will be titled NAME (or TITLE if supplied)."
;;;; Misc interoperability with etags system =================================
-(defadvice xref-find-definitions
- (before org-ctags-set-org-mark-before-finding-tag activate compile)
+(advice-add 'xref-find-definitions :before
+ #'org--ctags-set-org-mark-before-finding-tag)
+(defun org--ctags-set-org-mark-before-finding-tag (&rest _)
"Before trying to find a tag, save our current position on org mark ring."
(save-excursion
(when (and (derived-mode-p 'org-mode) org-ctags-enabled-p)
@@ -435,7 +437,7 @@ to append a new topic."
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)))
+ (call-interactively #'visit-tags-table))
(when (buffer-file-name)
(org-ctags-create-tags))
(org-ctags-find-tag name))
@@ -508,10 +510,7 @@ 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
+ (let* ((tag (ido-completing-read "Topic: " org-ctags-tag-list
nil 'confirm nil 'org-ctags-find-tag-history)))
(when tag
(cond
diff --git a/lisp/org/org-cycle.el b/lisp/org/org-cycle.el
new file mode 100644
index 00000000000..9531ac4c8c7
--- /dev/null
+++ b/lisp/org/org-cycle.el
@@ -0,0 +1,817 @@
+;;; org-cycle.el --- Visibility cycling of Org entries -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020-2020 Free Software Foundation, Inc.
+;;
+;; Maintainer: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: folding, visibility cycling, invisible text
+;; URL: 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 code controlling global folding state in buffer
+;; and TAB-cycling.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
+(require 'org-fold)
+
+(declare-function org-element-type "org-element" (element))
+(declare-function org-element-property "org-element" (property element))
+(declare-function org-element-lineage "org-element" (datum &optional types with-self))
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
+(declare-function org-display-inline-images "org" (&optional include-linked refresh beg end))
+(declare-function org-get-tags "org" (&optional pos local fontify))
+(declare-function org-subtree-end-visible-p "org" ())
+(declare-function org-narrow-to-subtree "org" (&optional element))
+(declare-function org-next-visible-heading "org" (arg))
+(declare-function org-at-property-p "org" ())
+(declare-function org-re-property "org" (property &optional literal allow-null value))
+(declare-function org-remove-inline-images "org" (&optional beg end))
+(declare-function org-item-beginning-re "org" ())
+(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
+(declare-function org-at-item-p "org" ())
+(declare-function org-before-first-heading-p "org" ())
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
+(declare-function org-entry-end-position "org" ())
+(declare-function org-try-cdlatex-tab "org" ())
+(declare-function org-cycle-level "org" ())
+(declare-function org-table-next-field "org-table" ())
+(declare-function org-table-justify-field-maybe "org-table" (&optional new))
+(declare-function org-inlinetask-at-task-p "org-inlinetask" ())
+(declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
+(declare-function org-list-get-all-items "org-list" (item struct prevs))
+(declare-function org-list-get-bottom-point "org-list" (struct))
+(declare-function org-list-prevs-alist "org-list" (struct))
+(declare-function org-list-set-item-visibility "org-list" (item struct view))
+(declare-function org-list-search-forward "org-list" (regexp &optional bound noerror))
+(declare-function org-list-has-child-p "org-list" (item struct))
+(declare-function org-list-get-item-end-before-blank "org-list" (item struct))
+(declare-function org-list-struct "org-list" ())
+(declare-function org-cycle-item-indentation "org-list" ())
+
+(declare-function outline-previous-heading "outline" ())
+(declare-function outline-next-heading "outline" ())
+(declare-function outline-end-of-heading "outline" ())
+(declare-function outline-up-heading "outline" (arg &optional invisible-ok))
+
+(defvar org-drawer-regexp)
+(defvar org-odd-levels-only)
+(defvar org-startup-folded)
+(defvar org-archive-tag)
+(defvar org-cycle-include-plain-lists)
+(defvar org-outline-regexp-bol)
+
+(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)
+
+;;;; Customization:
+
+
+(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-cycle-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: nohideblocks"
+ :group 'org-startup
+ :group 'org-cycle
+ :type 'boolean)
+
+(defcustom org-cycle-hide-drawer-startup t
+ "Non-nil means entering Org mode will fold all drawers.
+This can also be set in on a per-file basis with
+
+#+STARTUP: hidedrawers
+#+STARTUP: nohidedrawers"
+ :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-cycle-pre-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-show-empty-lines
+ org-cycle-optimize-window-after-visibility-change
+ org-cycle-display-inline-images)
+ "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)
+
+(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-cycle-inline-images-display nil
+ "Non-nil means auto display inline images under subtree when cycling."
+ :group 'org-startup
+ :group 'org-cycle
+ :package-version '(Org . "9.6")
+ :type 'boolean)
+
+(defvar org-cycle-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.")
+
+;;;; Implementation:
+
+(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-fold--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-fold--hide-drawers beg end)))))))
+
+;;;###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-cycle-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-cycle-set-startup-visibility)
+ (org-unlogged-message "Startup visibility, plus VISIBILITY properties"))
+ ((equal arg '(64))
+ (org-fold-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-fold-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-cycle-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-fold-hide-block-toggle nil t element))
+ ;; Try toggling visibility for drawer at point.
+ ((org-fold-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) (line-end-position)))
+ (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-force-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-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-cycle-pre-hook 'contents)
+ (unless ga (org-unlogged-message "CONTENTS..."))
+ (org-cycle-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-cycle-pre-hook 'all)
+ (org-fold-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-cycle-pre-hook 'overview)
+ (org-cycle-overview)
+ (unless ga (org-unlogged-message "OVERVIEW"))
+ (setq org-cycle-global-status 'overview)
+ (run-hook-with-args 'org-cycle-hook 'overview)))))
+
+(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 (line-end-position))
+ (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)
+ (> (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)
+ (if (eq org-fold-core-style 'text-properties)
+ (while (and (not (eobp)) ;this is like `next-line'
+ (org-fold-folded-p (1- (point))))
+ (goto-char (org-fold-next-visibility-change nil nil t))
+ (and (eolp) (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-cycle-pre-hook 'empty))
+ (org-unlogged-message "EMPTY ENTRY")
+ (setq org-cycle-subtree-status nil)
+ (save-excursion
+ (goto-char eos)
+ (org-with-limited-levels
+ (outline-next-heading))
+ (when (org-invisible-p) (org-fold-heading nil))))
+ ((and (or (>= eol eos)
+ (save-excursion (goto-char eol) (skip-chars-forward "[:space:]" eos) (= (point) 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)
+ (org-with-limited-levels
+ (run-hook-with-args 'org-cycle-pre-hook 'children)))
+ (if (org-at-item-p)
+ (org-list-set-item-visibility (line-beginning-position) struct 'children)
+ (org-fold-show-entry)
+ (org-with-limited-levels (org-fold-show-children))
+ (org-fold-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)
+ (org-with-limited-levels
+ (outline-next-heading))
+ (when (and
+ ;; Subtree does not end at the end of visible section of the
+ ;; buffer.
+ (< (point) (point-max))
+ (org-invisible-p))
+ ;; Reveal the following heading line.
+ (org-fold-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-fold-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-cycle-pre-hook 'folded)
+ (org-fold-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-cycle-global (&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-cycle-content arg)
+ (setq org-cycle-global-status 'contents))
+ ((equal arg '(4))
+ (org-cycle-set-startup-visibility)
+ (org-unlogged-message "Startup visibility, plus VISIBILITY properties."))
+ (t
+ (org-cycle '(4)))))
+
+(defun org-cycle-set-startup-visibility ()
+ "Set the visibility required by startup options and properties."
+ (cond
+ ((eq org-startup-folded t)
+ (org-cycle-overview))
+ ((eq org-startup-folded 'content)
+ (org-cycle-content))
+ ((eq org-startup-folded 'show2levels)
+ (org-cycle-content 2))
+ ((eq org-startup-folded 'show3levels)
+ (org-cycle-content 3))
+ ((eq org-startup-folded 'show4levels)
+ (org-cycle-content 4))
+ ((eq org-startup-folded 'show5levels)
+ (org-cycle-content 5))
+ ((or (eq org-startup-folded 'showeverything)
+ (eq org-startup-folded nil))
+ (org-fold-show-all)))
+ (unless (eq org-startup-folded 'showeverything)
+ (when org-cycle-hide-block-startup (org-fold-hide-block-all))
+ (org-cycle-set-visibility-according-to-property)
+ (org-cycle-hide-archived-subtrees 'all)
+ (when org-cycle-hide-drawer-startup (org-cycle-hide-drawers 'all))
+ (org-cycle-show-empty-lines t)))
+
+(defun org-cycle-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-fold-subtree t)
+ (pcase state
+ ("folded"
+ (org-fold-subtree t))
+ ("children"
+ (org-fold-show-hidden-entry)
+ (org-fold-show-children))
+ ("content"
+ (save-excursion
+ (save-restriction
+ (org-narrow-to-subtree)
+ (org-cycle-content))))
+ ((or "all" "showall")
+ (org-fold-show-subtree))
+ (_ nil)))
+ (org-end-of-subtree)))))))
+
+(defun org-cycle-overview ()
+ "Switch to overview mode, showing only top-level headlines."
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ ;; Hide top-level drawer.
+ (save-restriction
+ (narrow-to-region (point-min) (or (re-search-forward org-outline-regexp-bol nil t) (point-max)))
+ (org-fold-hide-drawer-all))
+ (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-fold-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-fold-region last (point) t 'outline)))))
+
+(defun org-cycle-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-fold-show-all '(headings))
+ (save-excursion
+ (goto-char (point-min))
+ ;; Hide top-level drawer.
+ (save-restriction
+ (narrow-to-region (point-min) (or (re-search-forward org-outline-regexp-bol nil t) (point-max)))
+ (org-fold-hide-drawer-all))
+ (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-fold-region (line-end-position) last t 'outline)
+ (setq last (line-end-position 0))))))
+
+(defvar org-cycle-scroll-position-to-restore nil
+ "Temporarily store scroll position to restore.")
+(defun org-cycle-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-cycle-scroll-position-to-restore nil))
+ (cond
+ ((eq state 'content) nil)
+ ((eq state 'all) nil)
+ ((and org-cycle-scroll-position-to-restore repeat
+ (eq state 'folded))
+ (set-window-start nil org-cycle-scroll-position-to-restore))
+ ((eq state 'folded) nil)
+ ((eq state 'children)
+ (setq org-cycle-scroll-position-to-restore (window-start))
+ (or (org-subtree-end-visible-p) (recenter 1)))
+ ((eq state 'subtree)
+ (unless repeat
+ (setq org-cycle-scroll-position-to-restore (window-start)))
+ (or (org-subtree-end-visible-p) (recenter 1)))))))
+
+(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 (org-invisible-p (match-end 1))
+ (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-fold-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-fold-region (point) (match-end 0) nil 'outline))))
+
+(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))))
+ (let ((globalp (memq state '(contents all))))
+ (if globalp
+ (org-fold-hide-archived-subtrees (point-min) (point-max))
+ (org-fold-hide-archived-subtrees
+ (point)
+ (save-excursion
+ (org-end-of-subtree t))))
+ (when (and (not globalp)
+ (member org-archive-tag
+ (org-get-tags nil 'local)))
+ (message "%s" (substitute-command-keys
+ "Subtree is archived and stays closed. Use \
+`\\[org-cycle-force-archived]' to cycle it anyway."))))))
+
+(defun org-cycle-display-inline-images (state)
+ "Auto display inline images under subtree when cycling.
+It works when `org-cycle-inline-images-display' is non-nil."
+ (when org-cycle-inline-images-display
+ (pcase state
+ ('children
+ (org-with-wide-buffer
+ (org-narrow-to-subtree)
+ ;; If has nested headlines, beg,end only from parent headline
+ ;; to first child headline which reference to upper
+ ;; let-binding `org-next-visible-heading'.
+ (org-display-inline-images
+ nil nil
+ (point-min) (progn (org-next-visible-heading 1) (point)))))
+ ('subtree
+ (org-with-wide-buffer
+ (org-narrow-to-subtree)
+ ;; If has nested headlines, also inline display images under all sub-headlines.
+ (org-display-inline-images nil nil (point-min) (point-max))))
+ ('folded
+ (org-with-wide-buffer
+ (org-narrow-to-subtree)
+ (if (numberp (point-max))
+ (org-remove-inline-images (point-min) (point-max))
+ (ignore)))))))
+
+(provide 'org-cycle)
+
+;;; org-cycle.el ends here
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el
index 30f5f99aea6..fb4df3cbe81 100644
--- a/lisp/org/org-datetree.el
+++ b/lisp/org/org-datetree.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -30,6 +30,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(defvar org-datetree-base-level 1
@@ -137,7 +140,7 @@ will be built under the headline at point."
(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))
+ (time (org-encode-time 0 0 0 day month year))
(iso-date (calendar-iso-from-absolute
(calendar-absolute-from-gregorian d)))
(weekyear (nth 2 iso-date))
@@ -185,8 +188,7 @@ inserted into the buffer."
(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"))
+ (when (org--blank-before-heading-p) (insert "\n"))
(insert "\n" (make-string org-datetree-base-level ?*) " \n")
(backward-char)
(when month (org-do-demote))
@@ -197,14 +199,14 @@ inserted into the buffer."
(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))))))
+ (format-time-string "-%m-%d %A" (org-encode-time 0 0 0 day month year))
+ (format-time-string "-%m %B" (org-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)
+ (org-encode-time 0 0 0 day month year)
nil
(eq org-datetree-add-timestamp 'inactive))))
(beginning-of-line))
diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el
index 6d55ba88408..6d6b8b5cf1d 100644
--- a/lisp/org/org-duration.el
+++ b/lisp/org/org-duration.el
@@ -51,6 +51,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-macs)
@@ -98,7 +101,7 @@ sure to call the following command:
:version "26.1"
:package-version '(Org . "9.1")
:set (lambda (var val)
- (set-default var val)
+ (set-default-toplevel-value var val)
;; Avoid recursive load at startup.
(when (featurep 'org-duration)
(org-duration-set-regexps)))
@@ -284,30 +287,31 @@ 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))))
+ (save-match-data
+ (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)
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 474a93577a9..48ede9c5289 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -58,54 +58,45 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'avl-tree)
+(require 'ring)
(require 'cl-lib)
(require 'ol)
(require 'org)
+(require 'org-persist)
(require 'org-compat)
(require 'org-entities)
(require 'org-footnote)
(require 'org-list)
(require 'org-macs)
(require 'org-table)
+(require 'org-fold-core)
(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 org-inlinetask-outline-regexp "org-inlinetask" ())
(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
@@ -117,6 +108,9 @@
;; `org-element-update-syntax' builds proper syntax regexps according
;; to current setup.
+(defconst org-element-archive-tag "ARCHIVE"
+ "Tag marking a substree as archived.")
+
(defconst org-element-citation-key-re
(rx "@" (group (one-or-more (any word "-.:?!`'/*@+|(){}<>&_^$#%~"))))
"Regexp matching a citation key.
@@ -130,6 +124,66 @@ Key is located in match group 1.")
"Regexp matching a citation prefix.
Style, if any, is located in match group 1.")
+(defconst org-element-clock-line-re
+ (rx-to-string
+ `(seq
+ line-start (0+ (or ?\t ?\s))
+ "CLOCK: "
+ (regexp ,org-ts-regexp-inactive)
+ (opt "--"
+ (regexp ,org-ts-regexp-inactive)
+ (1+ (or ?\t ?\s)) "=>" (1+ (or ?\t ?\s))
+ (1+ digit) ":" digit digit)
+ (0+ (or ?\t ?\s))
+ line-end))
+ "Regexp matching a clock line.")
+
+(defconst org-element-comment-string "COMMENT"
+ "String marker for commented headlines.")
+
+(defconst org-element-closed-keyword "CLOSED:"
+ "Keyword used to close TODO entries.")
+
+(defconst org-element-deadline-keyword "DEADLINE:"
+ "Keyword used to mark deadline entries.")
+
+(defconst org-element-scheduled-keyword "SCHEDULED:"
+ "Keyword used to mark scheduled entries.")
+
+(defconst org-element-planning-keywords-re
+ (regexp-opt (list org-element-closed-keyword
+ org-element-deadline-keyword
+ org-element-scheduled-keyword))
+ "Regexp matching any planning line keyword.")
+
+(defconst org-element-planning-line-re
+ (rx-to-string
+ `(seq line-start (0+ (any ?\s ?\t))
+ (group (regexp ,org-element-planning-keywords-re))))
+ "Regexp matching a planning line.")
+
+(defconst org-element-drawer-re
+ (rx line-start (0+ (any ?\s ?\t))
+ ":" (group (1+ (any ?- ?_ word))) ":"
+ (0+ (any ?\s ?\t)) line-end)
+ "Regexp matching opening or closing line of a drawer.
+Drawer's name is located in match group 1.")
+
+(defconst org-element-dynamic-block-open-re
+ (rx line-start (0+ (any ?\s ?\t))
+ "#+BEGIN:" (0+ (any ?\s ?\t))
+ (group (1+ word))
+ (opt
+ (1+ (any ?\s ?\t))
+ (group (1+ nonl))))
+ "Regexp matching the opening line of a dynamic block.
+Dynamic block's name is located in match group 1.
+Parameters are in match group 2.")
+
+(defconst org-element-headline-re
+ (rx line-start (1+ "*") " ")
+ "Regexp matching a headline.")
+
(defvar org-element-paragraph-separate nil
"Regexp to separate paragraphs in an Org buffer.
In the case of lines starting with \"#\" and \":\", this regexp
@@ -174,7 +228,7 @@ specially in `org-element--object-lex'.")
;; LaTeX environments.
"\\\\begin{\\([A-Za-z0-9*]+\\)}" "\\|"
;; Clock lines.
- "CLOCK:" "\\|"
+ org-element-clock-line-re "\\|"
;; Lists.
(let ((term (pcase org-plain-list-ordered-item-terminator
(?\) ")") (?. "\\.") (_ "[.)]")))
@@ -190,9 +244,7 @@ specially in `org-element--object-lex'.")
"\\(?:[_^][-{(*+.,[:alnum:]]\\)"
;; Bold, code, italic, strike-through, underline
;; and verbatim.
- (concat "[*~=+_/]"
- (format "[^%s]"
- (nth 2 org-emphasis-regexp-components)))
+ (rx (or "*" "~" "=" "+" "_" "/") (not space))
;; Plain links.
(concat "\\<" link-types ":")
;; Objects starting with "[": citations,
@@ -245,7 +297,7 @@ specially in `org-element--object-lex'.")
(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)
+ special-block table org-data)
"List of recursive element types aka Greater Elements.")
(defconst org-element-all-objects
@@ -550,7 +602,8 @@ Return parent element."
;; 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)))
+ (when child
+ (org-element-put-property child :parent (or parent children))))
;; Add CHILDREN at the end of PARENT contents.
(when parent
(apply #'org-element-set-contents
@@ -606,11 +659,19 @@ Parse tree is modified by side effect."
;; Set appropriate :parent property.
(org-element-put-property element :parent parent)))
+(defconst org-element--cache-element-properties
+ '(:cached
+ :org-element--cache-sync-key)
+ "List of element properties used internally by cache.")
+
(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))
+ (dolist (p org-element--cache-element-properties)
+ (when (org-element-property p old)
+ (org-element-put-property new p (org-element-property p 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
@@ -647,7 +708,21 @@ is cleared and contents are removed in the process."
(`plain-text (substring-no-properties datum))
(`nil (copy-sequence datum))
(_
- (list type (plist-put (copy-sequence (nth 1 datum)) :parent nil)))))))
+ (let ((element-copy (list type (plist-put (copy-sequence (nth 1 datum)) :parent nil))))
+ ;; We cannot simply return the copies property list. When
+ ;; DATUM is i.e. a headline, it's property list (`:title'
+ ;; in case of headline) can contain parsed objects. The
+ ;; objects will contain `:parent' property set to the DATUM
+ ;; itself. When copied, these inner `:parent' property
+ ;; values will contain incorrect object decoupled from
+ ;; DATUM. Changes to the DATUM copy will not longer be
+ ;; reflected in the `:parent' properties. So, we need to
+ ;; reassign inner `:parent' properties to the DATUM copy
+ ;; explicitly.
+ (org-element-map element-copy (cons 'plain-text org-element-all-objects)
+ (lambda (obj) (when (equal datum (org-element-property :parent obj))
+ (org-element-put-property obj :parent element-copy))))
+ element-copy))))))
@@ -758,8 +833,10 @@ Assume point is at beginning of drawer."
(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)))
+ (name
+ (progn
+ (looking-at org-element-drawer-re)
+ (match-string-no-properties 1)))
(begin (car affiliated))
(post-affiliated (point))
;; Empty drawers have no contents.
@@ -814,9 +891,10 @@ Assume point is at beginning of dynamic block."
(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))
+ (let* ((name (progn
+ (looking-at org-element-dynamic-block-open-re)
+ (match-string-no-properties 1)))
+ (arguments (match-string-no-properties 2))
(begin (car affiliated))
(post-affiliated (point))
;; Empty blocks have no contents.
@@ -854,7 +932,7 @@ CONTENTS is the contents of the element."
;;;; Footnote Definition
(defconst org-element--footnote-separator
- (concat org-outline-regexp-bol "\\|"
+ (concat org-element-headline-re "\\|"
org-footnote-definition-re "\\|"
"^\\([ \t]*\n\\)\\{2,\\}")
"Regexp used as a footnote definition separator.")
@@ -938,24 +1016,40 @@ CONTENTS is the contents of the 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.
+(defun org-element--get-node-properties (&optional at-point-p?)
+ "Return node properties for headline or property drawer 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."
+parser (e.g. `:end' and :END:). Return value is a plist.
+
+When AT-POINT-P? is nil, assume that point as at a headline. Otherwise
+parse properties for property drawer at point."
(save-excursion
- (forward-line)
- (when (looking-at-p org-planning-line-re) (forward-line))
+ (unless at-point-p?
+ (forward-line)
+ (when (looking-at-p org-element-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)
+ (let* ((property-name (concat ":" (upcase (match-string 2))))
+ (property-name-symbol (intern property-name))
+ (property-value (match-string-no-properties 3)))
+ (cond
+ ((and (plist-member properties property-name-symbol)
+ (string-match-p "\\+$" property-name))
+ (let ((val (plist-get properties property-name-symbol)))
+ (if (listp val)
+ (setq properties
+ (plist-put properties
+ property-name-symbol
+ (append (plist-get properties property-name-symbol)
+ (list property-value))))
+ (plist-put properties property-name-symbol (list val property-value)))))
+ (t (setq properties (plist-put properties property-name-symbol property-value)))))
(forward-line))
properties))))
@@ -963,21 +1057,21 @@ parser (e.g. `:end' and :END:). Return value is a plist."
"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))
+ (when (progn (forward-line) (looking-at org-element-planning-line-re))
+ (let ((end (line-end-position))
+ plist)
+ (while (re-search-forward org-element-planning-keywords-re end t)
(skip-chars-forward " \t")
- (let ((keyword (match-string 1))
+ (let ((keyword (match-string 0))
(time (org-element-timestamp-parser)))
- (cond ((equal keyword org-scheduled-string)
+ (cond ((equal keyword org-element-scheduled-keyword)
(setq plist (plist-put plist :scheduled time)))
- ((equal keyword org-deadline-string)
+ ((equal keyword org-element-deadline-keyword)
(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)
+(defun org-element-headline-parser (&optional _ raw-secondary-p)
"Parse a headline.
Return a list whose CAR is `headline' and CDR is a plist
@@ -992,16 +1086,15 @@ 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")))
+ (true-level (prog1 (skip-chars-forward "*")
+ (skip-chars-forward " \t")))
+ (level (org-reduced-level true-level))
(todo (and org-todo-regexp
(let (case-fold-search) (looking-at (concat org-todo-regexp " ")))
(progn (goto-char (match-end 0))
@@ -1013,8 +1106,11 @@ Assume point is at beginning of the headline."
(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))))
+ (and (let ((case-fold-search nil))
+ (looking-at org-element-comment-string))
+ (goto-char (match-end 0))
+ (when (looking-at-p "\\(?:[ \t]\\|$\\)")
+ (point))))
(title-start (prog1 (point)
(unless (or todo priority commentedp)
;; Headline like "* :tag:"
@@ -1028,12 +1124,18 @@ Assume point is at beginning of the headline."
(title-end (point))
(raw-value (org-trim
(buffer-substring-no-properties title-start title-end)))
- (archivedp (member org-archive-tag tags))
+ (archivedp (member org-element-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))
+ (end
+ (save-excursion
+ (let ((re (rx-to-string
+ `(seq line-start (** 1 ,true-level "*") " "))))
+ (if (re-search-forward re nil t)
+ (line-beginning-position)
+ (point-max)))))
(contents-begin (save-excursion
(forward-line)
(skip-chars-forward " \r\t\n" end)
@@ -1041,7 +1143,24 @@ Assume point is at beginning of the headline."
(contents-end (and contents-begin
(progn (goto-char end)
(skip-chars-backward " \r\t\n")
- (line-beginning-position 2)))))
+ (line-beginning-position 2))))
+ (robust-begin (and contents-begin
+ (progn (goto-char contents-begin)
+ (when (looking-at-p org-element-planning-line-re)
+ (forward-line))
+ (when (looking-at org-property-drawer-re)
+ (goto-char (match-end 0)))
+ ;; If there is :pre-blank, we
+ ;; need to be careful about
+ ;; robust beginning.
+ (max (if (< (+ 2 contents-begin) contents-end)
+ (+ 2 contents-begin)
+ 0)
+ (point)))))
+ (robust-end (and robust-begin
+ (when (> (- contents-end 2) robust-begin)
+ (- contents-end 2)))))
+ (unless robust-end (setq robust-begin nil))
(let ((headline
(list 'headline
(nconc
@@ -1053,6 +1172,8 @@ Assume point is at beginning of the headline."
(1- (count-lines begin contents-begin)))
:contents-begin contents-begin
:contents-end contents-end
+ :robust-begin robust-begin
+ :robust-end robust-end
:level level
:priority priority
:tags tags
@@ -1099,7 +1220,7 @@ CONTENTS is the contents of the element."
(concat (make-string (if org-odd-levels-only (1- (* level 2)) level)
?*)
(and todo (concat " " todo))
- (and commentedp (concat " " org-comment-string))
+ (and commentedp (concat " " org-element-comment-string))
(and priority (format " [#%c]" priority))
" "
(if (and org-footnote-section
@@ -1125,6 +1246,89 @@ CONTENTS is the contents of the element."
(make-string (1+ pre-blank) ?\n)
contents)))
+;;;; org-data
+
+(defun org-element--get-global-node-properties ()
+ "Return node properties associated with the whole Org buffer.
+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."
+ (org-with-wide-buffer
+ (goto-char (point-min))
+ (while (and (org-at-comment-p) (bolp)) (forward-line))
+ (org-element--get-node-properties t)))
+
+
+(defvar org-element-org-data-parser--recurse nil)
+(defun org-element-org-data-parser (&optional _)
+ "Parse org-data."
+ (org-with-wide-buffer
+ (let* ((begin 1)
+ (contents-begin (progn
+ (goto-char 1)
+ (org-skip-whitespace)
+ (beginning-of-line)
+ (point)))
+ (end (point-max))
+ (pos-before-blank (progn (goto-char (point-max))
+ (skip-chars-backward " \r\t\n")
+ (line-beginning-position 2)))
+ (robust-end (when (> (- pos-before-blank 2) contents-begin)
+ (- pos-before-blank 2)))
+ (robust-begin (when (and robust-end
+ (< (+ 2 contents-begin) pos-before-blank))
+ (or
+ (org-with-wide-buffer
+ (goto-char (point-min))
+ (while (and (org-at-comment-p) (bolp)) (forward-line))
+ (when (looking-at org-property-drawer-re)
+ (goto-char (match-end 0))
+ (skip-chars-backward " \t")
+ (min robust-end (point))))
+ (+ 2 contents-begin))))
+ (category (cond ((null org-category)
+ (when (org-with-base-buffer nil
+ buffer-file-name)
+ (file-name-sans-extension
+ (file-name-nondirectory
+ (org-with-base-buffer nil
+ buffer-file-name)))))
+ ((symbolp org-category) (symbol-name org-category))
+ (t org-category)))
+ (category (catch 'buffer-category
+ (unless org-element-org-data-parser--recurse
+ (org-with-point-at end
+ ;; Avoid recursive calls from
+ ;; `org-element-at-point-no-context'.
+ (let ((org-element-org-data-parser--recurse t))
+ (while (re-search-backward "^[ \t]*#\\+CATEGORY:" (point-min) t)
+ (org-element-with-disabled-cache
+ (let ((element (org-element-at-point-no-context)))
+ (when (eq (org-element-type element) 'keyword)
+ (throw 'buffer-category
+ (org-element-property :value element)))))))))
+ category))
+ (properties (org-element--get-global-node-properties)))
+ (unless (plist-get properties :CATEGORY)
+ (setq properties (plist-put properties :CATEGORY category)))
+ (list 'org-data
+ (nconc
+ (list :begin begin
+ :contents-begin contents-begin
+ :contents-end pos-before-blank
+ :end end
+ :robust-begin robust-begin
+ :robust-end robust-end
+ :post-blank (count-lines pos-before-blank end)
+ :post-affiliated begin
+ :path (buffer-file-name)
+ :mode 'org-data)
+ properties)))))
+
+(defun org-element-org-data-interpreter (_ contents)
+ "Interpret ORG-DATA element as Org syntax.
+CONTENTS is the contents of the element."
+ contents)
;;;; Inlinetask
@@ -1173,7 +1377,7 @@ Assume point is at beginning of the inline task."
(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)
+ (and (re-search-forward org-element-headline-re limit t)
(looking-at-p "[ \t]*END[ \t]*$")
(line-beginning-position))))
(standard-props (and task-end (org-element--get-node-properties)))
@@ -1394,7 +1598,12 @@ CONTENTS is the contents of the element."
(let ((case-fold-search t)
(top-ind limit)
(item-re (org-item-re))
- (inlinetask-re (and (featurep 'org-inlinetask) "^\\*+ "))
+ (inlinetask-re (and (featurep 'org-inlinetask)
+ (boundp 'org-inlinetask-min-level)
+ (boundp 'org-inlinetask-max-level)
+ (format "^\\*\\{%d,%d\\}+ "
+ org-inlinetask-min-level
+ org-inlinetask-max-level)))
items struct)
(save-excursion
(catch :exit
@@ -1413,7 +1622,7 @@ CONTENTS is the contents of the element."
;; At a new item: end previous sibling.
((looking-at item-re)
(let ((ind (save-excursion (skip-chars-forward " \t")
- (current-column))))
+ (org-current-text-column))))
(setq top-ind (min top-ind ind))
(while (and items (<= ind (nth 1 (car items))))
(let ((item (pop items)))
@@ -1447,7 +1656,7 @@ CONTENTS is the contents of the element."
(t
(let ((ind (save-excursion
(skip-chars-forward " \t")
- (current-column)))
+ (org-current-text-column)))
(end (save-excursion
(skip-chars-backward " \r\t\n")
(line-beginning-position 2))))
@@ -1463,7 +1672,7 @@ CONTENTS is the contents of the element."
(re-search-forward
(format "^[ \t]*#\\+END%s[ \t]*$" (match-string 1))
limit t)))
- ((and (looking-at org-drawer-regexp)
+ ((and (looking-at org-element-drawer-re)
(re-search-forward "^[ \t]*:END:[ \t]*$" limit t))))
(forward-line))))))))
@@ -1619,16 +1828,22 @@ containing `:begin', `:end', `:contents-begin', `contents-end',
(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))))
+ (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)))
+ (robust-end (when (> (- pos-before-blank 2) begin)
+ (- pos-before-blank 2)))
+ (robust-begin (when robust-end begin))
+ )
(list 'section
(list :begin begin
:end end
:contents-begin begin
:contents-end pos-before-blank
+ :robust-begin robust-begin
+ :robust-end robust-end
:post-blank (count-lines pos-before-blank end)
:post-affiliated begin)))))
@@ -1649,13 +1864,15 @@ 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.
+containing `:type', `:parameters', `: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))))
+ (type (progn (looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)[ \t]*\\(.*\\)[ \t]*$")
+ (match-string-no-properties 1)))
+ (parameters (match-string-no-properties 2)))
(if (not (save-excursion
(re-search-forward
(format "^[ \t]*#\\+END_%s[ \t]*$" (regexp-quote type))
@@ -1679,6 +1896,8 @@ Assume point is at the beginning of the block."
(list 'special-block
(nconc
(list :type type
+ :parameters (and (org-string-nw-p parameters)
+ (org-trim parameters))
:begin begin
:end end
:contents-begin contents-begin
@@ -1690,8 +1909,11 @@ Assume point is at the beginning of the block."
(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)))
+ (let ((block-type (org-element-property :type special-block))
+ (parameters (org-element-property :parameters special-block)))
+ (format "#+begin_%s%s\n%s#+end_%s" block-type
+ (if parameters (concat " " parameters) "")
+ (or contents "") block-type)))
@@ -2347,7 +2569,7 @@ Assume point is at the beginning of the paragraph."
((not (and (re-search-forward
org-element-paragraph-separate limit 'move)
(progn (beginning-of-line) t))))
- ((looking-at org-drawer-regexp)
+ ((looking-at org-element-drawer-re)
(save-excursion
(re-search-forward "^[ \t]*:END:[ \t]*$" limit t)))
((looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)")
@@ -2412,14 +2634,14 @@ containing `:closed', `:deadline', `:scheduled', `:begin',
(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))
+ (while (re-search-forward org-element-planning-keywords-re end t)
(skip-chars-forward " \t" end)
- (let ((keyword (match-string 1))
+ (let ((keyword (match-string 0))
(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)))))
+ (cond
+ ((equal keyword org-element-closed-keyword) (setq closed time))
+ ((equal keyword org-element-deadline-keyword) (setq deadline time))
+ (t (setq scheduled time)))))
(list 'planning
(list :closed closed
:deadline deadline
@@ -2436,15 +2658,15 @@ containing `:closed', `:deadline', `:scheduled', `:begin',
(delq nil
(list (let ((deadline (org-element-property :deadline planning)))
(when deadline
- (concat org-deadline-string " "
+ (concat org-element-deadline-keyword " "
(org-element-timestamp-interpreter deadline nil))))
(let ((scheduled (org-element-property :scheduled planning)))
(when scheduled
- (concat org-scheduled-string " "
+ (concat org-element-scheduled-keyword " "
(org-element-timestamp-interpreter scheduled nil))))
(let ((closed (org-element-property :closed planning)))
(when closed
- (concat org-closed-string " "
+ (concat org-element-closed-keyword " "
(org-element-timestamp-interpreter closed nil))))))
" "))
@@ -2739,6 +2961,50 @@ CONTENTS is verse block contents."
;;;; Bold
+(defun org-element--parse-generic-emphasis (mark type)
+ "Parse emphasis object at point, if any.
+
+MARK is the delimiter string used. TYPE is a symbol among
+`bold', `code', `italic', `strike-through', `underline', and
+`verbatim'.
+
+Assume point is at first MARK."
+ (save-excursion
+ (let ((origin (point)))
+ (unless (bolp) (forward-char -1))
+ (let ((opening-re
+ (rx-to-string
+ `(seq (or line-start (any space ?- ?\( ?' ?\" ?\{))
+ ,mark
+ (not space)))))
+ (when (looking-at opening-re)
+ (goto-char (1+ origin))
+ (let ((closing-re
+ (rx-to-string
+ `(seq
+ (not space)
+ (group ,mark)
+ (or (any space ?- ?. ?, ?\; ?: ?! ?? ?' ?\" ?\) ?\} ?\\ ?\[)
+ line-end)))))
+ (when (re-search-forward closing-re nil t)
+ (let ((closing (match-end 1)))
+ (goto-char closing)
+ (let* ((post-blank (skip-chars-forward " \t"))
+ (contents-begin (1+ origin))
+ (contents-end (1- closing)))
+ (list type
+ (append
+ (list :begin origin
+ :end (point)
+ :post-blank post-blank)
+ (if (memq type '(code verbatim))
+ (list :value
+ (and (memq type '(code verbatim))
+ (buffer-substring
+ contents-begin contents-end)))
+ (list :contents-begin contents-begin
+ :contents-end contents-end)))))))))))))
+
(defun org-element-bold-parser ()
"Parse bold object at point, if any.
@@ -2748,21 +3014,7 @@ is a plist with `:begin', `:end', `:contents-begin' and
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))))))
+ (org-element--parse-generic-emphasis "*" 'bold))
(defun org-element-bold-interpreter (_ contents)
"Interpret bold object as Org syntax.
@@ -2903,19 +3155,7 @@ 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))))))
+ (org-element--parse-generic-emphasis "~" 'code))
(defun org-element-code-interpreter (code _)
"Interpret CODE object as Org syntax."
@@ -2980,8 +3220,9 @@ Assume point is at the beginning of the snippet."
(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))))
+ (when
+ (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
@@ -3149,21 +3390,7 @@ cdr is a plist with `:begin', `:end', `:contents-begin' and
nil.
Assume point is at the first slash 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 'italic
- (list :begin begin
- :end end
- :contents-begin contents-begin
- :contents-end contents-end
- :post-blank post-blank))))))
+ (org-element--parse-generic-emphasis "/" 'italic))
(defun org-element-italic-interpreter (_ contents)
"Interpret italic object as Org syntax.
@@ -3271,7 +3498,7 @@ Assume point is at the beginning of the link."
(setq path (match-string-no-properties 1))
(setq contents-begin (match-beginning 1))
(setq contents-end (match-end 1)))
- ;; Type 2: Standard link, i.e. [[https://orgmode.org][homepage]]
+ ;; Type 2: Standard link, i.e. [[https://orgmode.org][website]]
((looking-at org-link-bracket-re)
(setq format 'bracket)
(setq contents-begin (match-beginning 2))
@@ -3529,21 +3756,7 @@ When at a strike-through object, return a list whose car is
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))))))
+ (org-element--parse-generic-emphasis "+" 'strike-through))
(defun org-element-strike-through-interpreter (_ contents)
"Interpret strike-through object as Org syntax.
@@ -3709,7 +3922,9 @@ Assume point is at the beginning of the timestamp."
(activep (eq (char-after) ?<))
(raw-value
(progn
- (looking-at "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\([<[].*?[]>]\\)\\)?")
+ (looking-at (concat "\\([<[]\\(%%\\)?.*?\\)[]>]\\(?:--\\("
+ org-ts-regexp-both
+ "\\)\\)?"))
(match-string-no-properties 0)))
(date-start (match-string-no-properties 1))
(date-end (match-string 3))
@@ -3817,8 +4032,7 @@ Assume point is at the beginning of the timestamp."
;; 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)
+ (org-time-stamp-format with-time-p)
time)))
(when (and hour-end minute-end)
(string-match "[012]?[0-9]:[0-5][0-9]" ts)
@@ -3847,12 +4061,12 @@ Assume point is at the beginning of the timestamp."
(/= 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))
+ (org-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)
@@ -3864,7 +4078,7 @@ Assume point is at the beginning of the timestamp."
(hour-end (org-element-property :hour-end timestamp)))
(concat
(funcall
- build-ts-string (encode-time
+ build-ts-string (org-encode-time
0
(or minute-start 0)
(or hour-start 0)
@@ -3875,12 +4089,13 @@ Assume point is at the beginning of the timestamp."
(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))
+ (org-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)))))
@@ -3897,21 +4112,7 @@ When at an underline object, return a list whose car is
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))))))
+ (org-element--parse-generic-emphasis "_" 'underline))
(defun org-element-underline-interpreter (_ contents)
"Interpret underline object as Org syntax.
@@ -3929,19 +4130,7 @@ 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))))))
+ (org-element--parse-generic-emphasis "=" 'verbatim))
(defun org-element-verbatim-interpreter (verbatim _)
"Interpret VERBATIM object as Org syntax."
@@ -3955,7 +4144,8 @@ Assume point is at the first equal sign marker."
;; It returns the Lisp representation of the element starting at
;; point.
-(defun org-element--current-element (limit &optional granularity mode structure)
+(defvar org-element--cache-sync-requests); Declared later
+(defun org-element--current-element (limit &optional granularity mode structure add-to-cache)
"Parse the element starting at point.
Return value is a list like (TYPE PROPS) where TYPE is the type
@@ -3980,157 +4170,200 @@ Optional argument MODE, when non-nil, can be either
If STRUCTURE isn't provided but MODE is set to `item', it will be
computed.
+Optional argument ADD-TO-CACHE, when non-nil, and when cache is active,
+will also add current element to cache if it is not yet there. Use
+this argument with care, as validity of the element in parse tree is
+not checked.
+
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
+ (let* ((element (and (not (buffer-narrowed-p))
+ (org-element--cache-active-p)
+ (not org-element--cache-sync-requests)
+ (org-element--cache-find (point) t)))
+ (element (progn (while (and element
+ (not (and (eq (point) (org-element-property :begin element))
+ (eq mode (org-element-property :mode element)))))
+ (setq element (org-element-property :parent element)))
+ element))
+ (old-element element)
+ (element (when
+ (pcase (org-element-property :granularity element)
+ (`nil t)
+ (`object t)
+ (`element (not (memq granularity '(nil object))))
+ (`greater-element (not (memq granularity '(nil object element))))
+ (`headline (eq granularity 'headline)))
+ element)))
+ (if element
+ element
+ (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))))
+ result)
+ (setq
+ result
+ (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 (looking-at-p org-outline-regexp-bol))
+ (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-element-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
- (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)))))))))
+ (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-element-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-element-drawer-re)
+ (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))
+ ((save-excursion
+ (beginning-of-line)
+ (looking-at org-element-dynamic-block-open-re))
+ (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)))))))
+ (when result
+ (org-element-put-property result :mode mode)
+ (org-element-put-property result :granularity granularity))
+ (when (and (not (buffer-narrowed-p))
+ (org-element--cache-active-p)
+ (not org-element--cache-sync-requests)
+ add-to-cache)
+ (if (not old-element)
+ (setq result (org-element--cache-put result))
+ (org-element-set-element old-element result)
+ (setq result old-element)))
+ result)))))
;; Most elements can have affiliated keywords. When looking for an
@@ -4271,12 +4504,14 @@ 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
- (line-beginning-position) (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))))
+ (let ((org-data (org-element-org-data-parser))
+ (gc-cons-threshold #x40000000))
+ (org-skip-whitespace)
+ (org-element--parse-elements
+ (line-beginning-position) (point-max)
+ ;; Start in `first-section' mode so text before the first
+ ;; headline belongs to a section.
+ 'first-section nil granularity visible-only org-data))))
(defun org-element-parse-secondary-string (string restriction &optional parent)
"Recursively parse objects in STRING and return structure.
@@ -4312,12 +4547,13 @@ If STRING is the empty string or nil, return nil."
(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.
+DATA is a parse tree (for example, returned by
+`org-element-parse-buffer'), an element, an object, a string, or a
+list of such constructs. TYPES is a symbol or list of symbols of
+elements or object 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
@@ -4345,6 +4581,7 @@ 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:
+ (setq tree (org-element-parse-buffer))
(org-element-map tree \\='(example-block src-block) #\\='identity)
The following snippet will find the first headline with a level
@@ -4492,6 +4729,8 @@ located inside the current one."
(pcase type
(`headline 'section)
((and (guard (eq mode 'first-section)) `section) 'top-comment)
+ ((and (guard (eq mode 'org-data)) `org-data) 'first-section)
+ ((and (guard (not mode)) `org-data) 'first-section)
(`inlinetask 'planning)
(`plain-list 'item)
(`property-drawer 'node-property)
@@ -4536,8 +4775,20 @@ Elements are accumulated into ACC."
(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))
+ (let* ((element (org-element-copy
+ ;; `org-element--current-element' may return cached
+ ;; elements. Below code reassigns
+ ;; `:parent' property of the element and
+ ;; may interfere with cache
+ ;; synchronization if parent element is not
+ ;; yet in cache. Moreover, the returned
+ ;; structure may be altered by caller code
+ ;; arbitrarily. Hence, we return a copy of
+ ;; the potentially cached element to make
+ ;; potential modifications safe for element
+ ;; cache.
+ (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))
@@ -4571,6 +4822,7 @@ Elements are accumulated into ACC."
;; Update mode.
(setq mode (org-element--next-mode mode type nil)))))
;; Return result.
+ (org-element-put-property acc :granularity granularity)
(apply #'org-element-set-contents acc (nreverse elements)))))
(defun org-element--object-lex (restriction)
@@ -4989,17 +5241,20 @@ indentation removed from its contents."
;;; Cache
;;
-;; Implement a caching mechanism for `org-element-at-point' and
-;; `org-element-context', which see.
+;; Implement a caching mechanism for `org-element-at-point', `org-element-context', and for
+;; fast mapping across Org elements in `org-element-cache-map', which see.
+;;
+;; When cache is enabled, the elements returned by `org-element-at-point' and
+;; `org-element-context' are returned by reference. Altering these elements will
+;; also alter their cache representation. The same is true for
+;; elements passed to mapping function in `org-element-cache-map'.
;;
-;; A single public function is provided: `org-element-cache-reset'.
+;; Public functions are: `org-element-cache-reset', `org-element-cache-refresh', and
+;; `org-element-cache-map'.
;;
-;; 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.
+;; Cache can be controlled using `org-element-use-cache' and `org-element-cache-persistent'.
+;; `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
@@ -5031,14 +5286,20 @@ indentation removed from its contents."
;; 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.
+;;
+;; The cache code debuggin is fairly complex because cache request
+;; state is often hard to reproduce. An extensive diagnostics
+;; functionality is built into the cache code to assist hunting bugs.
+;; See `org-element--cache-self-verify', `org-element--cache-self-verify-frequency',
+;; `org-element--cache-diagnostics', `org-element--cache-diagnostics-level',
+;; `org-element--cache-diagnostics-ring-size', `org-element--cache-map-statistics',
+;; `org-element--cache-map-statistics-threshold'.
+(defvar org-element-use-cache t
+ "Non-nil when Org parser should cache its results.")
-(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-persistent t
+ "Non-nil when cache should persist between Emacs sessions.")
(defvar org-element-cache-sync-idle-time 0.6
"Length, in seconds, of idle time before syncing cache.")
@@ -5053,16 +5314,93 @@ seconds.")
"Duration, as a time value, of the pause between synchronizations.
See `org-element-cache-sync-duration' for more information.")
+(defvar org-element--cache-self-verify t
+ "Activate extra consistency checks for the cache.
+
+This may cause serious performance degradation depending on the value
+of `org-element--cache-self-verify-frequency'.
+
+When set to symbol `backtrace', record and display backtrace log if
+any inconsistency is detected.")
+
+(defvar org-element--cache-self-verify-frequency 0.03
+ "Frequency of cache element verification.
+
+This number is a probability to check an element requested from cache
+to be correct. Setting this to a value less than 0.0001 is useless.")
+
+(defvar org-element--cache-diagnostics nil
+ "Print detailed diagnostics of cache processing.")
+
+(defvar org-element--cache-map-statistics nil
+ "Print statistics for `org-element-cache-map'.")
+
+(defvar org-element--cache-map-statistics-threshold 0.1
+ "Time threshold in seconds to log statistics for `org-element-cache-map'.")
+
+(defvar org-element--cache-diagnostics-level 2
+ "Detail level of the diagnostics.")
+
+(defvar-local org-element--cache-diagnostics-ring nil
+ "Ring containing last `org-element--cache-diagnostics-ring-size'
+cache process log entries.")
+
+(defvar org-element--cache-diagnostics-ring-size 5000
+ "Size of `org-element--cache-diagnostics-ring'.")
;;;; Data Structure
-(defvar org-element--cache nil
+(defvar-local 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
+(defvar-local org-element--headline-cache nil
+ "AVL tree used to cache headline and inlinetask elements.
+Each node of the tree contains an element. Comparison is done
+with `org-element--cache-compare'. This cache is used in
+`org-element-cache-map'.")
+
+(defconst org-element--cache-hash-size 16
+ "Cache size for recent cached calls to `org-element--cache-find'.
+
+This extra caching is based on the following paper:
+Pugh [Information Processing Letters] (1990) Slow optimally balanced
+ search strategies vs. cached fast uniformly balanced search
+ strategies. http://dx.doi.org/10.1016/0020-0190(90)90130-P
+
+Also, see `org-element--cache-hash-left' and `org-element--cache-hash-right'.")
+(defvar-local org-element--cache-hash-left nil
+ "Cached elements from `org-element--cache' for fast O(1) lookup.
+When non-nil, it should be a vector representing POS arguments of
+`org-element--cache-find' called with nil SIDE argument.
+Also, see `org-element--cache-hash-size'.")
+(defvar-local org-element--cache-hash-right nil
+ "Cached elements from `org-element--cache' for fast O(1) lookup.
+When non-nil, it should be a vector representing POS arguments of
+`org-element--cache-find' called with non-nil, non-`both' SIDE argument.
+Also, see `org-element--cache-hash-size'.")
+
+(defvar org-element--cache-hash-statistics '(0 . 0)
+ "Cons cell storing how Org makes use of `org-element--cache-find' caching.
+The car is the number of successful uses and cdr is the total calls to
+`org-element--cache-find'.")
+(defvar org-element--cache-hash-nocache 0
+ "Number of calls to `org-element--cache-has' with `both' SIDE argument.
+These calls are not cached by hash. See `org-element--cache-hash-size'.")
+
+(defvar-local org-element--cache-size 0
+ "Size of the `org-element--cache'.
+
+Storing value is variable is faster because `avl-tree-size' is O(N).")
+
+(defvar-local org-element--headline-cache-size 0
+ "Size of the `org-element--headline-cache'.
+
+Storing value is variable is faster because `avl-tree-size' is O(N).")
+
+(defvar-local org-element--cache-sync-requests nil
"List of pending synchronization requests.
A request is a vector with the following pattern:
@@ -5079,7 +5417,10 @@ 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.
+non-nil, is the common parent of all the elements between BEG and END.
+
+It is guaranteed that only a single phase 0 request exists at any
+moment of time. If it does, it must be the first request in the list.
During phase 1, NEXT is the key of the next known element in
cache and BEG its beginning position. Parse buffer between that
@@ -5088,18 +5429,115 @@ 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
+properties relative 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.")
+PHASE specifies the phase number, as an integer.
+
+For any synchronization request, all the later requests in the cache
+must not start at or before END. See `org-element--cache-submit-request'.")
-(defvar org-element--cache-sync-timer nil
+(defvar-local 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.
+(defvar-local org-element--cache-sync-keys-value nil
+ "Id value used to identify keys during synchronization.
See `org-element--cache-key' for more information.")
+(defvar-local org-element--cache-change-tic nil
+ "Last `buffer-chars-modified-tick' for registered changes.")
+
+(defvar-local org-element--cache-last-buffer-size nil
+ "Last value of `buffer-size' for registered changes.")
+
+(defvar org-element--cache-non-modifying-commands
+ '(org-agenda
+ org-agenda-redo
+ org-sparse-tree
+ org-occur
+ org-columns
+ org-columns-redo
+ org-columns-new
+ org-columns-delete
+ org-columns-compute
+ org-columns-insert-dblock
+ org-agenda-columns
+ org-ctrl-c-ctrl-c)
+ "List of commands that are not expected to change the cache state.
+
+This variable is used to determine when re-parsing buffer is not going
+to slow down the command.
+
+If the commands end up modifying the cache, the worst case scenario is
+performance drop. So, advicing these commands is safe. Yet, it is
+better to remove the commands advised in such a way from this list.")
+
+(defmacro org-element--request-key (request)
+ "Get NEXT part of a `org-element--cache-sync-requests' REQUEST."
+ `(aref ,request 0))
+
+(defmacro org-element--request-beg (request)
+ "Get BEG part of a `org-element--cache-sync-requests' REQUEST."
+ `(aref ,request 1))
+
+(defmacro org-element--request-end (request)
+ "Get END part of a `org-element--cache-sync-requests' REQUEST."
+ `(aref ,request 2))
+
+(defmacro org-element--request-offset (request)
+ "Get OFFSET part of a `org-element--cache-sync-requests' REQUEST."
+ `(aref ,request 3))
+
+(defmacro org-element--request-parent (request)
+ "Get PARENT part of a `org-element--cache-sync-requests' REQUEST."
+ `(aref ,request 4))
+
+(defmacro org-element--request-phase (request)
+ "Get PHASE part of a `org-element--cache-sync-requests' REQUEST."
+ `(aref ,request 5))
+
+(defmacro org-element--format-element (element)
+ "Format ELEMENT for printing in diagnostics."
+ `(let ((print-length 50)
+ (print-level 5))
+ (prin1-to-string ,element)))
+
+(defmacro org-element--cache-log-message (format-string &rest args)
+ "Add a new log message for org-element-cache."
+ `(when (or org-element--cache-diagnostics
+ (eq org-element--cache-self-verify 'backtrace))
+ (let* ((format-string (concat (format "org-element-cache diagnostics(%s): "
+ (buffer-name (current-buffer)))
+ ,format-string))
+ (format-string (funcall #'format format-string ,@args)))
+ (if org-element--cache-diagnostics
+ (display-warning 'org-element-cache format-string)
+ (unless org-element--cache-diagnostics-ring
+ (setq org-element--cache-diagnostics-ring
+ (make-ring org-element--cache-diagnostics-ring-size)))
+ (ring-insert org-element--cache-diagnostics-ring format-string)))))
+
+(defmacro org-element--cache-warn (format-string &rest args)
+ "Raise warning for org-element-cache."
+ `(let* ((format-string (funcall #'format ,format-string ,@args))
+ (format-string
+ (if (or (not org-element--cache-diagnostics-ring)
+ (not (eq 'backtrace org-element--cache-self-verify)))
+ format-string
+ (prog1
+ (concat (format "Warning(%s): "
+ (buffer-name (current-buffer)))
+ format-string
+ "\nBacktrace:\n "
+ (mapconcat #'identity
+ (ring-elements org-element--cache-diagnostics-ring)
+ "\n "))
+ (setq org-element--cache-diagnostics-ring nil)))))
+ (if (and (boundp 'org-batch-test) org-batch-test)
+ (error "%s" (concat "org-element--cache: " format-string))
+ (display-warning 'org-element-cache
+ (concat "org-element--cache: " format-string)))))
+
(defsubst org-element--cache-key (element)
"Return a unique key for ELEMENT in cache tree.
@@ -5109,16 +5547,19 @@ 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).
+a list (respectively a table). They key of a section is its beginning
+position minus one.
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)
+Such keys are stored inside the element property
+`:org-element--cache-sync-key'. The property is a cons containing
+current `org-element--cache-sync-keys-value' and the element key."
+ (or (when (eq org-element--cache-sync-keys-value (car (org-element-property :org-element--cache-sync-key element)))
+ (cdr (org-element-property :org-element--cache-sync-key element)))
(let* ((begin (org-element-property :begin element))
;; Increase beginning position of items (respectively
;; table rows) by one, so the first item can get
@@ -5126,10 +5567,20 @@ table is cleared once the synchronization is complete."
;; 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))))
+ ;; Decrease beginning position of sections by one,
+ ;; so that the first element of the section get
+ ;; different key from the parent section.
+ (if (eq (org-element-type element) 'section)
+ (1- begin)
+ (if (eq (org-element-type element) 'org-data)
+ (- begin 2)
+ begin)))))
+ (when org-element--cache-sync-requests
+ (org-element-put-property
+ element
+ :org-element--cache-sync-key
+ (cons org-element--cache-sync-keys-value key)))
+ key)))
(defun org-element--cache-generate-key (lower upper)
"Generate a key between LOWER and UPPER.
@@ -5204,7 +5655,11 @@ lesser than UPPER, per `org-element--cache-key-less-p'."
(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'."
+`org-element--cache-key'.
+
+Note that it is not reliable to compare buffer position with the cache
+keys. They keys may be larger compared to actual element :begin
+position."
(if (integerp a) (if (integerp b) (< a b) (<= a (car b)))
(if (integerp b) (< (car a) b)
(catch 'exit
@@ -5222,22 +5677,66 @@ A and B are either integers or lists of integers, as returned by
(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)))
+ (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.
+ "Return root value in `org-element--cache' .
This function assumes `org-element--cache' is a valid AVL tree."
(avl-tree--node-left (avl-tree--dummyroot org-element--cache)))
+(defsubst org-element--headline-cache-root ()
+ "Return root value in `org-element--headline-cache' .
+This function assumes `org-element--headline-cache' is a valid AVL tree."
+ (avl-tree--node-left (avl-tree--dummyroot org-element--headline-cache)))
;;;; Tools
-(defsubst org-element--cache-active-p ()
+;; FIXME: Ideally, this should be inlined to avoid overheads, but
+;; inlined functions should be declared before the code that uses them
+;; and some code above does use `org-element--cache-active-p'. Moving this
+;; declaration on top would require restructuring the whole cache
+;; section.
+(defun org-element--cache-active-p (&optional called-from-cache-change-func-p)
"Non-nil when cache is active in current buffer."
- (and org-element-use-cache
- org-element--cache
- (derived-mode-p 'org-mode)))
+ (org-with-base-buffer nil
+ (and org-element-use-cache
+ org-element--cache
+ (or called-from-cache-change-func-p
+ (eq org-element--cache-change-tic (buffer-chars-modified-tick))
+ (and
+ ;; org-num-mode calls some Org structure analysis functions
+ ;; that can trigger cache update in the middle of changes. See
+ ;; `org-num--verify' calling `org-num--skip-value' calling
+ ;; `org-entry-get' that uses cache.
+ ;; Forcefully disable cache when called from inside a
+ ;; modification hook, where `inhibit-modification-hooks' is set
+ ;; to t.
+ (not inhibit-modification-hooks)
+ ;; `combine-change-calls' sets `after-change-functions' to
+ ;; nil. We need not to use cache inside
+ ;; `combine-change-calls' because the buffer is potentially
+ ;; changed without notice (the change will be registered
+ ;; after exiting the `combine-change-calls' body though).
+ (memq #'org-element--cache-after-change after-change-functions))))))
+
+;; FIXME: Remove after we establish that hashing is effective.
+(defun org-element-cache-hash-show-statistics ()
+ "Display efficiency of O(1) query cache for `org-element--cache-find'.
+
+This extra caching is based on the following paper:
+Pugh [Information Processing Letters] (1990) Slow optimally balanced
+ search strategies vs. cached fast uniformly balanced search
+ strategies. http://dx.doi.org/10.1016/0020-0190(90)90130-P
+
+Also, see `org-element--cache-size'."
+ (interactive)
+ (message "%.2f%% of cache searches hashed, %.2f%% non-hashable."
+ (* 100
+ (/ (float (car org-element--cache-hash-statistics))
+ (cdr org-element--cache-hash-statistics)))
+ (* 100
+ (/ (float org-element--cache-hash-nocache)
+ (cdr org-element--cache-hash-statistics)))))
(defun org-element--cache-find (pos &optional side)
"Find element in cache starting at POS or before.
@@ -5252,75 +5751,156 @@ 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))))
+ (org-with-base-buffer nil
+ (let* ((limit (and org-element--cache-sync-requests
+ (org-element--request-key (car org-element--cache-sync-requests))))
+ (node (org-element--cache-root))
+ (hash-pos (unless (eq side 'both)
+ (mod (org-knuth-hash pos)
+ org-element--cache-hash-size)))
+ (hashed (if (not side)
+ (aref org-element--cache-hash-left hash-pos)
+ (unless (eq side 'both)
+ (aref org-element--cache-hash-right hash-pos))))
+ lower upper)
+ ;; `org-element--cache-key-less-p' does not accept markers.
+ (when (markerp pos) (setq pos (marker-position pos)))
+ (cl-incf (cdr org-element--cache-hash-statistics))
+ (when (eq side 'both) (cl-incf org-element--cache-hash-nocache))
+ (if (and hashed (not (eq side 'both))
+ (or (not limit)
+ ;; Limit can be a list key.
+ (org-element--cache-key-less-p
+ (org-element--cache-key hashed)
+ limit))
+ (= pos (org-element-property :begin hashed))
+ ;; We cannot rely on element :begin for elements with
+ ;; children starting at the same pos.
+ (not (memq (org-element-type hashed)
+ '(section org-data table)))
+ (org-element-property :cached hashed))
+ (progn
+ (cl-incf (car org-element--cache-hash-statistics))
+ hashed)
+ (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)))
+ ((or (< begin pos)
+ ;; If the element is section or org-data, we also need
+ ;; to check the following element.
+ (memq (org-element-type element) '(section org-data)))
+ (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)))))
+ (if (not side)
+ (aset org-element--cache-hash-left hash-pos lower)
+ (unless (eq side 'both)
+ (aset org-element--cache-hash-right hash-pos lower)))
+ (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)))
+ (org-with-base-buffer nil
+ (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))
+ (new-key (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
+ (org-element--request-key (car org-element--cache-sync-requests)))))))
+ (org-element-put-property
+ element
+ :org-element--cache-sync-key
+ (cons org-element--cache-sync-keys-value new-key))))
+ (when (>= org-element--cache-diagnostics-level 2)
+ (org-element--cache-log-message
+ "Added new element with %S key: %S"
+ (org-element-property :org-element--cache-sync-key element)
+ (org-element--format-element element)))
+ (org-element-put-property element :cached t)
+ (when (memq (org-element-type element) '(headline inlinetask))
+ (cl-incf org-element--headline-cache-size)
+ (avl-tree-enter org-element--headline-cache element))
+ (cl-incf org-element--cache-size)
+ (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))
-
+ (org-with-base-buffer nil
+ (org-element-put-property element :cached nil)
+ (cl-decf org-element--cache-size)
+ ;; Invalidate contents of parent.
+ (when (and (org-element-property :parent element)
+ (org-element-contents (org-element-property :parent element)))
+ (org-element-set-contents (org-element-property :parent element) nil))
+ (when (memq (org-element-type element) '(headline inlinetask))
+ (cl-decf org-element--headline-cache-size)
+ (avl-tree-delete org-element--headline-cache element))
+ (org-element--cache-log-message
+ "Decreasing cache size to %S"
+ org-element--cache-size)
+ (when (< org-element--cache-size 0)
+ (org-element--cache-warn
+ "Cache grew to negative size in %S when deleting %S at %S. Cache key: %S.
+If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report)."
+ (org-element-type element)
+ (current-buffer)
+ (org-element-property :begin element)
+ (org-element-property :org-element--cache-sync-key element))
+ (org-element-cache-reset)
+ (throw 'quit nil))
+ (or (avl-tree-delete org-element--cache element)
+ (progn
+ ;; This should not happen, but if it is, would be better to know
+ ;; where it happens.
+ (org-element--cache-warn
+ "Failed to delete %S element in %S at %S. The element cache key was %S.
+If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report)."
+ (org-element-type element)
+ (current-buffer)
+ (org-element-property :begin element)
+ (org-element-property :org-element--cache-sync-key element))
+ (org-element-cache-reset)
+ (throw 'quit nil)))))
;;;; Synchronization
@@ -5331,7 +5911,7 @@ Assume ELEMENT belongs to cache and that a cache is active."
(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)
+ (if idle (time-add idle org-element-cache-sync-break)
org-element-cache-sync-idle-time))
nil
#'org-element--cache-sync
@@ -5342,7 +5922,7 @@ Assume ELEMENT belongs to cache and that a cache is active."
TIME-LIMIT is a time value or nil."
(and time-limit
(or (input-pending-p)
- (org-time-less-p time-limit nil))))
+ (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.
@@ -5359,17 +5939,34 @@ Properties are modified by side-effect."
;; 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)))
+ (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))
+ (dolist (key '( :begin :contents-begin :contents-end :end
+ :post-affiliated :robust-begin :robust-end))
(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)
+(defvar org-element--cache-interrupt-C-g t
+ "When non-nil, allow the user to abort `org-element--cache-sync'.
+The execution is aborted upon pressing `\\[keyboard-quit]'
+`org-element--cache-interrupt-C-g-max-count' times.")
+(defvar org-element--cache-interrupt-C-g-max-count 5
+ "`\\[keyboard-quit]' count to interrupt `org-element--cache-sync'.
+See `org-element--cache-interrupt-C-g'.")
+(defvar org-element--cache-interrupt-C-g-count 0
+ "Current number of `org-element--cache-sync' calls.
+See `org-element--cache-interrupt-C-g'.")
+
+(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, or a number representing smallest level of
+modified headline. The level considers headline levels both before
+and after the modification.")
+
+(defun org-element--cache-sync (buffer &optional threshold future-change offset)
"Synchronize cache with recent modification in BUFFER.
When optional argument THRESHOLD is non-nil, do the
@@ -5379,46 +5976,88 @@ then exit. Otherwise, synchronize cache for as long as
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."
+not registered yet in the cache are going to happen. OFFSET is the
+change offset. 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))))))
+ (org-with-base-buffer buffer
+ ;; Do not sync when, for example, in the middle of
+ ;; `combine-change-calls'. See the commentary inside
+ ;; `org-element--cache-active-p'.
+ (when (and org-element--cache-sync-requests (org-element--cache-active-p))
+ ;; Check if the buffer have been changed outside visibility of
+ ;; `org-element--cache-before-change' and `org-element--cache-after-change'.
+ (if (/= org-element--cache-last-buffer-size (buffer-size))
+ (progn
+ (org-element--cache-warn
+ "Unregistered buffer modifications detected (%S != %S). Resetting.
+If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report).
+The buffer is: %s\n Current command: %S\n Backtrace:\n%S"
+ org-element--cache-last-buffer-size
+ (buffer-size)
+ (buffer-name (current-buffer))
+ this-command
+ (when (and (fboundp 'backtrace-get-frames)
+ (fboundp 'backtrace-to-string))
+ (backtrace-to-string (backtrace-get-frames 'backtrace))))
+ (org-element-cache-reset))
+ (let ((inhibit-quit t) request next)
+ (setq org-element--cache-interrupt-C-g-count 0)
+ (when org-element--cache-sync-timer
+ (cancel-timer org-element--cache-sync-timer))
+ (let ((time-limit (time-add nil org-element-cache-sync-duration)))
+ (catch 'org-element--cache-interrupt
+ (when org-element--cache-sync-requests
+ (org-element--cache-log-message "Syncing down to %S-%S" (or future-change threshold) threshold))
+ (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
+ (when next (org-element--request-key next))
+ threshold
+ (unless threshold time-limit)
+ future-change
+ offset)
+ ;; Re-assign current and next requests. It could have
+ ;; been altered during phase 1.
+ (setq request (car org-element--cache-sync-requests)
+ next (nth 1 org-element--cache-sync-requests))
+ ;; Request processed. Merge current and next offsets and
+ ;; transfer ending position.
+ (when next
+ ;; The following requests can only be either phase 1
+ ;; or phase 2 requests. We need to let them know
+ ;; that additional shifting happened ahead of them.
+ (cl-incf (org-element--request-offset next) (org-element--request-offset request))
+ (org-element--cache-log-message
+ "Updating next request offset to %S: %s"
+ (org-element--request-offset next)
+ (let ((print-length 10) (print-level 3)) (prin1-to-string next)))
+ ;; FIXME: END part of the request only matters for
+ ;; phase 0 requests. However, the only possible
+ ;; phase 0 request must be the first request in the
+ ;; list all the time. END position should be
+ ;; unused.
+ (setf (org-element--request-end next) (org-element--request-end request)))
+ (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)
+ (setq org-element--cache-change-warning nil)
+ (setq org-element--cache-sync-keys-value (1+ org-element--cache-sync-keys-value)))))))))
(defun org-element--cache-process-request
- (request next threshold time-limit future-change)
+ (request next-request-key threshold time-limit future-change offset)
"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'.
+NEXT-REQUEST-KEY is a cache key of the next request, 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.
@@ -5426,180 +6065,373 @@ 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.
+When non-nil, FUTURE-CHANGE is a buffer position where changes not
+registered yet in the cache are going to happen. OFFSET is the
+changed text length. See `org-element--cache-submit-request' for more
+information.
+
+Throw `org-element--cache-interrupt' if the process stops before
+completing the request."
+ (org-with-base-buffer nil
+ (org-element--cache-log-message
+ "org-element-cache: Processing request %s up to %S-%S, next: %S"
+ (let ((print-length 10) (print-level 3)) (prin1-to-string request))
+ future-change
+ threshold
+ next-request-key)
+ (catch 'org-element--cache-quit
+ (when (= (org-element--request-phase request) 0)
+ ;; Phase 0.
+ ;;
+ ;; Delete all elements starting after beginning of the element
+ ;; with request key NEXT, but not after buffer position END.
+ ;;
+ ;; At each iteration, we start again at tree root since
+ ;; a deletion modifies structure of the balanced tree.
+ (org-element--cache-log-message "Phase 0")
+ (catch 'org-element--cache-end-phase
+ (let ((deletion-count 0))
+ (while t
+ (when (org-element--cache-interrupt-p time-limit)
+ (org-element--cache-log-message "Interrupt: time limit")
+ (throw 'org-element--cache-interrupt nil))
+ (let ((request-key (org-element--request-key request))
+ (end (org-element--request-end request))
+ (node (org-element--cache-root))
+ data data-key)
+ ;; Find first element in cache with key REQUEST-KEY or
+ ;; after it.
+ (while node
+ (let* ((element (avl-tree--node-data node))
+ (key (org-element--cache-key element)))
+ (cond
+ ((org-element--cache-key-less-p key request-key)
+ (setq node (avl-tree--node-right node)))
+ ((org-element--cache-key-less-p request-key key)
+ (setq data element
+ data-key key
+ node (avl-tree--node-left node)))
+ (t (setq data element
+ data-key key
+ node nil)))))
+ (if data
+ ;; We found first element in cache starting at or
+ ;; after REQUEST-KEY.
+ (let ((pos (org-element-property :begin data)))
+ ;; FIXME: Maybe simply (< pos end)?
+ (if (<= pos end)
+ (progn
+ (org-element--cache-log-message "removing %S::%S"
+ (org-element-property :org-element--cache-sync-key data)
+ (org-element--format-element data))
+ (cl-incf deletion-count)
+ (org-element--cache-remove data)
+ (when (and (> (log org-element--cache-size 2) 10)
+ (> deletion-count
+ (/ org-element--cache-size (log org-element--cache-size 2))))
+ (org-element--cache-log-message "Removed %S>N/LogN(=%S/%S) elements. Resetting cache to prevent performance degradation"
+ deletion-count
+ org-element--cache-size
+ (log org-element--cache-size 2))
+ (org-element-cache-reset)
+ (throw 'org-element--cache-quit t)))
+ ;; Done deleting everything starting before END.
+ ;; DATA-KEY is the first known element after END.
+ ;; Move on to phase 1.
+ (org-element--cache-log-message
+ "found element after %S: %S::%S"
+ end
+ (org-element-property :org-element--cache-sync-key data)
+ (org-element--format-element data))
+ (setf (org-element--request-key request) data-key)
+ (setf (org-element--request-beg request) pos)
+ (setf (org-element--request-phase request) 1)
+ (throw 'org-element--cache-end-phase nil)))
+ ;; No element starting after modifications left in
+ ;; cache: further processing is futile.
+ (org-element--cache-log-message
+ "Phase 0 deleted all elements in cache after %S!"
+ request-key)
+ (throw 'org-element--cache-quit t)))))))
+ (when (= (org-element--request-phase request) 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, current
+ ;; request is inside a to-be-shifted part of the cache. It is
+ ;; fine because the order of elements will not be altered by
+ ;; shifting. However, we cannot know the real position of the
+ ;; unshifted NEXT element in the current request. So, we need
+ ;; to sort the request list according to keys and re-start
+ ;; processing from the new leftmost request.
+ (org-element--cache-log-message "Phase 1")
+ (let ((key (org-element--request-key request)))
+ (when (and next-request-key (not (org-element--cache-key-less-p key next-request-key)))
+ ;; In theory, the only case when requests are not
+ ;; ordered is when key of the next request is either the
+ ;; same with current key or it is a key for a removed
+ ;; element. Either way, we can simply merge the two
+ ;; requests.
+ (let ((next-request (nth 1 org-element--cache-sync-requests)))
+ (org-element--cache-log-message "Phase 1: Unorderered requests. Merging: %S\n%S\n"
+ (let ((print-length 10) (print-level 3)) (prin1-to-string request))
+ (let ((print-length 10) (print-level 3)) (prin1-to-string next-request)))
+ (setf (org-element--request-key next-request) key)
+ (setf (org-element--request-beg next-request) (org-element--request-beg request))
+ (setf (org-element--request-phase next-request) 1)
+ (throw 'org-element--cache-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 (+ (org-element--request-beg request) (org-element--request-offset request)))
+ cached-before)
+ (cond ((and threshold (> limit threshold))
+ (org-element--cache-log-message "Interrupt: position %S after threshold %S" limit threshold)
+ (throw 'org-element--cache-interrupt nil))
+ ((and future-change (>= limit future-change))
+ ;; Changes happened around this element and they will
+ ;; trigger another phase 1 request. Skip re-parenting
+ ;; and simply proceed with shifting (phase 2) to make
+ ;; sure that followup phase 0 request for the recent
+ ;; changes can operate on the correctly shifted cache.
+ (org-element--cache-log-message "position %S after future change %S" limit future-change)
+ (setf (org-element--request-parent request) nil)
+ (setf (org-element--request-phase request) 2))
+ (t
+ (when future-change
+ ;; Changes happened, but not yet registered after
+ ;; this element. However, we a not yet safe to look
+ ;; at the buffer and parse elements in the cache gap.
+ ;; Some of the parents to be added to cache may end
+ ;; after the changes. Parsing this parents will
+ ;; assign the :end correct value for cache state
+ ;; after future-change. Then, when the future change
+ ;; is going to be processed, such parent boundary
+ ;; will be altered unnecessarily. To avoid this,
+ ;; we alter the new parents by -OFFSET.
+ ;; For now, just save last known cached element and
+ ;; then check all the parents below.
+ (setq cached-before (org-element--cache-find (1- limit) nil)))
+ ;; No relevant changes happened after submitting this
+ ;; request. We are safe to look at the actual Org
+ ;; buffer and calculate the new parent.
+ (let ((parent (org-element--parse-to (1- limit) nil time-limit)))
+ (when future-change
+ ;; Check all the newly added parents to not
+ ;; intersect with future change.
+ (let ((up parent))
+ (while (and up
+ (or (not cached-before)
+ (> (org-element-property :begin up)
+ (org-element-property :begin cached-before))))
+ (when (> (org-element-property :end up) future-change)
+ ;; Offset future cache request.
+ (org-element--cache-shift-positions
+ up (- offset)
+ (if (and (org-element-property :robust-begin up)
+ (org-element-property :robust-end up))
+ '(:contents-end :end :robust-end)
+ '(:contents-end :end))))
+ (setq up (org-element-property :parent up)))))
+ (org-element--cache-log-message
+ "New parent at %S: %S::%S"
+ limit
+ (org-element-property :org-element--cache-sync-key parent)
+ (org-element--format-element parent))
+ (setf (org-element--request-parent request) parent)
+ (setf (org-element--request-phase request) 2))))))
+ ;; Phase 2.
;;
- ;; 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.
+ ;; Shift all elements starting from key START, but before NEXT, by
+ ;; OFFSET, and re-parent them when appropriate.
;;
- ;; Note that we only need to get the parent from the first
- ;; element in cache after the hole.
+ ;; Elements are modified by side-effect so the tree structure
+ ;; remains intact.
;;
- ;; 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)))
+ ;; Once THRESHOLD, if any, is reached, or once there is an input
+ ;; pending, exit. Before leaving, the current synchronization
+ ;; request is updated.
+ (org-element--cache-log-message "Phase 2")
+ (let ((start (org-element--request-key request))
+ (offset (org-element--request-offset request))
+ (parent (org-element--request-parent request))
+ (node (org-element--cache-root))
+ (stack (list nil))
+ (leftp t)
+ exit-flag continue-flag)
+ ;; No re-parenting nor shifting planned: request is over.
+ (when (and (not parent) (zerop offset))
+ (org-element--cache-log-message "Empty offset. Request completed.")
+ (throw 'org-element--cache-quit t))
+ (while node
+ (let* ((data (avl-tree--node-data node))
+ (key (org-element--cache-key data)))
+ ;; Traverse the cache tree. Ignore all the elements before
+ ;; START. Note that `avl-tree-stack' would not bypass the
+ ;; elements before START and thus would have been less
+ ;; efficient.
+ (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)))
+ ;; Shift and re-parent when current node starts at or
+ ;; after START, but before NEXT.
+ (unless (org-element--cache-key-less-p key start)
+ ;; We reached NEXT. Request is complete.
+ (when (and next-request-key
+ (not (org-element--cache-key-less-p key next-request-key)))
+ (org-element--cache-log-message "Reached next request.")
+ (let ((next-request (nth 1 org-element--cache-sync-requests)))
+ (unless (and (org-element-property :cached (org-element--request-parent next-request))
+ (org-element-property :begin (org-element--request-parent next-request))
+ parent
+ (> (org-element-property :begin (org-element--request-parent next-request))
+ (org-element-property :begin parent)))
+ (setf (org-element--request-parent next-request) parent)))
+ (throw 'org-element--cache-quit t))
+ ;; Handle interruption request. Update current request.
+ (when (or exit-flag (org-element--cache-interrupt-p time-limit))
+ (org-element--cache-log-message "Interrupt: %s" (if exit-flag "threshold" "time limit"))
+ (setf (org-element--request-key request) key)
+ (setf (org-element--request-parent request) parent)
+ (throw 'org-element--cache-interrupt nil))
+ ;; Shift element.
+ (unless (zerop offset)
+ (when (>= org-element--cache-diagnostics-level 3)
+ (org-element--cache-log-message "Shifting positions (𝝙%S) in %S::%S"
+ offset
+ (org-element-property :org-element--cache-sync-key data)
+ (org-element--format-element data)))
+ (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 'org-element--cache-quit nil))
+ ;; Consider scenario when DATA lays within
+ ;; sensitive lines of PARENT that was found
+ ;; during phase 2. For example:
+ ;;
+ ;; #+ begin_quote
+ ;; Paragraph
+ ;; #+end_quote
+ ;;
+ ;; In the above source block, remove space in
+ ;; the first line will trigger re-parenting of
+ ;; the paragraph and "#+end_quote" that is also
+ ;; considered paragraph before the modification.
+ ;; However, the paragraph element stored in
+ ;; cache must be deleted instead.
+ ((and parent
+ (or (not (memq (org-element-type parent) org-element-greater-elements))
+ (and (org-element-property :contents-begin parent)
+ (< (org-element-property :begin data) (org-element-property :contents-begin parent)))
+ (and (org-element-property :contents-end parent)
+ (>= (org-element-property :begin data) (org-element-property :contents-end parent)))
+ (> (org-element-property :end data) (org-element-property :end parent))
+ (and (org-element-property :contents-end data)
+ (> (org-element-property :contents-end data) (org-element-property :contents-end parent)))))
+ (org-element--cache-log-message "org-element-cache: Removing obsolete element with key %S::%S"
+ (org-element-property :org-element--cache-sync-key data)
+ (org-element--format-element data))
+ (org-element--cache-remove data)
+ ;; We altered the tree structure. The tree
+ ;; traversal needs to be restarted.
+ (setf (org-element--request-key request) key)
+ (setf (org-element--request-parent request) parent)
+ ;; Restart tree traversal.
+ (setq node (org-element--cache-root)
+ stack (list nil)
+ leftp t
+ begin -1
+ continue-flag t))
+ ((and parent
+ (not (eq parent data))
+ (let ((p (org-element-property :parent data)))
+ (or (not p)
+ (< (org-element-property :begin p)
+ (org-element-property :begin parent))
+ (unless (eq p parent)
+ (not (org-element-property :cached p))
+ ;; (not (avl-tree-member-p org-element--cache p))
+ ))))
+ (org-element--cache-log-message
+ "Updating parent in %S\n Old parent: %S\n New parent: %S"
+ (org-element--format-element data)
+ (org-element--format-element (org-element-property :parent data))
+ (org-element--format-element parent))
+ (when (and (eq 'org-data (org-element-type parent))
+ (not (eq 'headline (org-element-type data))))
+ ;; FIXME: This check is here to see whether
+ ;; such error happens within
+ ;; `org-element--cache-process-request' or somewhere
+ ;; else.
+ (org-element--cache-warn
+ "Added org-data parent to non-headline element: %S
+If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report)."
+ data)
+ (org-element-cache-reset)
+ (throw 'org-element--cache-quit t))
+ (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))
+ (org-element--cache-log-message "Reached threshold %S: %S"
+ threshold
+ (org-element--format-element data))
+ (setq exit-flag t))))
+ (if continue-flag
+ (setq continue-flag nil)
+ (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))
+ (org-element--cache-log-message
+ "org-element-cache: Finished process. The cache size is %S. The remaining sync requests: %S"
+ org-element--cache-size
+ (let ((print-level 2)) (prin1-to-string org-element--cache-sync-requests)))))
+
+(defsubst org-element--open-end-p (element)
+ "Check if ELEMENT in current buffer contains extra blank lines after
+it and does not have closing term.
+
+Examples of such elements are: section, headline, org-data,
+and footnote-definition."
+ (and (org-element-property :contents-end element)
+ (= (org-element-property :contents-end element)
+ (save-excursion
+ (goto-char (org-element-property :end element))
+ (skip-chars-backward " \r\n\t")
+ (line-beginning-position 2)))))
(defun org-element--parse-to (pos &optional syncp time-limit)
"Parse elements in current section, down to POS.
@@ -5611,129 +6443,216 @@ 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."
+when the parsing should stop. The function throws
+`org-element--cache-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)))))))
-
+ (save-match-data
+ (org-with-base-buffer nil
+ (org-with-wide-buffer
+ (goto-char pos)
+ (save-excursion
+ (end-of-line)
+ (skip-chars-backward " \r\t\n")
+ ;; Within blank lines at the beginning of buffer, return nil.
+ (when (bobp) (throw 'exit nil)))
+ (let* ((cached (and (org-element--cache-active-p)
+ (org-element--cache-find pos nil)))
+ (mode (org-element-property :mode cached))
+ element next)
+ (cond
+ ;; Nothing in cache before point: start parsing from first
+ ;; element in buffer down to POS or from the beginning of the
+ ;; file.
+ ((and (not cached) (org-element--cache-active-p))
+ (setq element (org-element-org-data-parser))
+ (unless (org-element-property :begin element)
+ (org-element--cache-warn "Error parsing org-data. Got %S\nPlease report to Org mode mailing list (M-x org-submit-bug-report)." element))
+ (org-element--cache-log-message
+ "Nothing in cache. Adding org-data: %S"
+ (org-element--format-element element))
+ (org-element--cache-put element)
+ (goto-char (org-element-property :contents-begin element))
+ (setq mode 'org-data))
+ ;; Nothing in cache before point because cache is not active.
+ ;; Parse from previous heading to avoid re-parsing the whole
+ ;; buffer above. This comes at the cost of not calculating
+ ;; `:parent' property for headings.
+ ((not cached)
+ (if (org-with-limited-levels (outline-previous-heading))
+ (progn
+ (setq element (org-element-headline-parser nil 'fast))
+ (setq mode 'planning)
+ (forward-line))
+ (setq element (org-element-org-data-parser))
+ (setq mode 'org-data))
+ (org-skip-whitespace)
+ (beginning-of-line))
+ ;; 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 location, which is
+ ;; right after the top-most element containing CACHED but
+ ;; still before POS.
+ ;;
+ ;; 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)))
+ (while (and up (<= (org-element-property :end up) pos))
+ (goto-char (org-element-property :end up))
+ (setq element up
+ mode (org-element--next-mode (org-element-property :mode element) (org-element-type element) nil)
+ up (org-element-property :parent up)
+ next (point)))
+ (when up (setq element up)))))
+ ;; Parse successively each element until we reach POS.
+ (let ((end (or (org-element-property :end element) (point-max)))
+ (parent (org-element-property :parent element)))
+ (while t
+ (when (org-element--cache-interrupt-p time-limit)
+ (throw 'org-element--cache-interrupt nil))
+ (when (and inhibit-quit org-element--cache-interrupt-C-g quit-flag)
+ (when quit-flag
+ (cl-incf org-element--cache-interrupt-C-g-count)
+ (setq quit-flag nil))
+ (when (>= org-element--cache-interrupt-C-g-count
+ org-element--cache-interrupt-C-g-max-count)
+ (setq quit-flag t)
+ (setq org-element--cache-interrupt-C-g-count 0)
+ (org-element-cache-reset)
+ (error "org-element: Parsing aborted by user. Cache has been cleared.
+If you observe Emacs hangs frequently, please report this to Org mode mailing list (M-x org-submit-bug-report)."))
+ (message (substitute-command-keys
+ "`org-element--parse-buffer': Suppressed `\\[keyboard-quit]'. Press `\\[keyboard-quit]' %d more times to force interruption.")
+ (- org-element--cache-interrupt-C-g-max-count
+ org-element--cache-interrupt-C-g-count)))
+ (unless element
+ ;; Do not try to parse within blank at EOB.
+ (unless (save-excursion
+ (org-skip-whitespace)
+ (eobp))
+ (org-element-with-disabled-cache
+ (setq element (org-element--current-element
+ end 'element mode
+ (org-element-property :structure parent)))))
+ ;; Make sure that we return referenced element in cache
+ ;; that can be altered directly.
+ (if element
+ (setq element (or (org-element--cache-put element) element))
+ ;; Nothing to parse (i.e. empty file).
+ (throw 'exit parent))
+ (unless (or (not (org-element--cache-active-p)) parent)
+ (org-element--cache-warn
+ "Got empty parent while parsing. Please report it to Org mode mailing list (M-x org-submit-bug-report).\n Backtrace:\n%S"
+ (when (and (fboundp 'backtrace-get-frames)
+ (fboundp 'backtrace-to-string))
+ (backtrace-to-string (backtrace-get-frames 'backtrace))
+ (org-element-cache-reset)
+ (error "org-element--cache: Emergency exit"))))
+ (org-element-put-property element :parent parent))
+ (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))
+ ;; Avoid parsing headline siblings above.
+ (goto-char elem-end)
+ (when (eq type 'headline)
+ (save-match-data
+ (unless (when (and (/= 1 (org-element-property :level element))
+ (re-search-forward
+ (rx-to-string
+ `(and bol (repeat 1 ,(1- (let ((level (org-element-property :level element)))
+ (if org-odd-levels-only (1- (* level 2)) level)))
+ "*")
+ " "))
+ pos t))
+ (beginning-of-line)
+ t)
+ ;; There are headings with lower level than
+ ;; ELEMENT between ELEM-END and POS. Siblings
+ ;; may exist though. Parse starting from the
+ ;; last sibling or from ELEM-END if there are
+ ;; no other siblings.
+ (goto-char pos)
+ (unless
+ (re-search-backward
+ (rx-to-string
+ `(and bol (repeat ,(let ((level (org-element-property :level element)))
+ (if org-odd-levels-only (1- (* level 2)) level))
+ "*")
+ " "))
+ elem-end t)
+ ;; Roll-back to normal parsing.
+ (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 (if syncp parent 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 (and cbeg cend
+ (or (< cbeg pos)
+ (and (= cbeg pos)
+ (not (memq type '(plain-list table)))))
+ (or (> cend pos)
+ ;; When we are at cend or within blank
+ ;; lines after, it is a special case:
+ ;; 1. At the end of buffer we return
+ ;; the innermost element.
+ ;; 2. At cend of element with return
+ ;; that element.
+ ;; 3. At the end of element, we would
+ ;; return in the earlier cond form.
+ ;; 4. Within blank lines after cend,
+ ;; when element does not have a
+ ;; closing keyword, we return that
+ ;; outermost element, unless the
+ ;; outermost element is a non-empty
+ ;; headline. In the latter case, we
+ ;; return the outermost element inside
+ ;; the headline section.
+ (and (org-element--open-end-p element)
+ (or (= (org-element-property :end element) (point-max))
+ (and (>= pos (org-element-property :contents-end element))
+ (memq (org-element-type element) '(org-data section headline)))))))
+ (goto-char (or next cbeg))
+ (setq mode (if next mode (org-element--next-mode mode type t))
+ next nil
+ parent element
+ end (if (org-element--open-end-p element)
+ (org-element-property :end element)
+ (org-element-property :contents-end element))))))
+ ;; Otherwise, return ELEMENT as it is the smallest
+ ;; element containing POS.
+ (t (throw 'exit (if syncp parent element)))))
+ (setq element nil)))))))))
;;;; Staging Buffer Changes
@@ -5742,8 +6661,9 @@ the process stopped before finding the expected result."
"^\\*+ " "\\|"
"\\\\end{[A-Za-z0-9*]+}[ \t]*$" "\\|"
"^[ \t]*\\(?:"
- "#\\+\\(?:BEGIN[:_]\\|END\\(?:_\\|:?[ \t]*$\\)\\)" "\\|"
- "\\\\begin{[A-Za-z0-9*]+}" "\\|"
+ "#\\+END\\(?:_\\|:?[ \t]*$\\)" "\\|"
+ org-list-full-item-re "\\|"
+ ":\\(?: \\|$\\)" "\\|"
":\\(?:\\w\\|[-_]\\)+:[ \t]*$"
"\\)")
"Regexp matching a sensitive line, structure wise.
@@ -5752,67 +6672,133 @@ 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.
+ "Detect modifications in sensitive parts of Org buffer.
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)))))))))
+text. See `before-change-functions' for more information.
+
+The function returns the new value of `org-element--cache-change-warning'."
+ (org-with-base-buffer nil
+ (when (org-element--cache-active-p t)
+ (org-with-wide-buffer
+ (setq org-element--cache-change-tic (buffer-chars-modified-tick))
+ (setq org-element--cache-last-buffer-size (buffer-size))
+ (goto-char beg)
+ (beginning-of-line)
+ (let ((bottom (save-excursion
+ (goto-char end)
+ (if (and (bolp)
+ ;; When beg == end, still extent to eol.
+ (> (point) beg))
+ ;; FIXME: Potential pitfall.
+ ;; We are appending to an element end.
+ ;; Unless the last inserted char is not
+ ;; newline, the next element is not broken
+ ;; and does not need to be purged from the
+ ;; cache.
+ end
+ (line-end-position)))))
+ (prog1
+ ;; Use the worst change warning to not miss important edits.
+ ;; This function is called before edit and after edit by
+ ;; `org-element--cache-after-change'. Before the edit, we still
+ ;; want to use the old value if it comes from previous
+ ;; not yet processed edit (they may be merged by
+ ;; `org-element--cache-submit-request'). After the edit, we want to
+ ;; look if there was a sensitive removed during edit.
+ ;; FIXME: This is not the most efficient way and we now
+ ;; have to delete more elements than needed in some
+ ;; cases. A better approach may be storing the warning
+ ;; in the modification request itself.
+ (let ((org-element--cache-change-warning-before org-element--cache-change-warning)
+ (org-element--cache-change-warning-after))
+ (setq org-element--cache-change-warning-after
+ (save-match-data
+ (let ((case-fold-search t))
+ (when (re-search-forward
+ org-element--cache-sensitive-re bottom t)
+ (goto-char beg)
+ (beginning-of-line)
+ (let (min-level)
+ (cl-loop while (re-search-forward
+ (rx-to-string
+ (if (and min-level
+ (> min-level 1))
+ `(and bol (repeat 1 ,(1- min-level) "*") " ")
+ `(and bol (+ "*") " ")))
+ bottom t)
+ do (setq min-level (1- (length (match-string 0))))
+ until (= min-level 1))
+ (goto-char beg)
+ (beginning-of-line)
+ (or (and min-level (org-reduced-level min-level))
+ (when (looking-at-p "^[ \t]*#\\+CATEGORY:")
+ 'org-data)
+ t))))))
+ (setq org-element--cache-change-warning
+ (cond
+ ((and (numberp org-element--cache-change-warning-before)
+ (numberp org-element--cache-change-warning-after))
+ (min org-element--cache-change-warning-after
+ org-element--cache-change-warning-before))
+ ((numberp org-element--cache-change-warning-before)
+ org-element--cache-change-warning-before)
+ ((numberp org-element--cache-change-warning-after)
+ org-element--cache-change-warning-after)
+ (t (or org-element--cache-change-warning-after
+ org-element--cache-change-warning-before)))))
+ (org-element--cache-log-message
+ "%S is about to modify text: warning %S"
+ this-command
+ org-element--cache-change-warning)))))))
(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))))
-
+ (org-with-base-buffer nil
+ (when (org-element--cache-active-p t)
+ (when (not (eq org-element--cache-change-tic (buffer-chars-modified-tick)))
+ (org-element--cache-log-message "After change")
+ (setq org-element--cache-change-warning (org-element--cache-before-change beg end))
+ ;; If beg is right after spaces in front of an element, we
+ ;; risk affecting previous element, so move beg to bol, making
+ ;; sure that we capture preceding element.
+ (setq beg (save-excursion
+ (goto-char beg)
+ (cl-incf pre (- beg (line-beginning-position)))
+ (line-beginning-position)))
+ ;; Store synchronization request.
+ (let ((offset (- end beg pre)))
+ (save-match-data
+ (org-element--cache-submit-request beg (- end offset) offset)))
+ ;; Activate a timer to process the request during idle time.
+ (org-element--cache-set-timer (current-buffer))))))
+
+(defun org-element--cache-setup-change-functions ()
+ "Setup `before-change-functions' and `after-change-functions'."
+ (when (and (derived-mode-p 'org-mode) org-element-use-cache)
+ (add-hook 'before-change-functions
+ #'org-element--cache-before-change nil t)
+ ;; Run `org-element--cache-after-change' early to handle cases
+ ;; when other `after-change-functions' require element cache.
+ (add-hook 'after-change-functions
+ #'org-element--cache-after-change -1 t)))
+
+(defvar org-element--cache-avoid-synchronous-headline-re-parsing nil
+ "This variable controls how buffer changes are handled by the cache.
+
+By default (when this variable is nil), cache re-parses modified
+headlines immediately after modification preserving all the unaffected
+elements inside the headline.
+
+The default behavior works best when users types inside Org buffer of
+when buffer modifications are mixed with cache requests. However,
+large automated edits inserting/deleting many headlines are somewhat
+slower by default (as in `org-archive-subtree'). Let-binding this
+variable to non-nil will reduce cache latency after every singular edit
+(`after-change-functions') at the cost of slower cache queries.")
(defun org-element--cache-for-removal (beg end offset)
"Return first element to remove from cache.
@@ -5823,43 +6809,158 @@ 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."
+changes. In the latter case, the returned element is the outermost
+non-robust element affected by the changes. Note that the returned
+element may end before END position in which case some cached element
+starting after the returned may still be affected by the changes.
+
+Also, when there are no elements in cache before BEG, return first
+known element in cache (it may start after END)."
(let* ((elements (org-element--cache-find (1- beg) 'both))
(before (car elements))
(after (cdr elements)))
(if (not before) after
+ ;; If BEFORE is a keyword, it may need to be removed to become
+ ;; an affiliated keyword.
+ (when (eq 'keyword (org-element-type before))
+ (let ((prev before))
+ (while (eq 'keyword (org-element-type prev))
+ (setq before prev
+ beg (org-element-property :begin prev))
+ (setq prev (org-element--cache-find (1- (org-element-property :begin before)))))))
(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)))))
+ (or (and (memq type '( center-block dynamic-block
+ quote-block special-block
+ drawer))
+ (or (not (eq type 'drawer))
+ (not (string= "PROPERTIES" (org-element-property :drawer-name up))))
+ ;; Sensitive change. This is
+ ;; unconditionally non-robust change.
+ (not org-element--cache-change-warning)
+ (let ((cbeg (org-element-property :contents-begin up))
+ (cend (org-element-property :contents-end up)))
+ (and cbeg
+ (<= cbeg beg)
+ (or (> cend end)
+ (and (= cend end)
+ (= (+ end offset) (point-max)))))))
+ (and (memq type '(headline section org-data))
+ (let ((rbeg (org-element-property :robust-begin up))
+ (rend (org-element-property :robust-end up)))
+ (and rbeg rend
+ (<= rbeg beg)
+ (or (> rend end)
+ (and (= rend end)
+ (= (+ end offset) (point-max))))))
+ (pcase type
+ ;; Sensitive change in section. Need to
+ ;; re-parse.
+ (`section (not org-element--cache-change-warning))
+ ;; Headline might be inserted. This is non-robust
+ ;; change when `up' is a `headline' or `section'
+ ;; with `>' level compared to the inserted headline.
+ ;;
+ ;; Also, planning info/property drawer
+ ;; could have been inserted. It is not
+ ;; robust change then.
+ (`headline
+ (and
+ (or (not (numberp org-element--cache-change-warning))
+ (> org-element--cache-change-warning
+ (org-element-property :level up)))
+ (org-with-point-at (org-element-property :contents-begin up)
+ (unless
+ (save-match-data
+ (when (looking-at-p org-element-planning-line-re)
+ (forward-line))
+ (when (looking-at org-property-drawer-re)
+ (< beg (match-end 0))))
+ 'robust))))
+ (`org-data (and (not (eq org-element--cache-change-warning 'org-data))
+ ;; Property drawer could
+ ;; have been inserted. It
+ ;; is not robust change
+ ;; then.
+ (org-with-wide-buffer
+ (goto-char (point-min))
+ (while (and (org-at-comment-p) (bolp)) (forward-line))
+ ;; Should not see property
+ ;; drawer within changed
+ ;; region.
+ (save-match-data
+ (or (not (looking-at org-property-drawer-re))
+ (> beg (match-end 0)))))))
+ (_ 'robust)))))
;; 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)))
+ (progn
+ (org-element--cache-shift-positions
+ up offset
+ (if (and (org-element-property :robust-begin up)
+ (org-element-property :robust-end up))
+ '(:contents-end :end :robust-end)
+ '(:contents-end :end)))
+ (org-element--cache-log-message
+ "Shifting end positions of robust parent: %S"
+ (org-element--format-element up)))
+ (unless (or
+ ;; UP is non-robust. Yet, if UP is headline, flagging
+ ;; everything inside for removal may be to
+ ;; costly. Instead, we should better re-parse only the
+ ;; headline itself when possible. If a headline is still
+ ;; starting from old :begin position, we do not care that
+ ;; its boundaries could have extended to shrunk - we
+ ;; will re-parent and shift them anyway.
+ (and (eq 'headline (org-element-type up))
+ (not org-element--cache-avoid-synchronous-headline-re-parsing)
+ ;; The change is not inside headline. Not
+ ;; updating here.
+ (not (<= beg (org-element-property :begin up)))
+ (not (> end (org-element-property :end up)))
+ (let ((current (org-with-point-at (org-element-property :begin up)
+ (org-element-with-disabled-cache
+ (and (looking-at-p org-element-headline-re)
+ (org-element-headline-parser))))))
+ (when (eq 'headline (org-element-type current))
+ (org-element--cache-log-message
+ "Found non-robust headline that can be updated individually: %S"
+ (org-element--format-element current))
+ (org-element-set-element up current)
+ t)))
+ ;; If UP is org-data, the situation is similar to
+ ;; headline case. We just need to re-parse the
+ ;; org-data itself, unless the change is made
+ ;; within blank lines at BOB (that could
+ ;; potentially alter first-section).
+ (when (and (eq 'org-data (org-element-type up))
+ (>= beg (org-element-property :contents-begin up)))
+ (org-element-set-element up (org-with-point-at 1 (org-element-org-data-parser)))
+ (org-element--cache-log-message
+ "Found non-robust change invalidating org-data. Re-parsing: %S"
+ (org-element--format-element up))
+ t))
+ (org-element--cache-log-message
+ "Found non-robust element: %S"
+ (org-element--format-element up))
+ (setq before up)
+ (when robust-flag (setq robust-flag nil))))
+ (unless (or (org-element-property :parent up)
+ (eq 'org-data (org-element-type up)))
+ (org-element--cache-warn "Got element without parent. Please report it to Org mode mailing list (M-x org-submit-bug-report).\n%S" up)
+ (org-element-cache-reset)
+ (error "org-element--cache: Emergency exit"))
(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
+ ;; 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)
@@ -5867,91 +6968,339 @@ changes."
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)))))))
-
+ (org-element--cache-log-message
+ "Submitting new synchronization request for [%S..%S]𝝙%S"
+ beg end offset)
+ (org-with-base-buffer nil
+ (let ((next (car org-element--cache-sync-requests))
+ delete-to delete-from)
+ (if (and next
+ ;; First existing sync request is in phase 0.
+ (= 0 (org-element--request-phase next))
+ ;; Current changes intersect with the first sync request.
+ (> (setq delete-to (+ (org-element--request-end next)
+ (org-element--request-offset next)))
+ end)
+ (<= (setq delete-from (org-element--request-beg next))
+ end))
+ ;; Current changes can be merged with first sync request: we
+ ;; can save a partial cache synchronization.
+ (progn
+ (org-element--cache-log-message "Found another phase 0 request intersecting with current")
+ ;; Update OFFSET of the existing request.
+ (cl-incf (org-element--request-offset next) 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)
+ ;; The current modification is completely inside NEXT.
+ ;; We already added the current OFFSET to the NEXT
+ ;; request. However, the robust elements around
+ ;; modifications also need to be shifted. Moreover, the
+ ;; new modification may also have non-nil
+ ;; `org-element--cache-change-warning'. In the latter case, we
+ ;; also need to update the request.
+ (let ((first (org-element--cache-for-removal delete-from end offset) ; Shift as needed.
+ ))
+ (org-element--cache-log-message
+ "Current request is inside next. Candidate parent: %S"
+ (org-element--format-element first))
+ (when
+ ;; Non-robust element is now before NEXT. Need to
+ ;; update.
+ (and first
+ (org-element--cache-key-less-p
+ (org-element--cache-key first)
+ (org-element--request-key next)))
+ (org-element--cache-log-message
+ "Current request is inside next. New parent: %S"
+ (org-element--format-element first))
+ (setf (org-element--request-key next)
+ (org-element--cache-key first))
+ (setf (org-element--request-beg next)
+ (org-element-property :begin first))
+ (setf (org-element--request-end next)
+ (max (org-element-property :end first)
+ (org-element--request-end next)))
+ (setf (org-element--request-parent next)
+ (org-element-property :parent first))))
+ ;; The current and NEXT modifications are intersecting
+ ;; with current modification starting before NEXT and NEXT
+ ;; ending after current. We need to update the common
+ ;; non-robust parent for the new extended modification
+ ;; region.
+ (let ((first (org-element--cache-for-removal beg delete-to offset)))
+ (org-element--cache-log-message
+ "Current request intersects with next. Candidate parent: %S"
+ (org-element--format-element first))
+ (when (and first
+ (org-element--cache-key-less-p
+ (org-element--cache-key first)
+ (org-element--request-key next)))
+ (org-element--cache-log-message
+ "Current request intersects with next. Updating. New parent: %S"
+ (org-element--format-element first))
+ (setf (org-element--request-key next) (org-element--cache-key first))
+ (setf (org-element--request-beg next) (org-element-property :begin first))
+ (setf (org-element--request-end next)
+ (max (org-element-property :end first)
+ (org-element--request-end next)))
+ (setf (org-element--request-parent next) (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).
+ (org-element--cache-log-message "Adding new phase 0 request")
+ (when next (org-element--cache-sync (current-buffer) end beg offset))
+ (let ((first (org-element--cache-for-removal beg end offset)))
+ (if first
+ (push (let ((first-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.
+ ((> first-beg end)
+ (org-element--cache-log-message "Changes are before first known element. Submitting phase 1 request")
+ (vector key first-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.
+ ;;
+ ;; The current modification is completely inside
+ ;; FIRST. Clear and update cached elements in
+ ;; region containing FIRST.
+ ((let ((first-end (org-element-property :end first)))
+ (when (> first-end end)
+ (org-element--cache-log-message "Extending to non-robust element %S" (org-element--format-element first))
+ (vector key first-beg first-end offset (org-element-property :parent first) 0))))
+ (t
+ ;; Now, FIRST is the first element after BEG or
+ ;; non-robust element containing BEG. However,
+ ;; FIRST ends before END and there might be
+ ;; another ELEMENT before END that spans beyond
+ ;; END. If there is such element, we need to
+ ;; extend the region down to end of the common
+ ;; parent of FIRST and everything inside
+ ;; BEG..END.
+ (let* ((element (org-element--cache-find end))
+ (element-end (org-element-property :end element))
+ (up element))
+ (while (and (not (eq up first))
+ (setq up (org-element-property :parent up))
+ (>= (org-element-property :begin up) first-beg))
+ ;; Note that UP might have been already
+ ;; shifted if it is a robust element. After
+ ;; deletion, it can put it's end before yet
+ ;; unprocessed ELEMENT.
+ (setq element-end (max (org-element-property :end up) element-end)
+ element up))
+ ;; Extend region to remove elements between
+ ;; beginning of first and the end of outermost
+ ;; element starting before END but after
+ ;; beginning of first.
+ ;; of the FIRST.
+ (org-element--cache-log-message
+ "Extending to all elements between:\n 1: %S\n 2: %S"
+ (org-element--format-element first)
+ (org-element--format-element element))
+ (vector key first-beg element-end offset up 0)))))
+ org-element--cache-sync-requests)
+ ;; No element to remove. No need to re-parent either.
+ ;; Simply shift additional elements, if any, by OFFSET.
+ (if org-element--cache-sync-requests
+ (progn
+ (org-element--cache-log-message
+ "Nothing to remove. Updating offset of the next request by 𝝙%S: %S"
+ offset
+ (let ((print-level 3))
+ (car org-element--cache-sync-requests)))
+ (cl-incf (org-element--request-offset (car org-element--cache-sync-requests))
+ offset))
+ (org-element--cache-log-message
+ "Nothing to remove. No elements in cache after %S. Terminating."
+ end))))))
+ (setq org-element--cache-change-warning nil)))
+
+(defun org-element--cache-verify-element (element)
+ "Verify correctness of ELEMENT when `org-element--cache-self-verify' is non-nil.
+
+Return non-nil when verification failed."
+ (let ((org-element--cache-self-verify
+ (or org-element--cache-self-verify
+ (and (boundp 'org-batch-test) org-batch-test)))
+ (org-element--cache-self-verify-frequency
+ (if (and (boundp 'org-batch-test) org-batch-test)
+ 1
+ org-element--cache-self-verify-frequency)))
+ ;; Verify correct parent for the element.
+ (unless (or (not org-element--cache-self-verify)
+ (org-element-property :parent element)
+ (eq 'org-data (org-element-type element)))
+ (org-element--cache-warn "Got element without parent (cache active?: %S). Please report it to Org mode mailing list (M-x org-submit-bug-report).\n%S" (org-element--cache-active-p) element)
+ (org-element-cache-reset))
+ (when (and org-element--cache-self-verify
+ (org-element--cache-active-p)
+ (eq 'headline (org-element-type element))
+ ;; Avoid too much slowdown
+ (< (random 1000) (* 1000 org-element--cache-self-verify-frequency)))
+ (org-with-point-at (org-element-property :begin element)
+ (org-element-with-disabled-cache (org-up-heading-or-point-min))
+ (unless (or (= (point) (org-element-property :begin (org-element-property :parent element)))
+ (eq (point) (point-min)))
+ (org-element--cache-warn
+ "Cached element has wrong parent in %s. Resetting.
+If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report).
+The element is: %S\n The parent is: %S\n The real parent is: %S"
+ (buffer-name (current-buffer))
+ (org-element--format-element element)
+ (org-element--format-element (org-element-property :parent element))
+ (org-element--format-element (org-element--current-element (org-element-property :end (org-element-property :parent element)))))
+ (org-element-cache-reset))
+ (org-element--cache-verify-element (org-element-property :parent element))))
+ ;; Verify the element itself.
+ (when (and org-element--cache-self-verify
+ (org-element--cache-active-p)
+ element
+ (not (memq (org-element-type element) '(section org-data)))
+ ;; Avoid too much slowdown
+ (< (random 1000) (* 1000 org-element--cache-self-verify-frequency)))
+ (let ((real-element (let (org-element-use-cache)
+ (org-element--parse-to
+ (if (memq (org-element-type element) '(table-row item))
+ (1+ (org-element-property :begin element))
+ (org-element-property :begin element))))))
+ (unless (and (eq (org-element-type real-element) (org-element-type element))
+ (eq (org-element-property :begin real-element) (org-element-property :begin element))
+ (eq (org-element-property :end real-element) (org-element-property :end element))
+ (eq (org-element-property :contents-begin real-element) (org-element-property :contents-begin element))
+ (eq (org-element-property :contents-end real-element) (org-element-property :contents-end element))
+ (or (not (org-element-property :ID real-element))
+ (string= (org-element-property :ID real-element) (org-element-property :ID element))))
+ (org-element--cache-warn "(%S) Cached element is incorrect in %s. (Cache tic up to date: %S) Resetting.
+If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report).
+The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S"
+ this-command
+ (buffer-name (current-buffer))
+ (if (/= org-element--cache-change-tic
+ (buffer-chars-modified-tick))
+ "no" "yes")
+ (org-element--format-element element)
+ (org-element--format-element real-element)
+ (org-element--cache-find (1- (org-element-property :begin real-element)))
+ (car (org-element--cache-find (org-element-property :begin real-element) 'both))
+ (cdr (org-element--cache-find (org-element-property :begin real-element) 'both)))
+ (org-element-cache-reset))))))
+
+;;; Cache persistence
+
+(defun org-element--cache-persist-before-write (container &optional associated)
+ "Sync cache before saving."
+ (when (equal container '(elisp org-element--cache))
+ (if (and org-element-use-cache
+ (plist-get associated :file)
+ (get-file-buffer (plist-get associated :file))
+ org-element-cache-persistent)
+ (with-current-buffer (get-file-buffer (plist-get associated :file))
+ (if (and (derived-mode-p 'org-mode)
+ org-element--cache)
+ (org-with-wide-buffer
+ (org-element--cache-sync (current-buffer) (point-max))
+ ;; Cleanup cache request keys to avoid collisions during next
+ ;; Emacs session.
+ (avl-tree-mapc
+ (lambda (el)
+ (org-element-put-property el :org-element--cache-sync-key nil))
+ org-element--cache)
+ nil)
+ 'forbid))
+ 'forbid)))
+
+(defun org-element--cache-persist-before-read (container &optional associated)
+ "Avoid reading cache before Org mode is loaded."
+ (when (equal container '(elisp org-element--cache))
+ (if (not (and (plist-get associated :file)
+ (get-file-buffer (plist-get associated :file))))
+ 'forbid
+ (with-current-buffer (get-file-buffer (plist-get associated :file))
+ (unless (and org-element-use-cache
+ org-element-cache-persistent
+ (derived-mode-p 'org-mode)
+ (equal (secure-hash 'md5 (current-buffer))
+ (plist-get associated :hash)))
+ 'forbid)))))
+
+(defun org-element--cache-persist-after-read (container &optional associated)
+ "Setup restored cache."
+ (when (and (plist-get associated :file)
+ (get-file-buffer (plist-get associated :file)))
+ (with-current-buffer (get-file-buffer (plist-get associated :file))
+ (when (and org-element-use-cache org-element-cache-persistent)
+ (when (and (equal container '(elisp org-element--cache)) org-element--cache)
+ (setq-local org-element--cache-size (avl-tree-size org-element--cache)))
+ (when (and (equal container '(elisp org-element--headline-cache)) org-element--headline-cache)
+ (setq-local org-element--headline-cache-size (avl-tree-size org-element--headline-cache)))))))
+
+(add-hook 'org-persist-before-write-hook #'org-element--cache-persist-before-write)
+(add-hook 'org-persist-before-read-hook #'org-element--cache-persist-before-read)
+(add-hook 'org-persist-after-read-hook #'org-element--cache-persist-after-read)
;;;; Public Functions
+(defvar-local org-element--cache-gapless nil
+ "An alist containing (granularity . `org-element--cache-change-tic') elements.
+Each element indicates the latest `org-element--cache-change-tic' when
+change did not contain gaps.")
+
;;;###autoload
-(defun org-element-cache-reset (&optional all)
+(defun org-element-cache-reset (&optional all no-persistance)
"Reset cache in current buffer.
When optional argument ALL is non-nil, reset cache in all Org
-buffers."
+buffers.
+When optional argument NO-PERSISTANCE is non-nil, do not try to update
+the cache persistence in the buffer."
(interactive "P")
(dolist (buffer (if all (buffer-list) (list (current-buffer))))
- (with-current-buffer buffer
+ (org-with-base-buffer buffer
(when (and org-element-use-cache (derived-mode-p 'org-mode))
+ ;; Only persist cache in file buffers.
+ (when (and (buffer-file-name) (not no-persistance))
+ (when (not org-element-cache-persistent)
+ (org-persist-unregister 'org-element--headline-cache (current-buffer))
+ (org-persist-unregister 'org-element--cache (current-buffer)))
+ (when (and org-element-cache-persistent
+ (buffer-file-name (current-buffer)))
+ (org-persist-register 'org-element--cache (current-buffer))
+ (org-persist-register 'org-element--headline-cache
+ (current-buffer)
+ :inherit 'org-element--cache)))
+ (setq-local org-element--cache-change-tic (buffer-chars-modified-tick))
+ (setq-local org-element--cache-last-buffer-size (buffer-size))
+ (setq-local org-element--cache-gapless nil)
(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--headline-cache
+ (avl-tree-create #'org-element--cache-compare))
+ (setq-local org-element--cache-hash-left (make-vector org-element--cache-hash-size nil))
+ (setq-local org-element--cache-hash-right (make-vector org-element--cache-hash-size nil))
+ (setq-local org-element--cache-size 0)
+ (setq-local org-element--headline-cache-size 0)
+ (setq-local org-element--cache-sync-keys-value 0)
(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)))))
+ (org-element--cache-setup-change-functions)
+ ;; Make sure that `org-element--cache-after-change' and
+ ;; `org-element--cache-before-change' are working inside properly created
+ ;; indirect buffers. Note that `clone-indirect-buffer-hook'
+ ;; will not work inside indirect buffers not created by
+ ;; calling `clone-indirect-buffer'. We consider that the code
+ ;; not using `clone-indirect-buffer' to be written with
+ ;; awareness about possible consequences.
+ (add-hook 'clone-indirect-buffer-hook
+ #'org-element--cache-setup-change-functions)))))
;;;###autoload
(defun org-element-cache-refresh (pos)
@@ -5961,8 +7310,470 @@ buffers."
(org-element--cache-submit-request pos pos 0)
(org-element--cache-set-timer (current-buffer))))
+(defvar warning-minimum-log-level) ; Defined in warning.el
+
+(defvar org-element-cache-map-continue-from nil
+ "Position from where mapping should continue.
+This variable can be set by called function, especially when the
+function modified the buffer.")
+;;;###autoload
+(cl-defun org-element-cache-map (func &key (granularity 'headline+inlinetask) restrict-elements
+ next-re fail-re from-pos (to-pos (point-max-marker)) after-element limit-count
+ narrow)
+ "Map all elements in current buffer with FUNC according to
+GRANULARITY. Collect non-nil return values into result list.
+
+FUNC should accept a single argument - the element.
+
+FUNC can modify the buffer, but doing so may reduce performance. If
+buffer is modified, the mapping will continue from an element starting
+after the last mapped element. If the last mapped element is deleted,
+the subsequent element will be skipped as it cannot be distinguished
+deterministically from a changed element. If FUNC is expected to
+delete the element, it should directly set the value of
+`org-element-cache-map-continue-from' to force `org-element-cache-map'
+continue from the right point in buffer.
+
+If some elements are not yet in cache, they will be added.
+
+GRANULARITY can be `headline', `headline+inlinetask'
+`greater-element', or `element'. The default is
+`headline+inlinetask'. `object' granularity is not supported.
+
+RESTRICT-ELEMENTS is a list of element types to be mapped over.
+
+NEXT-RE is a regexp used to search next candidate match when FUNC
+returns non-nil and to search the first candidate match. FAIL-RE is a
+regexp used to search next candidate match when FUNC returns nil. The
+mapping will continue starting from headline at the RE match.
+
+FROM-POS and TO-POS are buffer positions. When non-nil, they bound the
+mapped elements to elements starting at of after FROM-POS but before
+TO-POS.
+
+AFTER-ELEMENT, when non-nil, bounds the mapping to all the elements
+after AFTER-ELEMENT (i.e. if AFTER-ELEMENT is a headline section, we
+map all the elements starting from first element inside section, but
+not including the section).
+
+LIMIT-COUNT limits mapping to that many first matches where FUNC
+returns non-nil.
+
+NARROW controls whether current buffer narrowing should be preserved.
+
+This function does a subset of what `org-element-map' does, but with
+much better performance. Cached elements are supplied as the single
+argument of FUNC. Changes to elements made in FUNC will also alter
+the cache."
+ (unless (org-element--cache-active-p)
+ (error "Cache must be active."))
+ (unless (memq granularity '( headline headline+inlinetask
+ greater-element element))
+ (error "Unsupported granularity: %S" granularity))
+ ;; Make TO-POS marker. Otherwise, buffer edits may garble the the
+ ;; process.
+ (unless (markerp to-pos)
+ (let ((mk (make-marker)))
+ (set-marker mk to-pos)
+ (setq to-pos mk)))
+ (let (;; Bind variables used inside loop to avoid memory
+ ;; re-allocation on every iteration.
+ ;; See https://emacsconf.org/2021/talks/faster/
+ tmpnext-start tmpparent tmpelement)
+ (save-excursion
+ (save-restriction
+ (unless narrow (widen))
+ ;; Synchronize cache up to the end of mapped region.
+ (org-element-at-point to-pos)
+ (cl-macrolet ((cache-root
+ ;; Use the most optimal version of cache available.
+ () `(if (memq granularity '(headline headline+inlinetask))
+ (org-element--headline-cache-root)
+ (org-element--cache-root)))
+ (cache-size
+ ;; Use the most optimal version of cache available.
+ () `(if (memq granularity '(headline headline+inlinetask))
+ org-element--headline-cache-size
+ org-element--cache-size))
+ (cache-walk-restart
+ ;; Restart tree traversal after AVL tree re-balance.
+ () `(when node
+ (org-element-at-point (point-max))
+ (setq node (cache-root)
+ stack (list nil)
+ leftp t
+ continue-flag t)))
+ (cache-walk-abort
+ ;; Abort tree traversal.
+ () `(setq continue-flag t
+ node nil))
+ (element-match-at-point
+ ;; Returning the first element to match around point.
+ ;; For example, if point is inside headline and
+ ;; granularity is restricted to headlines only, skip
+ ;; over all the child elements inside the headline
+ ;; and return the first parent headline.
+ ;; When we are inside a cache gap, calling
+ ;; `org-element-at-point' also fills the cache gap down to
+ ;; point.
+ () `(progn
+ ;; Parsing is one of the performance
+ ;; bottlenecks. Make sure to optimize it as
+ ;; much as possible.
+ ;;
+ ;; Avoid extra staff like timer cancels et al
+ ;; and only call `org-element--cache-sync-requests' when
+ ;; there are pending requests.
+ (when org-element--cache-sync-requests
+ (org-element--cache-sync (current-buffer)))
+ ;; Call `org-element--parse-to' directly avoiding any
+ ;; kind of `org-element-at-point' overheads.
+ (if restrict-elements
+ ;; Search directly instead of calling
+ ;; `org-element-lineage' to avoid funcall overheads
+ ;; and making sure that we do not go all
+ ;; the way to `org-data' as `org-element-lineage'
+ ;; does.
+ (progn
+ (setq tmpelement (org-element--parse-to (point)))
+ (while (and tmpelement (not (memq (org-element-type tmpelement) restrict-elements)))
+ (setq tmpelement (org-element-property :parent tmpelement)))
+ tmpelement)
+ (org-element--parse-to (point)))))
+ ;; Starting from (point), search RE and move START to
+ ;; the next valid element to be matched according to
+ ;; restriction. Abort cache walk if no next element
+ ;; can be found. When RE is nil, just find element at
+ ;; point.
+ (move-start-to-next-match
+ (re) `(save-match-data
+ (if (or (not ,re)
+ (if org-element--cache-map-statistics
+ (progn
+ (setq before-time (float-time))
+ (re-search-forward (or (car-safe ,re) ,re) nil 'move)
+ (cl-incf re-search-time
+ (- (float-time)
+ before-time)))
+ (re-search-forward (or (car-safe ,re) ,re) nil 'move)))
+ (unless (or (< (point) (or start -1))
+ (and data
+ (< (point) (org-element-property :begin data))))
+ (if (cdr-safe ,re)
+ ;; Avoid parsing when we are 100%
+ ;; sure that regexp is good enough
+ ;; to find new START.
+ (setq start (match-beginning 0))
+ (setq start (max (or start -1)
+ (or (org-element-property :begin data) -1)
+ (or (org-element-property :begin (element-match-at-point)) -1))))
+ (when (>= start to-pos) (cache-walk-abort))
+ (when (eq start -1) (setq start nil)))
+ (cache-walk-abort))))
+ ;; Find expected begin position of an element after
+ ;; DATA.
+ (next-element-start
+ () `(progn
+ (setq tmpnext-start nil)
+ (if (memq granularity '(headline headline+inlinetask))
+ (setq tmpnext-start (or (when (memq (org-element-type data) '(headline org-data))
+ (org-element-property :contents-begin data))
+ (org-element-property :end data)))
+ (setq tmpnext-start (or (when (memq (org-element-type data) org-element-greater-elements)
+ (org-element-property :contents-begin data))
+ (org-element-property :end data))))
+ ;; DATA end may be the last element inside
+ ;; i.e. source block. Skip up to the end
+ ;; of parent in such case.
+ (setq tmpparent data)
+ (catch :exit
+ (when (eq tmpnext-start (org-element-property :contents-end tmpparent))
+ (setq tmpnext-start (org-element-property :end tmpparent)))
+ (while (setq tmpparent (org-element-property :parent tmpparent))
+ (if (eq tmpnext-start (org-element-property :contents-end tmpparent))
+ (setq tmpnext-start (org-element-property :end tmpparent))
+ (throw :exit t))))
+ tmpnext-start))
+ ;; Check if cache does not have gaps.
+ (cache-gapless-p
+ () `(eq org-element--cache-change-tic
+ (alist-get granularity org-element--cache-gapless))))
+ ;; The core algorithm is simple walk along binary tree. However,
+ ;; instead of checking all the tree elements from first to last
+ ;; (like in `avl-tree-mapcar'), we begin from FROM-POS skipping
+ ;; the elements before FROM-POS efficiently: O(logN) instead of
+ ;; O(Nbefore).
+ ;;
+ ;; Later, we may also not check every single element in the
+ ;; binary tree after FROM-POS. Instead, we can find position of
+ ;; next candidate elements by means of regexp search and skip the
+ ;; binary tree branches that are before the next candidate:
+ ;; again, O(logN) instead of O(Nbetween).
+ ;;
+ ;; Some elements might not yet be in the tree. So, we also parse
+ ;; the empty gaps in cache as needed making sure that we do not
+ ;; miss anything.
+ (let* (;; START is always beginning of an element. When there is
+ ;; no element in cache at START, we are inside cache gap
+ ;; and need to fill it.
+ (start (and from-pos
+ (progn
+ (goto-char from-pos)
+ (org-element-property :begin (element-match-at-point)))))
+ ;; Some elements may start at the same position, so we
+ ;; also keep track of the last processed element and make
+ ;; sure that we do not try to search it again.
+ (prev after-element)
+ (node (cache-root))
+ data
+ (stack (list nil))
+ (leftp t)
+ result
+ ;; Whether previous element matched FUNC (FUNC
+ ;; returned non-nil).
+ (last-match t)
+ continue-flag
+ ;; Generic regexp to search next potential match. If it
+ ;; is a cons of (regexp . 'match-beg), we are 100% sure
+ ;; that the match beginning is the existing element
+ ;; beginning.
+ (next-element-re (pcase granularity
+ ((or `headline
+ (guard (eq '(headline)
+ restrict-elements)))
+ (cons
+ (org-with-limited-levels
+ org-element-headline-re)
+ 'match-beg))
+ (`headline+inlinetask
+ (cons
+ (if (eq '(inlinetask) restrict-elements)
+ (org-inlinetask-outline-regexp)
+ org-element-headline-re)
+ 'match-beg))
+ ;; TODO: May add other commonly
+ ;; searched elements as needed.
+ (_)))
+ ;; Make sure that we are not checking the same regexp twice.
+ (next-re (unless (and next-re
+ (string= next-re
+ (or (car-safe next-element-re)
+ next-element-re)))
+ next-re))
+ (fail-re (unless (and fail-re
+ (string= fail-re
+ (or (car-safe next-element-re)
+ next-element-re)))
+ fail-re))
+ (restrict-elements (or restrict-elements
+ (pcase granularity
+ (`headline
+ '(headline))
+ (`headline+inlinetask
+ '(headline inlinetask))
+ (`greater-element
+ org-element-greater-elements)
+ (_ nil))))
+ ;; Statistics
+ (time (float-time))
+ (predicate-time 0)
+ (pre-process-time 0)
+ (re-search-time 0)
+ (count-predicate-calls-match 0)
+ (count-predicate-calls-fail 0)
+ ;; Bind variables used inside loop to avoid memory
+ ;; re-allocation on every iteration.
+ ;; See https://emacsconf.org/2021/talks/faster/
+ cache-size before-time modified-tic)
+ ;; Skip to first element within region.
+ (goto-char (or start (point-min)))
+ (move-start-to-next-match next-element-re)
+ (unless (and start (>= start to-pos))
+ (while node
+ (setq data (avl-tree--node-data node))
+ (if (and leftp (avl-tree--node-left node) ; Left branch.
+ ;; Do not move to left branch when we are before
+ ;; PREV.
+ (or (not prev)
+ (not (org-element--cache-key-less-p
+ (org-element--cache-key data)
+ (org-element--cache-key prev))))
+ ;; ... or when we are before START.
+ (or (not start)
+ (not (> start (org-element-property :begin data)))))
+ (progn (push node stack)
+ (setq node (avl-tree--node-left node)))
+ ;; The whole tree left to DATA is before START and
+ ;; PREV. DATA may still be before START (i.e. when
+ ;; DATA is the root or when START moved), at START, or
+ ;; after START.
+ ;;
+ ;; If DATA is before start, skip it over and move to
+ ;; subsequent elements.
+ ;; If DATA is at start, run FUNC if necessary and
+ ;; update START according and NEXT-RE, FAIL-RE,
+ ;; NEXT-ELEMENT-RE.
+ ;; If DATA is after start, we have found a cache gap
+ ;; and need to fill it.
+ (unless (or (and start (< (org-element-property :begin data) start))
+ (and prev (not (org-element--cache-key-less-p
+ (org-element--cache-key prev)
+ (org-element--cache-key data)))))
+ ;; DATA is at of after START and PREV.
+ (if (or (not start) (= (org-element-property :begin data) start))
+ ;; DATA is at START. Match it.
+ ;; In the process, we may alter the buffer,
+ ;; so also keep track of the cache state.
+ (progn
+ (setq modified-tic org-element--cache-change-tic)
+ (setq cache-size (cache-size))
+ ;; When NEXT-RE/FAIL-RE is provided, skip to
+ ;; next regexp match after :begin of the current
+ ;; element.
+ (when (if last-match next-re fail-re)
+ (goto-char (org-element-property :begin data))
+ (move-start-to-next-match
+ (if last-match next-re fail-re)))
+ (when (and (or (not start) (eq (org-element-property :begin data) start))
+ (< (org-element-property :begin data) to-pos))
+ ;; Calculate where next possible element
+ ;; starts and update START if needed.
+ (setq start (next-element-start))
+ (goto-char start)
+ ;; Move START further if possible.
+ (when (and next-element-re
+ ;; Do not move if we know for
+ ;; sure that cache does not
+ ;; contain gaps. Regexp
+ ;; searches are not cheap.
+ (not (cache-gapless-p)))
+ (move-start-to-next-match next-element-re)
+ ;; Make sure that point is at START
+ ;; before running FUNC.
+ (goto-char start))
+ ;; Try FUNC if DATA matches all the
+ ;; restrictions. Calculate new START.
+ (when (or (not restrict-elements)
+ (memq (org-element-type data) restrict-elements))
+ ;; DATA matches restriction. FUNC may
+ ;;
+ ;; Call FUNC. FUNC may move point.
+ (setq org-element-cache-map-continue-from nil)
+ (if org-element--cache-map-statistics
+ (progn
+ (setq before-time (float-time))
+ (push (funcall func data) result)
+ (cl-incf predicate-time
+ (- (float-time)
+ before-time))
+ (if (car result)
+ (cl-incf count-predicate-calls-match)
+ (cl-incf count-predicate-calls-fail)))
+ (push (funcall func data) result)
+ (when (car result) (cl-incf count-predicate-calls-match)))
+ ;; Set `last-match'.
+ (setq last-match (car result))
+ ;; If FUNC moved point forward, update
+ ;; START.
+ (when org-element-cache-map-continue-from
+ (goto-char org-element-cache-map-continue-from))
+ (when (> (point) start)
+ (move-start-to-next-match nil))
+ ;; Drop nil.
+ (unless (car result) (pop result)))
+ ;; If FUNC did not move the point and we
+ ;; know for sure that cache does not contain
+ ;; gaps, do not try to calculate START in
+ ;; advance but simply loop to the next cache
+ ;; element.
+ (when (and (cache-gapless-p)
+ (eq (next-element-start)
+ start))
+ (setq start nil))
+ ;; Check if the buffer has been modified.
+ (unless (and (eq modified-tic org-element--cache-change-tic)
+ (eq cache-size (cache-size)))
+ ;; START may no longer be valid, update
+ ;; it to beginning of real element.
+ ;; Upon modification, START may lay
+ ;; inside an element. We want to move
+ ;; it to real beginning then despite
+ ;; START being larger.
+ (setq start nil)
+ (move-start-to-next-match nil)
+ ;; The new element may now start before
+ ;; or at already processed position.
+ ;; Make sure that we continue from an
+ ;; element past already processed
+ ;; place.
+ (when (and start
+ (<= start (org-element-property :begin data))
+ (not org-element-cache-map-continue-from))
+ (goto-char start)
+ (setq data (element-match-at-point))
+ ;; If DATA is nil, buffer is
+ ;; empty. Abort.
+ (when data
+ (goto-char (next-element-start))
+ (move-start-to-next-match next-element-re)))
+ (org-element-at-point to-pos)
+ (cache-walk-restart))
+ ;; Reached LIMIT-COUNT. Abort.
+ (when (and limit-count
+ (>= count-predicate-calls-match
+ limit-count))
+ (cache-walk-abort))
+ (if (org-element-property :cached data)
+ (setq prev data)
+ (setq prev nil))))
+ ;; DATA is after START. Fill the gap.
+ (if (memq (org-element-type (org-element--parse-to start)) '(plain-list table))
+ ;; Tables and lists are special, we need a
+ ;; trickery to make items/rows be populated
+ ;; into cache.
+ (org-element--parse-to (1+ start)))
+ ;; Restart tree traversal as AVL tree is
+ ;; re-balanced upon adding elements. We can no
+ ;; longer trust STACK.
+ (cache-walk-restart)))
+ ;; Second, move to the right branch of the tree or skip
+ ;; it altogether.
+ (if continue-flag
+ (setq continue-flag nil)
+ (setq node (if (and (car stack)
+ ;; If START advanced beyond stack parent, skip the right branch.
+ (or (and start (< (org-element-property :begin (avl-tree--node-data (car stack))) start))
+ (and prev (org-element--cache-key-less-p
+ (org-element--cache-key (avl-tree--node-data (car stack)))
+ (org-element--cache-key prev)))))
+ (progn
+ (setq leftp nil)
+ (pop stack))
+ ;; Otherwise, move ahead into the right
+ ;; branch when it exists.
+ (if (setq leftp (avl-tree--node-right node))
+ (avl-tree--node-right node)
+ (pop stack))))))))
+ (when (and org-element--cache-map-statistics
+ (or (not org-element--cache-map-statistics-threshold)
+ (> (- (float-time) time) org-element--cache-map-statistics-threshold)))
+ (message "Mapped over elements in %S. %d/%d predicate matches. Total time: %f sec. Pre-process time: %f sec. Predicate time: %f sec. Re-search time: %f sec.
+ Calling parameters: :granularity %S :restrict-elements %S :next-re %S :fail-re %S :from-pos %S :to-pos %S :limit-count %S :after-element %S"
+ (current-buffer)
+ count-predicate-calls-match
+ (+ count-predicate-calls-match
+ count-predicate-calls-fail)
+ (- (float-time) time)
+ pre-process-time
+ predicate-time
+ re-search-time
+ granularity restrict-elements next-re fail-re from-pos to-pos limit-count after-element))
+ ;; Return result.
+ (nreverse result)))))))
+
+
;;; The Toolbox
;;
;; The first move is to implement a way to obtain the smallest element
@@ -5981,8 +7792,11 @@ buffers."
;;;###autoload
-(defun org-element-at-point ()
- "Determine closest element around point.
+(defun org-element-at-point (&optional pom cached-only)
+ "Determine closest element around point or POM.
+
+Only check cached element when CACHED-ONLY is non-nil and return nil
+unconditionally when element at POM is not in cache.
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
@@ -6000,24 +7814,65 @@ 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))))))
+ (setq pom (or pom (point)))
+ ;; Allow re-parsing when the command can benefit from it.
+ (when (and cached-only
+ (memq this-command org-element--cache-non-modifying-commands))
+ (setq cached-only nil))
+ (let (element)
+ (when (org-element--cache-active-p)
+ (if (not org-element--cache) (org-element-cache-reset)
+ (unless cached-only (org-element--cache-sync (current-buffer) pom))))
+ (setq element (if cached-only
+ (when (and (org-element--cache-active-p)
+ (or (not org-element--cache-sync-requests)
+ (< pom
+ (org-element--request-beg
+ (car org-element--cache-sync-requests)))))
+ (org-element--cache-find pom))
+ (condition-case err
+ (org-element--parse-to pom)
+ (error
+ (org-element--cache-warn
+ "Org parser error in %s::%S. Resetting.\n The error was: %S\n Backtrace:\n%S\n Please report this to Org mode mailing list (M-x org-submit-bug-report)."
+ (buffer-name (current-buffer))
+ pom
+ err
+ (when (and (fboundp 'backtrace-get-frames)
+ (fboundp 'backtrace-to-string))
+ (backtrace-to-string (backtrace-get-frames 'backtrace))))
+ (org-element-cache-reset)
+ (org-element--parse-to pom)))))
+ (when (and (org-element--cache-active-p)
+ element
+ (org-element--cache-verify-element element))
+ (setq element (org-element--parse-to pom)))
+ (unless (eq 'org-data (org-element-type element))
+ (unless (and cached-only
+ (not (and element
+ (or (= pom (org-element-property :begin element))
+ (and (not (memq (org-element-type element) org-element-greater-elements))
+ (>= pom (org-element-property :begin element))
+ (< pom (org-element-property :end element)))
+ (and (org-element-property :contents-begin element)
+ (>= pom (org-element-property :begin element))
+ (< pom (org-element-property :contents-begin element)))
+ (and (not (org-element-property :contents-end element))
+ (>= pom (org-element-property :begin element))
+ (< pom (org-element-property :end element)))))))
+ (if (not (eq (org-element-type element) 'section))
+ element
+ (org-element-at-point (1+ pom) cached-only))))))
+
+;;;###autoload
+(defsubst org-element-at-point-no-context (&optional pom)
+ "Quickly find element at point or POM.
+
+It is a faster version of `org-element-at-point' that is not
+guaranteed to return correct `:parent' properties even when cache is
+enabled."
+ (or (org-element-at-point pom 'cached-only)
+ (let (org-element-use-cache) (org-element-at-point pom))))
;;;###autoload
(defun org-element-context (&optional element)
@@ -6038,115 +7893,116 @@ 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)
+ (save-match-data
+ (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)))
+ (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-element-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)))
- ;; 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)))))))))))))
+ (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.
@@ -6196,60 +8052,51 @@ end of ELEM-A."
(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))))
+ (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")
- (line-end-position)))
- (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")
- (line-end-position)))
- ;; 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)))
+ ;; Preserve folding state when `org-fold-core-style' is set to
+ ;; `text-properties'.
+ (org-fold-core-ignore-modifications
+ ;; 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")
+ (line-end-position)))
+ (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")
+ (line-end-position)))
+ ;; Store inner folds responsible for visibility status.
+ (folds
+ (cons
+ (org-fold-core-get-regions :from beg-A :to end-A :relative t)
+ (org-fold-core-get-regions :from beg-B :to end-B :relative t)))
+ ;; Get contents.
+ (body-A (buffer-substring beg-A end-A))
+ (body-B (buffer-substring beg-B end-B)))
+ ;; Clear up the folds.
+ (org-fold-region beg-A end-A nil)
+ (org-fold-region beg-B end-B nil)
+ (delete-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 folds.
+ (org-fold-core-regions (car folds) :relative beg-B)
(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)))))
-
+ ;; Restore ex ELEM-A folds.
+ (org-fold-core-regions (cdr folds) :relative beg-A)
+ (goto-char (org-element-property :end elem-B))))))
(provide 'org-element)
diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el
index b2dbccd40c8..153aa2b6767 100644
--- a/lisp/org/org-entities.el
+++ b/lisp/org/org-entities.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>,
;; Ulf Stegemann <ulf at zeitform dot de>
;; Keywords: outlines, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -27,6 +27,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(declare-function org-mode "org" ())
(declare-function org-toggle-pretty-entities "org" ())
(declare-function org-table-align "org-table" ())
@@ -89,8 +92,8 @@ packages to be loaded, add these packages to `org-latex-packages-alist'."
("aacute" "\\'{a}" nil "&aacute;" "a" "á" "á")
("Acirc" "\\^{A}" nil "&Acirc;" "A" "Â" "Â")
("acirc" "\\^{a}" nil "&acirc;" "a" "â" "â")
- ("Amacr" "\\bar{A}" nil "&Amacr;" "A" "Ã" "Ã")
- ("amacr" "\\bar{a}" nil "&amacr;" "a" "ã" "ã")
+ ("Amacr" "\\={A}" nil "&Amacr;" "A" "Ã" "Ã")
+ ("amacr" "\\={a}" nil "&amacr;" "a" "ã" "ã")
("Atilde" "\\~{A}" nil "&Atilde;" "A" "Ã" "Ã")
("atilde" "\\~{a}" nil "&atilde;" "a" "ã" "ã")
("Auml" "\\\"{A}" nil "&Auml;" "Ae" "Ä" "Ä")
@@ -307,7 +310,7 @@ packages to be loaded, add these packages to `org-latex-packages-alist'."
("trade" "\\texttrademark{}" nil "&trade;" "TM" "TM" "™")
"** Science et al."
- ("minus" "\\minus" t "&minus;" "-" "-" "−")
+ ("minus" "-" t "&minus;" "-" "-" "−")
("pm" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
("plusmn" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
("times" "\\texttimes{}" nil "&times;" "*" "×" "×")
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index 78148a1b6d1..0effa13a1d6 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(defgroup org-faces nil
"Faces in Org mode."
:tag "Org Faces"
@@ -338,7 +341,7 @@ determines if it is a foreground or a background color."
(defvar org-tags-special-faces-re nil)
(defun org-set-tag-faces (var value)
- (set var value)
+ (set-default-toplevel-value var value)
(if (not value)
(setq org-tags-special-faces-re nil)
(setq org-tags-special-faces-re
@@ -455,6 +458,10 @@ verse and quote blocks are fontified using the `org-verse' and
"Face used for the line delimiting the end of source blocks."
:group 'org-faces)
+(defface org-inline-src-block '((t (:inherit org-block)))
+ "Face used for inline source blocks as a whole."
+ :group 'org-faces)
+
(defface org-verbatim '((t (:inherit shadow)))
"Face for fixed-with text like code snippets."
:group 'org-faces
@@ -593,7 +600,7 @@ See also `org-agenda-deadline-faces'.")
(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\").
+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
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index c7b4bde0d28..3523a6c5ba0 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -4,7 +4,7 @@
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -88,6 +88,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(require 'sha1)
@@ -412,8 +415,8 @@ it can be a list structured like an entry in `org-feed-alist'."
;; Normalize the visibility of the inbox tree
(goto-char inbox-pos)
- (org-flag-subtree t)
- (org-show-children)
+ (org-fold-subtree t)
+ (org-fold-show-children)
;; Hooks and messages
(when org-feed-save-after-adding (save-buffer))
diff --git a/lisp/org/org-fold-core.el b/lisp/org/org-fold-core.el
new file mode 100644
index 00000000000..be600f8a0cc
--- /dev/null
+++ b/lisp/org/org-fold-core.el
@@ -0,0 +1,1511 @@
+;;; org-fold-core.el --- Folding buffer text -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020-2020 Free Software Foundation, Inc.
+;;
+;; Author: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: folding, invisible text
+;; URL: 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 library to control temporary invisibility
+;; (folding and unfolding) of text in buffers.
+
+;; The file implements the following functionality:
+;;
+;; - Folding/unfolding regions of text
+;; - Searching and examining boundaries of folded text
+;; - Interactive searching in folded text (via isearch)
+;; - Handling edits in folded text
+;; - Killing/yanking (copying/pasting) of the folded text
+
+;; To setup folding in an arbitrary buffer, one must call
+;; `org-fold-core-initialize', optionally providing the list of folding specs to be
+;; used in the buffer. The specs can be added, removed, or
+;; re-configured later. Read below for more details.
+
+;;; Folding/unfolding regions of text
+
+;; User can temporarily hide/reveal (fold/unfold) arbitrary regions or
+;; text. The folds can be nested.
+
+;; Internally, nested folds are marked with different folding specs
+;; Overlapping folds marked with the same folding spec are
+;; automatically merged, while folds with different folding specs can
+;; coexist and be folded/unfolded independently.
+
+;; When multiple folding specs are applied to the same region of text,
+;; text visibility is decided according to the folding spec with
+;; topmost priority.
+
+;; By default, we define two types of folding specs:
+;; - 'org-fold-visible :: the folded text is not hidden
+;; - 'org-fold-hidden :: the folded text is completely hidden
+;;
+;; The 'org-fold-visible spec has highest priority allowing parts of
+;; text folded with 'org-fold-hidden to be shown unconditionally.
+
+;; Consider the following Org mode link:
+;; [[file:/path/to/file/file.ext][description]]
+;; Only the word "description" is normally visible in this link.
+;;
+;; The way this partial visibility is achieved is combining the two
+;; folding specs. The whole link is folded using 'org-fold-hidden
+;; folding spec, but the visible part is additionally folded using
+;; 'org-fold-visible:
+;;
+;; <begin org-fold-hidden>[[file:/path/to/file/file.ext][<begin org-fold-visible>description<end org-fold-visible>]]<end org-fold-hidden>
+;;
+;; Because 'org-fold-visible has higher priority than
+;; 'org-fold-hidden, it suppresses the 'org-fold-hidden effect and
+;; thus reveals the description part of the link.
+
+;; Similar to 'org-fold-visible, display of any arbitrary folding spec
+;; can be configured using folding spec properties. In particular,
+;; `:visible' folding spec property controls whether the folded text
+;; is visible or not. If the `:visible' folding spec property is nil,
+;; folded text is hidden or displayed as a constant string (ellipsis)
+;; according to the value of `:ellipsis' folding spec property. See
+;; docstring of `org-fold-core--specs' for the description of all the available
+;; folding spec properties.
+
+;; Folding spec properties of any valid folding spec can be changed
+;; any time using `org-fold-core-set-folding-spec-property'.
+
+;; If necessary, one can add or remove folding specs using
+;; `org-fold-core-add-folding-spec' and `org-fold-core-remove-folding-spec'.
+
+;; If a buffer initialized with `org-fold-core-initialize' is cloned into indirect
+;; buffers, it's folding state is copied to that indirect buffer.
+;; The folding states are independent.
+
+;; When working with indirect buffers that are handled by this
+;; library, one has to keep in mind that folding state is preserved on
+;; copy when using non-interactive functions. Moreover, the folding
+;; states of all the indirect buffers will be copied together.
+;;
+;; Example of the implications:
+;; Consider a base buffer and indirect buffer with the following state:
+;; ----- base buffer --------
+;; * Heading<begin fold>
+;; Some text folded in the base buffer, but unfolded in the indirect buffer<end fold>
+;; * Other heading
+;; Heading unfolded in both the buffers.
+;; ---------------------------
+;; ------ indirect buffer ----
+;; * Heading
+;; Some text folded in the base buffer, but unfolded in the indirect buffer
+;; * Other heading
+;; Heading unfolded in both the buffers.
+;; ----------------------------
+;; If some Elisp code copies the whole "Heading" from the indirect
+;; buffer with `buffer-substring' or match data and inserts it into
+;; the base buffer, the inserted heading will be folded since the
+;; internal setting for the folding state is shared between the base
+;; and indirect buffers. It's just that the indirect buffer ignores
+;; the base buffer folding settings. However, as soon as the text is
+;; copied back to the base buffer, the folding state will become
+;; respected again.
+
+;; If the described situation is undesired, Elisp code can use
+;; `filter-buffer-substring' instead of `buffer-substring'. All the
+;; folding states that do not belong to the currently active buffer
+;; will be cleared in the copied text then. See
+;; `org-fold-core--buffer-substring-filter' for more details.
+
+;; Because of details of implementation of the folding, it is also not
+;; recommended to set text visibility in buffer directly by setting
+;; `invisible' text property to anything other than t. While this
+;; should usually work just fine, normal folding can be broken if one
+;; sets `invisible' text property to a value not listed in
+;; `buffer-invisibility-spec'.
+
+;;; Searching and examining boundaries of folded text
+
+;; It is possible to examine folding specs (there may be several) of
+;; text at point or search for regions with the same folding spec.
+;; See functions defined under ";;;; Searching and examining folded
+;; text" below for details.
+
+;; All the folding specs can be specified by symbol representing their
+;; name. However, this is not always convenient, especially if the
+;; same spec can be used for fold different syntaxical structures.
+;; Any folding spec can be additionally referenced by a symbol listed
+;; in the spec's `:alias' folding spec property. For example, Org
+;; mode's `org-fold-outline' folding spec can be referenced as any
+;; symbol from the following list: '(headline heading outline
+;; inlinetask plain-list) The list is the value of the spec's `:alias'
+;; property.
+
+;; Most of the functions defined below that require a folding spec
+;; symbol as their argument, can also accept any symbol from the
+;; `:alias' spec property to reference that folding spec.
+
+;; If one wants to search invisible text without using the provided
+;; functions, it is important to keep in mind that 'invisible text
+;; property may have multiple possible values (not just nil and
+;; t). Hence, (next-single-char-property-change pos 'invisible) is not
+;; guaranteed to return the boundary of invisible/visible text.
+
+;;; Interactive searching inside folded text (via isearch)
+
+;; The library provides a way to control if the folded text can be
+;; searchable using isearch. If the text is searchable, it is also
+;; possible to control to unfold it temporarily during interactive
+;; isearch session.
+
+;; The isearch behavior is controlled on per-folding-spec basis by
+;; setting `isearch-open' and `isearch-ignore' folding spec
+;; properties. The the docstring of `org-fold-core--specs' for more details.
+
+;;; Handling edits inside folded text
+
+;; The visibility of the text inserted in front, rear, or in the
+;; middle of a folded region is managed according to `:front-sticky'
+;; and `:rear-sticky' folding properties of the corresponding folding
+;; spec. The rules are the same with stickiness of text properties in
+;; Elisp.
+
+;; If a text being inserted into the buffer is already folded and
+;; invisible (before applying the stickiness rules), then it is
+;; revealed. This behavior can be changed by wrapping the insertion
+;; code into `org-fold-core-ignore-modifications' macro. The macro will disable
+;; all the processing related to buffer modifications.
+
+;; The library also provides a way to unfold the text after some
+;; destructive changes breaking syntaxical structure of the buffer.
+;; For example, Org mode automatically reveals folded drawers when the
+;; drawer becomes syntaxically incorrect:
+;; ------- before modification -------
+;; :DRAWER:<begin fold>
+;; Some folded text inside drawer
+;; :END:<end fold>
+;; -----------------------------------
+;; If the ":END:" is edited, drawer syntax is not correct anymore and
+;; the folded text is automatically unfolded.
+;; ------- after modification --------
+;; :DRAWER:
+;; Some folded text inside drawer
+;; :EN:
+;; -----------------------------------
+
+;; The described automatic unfolding is controlled by `:fragile'
+;; folding spec property. It's value can be a function checking if
+;; changes inside (or around) the fold should drigger the unfold. By
+;; default, only changes that directly involve folded regions will
+;; trigger the check. In addition, `org-fold-core-extend-changed-region-functions'
+;; can be set to extend the checks to all folded regions intersecting
+;; with the region returned by the functions listed in the variable.
+
+;; The fragility checks can be bypassed if the code doing
+;; modifications is wrapped into `org-fold-core-ignore-fragility-checks' macro.
+
+;;; Performance considerations
+
+;; This library is using text properties to hide text. Text
+;; properties are much faster than overlays, that could be used for
+;; the same purpose. Overlays are implemented with O(n) complexity in
+;; Emacs (as for 2021-03-11). It means that any attempt to move
+;; through hidden text in a file with many invisible overlays will
+;; require time scaling with the number of folded regions (the problem
+;; Overlays note of the manual warns about). For curious, historical
+;; reasons why overlays are not efficient can be found in
+;; https://www.jwz.org/doc/lemacs.html.
+
+;; Despite using text properties, the performance is still limited by
+;; Emacs display engine. For example, >7Mb of text hidden within
+;; visible part of a buffer may cause noticeable lags (which is still
+;; orders of magnitude better in comparison with overlays). If the
+;; performance issues become critical while using this library, it is
+;; recommended to minimize the number of folding specs used in the
+;; same buffer at a time.
+
+;; Alternatively, the library provides `org-fold-core--optimise-for-huge-buffers'
+;; for additional speedup. This can be used as a file-local variable
+;; in huge buffers. The variable can be set to enable various levels
+;; of extra optimization. See the docstring for detailed information.
+
+;; It is worth noting that when using `org-fold-core--optimise-for-huge-buffers'
+;; with `grab-invisible' option, folded regions copied to other
+;; buffers (including buffers that do not use this library) will
+;; remain invisible. org-fold-core provides functions to work around
+;; this issue: `org-fold-core-remove-optimisation' and `org-fold-core-update-optimisation', but
+;; it is unlikely that a random external package will use them.
+
+;; Another possible bottleneck is the fragility check after the change
+;; related to the folded text. The functions used in `:fragile'
+;; folding properties must be optimized. Also,
+;; `org-fold-core-ignore-fragility-checks' or even `org-fold-core-ignore-modifications' may be
+;; used when appropriate in the performance-critical code. When
+;; inserting text from within `org-fold-core-ignore-modifications' macro, it is
+;; recommended to use `insert-and-inherit' instead of `insert' and
+;; `insert-before-markers-and-inherit' instead of
+;; `insert-before-markers' to avoid revealing inserted text in the
+;; middle of a folded region.
+
+;; Performance of isearch is currently limited by Emacs isearch
+;; implementation. For now, Emacs isearch only supports searching
+;; through text hidden using overlays. This library handles isearch
+;; by converting folds with matching text to overlays, which may
+;; affect performance in case of large number of matches. In the
+;; future, Emacs will hopefully accept the relevant patch allowing
+;; isearch to work with text hidden via text properties, but the
+;; performance hit has to be accepted meanwhile.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
+(require 'org-compat)
+
+(declare-function isearch-filter-visible "isearch" (beg end))
+
+;;; Customization
+
+(defcustom org-fold-core-style 'text-properties
+ "Internal implementation detail used to hide folded text.
+Can be either `text-properties' or `overlays'.
+The former is faster on large files, while the latter is generally
+less error-prone with regard to third-party packages that haven't yet
+adapted to the new folding implementation.
+
+Important: This variable must be set before loading Org."
+ :group 'org
+ :package-version '(Org . "9.6")
+ :type '(choice
+ (const :tag "Overlays" overlays)
+ (const :tag "Text properties" text-properties)))
+
+(defvar-local org-fold-core-isearch-open-function #'org-fold-core--isearch-reveal
+ "Function used to reveal hidden text found by isearch.
+The function is called with a single argument - point where text is to
+be revealed.")
+
+(defvar-local org-fold-core--optimise-for-huge-buffers nil
+ "Non-nil turns on extra speedup on huge buffers (Mbs of folded text).
+
+This setting is risky and may cause various artifacts and degraded
+functionality, especially when using external packages. It is
+recommended to enable it on per-buffer basis as file-local variable.
+
+When set to non-nil, must be a list containing one or multiple the
+following symbols:
+
+- `grab-invisible': Use `invisible' text property to hide text. This
+ will reduce the load on Emacs display engine and one may use it if
+ moving point across folded regions becomes slow. However, as a side
+ effect, some external packages extracting i.e. headlings from folded
+ parts of buffer may keep the text invisible.
+
+- `ignore-fragility-checks': Do not try to detect when user edits
+ break structure of the folded elements. This will speed up
+ modifying the folded regions at the cost that some higher-level
+ functions relying on this package might not be able to unfold the
+ edited text. For example, removed leading stars from a folded
+ headline in Org mode will break visibility cycling since Org mode
+ will not be avare that the following folded text belonged to
+ headline.
+
+- `ignore-modification-checks': Do not try to detect insertions in the
+ middle of the folded regions. This will speed up non-interactive
+ edits of the folded regions. However, text inserted in the middle
+ of the folded regions may become visible for some external packages
+ inserting text using `insert' instead of `insert-and-inherit' (the
+ latter is rarely used in practice).
+
+- `ignore-indirect': Do not decouple folding state in the indirect
+ buffers. This can speed up Emacs display engine (and thus motion of
+ point), especially when large number of indirect buffers is being
+ used.
+
+- `merge-folds': Do not distinguish between different types of folding
+ specs. This is the most aggressive optimization with unforeseen and
+ potentially drastic effects.")
+(put 'org-fold-core--optimise-for-huge-buffers 'safe-local-variable 'listp)
+
+;;; Core functionality
+
+;;;; Folding specs
+
+(defvar-local org-fold-core--specs '((org-fold-visible
+ (:visible . t)
+ (:alias . (visible)))
+ (org-fold-hidden
+ (:ellipsis . "...")
+ (:isearch-open . t)
+ (:alias . (hidden))))
+ "Folding specs defined in current buffer.
+
+Each spec is a list (SPEC-SYMBOL SPEC-PROPERTIES).
+SPEC-SYMBOL is the symbol representing the folding spec.
+SPEC-PROPERTIES is an alist defining folding spec properties.
+
+If a text region is folded using multiple specs, only the folding spec
+listed earlier is used.
+
+The following properties are known:
+- :ellipsis :: must be nil or string to show when text is folded
+ using this spec.
+- :global :: non-nil means that folding state will be preserved
+ when copying folded text between buffers.
+- :isearch-ignore :: non-nil means that folded text is not searchable
+ using isearch.
+- :isearch-open :: non-nil means that isearch can reveal text hidden
+ using this spec. This property does nothing
+ when `isearch-ignore' property is non-nil.
+- :front-sticky :: non-nil means that text prepended to the folded text
+ is automatically folded.
+- :rear-sticky :: non-nil means that text appended to the folded text
+ is folded.
+- :visible :: non-nil means that folding spec visibility is not
+ managed. Instead, visibility settings in
+ `buffer-invisibility-spec' will be used as is.
+ Note that changing this property from nil to t may
+ clear the setting in `buffer-invisibility-spec'.
+- :alias :: a list of aliases for the SPEC-SYMBOL.
+- :fragile :: Must be a function accepting two arguments.
+ Non-nil means that changes in region may cause
+ the region to be revealed. The region is
+ revealed after changes if the function returns
+ non-nil.
+ The function called after changes are made with
+ two arguments: cons (beg . end) representing the
+ folded region and spec symbol.")
+(defvar-local org-fold-core--spec-symbols nil
+ "Alist holding buffer spec symbols and aliases.
+
+This variable is defined to reduce load on Emacs garbage collector
+reducing the number of transiently allocated variables.")
+(defvar-local org-fold-core--spec-list nil
+ "List holding buffer spec symbols, but not aliases.
+
+This variable is defined to reduce load on Emacs garbage collector
+reducing the number of transiently allocated variables.")
+
+(defvar-local org-fold-core-extend-changed-region-functions nil
+ "Special hook run just before handling changes in buffer.
+
+This is used to account changes outside folded regions that still
+affect the folded region visibility. For example, removing all stars
+at the beginning of a folded Org mode heading should trigger the
+folded text to be revealed. Each function is called with two
+arguments: beginning and the end of the changed region.")
+
+;;; Utility functions
+
+(defsubst org-fold-core-folding-spec-list (&optional buffer)
+ "Return list of all the folding spec symbols in BUFFER."
+ (or (buffer-local-value 'org-fold-core--spec-list (or buffer (current-buffer)))
+ (with-current-buffer (or buffer (current-buffer))
+ (setq org-fold-core--spec-list (mapcar #'car org-fold-core--specs)))))
+
+(defun org-fold-core-get-folding-spec-from-alias (spec-or-alias)
+ "Return the folding spec symbol for SPEC-OR-ALIAS.
+Return nil when there is no matching folding spec."
+ (when spec-or-alias
+ (unless org-fold-core--spec-symbols
+ (dolist (spec (org-fold-core-folding-spec-list))
+ (push (cons spec spec) org-fold-core--spec-symbols)
+ (dolist (alias (assq :alias (assq spec org-fold-core--specs)))
+ (push (cons alias spec) org-fold-core--spec-symbols))))
+ (alist-get spec-or-alias org-fold-core--spec-symbols)))
+
+(defsubst org-fold-core-folding-spec-p (spec-or-alias)
+ "Check if SPEC-OR-ALIAS is a registered folding spec."
+ (org-fold-core-get-folding-spec-from-alias spec-or-alias))
+
+(defsubst org-fold-core--check-spec (spec-or-alias)
+ "Throw an error if SPEC-OR-ALIAS is not in `org-fold-core--spec-priority-list'."
+ (unless (org-fold-core-folding-spec-p spec-or-alias)
+ (error "%s is not a valid folding spec" spec-or-alias)))
+
+(defsubst org-fold-core-get-folding-spec-property (spec-or-alias property)
+ "Get PROPERTY of a folding SPEC-OR-ALIAS.
+Possible properties can be found in `org-fold-core--specs' docstring."
+ (org-fold-core--check-spec spec-or-alias)
+ (if (and (memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers)
+ (eq property :global))
+ t
+ (if (and (memql 'merge-folds org-fold-core--optimise-for-huge-buffers)
+ (eq property :visible))
+ nil
+ (cdr (assq property (assq (org-fold-core-get-folding-spec-from-alias spec-or-alias) org-fold-core--specs))))))
+
+(defconst org-fold-core--spec-property-prefix "org-fold--spec-"
+ "Prefix used to create property symbol.")
+
+(defsubst org-fold-core-get-folding-property-symbol (spec &optional buffer global)
+ "Get folding text property using to store SPEC in current buffer or BUFFER.
+If GLOBAL is non-nil, do not make the property unique in the BUFFER."
+ (if (memql 'merge-folds org-fold-core--optimise-for-huge-buffers)
+ (intern (format "%s-global" org-fold-core--spec-property-prefix))
+ (intern (format (concat org-fold-core--spec-property-prefix "%s-%S")
+ (symbol-name spec)
+ ;; (sxhash buf) appears to be not constant over time.
+ ;; Using buffer-name is safe, since the only place where
+ ;; buffer-local text property actually matters is an indirect
+ ;; buffer, where the name cannot be same anyway.
+ (if (or global
+ (memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers))
+ 'global
+ (sxhash (buffer-name (or buffer (current-buffer)))))))))
+
+(defsubst org-fold-core-get-folding-spec-from-folding-prop (folding-prop)
+ "Return folding spec symbol used for folding property with name FOLDING-PROP."
+ (catch :exit
+ (dolist (spec (org-fold-core-folding-spec-list))
+ ;; We know that folding properties have
+ ;; folding spec in their name.
+ (when (string-match-p (symbol-name spec)
+ (symbol-name folding-prop))
+ (throw :exit spec)))))
+
+(defvar org-fold-core--property-symbol-cache (make-hash-table :test 'equal)
+ "Saved values of folding properties for (buffer . spec) conses.")
+(defvar-local org-fold-core--indirect-buffers nil
+ "List of indirect buffers created from current buffer.
+
+The first element of the list is always the current buffer.
+
+This variable is needed to work around Emacs bug#46982, while Emacs
+does not provide a way `after-change-functions' in any other buffer
+than the buffer where the change was actually made.")
+
+(defmacro org-fold-core-cycle-over-indirect-buffers (&rest body)
+ "Execute BODY in current buffer and all its indirect buffers.
+
+Also, make sure that folding properties from killed buffers are not
+hanging around."
+ (declare (debug (form body)) (indent 0))
+ `(let (buffers dead-properties)
+ (if (and (not (buffer-base-buffer))
+ (not (eq (current-buffer) (car org-fold-core--indirect-buffers))))
+ ;; We are in base buffer with `org-fold-core--indirect-buffers' value from
+ ;; different buffer. This can happen, for example, when
+ ;; org-capture copies local variables into *Capture* buffer.
+ (setq buffers (list (current-buffer)))
+ (dolist (buf (cons (or (buffer-base-buffer) (current-buffer))
+ (buffer-local-value 'org-fold-core--indirect-buffers (or (buffer-base-buffer) (current-buffer)))))
+ (if (buffer-live-p buf)
+ (push buf buffers)
+ (dolist (spec (org-fold-core-folding-spec-list))
+ (when (and (not (org-fold-core-get-folding-spec-property spec :global))
+ (gethash (cons buf spec) org-fold-core--property-symbol-cache))
+ ;; Make sure that dead-properties variable can be passed
+ ;; as argument to `remove-text-properties'.
+ (push t dead-properties)
+ (push (gethash (cons buf spec) org-fold-core--property-symbol-cache)
+ dead-properties))))))
+ (dolist (buf buffers)
+ (with-current-buffer buf
+ (with-silent-modifications
+ (save-restriction
+ (widen)
+ (remove-text-properties
+ (point-min) (point-max)
+ dead-properties)))
+ ,@body))))
+
+;; This is the core function used to fold text in buffers. We use
+;; text properties to hide folded text, however 'invisible property is
+;; not directly used (unless risky `org-fold-core--optimise-for-huge-buffers' is
+;; enabled). Instead, we define unique text property (folding
+;; property) for every possible folding spec and add the resulting
+;; text properties into `char-property-alias-alist', so that
+;; 'invisible text property is automatically defined if any of the
+;; folding properties is non-nil. This approach lets us maintain
+;; multiple folds for the same text region - poor man's overlays (but
+;; much faster). Additionally, folding properties are ensured to be
+;; unique for different buffers (especially for indirect
+;; buffers). This is done to allow different folding states in
+;; indirect buffers.
+(defun org-fold-core--property-symbol-get-create (spec &optional buffer return-only)
+ "Return a unique symbol suitable as folding text property.
+Return value is unique for folding SPEC in BUFFER.
+If the buffer already have buffer-local setup in `char-property-alias-alist'
+and the setup appears to be created for different buffer,
+copy the old invisibility state into new buffer-local text properties,
+unless RETURN-ONLY is non-nil."
+ (if (eq org-fold-core-style 'overlays)
+ (org-fold-core-get-folding-property-symbol spec nil 'global)
+ (let* ((buf (or buffer (current-buffer))))
+ ;; Create unique property symbol for SPEC in BUFFER
+ (let ((local-prop (or (gethash (cons buf spec) org-fold-core--property-symbol-cache)
+ (puthash (cons buf spec)
+ (org-fold-core-get-folding-property-symbol
+ spec buf
+ (org-fold-core-get-folding-spec-property spec :global))
+ org-fold-core--property-symbol-cache))))
+ (prog1
+ local-prop
+ (unless return-only
+ (with-current-buffer buf
+ ;; Update folding properties carried over from other
+ ;; buffer (implying that current buffer is indirect
+ ;; buffer). Normally, `char-property-alias-alist' in new
+ ;; indirect buffer is a copy of the same variable from
+ ;; the base buffer. Then, `char-property-alias-alist'
+ ;; would contain folding properties, which are not
+ ;; matching the generated `local-prop'.
+ (unless (member local-prop (cdr (assq 'invisible char-property-alias-alist)))
+ ;; Add current buffer to the list of indirect buffers in the base buffer.
+ (when (buffer-base-buffer)
+ (with-current-buffer (buffer-base-buffer)
+ (setq-local org-fold-core--indirect-buffers
+ (let (bufs)
+ (org-fold-core-cycle-over-indirect-buffers
+ (push (current-buffer) bufs))
+ (push buf bufs)
+ (delete-dups bufs)))))
+ ;; Copy all the old folding properties to preserve the folding state
+ (with-silent-modifications
+ (dolist (old-prop (cdr (assq 'invisible char-property-alias-alist)))
+ (org-with-wide-buffer
+ (let* ((pos (point-min))
+ (spec (org-fold-core-get-folding-spec-from-folding-prop old-prop))
+ ;; Generate new buffer-unique folding property
+ (new-prop (when spec (org-fold-core--property-symbol-get-create spec nil 'return-only))))
+ ;; Copy the visibility state for `spec' from `old-prop' to `new-prop'
+ (unless (eq old-prop new-prop)
+ (while (< pos (point-max))
+ (let ((val (get-text-property pos old-prop))
+ (next (next-single-char-property-change pos old-prop)))
+ (when val
+ (put-text-property pos next new-prop val))
+ (setq pos next)))))))
+ ;; Update `char-property-alias-alist' with folding
+ ;; properties unique for the current buffer.
+ (setq-local char-property-alias-alist
+ (cons (cons 'invisible
+ (mapcar (lambda (spec)
+ (org-fold-core--property-symbol-get-create spec nil 'return-only))
+ (org-fold-core-folding-spec-list)))
+ (remove (assq 'invisible char-property-alias-alist)
+ char-property-alias-alist)))
+ ;; Set folding property stickiness according to
+ ;; their `:font-sticky' and `:rear-sticky'
+ ;; parameters.
+ (let (full-prop-list)
+ (org-fold-core-cycle-over-indirect-buffers
+ (setq full-prop-list
+ (append full-prop-list
+ (delq nil
+ (mapcar (lambda (spec)
+ (cond
+ ((org-fold-core-get-folding-spec-property spec :front-sticky)
+ (cons (org-fold-core--property-symbol-get-create spec nil 'return-only)
+ nil))
+ ((org-fold-core-get-folding-spec-property spec :rear-sticky)
+ nil)
+ (t
+ (cons (org-fold-core--property-symbol-get-create spec nil 'return-only)
+ t))))
+ (org-fold-core-folding-spec-list))))))
+ (org-fold-core-cycle-over-indirect-buffers
+ (setq-local text-property-default-nonsticky
+ (delete-dups (append
+ text-property-default-nonsticky
+ full-prop-list))))))))))))))
+
+(defun org-fold-core-decouple-indirect-buffer-folds ()
+ "Copy and decouple folding state in a newly created indirect buffer.
+This function is mostly intended to be used in
+`clone-indirect-buffer-hook'."
+ (when (and (buffer-base-buffer)
+ (eq org-fold-core-style 'text-properties)
+ (not (memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers)))
+ (org-fold-core--property-symbol-get-create (car (org-fold-core-folding-spec-list)))))
+
+;;; API
+
+;;;; Modifying folding specs
+
+(defun org-fold-core-set-folding-spec-property (spec property value &optional force)
+ "Set PROPERTY of a folding SPEC to VALUE.
+Possible properties and values can be found in `org-fold-core--specs' docstring.
+Do not check previous value when FORCE is non-nil."
+ (pcase property
+ (:ellipsis
+ (unless (and (not force) (equal value (org-fold-core-get-folding-spec-property spec :ellipsis)))
+ (remove-from-invisibility-spec (cons spec (org-fold-core-get-folding-spec-property spec :ellipsis)))
+ (unless (org-fold-core-get-folding-spec-property spec :visible)
+ (add-to-invisibility-spec (cons spec value)))))
+ (:visible
+ (unless (or (memql 'merge-folds org-fold-core--optimise-for-huge-buffers)
+ (and (not force) (equal value (org-fold-core-get-folding-spec-property spec :visible))))
+ (if value
+ (remove-from-invisibility-spec (cons spec (org-fold-core-get-folding-spec-property spec :ellipsis)))
+ (add-to-invisibility-spec (cons spec (org-fold-core-get-folding-spec-property spec :ellipsis))))))
+ (:alias
+ ;; Clear symbol cache.
+ (setq org-fold-core--spec-symbols nil))
+ (:isearch-open nil)
+ (:isearch-ignore nil)
+ (:front-sticky nil)
+ (:rear-sticky nil)
+ (_ nil))
+ (setf (cdr (assq property (assq spec org-fold-core--specs))) value))
+
+(defun org-fold-core-add-folding-spec (spec &optional properties buffer append)
+ "Add a new folding SPEC with PROPERTIES in BUFFER.
+
+SPEC must be a symbol. BUFFER can be a buffer to set SPEC in or nil to
+set SPEC in current buffer.
+
+By default, the added SPEC will have highest priority among the
+previously defined specs. When optional APPEND argument is non-nil,
+SPEC will have the lowest priority instead. If SPEC was already
+defined earlier, it will be redefined according to provided optional
+arguments.
+`
+The folding spec properties will be set to PROPERTIES (see
+`org-fold-core--specs' for details)."
+ (when (eq spec 'all) (error "Cannot use reserved folding spec symbol 'all"))
+ (with-current-buffer (or buffer (current-buffer))
+ ;; Clear the cache.
+ (setq org-fold-core--spec-list nil
+ org-fold-core--spec-symbols nil)
+ (let* ((full-properties (mapcar (lambda (prop) (cons prop (cdr (assq prop properties))))
+ '( :visible :ellipsis :isearch-ignore
+ :global :isearch-open :front-sticky
+ :rear-sticky :fragile :alias)))
+ (full-spec (cons spec full-properties)))
+ (add-to-list 'org-fold-core--specs full-spec append)
+ (mapc (lambda (prop-cons) (org-fold-core-set-folding-spec-property spec (car prop-cons) (cdr prop-cons) 'force)) full-properties)
+ ;; Update buffer inivisibility specs.
+ (org-fold-core--property-symbol-get-create spec))))
+
+(defun org-fold-core-remove-folding-spec (spec &optional buffer)
+ "Remove a folding SPEC in BUFFER.
+
+SPEC must be a symbol.
+
+BUFFER can be a buffer to remove SPEC in, nil to remove SPEC in current
+buffer, or `all' to remove SPEC in all open `org-mode' buffers and all
+future org buffers."
+ (org-fold-core--check-spec spec)
+ (when (eq buffer 'all)
+ (setq-default org-fold-core--specs (delete (cdr (assq spec org-fold-core--specs)) org-fold-core--specs))
+ (mapc (lambda (buf)
+ (org-fold-core-remove-folding-spec spec buf))
+ (buffer-list)))
+ (let ((buffer (or buffer (current-buffer))))
+ (with-current-buffer buffer
+ ;; Clear the cache.
+ (setq org-fold-core--spec-list nil
+ org-fold-core--spec-symbols nil)
+ (org-fold-core-set-folding-spec-property spec :visible t)
+ (setq org-fold-core--specs (delete (cdr (assq spec org-fold-core--specs)) org-fold-core--specs)))))
+
+(defun org-fold-core-initialize (&optional specs)
+ "Setup folding in current buffer using SPECS as value of `org-fold-core--specs'."
+ ;; Preserve the priorities.
+ (when specs (setq specs (nreverse specs)))
+ (unless specs (setq specs org-fold-core--specs))
+ (setq org-fold-core--specs nil
+ org-fold-core--spec-list nil
+ org-fold-core--spec-symbols nil)
+ (dolist (spec specs)
+ (org-fold-core-add-folding-spec (car spec) (cdr spec)))
+ (add-hook 'after-change-functions 'org-fold-core--fix-folded-region nil 'local)
+ (add-hook 'clone-indirect-buffer-hook #'org-fold-core-decouple-indirect-buffer-folds nil 'local)
+ ;; Setup killing text
+ (setq-local filter-buffer-substring-function #'org-fold-core--buffer-substring-filter)
+ (if (and (boundp 'isearch-opened-regions)
+ (eq org-fold-core-style 'text-properties))
+ ;; Use new implementation of isearch allowing to search inside text
+ ;; hidden via text properties.
+ (org-fold-core--isearch-setup 'text-properties)
+ (org-fold-core--isearch-setup 'overlays)))
+
+;;;; Searching and examining folded text
+
+(defsubst org-fold-core-folded-p (&optional pos spec-or-alias)
+ "Non-nil if the character after POS is folded.
+If POS is nil, use `point' instead.
+If SPEC-OR-ALIAS is a folding spec or a list, only check the given
+folding spec or the listed specs."
+ (if (and spec-or-alias (listp spec-or-alias))
+ (catch :found
+ (dolist (spec spec-or-alias)
+ (let ((val (org-fold-core-get-folding-spec spec pos)))
+ (when val (throw :found val)))))
+ (org-fold-core-get-folding-spec spec-or-alias pos)))
+
+(defun org-fold-core-region-folded-p (beg end &optional spec-or-alias)
+ "Non-nil if the region between BEG and END is folded.
+If SPEC-OR-ALIAS is a folding spec, only check the given folding spec."
+ (org-with-point-at beg
+ (catch :visible
+ (while (< (point) end)
+ (unless (org-fold-core-get-folding-spec spec-or-alias) (throw :visible nil))
+ (goto-char (org-fold-core-next-folding-state-change spec-or-alias nil end)))
+ t)))
+
+(defun org-fold-core-get-folding-spec (&optional spec-or-alias pom)
+ "Get folding state at `point' or POM.
+Return nil if there is no folding at point or POM.
+If SPEC-OR-ALIAS is nil, return a folding spec with highest priority
+among present at `point' or POM.
+If SPEC-OR-ALIAS is `all', return the list of all present folding
+specs.
+If SPEC-OR-ALIAS is a valid folding spec or a spec alias, return the
+corresponding folding spec (if the text is folded using that spec)."
+ (let ((spec (if (eq spec-or-alias 'all)
+ 'all
+ (org-fold-core-get-folding-spec-from-alias spec-or-alias))))
+ (when (and spec (not (eq spec 'all))) (org-fold-core--check-spec spec))
+ (org-with-point-at pom
+ (cond
+ ((eq spec 'all)
+ (let ((result))
+ (dolist (spec (org-fold-core-folding-spec-list))
+ (let ((val (get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t))))
+ (when val (push val result))))
+ (reverse result)))
+ ((null spec)
+ (let ((result (get-char-property (point) 'invisible)))
+ (when (org-fold-core-folding-spec-p result) result)))
+ (t (get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t)))))))
+
+(defun org-fold-core-get-folding-specs-in-region (beg end)
+ "Get all folding specs in region from BEG to END."
+ (let ((pos beg)
+ all-specs)
+ (while (< pos end)
+ (setq all-specs (append all-specs (org-fold-core-get-folding-spec nil pos)))
+ (setq pos (org-fold-core-next-folding-state-change nil pos end)))
+ (unless (listp all-specs) (setq all-specs (list all-specs)))
+ (delete-dups all-specs)))
+
+(defun org-fold-core-get-region-at-point (&optional spec-or-alias pom)
+ "Return region folded using SPEC-OR-ALIAS at POM.
+If SPEC is nil, return the largest possible folded region.
+The return value is a cons of beginning and the end of the region.
+Return nil when no fold is present at point of POM."
+ (let ((spec (org-fold-core-get-folding-spec-from-alias spec-or-alias)))
+ (org-with-point-at (or pom (point))
+ (if spec
+ (if (eq org-fold-core-style 'text-properties)
+ (org-find-text-property-region (point) (org-fold-core--property-symbol-get-create spec nil t))
+ (let ((ov (cdr (get-char-property-and-overlay (point) (org-fold-core--property-symbol-get-create spec nil t)))))
+ (when ov (cons (overlay-start ov) (overlay-end ov)))))
+ (let ((region (cons (point) (point))))
+ (dolist (spec (org-fold-core-get-folding-spec 'all))
+ (let ((local-region (org-fold-core-get-region-at-point spec)))
+ (when (< (car local-region) (car region))
+ (setcar region (car local-region)))
+ (when (> (cdr local-region) (cdr region))
+ (setcdr region (cdr local-region)))))
+ (unless (eq (car region) (cdr region)) region))))))
+
+(defun org-fold-core-next-visibility-change (&optional pos limit ignore-hidden-p previous-p)
+ "Return next point from POS up to LIMIT where text becomes visible/invisible.
+By default, text hidden by any means (i.e. not only by folding, but
+also via fontification) will be considered.
+If IGNORE-HIDDEN-P is non-nil, consider only folded text.
+If PREVIOUS-P is non-nil, search backwards."
+ (let* ((pos (or pos (point)))
+ (invisible-p (if ignore-hidden-p
+ #'org-fold-core-folded-p
+ #'invisible-p))
+ (invisible-initially? (funcall invisible-p pos))
+ (limit (or limit (if previous-p
+ (point-min)
+ (point-max))))
+ (cmp (if previous-p #'> #'<))
+ (next-change (if previous-p
+ (if ignore-hidden-p
+ (lambda (p) (org-fold-core-previous-folding-state-change (org-fold-core-get-folding-spec nil p) p limit))
+ (lambda (p) (max limit (1- (previous-single-char-property-change p 'invisible nil limit)))))
+ (if ignore-hidden-p
+ (lambda (p) (org-fold-core-next-folding-state-change (org-fold-core-get-folding-spec nil p) p limit))
+ (lambda (p) (next-single-char-property-change p 'invisible nil limit)))))
+ (next pos))
+ (while (and (funcall cmp next limit)
+ (not (org-xor invisible-initially? (funcall invisible-p next))))
+ (setq next (funcall next-change next)))
+ next))
+
+(defun org-fold-core-previous-visibility-change (&optional pos limit ignore-hidden-p)
+ "Call `org-fold-core-next-visibility-change' searching backwards."
+ (org-fold-core-next-visibility-change pos limit ignore-hidden-p 'previous))
+
+(defun org-fold-core-next-folding-state-change (&optional spec-or-alias pos limit previous-p)
+ "Return point after POS where folding state changes up to LIMIT.
+If SPEC-OR-ALIAS is nil, return next point where _any_ single folding
+spec changes.
+For example, (org-fold-core-next-folding-state-change nil) with point
+somewhere in the below structure will return the nearest <...> point.
+
+* Headline <begin outline fold>
+:PROPERTIES:<begin drawer fold>
+:ID: test
+:END:<end drawer fold>
+
+Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo,
+quis tempor ligula erat quis odio.
+
+** Another headline
+:DRAWER:<begin drawer fold>
+:END:<end drawer fold>
+** Yet another headline
+<end of outline fold>
+
+If SPEC-OR-ALIAS is a folding spec symbol, only consider that folding
+spec.
+
+If SPEC-OR-ALIAS is a list, only consider changes of folding specs
+from the list.
+
+Search backwards when PREVIOUS-P is non-nil."
+ (when (and spec-or-alias (symbolp spec-or-alias))
+ (setq spec-or-alias (list spec-or-alias)))
+ (when spec-or-alias
+ (setq spec-or-alias
+ (mapcar (lambda (spec-or-alias)
+ (or (org-fold-core-get-folding-spec-from-alias spec-or-alias)
+ spec-or-alias))
+ spec-or-alias))
+ (mapc #'org-fold-core--check-spec spec-or-alias))
+ (unless spec-or-alias
+ (setq spec-or-alias (org-fold-core-folding-spec-list)))
+ (setq pos (or pos (point)))
+ (apply (if previous-p
+ #'max
+ #'min)
+ (mapcar (if previous-p
+ (lambda (prop) (max (or limit (point-min)) (previous-single-char-property-change pos prop nil (or limit (point-min)))))
+ (lambda (prop) (next-single-char-property-change pos prop nil (or limit (point-max)))))
+ (mapcar (lambda (el) (org-fold-core--property-symbol-get-create el nil t))
+ spec-or-alias))))
+
+(defun org-fold-core-previous-folding-state-change (&optional spec-or-alias pos limit)
+ "Call `org-fold-core-next-folding-state-change' searching backwards."
+ (org-fold-core-next-folding-state-change spec-or-alias pos limit 'previous))
+
+(defun org-fold-core-search-forward (spec-or-alias &optional limit)
+ "Search next region folded via folding SPEC-OR-ALIAS up to LIMIT.
+Move point right after the end of the region, to LIMIT, or
+`point-max'. The `match-data' will contain the region."
+ (let ((spec (org-fold-core-get-folding-spec-from-alias spec-or-alias)))
+ (let ((prop-symbol (org-fold-core--property-symbol-get-create spec nil t)))
+ (goto-char (or (next-single-char-property-change (point) prop-symbol nil limit) limit (point-max)))
+ (when (and (< (point) (or limit (point-max)))
+ (not (org-fold-core-get-folding-spec spec)))
+ (goto-char (next-single-char-property-change (point) prop-symbol nil limit)))
+ (when (org-fold-core-get-folding-spec spec)
+ (let ((region (org-fold-core-get-region-at-point spec)))
+ (when (< (cdr region) (or limit (point-max)))
+ (goto-char (1+ (cdr region)))
+ (set-match-data (list (set-marker (make-marker) (car region) (current-buffer))
+ (set-marker (make-marker) (cdr region) (current-buffer))))))))))
+
+(cl-defun org-fold-core-get-regions (&key specs from to with-markers relative)
+ "Find all the folded regions in current buffer.
+
+Each element of the returned list represent folded region boundaries
+and the folding spec: (BEG END SPEC).
+
+Search folds intersecting with (FROM TO) buffer region if FROM and TO
+are provided.
+
+If FROM is non-nil and TO is nil, search the folded regions at FROM.
+
+When SPECS is non-nil it should be a list of folding specs or a symbol.
+Only return the matching fold types.
+
+When WITH-MARKERS is non-nil, use markers to represent region
+boundaries.
+
+When RELATIVE is a buffer position, regions boundaries are given
+relative to that position.
+When RELATIVE is t, use FROM as the position.
+WITH-MARKERS must be nil when RELATIVE is non-nil."
+ (when (and relative with-markers)
+ (error "Cannot use markers in non-absolute region boundaries"))
+ (when (eq relative t) (setq relative from))
+ (unless (listp specs) (setq specs (list specs)))
+ (let (regions region mk-region)
+ (org-with-wide-buffer
+ (when (and from (not to)) (setq to (point-max)))
+ (when (and from (< from (point-min))) (setq from (point-min)))
+ (when (and to (> to (point-max))) (setq to (point-max)))
+ (unless from (setq from (point-min)))
+ (dolist (spec (or specs (org-fold-core-folding-spec-list)) regions)
+ (goto-char from)
+ (catch :exit
+ (while (or (not to) (< (point) to))
+ (when (org-fold-core-get-folding-spec spec)
+ (setq region (org-fold-core-get-region-at-point spec))
+ (when relative
+ (cl-decf (car region) relative)
+ (cl-decf (cdr region) relative))
+ (if (not with-markers)
+ (setq mk-region `(,(car region) ,(cdr region) ,spec))
+ (setq mk-region `(,(make-marker) ,(make-marker) ,spec))
+ (move-marker (nth 0 mk-region) (car region))
+ (move-marker (nth 1 mk-region) (cdr region)))
+ (push mk-region regions))
+ (unless to (throw :exit nil))
+ (goto-char (org-fold-core-next-folding-state-change spec nil to))))))))
+
+;;;; Changing visibility
+
+;;;;; Region visibility
+
+;; This is the core function performing actual folding/unfolding. The
+;; folding state is stored in text property (folding property)
+;; returned by `org-fold-core--property-symbol-get-create'. The value of the
+;; folding property is folding spec symbol.
+(defun org-fold-core-region (from to flag &optional spec-or-alias)
+ "Hide or show lines from FROM to TO, according to FLAG.
+SPEC-OR-ALIAS is the folding spec or foldable element, as a symbol.
+If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold everything in the region."
+ (let ((spec (org-fold-core-get-folding-spec-from-alias spec-or-alias)))
+ (when spec (org-fold-core--check-spec spec))
+ (with-silent-modifications
+ (org-with-wide-buffer
+ (when (eq org-fold-core-style 'overlays) (remove-overlays from to 'invisible spec))
+ (if flag
+ (if (not spec)
+ (error "Calling `org-fold-core-region' with missing SPEC")
+ (if (eq org-fold-core-style 'overlays)
+ ;; Use `front-advance' since text right before to the beginning of
+ ;; the overlay belongs to the visible line than to the contents.
+ (let ((o (make-overlay from to nil
+ (org-fold-core-get-folding-spec-property spec :front-sticky)
+ (org-fold-core-get-folding-spec-property spec :rear-sticky))))
+ (overlay-put o 'evaporate t)
+ (overlay-put o (org-fold-core--property-symbol-get-create spec) spec)
+ (overlay-put o 'invisible spec)
+ (overlay-put o 'isearch-open-invisible #'org-fold-core--isearch-show)
+ (overlay-put o 'isearch-open-invisible-temporary #'org-fold-core--isearch-show-temporary))
+ (put-text-property from to (org-fold-core--property-symbol-get-create spec) spec)
+ (put-text-property from to 'isearch-open-invisible #'org-fold-core--isearch-show)
+ (put-text-property from to 'isearch-open-invisible-temporary #'org-fold-core--isearch-show-temporary)
+ (when (memql 'grab-invisible org-fold-core--optimise-for-huge-buffers)
+ ;; If the SPEC has highest priority, assign it directly
+ ;; to 'invisible property as well. This is done to speed
+ ;; up Emacs redisplay on huge (Mbs) folded regions where
+ ;; we don't even want Emacs to spend time cycling over
+ ;; `char-property-alias-alist'.
+ (when (eq spec (caar org-fold-core--specs)) (put-text-property from to 'invisible spec)))))
+ (if (not spec)
+ (mapc (lambda (spec) (org-fold-core-region from to nil spec)) (org-fold-core-folding-spec-list))
+ (when (and (memql 'grab-invisible org-fold-core--optimise-for-huge-buffers)
+ (eq org-fold-core-style 'text-properties))
+ (when (eq spec (caar org-fold-core--specs))
+ (let ((pos from))
+ (while (< pos to)
+ (if (eq spec (get-text-property pos 'invisible))
+ (let ((next (org-fold-core-next-folding-state-change spec pos to)))
+ (remove-text-properties pos next '(invisible t))
+ (setq pos next))
+ (setq pos (next-single-char-property-change pos 'invisible nil to)))))))
+ (when (eq org-fold-core-style 'text-properties)
+ (remove-text-properties from to (list (org-fold-core--property-symbol-get-create spec) nil)))))))))
+
+(cl-defmacro org-fold-core-regions (regions &key override clean-markers relative)
+ "Fold every region in REGIONS list in current buffer.
+
+Each region in the list is a list (BEG END SPEC-OR-ALIAS) describing
+region and folding spec to be applied.
+
+When optional argument OVERRIDE is non-nil, clear folding state in the
+buffer first.
+
+When optional argument CLEAN-MARKERS is non-nil, clear markers used to
+mark region boundaries in REGIONS.
+
+When optional argument RELATIVE is non-nil, it must be a buffer
+position. REGION boundaries are then treated as relative distances
+from that position."
+ `(org-with-wide-buffer
+ (when ,override (org-fold-core-region (point-min) (point-max) nil))
+ (pcase-dolist (`(,beg ,end ,spec) (delq nil ,regions))
+ (let ((rel ,relative))
+ (if rel
+ (org-fold-core-region (+ rel beg) (+ rel end) t spec)
+ (org-fold-core-region beg end t spec)))
+ (when ,clean-markers
+ (when (markerp beg) (set-marker beg nil))
+ (when (markerp end) (set-marker end nil))))))
+
+(defmacro org-fold-core-save-visibility (use-markers &rest body)
+ "Save and restore folding state 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 (regions)
+ `(let* ((,regions ,(org-fold-core-get-regions :with-markers use-markers)))
+ (unwind-protect (progn ,@body)
+ (org-fold-core-regions ,regions :override t :clean-markers t)))))
+
+;;; Make isearch search in some text hidden via text propertoes
+
+(defvar org-fold-core--isearch-overlays nil
+ "List of overlays temporarily created during isearch.
+This is used to allow searching in regions hidden via text properties.
+As for [2020-05-09 Sat], Isearch only has special handling of hidden overlays.
+Any text hidden via text properties is not revealed even if `search-invisible'
+is set to `t'.")
+
+(defvar-local org-fold-core--isearch-local-regions (make-hash-table :test 'equal)
+ "Hash table storing temporarily shown folds from isearch matches.")
+
+(defun org-fold-core--isearch-setup (type)
+ "Initialize isearch in org buffer.
+TYPE can be either `text-properties' or `overlays'."
+ (pcase type
+ (`text-properties
+ (setq-local search-invisible 'open-all)
+ (add-hook 'isearch-mode-end-hook #'org-fold-core--clear-isearch-state nil 'local)
+ (add-hook 'isearch-mode-hook #'org-fold-core--clear-isearch-state nil 'local)
+ (setq-local isearch-filter-predicate #'org-fold-core--isearch-filter-predicate-text-properties))
+ (`overlays
+ (when (eq org-fold-core-style 'text-properties)
+ (setq-local isearch-filter-predicate #'org-fold-core--isearch-filter-predicate-overlays)
+ (add-hook 'isearch-mode-end-hook #'org-fold-core--clear-isearch-overlays nil 'local)))
+ (_ (error "%s: Unknown type of setup for `org-fold-core--isearch-setup'" type))))
+
+(defun org-fold-core--isearch-reveal (pos)
+ "Default function used to reveal hidden text at POS for isearch."
+ (let ((region (org-fold-core-get-region-at-point pos)))
+ (org-fold-core-region (car region) (cdr region) nil)))
+
+(defun org-fold-core--isearch-filter-predicate-text-properties (beg end)
+ "Make sure that folded text is searchable when user want so.
+This function is intended to be used as `isearch-filter-predicate'."
+ (and
+ ;; Check folding specs that cannot be searched
+ (not (memq nil (mapcar (lambda (spec) (not (org-fold-core-get-folding-spec-property spec :isearch-ignore)))
+ (org-fold-core-get-folding-specs-in-region beg end))))
+ ;; Check 'invisible properties that are not folding specs.
+ (or (eq search-invisible t) ; User wants to search anyway, allow it.
+ (let ((pos beg)
+ unknown-invisible-property)
+ (while (and (< pos end)
+ (not unknown-invisible-property))
+ (when (and (get-text-property pos 'invisible)
+ (not (org-fold-core-folding-spec-p (get-text-property pos 'invisible))))
+ (setq unknown-invisible-property t))
+ (setq pos (next-single-char-property-change pos 'invisible)))
+ (not unknown-invisible-property)))
+ (or (and (eq search-invisible t)
+ ;; FIXME: this opens regions permanenly for now.
+ ;; I also tried to force search-invisible 'open-all around
+ ;; `isearch-range-invisible', but that somehow causes
+ ;; infinite loop in `isearch-lazy-highlight'.
+ (prog1 t
+ ;; We still need to reveal the folded location
+ (org-fold-core--isearch-show-temporary (cons beg end) nil)))
+ (not (isearch-range-invisible beg end)))))
+
+(defun org-fold-core--clear-isearch-state ()
+ "Clear `org-fold-core--isearch-local-regions'."
+ (clrhash org-fold-core--isearch-local-regions))
+
+(defun org-fold-core--isearch-show (region)
+ "Reveal text in REGION found by isearch.
+REGION can also be an overlay in current buffer."
+ (when (overlayp region)
+ (setq region (cons (overlay-start region)
+ (overlay-end region))))
+ (org-with-point-at (car region)
+ (while (< (point) (cdr region))
+ (funcall org-fold-core-isearch-open-function (car region))
+ (goto-char (org-fold-core-next-visibility-change (point) (cdr region) 'ignore-hidden)))))
+
+(defun org-fold-core--isearch-show-temporary (region hide-p)
+ "Temporarily reveal text in REGION.
+Hide text instead if HIDE-P is non-nil.
+REGION can also be an overlay in current buffer."
+ (when (overlayp region)
+ (setq region (cons (overlay-start region)
+ (overlay-end region))))
+ (if (not hide-p)
+ (let ((pos (car region)))
+ (while (< pos (cdr region))
+ (let ((spec-no-open
+ (catch :found
+ (dolist (spec (org-fold-core-get-folding-spec 'all pos))
+ (unless (org-fold-core-get-folding-spec-property spec :isearch-open)
+ (throw :found spec))))))
+ (if spec-no-open
+ ;; Skip regions folded with folding specs that cannot be opened.
+ (setq pos (org-fold-core-next-folding-state-change spec-no-open pos (cdr region)))
+ (dolist (spec (org-fold-core-get-folding-spec 'all pos))
+ (push (cons spec (org-fold-core-get-region-at-point spec pos)) (gethash region org-fold-core--isearch-local-regions)))
+ (org-fold-core--isearch-show region)
+ (setq pos (org-fold-core-next-folding-state-change nil pos (cdr region)))))))
+ (mapc (lambda (val) (org-fold-core-region (cadr val) (cddr val) t (car val))) (gethash region org-fold-core--isearch-local-regions))
+ (remhash region org-fold-core--isearch-local-regions)))
+
+(defvar-local org-fold-core--isearch-special-specs nil
+ "List of specs that can break visibility state when converted to overlays.
+This is a hack, but I do not see a better way around until isearch
+gets support of text properties.")
+(defun org-fold-core--create-isearch-overlays (beg end)
+ "Replace text property invisibility spec by overlays between BEG and END.
+All the searchable folded regions will be changed to use overlays
+instead of text properties. The created overlays will be stored in
+`org-fold-core--isearch-overlays'."
+ (let ((pos beg))
+ (while (< pos end)
+ ;; We need loop below to make sure that we clean all invisible
+ ;; properties, which may be nested.
+ (dolist (spec (org-fold-core-get-folding-spec 'all pos))
+ (unless (org-fold-core-get-folding-spec-property spec :isearch-ignore)
+ (let* ((region (org-fold-core-get-region-at-point spec pos)))
+ (when (memq spec org-fold-core--isearch-special-specs)
+ (setq pos (min pos (car region)))
+ (setq end (max end (cdr region))))
+ ;; Changing text properties is considered buffer modification.
+ ;; We do not want it here.
+ (with-silent-modifications
+ (org-fold-core-region (car region) (cdr region) nil spec)
+ ;; The overlay is modeled after `outline-flag-region'
+ ;; [2020-05-09 Sat] overlay for 'outline blocks.
+ (let ((o (make-overlay (car region) (cdr region) nil 'front-advance)))
+ (overlay-put o 'evaporate t)
+ (overlay-put o 'invisible spec)
+ (overlay-put o 'org-invisible spec)
+ ;; Make sure that overlays are applied in the same order
+ ;; with the folding specs.
+ ;; Note: `memq` returns cdr with car equal to the first
+ ;; found matching element.
+ (overlay-put o 'priority (length (memq spec (org-fold-core-folding-spec-list))))
+ ;; `delete-overlay' here means that spec information will be lost
+ ;; for the region. The region will remain visible.
+ (if (org-fold-core-get-folding-spec-property spec :isearch-open)
+ (overlay-put o 'isearch-open-invisible #'delete-overlay)
+ (overlay-put o 'isearch-open-invisible #'ignore)
+ (overlay-put o 'isearch-open-invisible-temporary #'ignore))
+ (push o org-fold-core--isearch-overlays))))))
+ (setq pos (org-fold-core-next-folding-state-change nil pos end)))))
+
+(defun org-fold-core--isearch-filter-predicate-overlays (beg end)
+ "Return non-nil if text between BEG and END is deemed visible by isearch.
+This function is intended to be used as `isearch-filter-predicate'."
+ (org-fold-core--create-isearch-overlays beg end) ;; trick isearch by creating overlays in place of invisible text
+ (isearch-filter-visible beg end))
+
+(defun org-fold-core--clear-isearch-overlay (ov)
+ "Convert OV region back into using text properties."
+ (let ((spec (if isearch-mode-end-hook-quit
+ ;; Restore all folds.
+ (overlay-get ov 'org-invisible)
+ ;; Leave opened folds open.
+ (overlay-get ov 'invisible))))
+ ;; Ignore deleted overlays.
+ (when (and spec
+ (overlay-buffer ov))
+ ;; Changing text properties is considered buffer modification.
+ ;; We do not want it here.
+ (with-silent-modifications
+ (when (<= (overlay-end ov) (point-max))
+ (org-fold-core-region (overlay-start ov) (overlay-end ov) t spec)))))
+ (when (member ov isearch-opened-overlays)
+ (setq isearch-opened-overlays (delete ov isearch-opened-overlays)))
+ (delete-overlay ov))
+
+(defun org-fold-core--clear-isearch-overlays ()
+ "Convert overlays from `org-fold-core--isearch-overlays' back to text properties."
+ (when org-fold-core--isearch-overlays
+ (mapc #'org-fold-core--clear-isearch-overlay org-fold-core--isearch-overlays)
+ (setq org-fold-core--isearch-overlays nil)))
+
+;;; Handling changes in folded elements
+
+(defvar org-fold-core--ignore-modifications nil
+ "Non-nil: skip processing modifications in `org-fold-core--fix-folded-region'.")
+(defvar org-fold-core--ignore-fragility-checks nil
+ "Non-nil: skip fragility checks in `org-fold-core--fix-folded-region'.")
+
+(defmacro org-fold-core-ignore-modifications (&rest body)
+ "Run BODY ignoring buffer modifications in `org-fold-core--fix-folded-region'."
+ (declare (debug (form body)) (indent 0))
+ `(let ((org-fold-core--ignore-modifications t))
+ (unwind-protect (progn ,@body)
+ (setq org-fold-core--last-buffer-chars-modified-tick (buffer-chars-modified-tick)))))
+
+(defmacro org-fold-core-ignore-fragility-checks (&rest body)
+ "Run BODY skipping :fragility checks in `org-fold-core--fix-folded-region'."
+ (declare (debug (form body)) (indent 0))
+ `(let ((org-fold-core--ignore-fragility-checks t))
+ (progn ,@body)))
+
+(defvar-local org-fold-core--last-buffer-chars-modified-tick nil
+ "Variable storing the last return value of `buffer-chars-modified-tick'.")
+
+(defun org-fold-core--fix-folded-region (from to _)
+ "Process modifications in folded elements within FROM . TO region.
+This function intended to be used as one of `after-change-functions'.
+
+This function does nothing if text the only modification was changing
+text properties (for the sake of reducing overheads).
+
+If a text was inserted into invisible region, hide the inserted text.
+If a text was inserted in front/back of the region, hide it according
+to :front-sticky/:rear-sticky folding spec property.
+
+If the folded region is folded with a spec with non-nil :fragile
+property, unfold the region if the :fragile function returns non-nil."
+ ;; If no insertions or deletions in buffer, skip all the checks.
+ (unless (or (eq org-fold-core--last-buffer-chars-modified-tick (buffer-chars-modified-tick))
+ org-fold-core--ignore-modifications
+ (memql 'ignore-modification-checks org-fold-core--optimise-for-huge-buffers))
+ ;; Store the new buffer modification state.
+ (setq org-fold-core--last-buffer-chars-modified-tick (buffer-chars-modified-tick))
+ (save-match-data
+ ;; Handle changes in all the indirect buffers and in the base
+ ;; buffer. Work around Emacs bug#46982.
+ (when (eq org-fold-core-style 'text-properties)
+ (org-fold-core-cycle-over-indirect-buffers
+ ;; Re-hide text inserted in the middle/front/back of a folded
+ ;; region.
+ (unless (equal from to) ; Ignore deletions.
+ (dolist (spec (org-fold-core-folding-spec-list))
+ ;; Reveal fully invisible text inserted in the middle
+ ;; of visible portion of the buffer. This is needed,
+ ;; for example, when there was a deletion in a folded
+ ;; heading, the heading was unfolded, end `undo' was
+ ;; called. The `undo' would insert the folded text.
+ (when (and (or (eq from (point-min))
+ (not (org-fold-core-folded-p (1- from) spec)))
+ (or (eq to (point-max))
+ (not (org-fold-core-folded-p to spec)))
+ (org-fold-core-region-folded-p from to spec))
+ (org-fold-core-region from to nil spec))
+ ;; Look around and fold the new text if the nearby folds are
+ ;; sticky.
+ (unless (org-fold-core-region-folded-p from to spec)
+ (let ((spec-to (org-fold-core-get-folding-spec spec (min to (1- (point-max)))))
+ (spec-from (org-fold-core-get-folding-spec spec (max (point-min) (1- from)))))
+ ;; Reveal folds around undone deletion.
+ (when undo-in-progress
+ (let ((lregion (org-fold-core-get-region-at-point spec (max (point-min) (1- from))))
+ (rregion (org-fold-core-get-region-at-point spec (min to (1- (point-max))))))
+ (if (and lregion rregion)
+ (org-fold-core-region (car lregion) (cdr rregion) nil spec)
+ (when lregion
+ (org-fold-core-region (car lregion) (cdr lregion) nil spec))
+ (when rregion
+ (org-fold-core-region (car rregion) (cdr rregion) nil spec)))))
+ ;; Hide text inserted in the middle of a fold.
+ (when (and (or spec-from (eq from (point-min)))
+ (or spec-to (eq to (point-max)))
+ (or spec-from spec-to)
+ (eq spec-to spec-from)
+ (or (org-fold-core-get-folding-spec-property spec :front-sticky)
+ (org-fold-core-get-folding-spec-property spec :rear-sticky)))
+ (unless (and (eq from (point-min)) (eq to (point-max))) ; Buffer content replaced.
+ (org-fold-core-region from to t (or spec-from spec-to))))
+ ;; Hide text inserted at the end of a fold.
+ (when (and spec-from (org-fold-core-get-folding-spec-property spec-from :rear-sticky))
+ (org-fold-core-region from to t spec-from))
+ ;; Hide text inserted in front of a fold.
+ (when (and spec-to
+ (not (eq to (point-max))) ; Text inserted at the end of buffer is not prepended anywhere.
+ (org-fold-core-get-folding-spec-property spec-to :front-sticky))
+ (org-fold-core-region from to t spec-to))))))))
+ ;; Process all the folded text between `from' and `to'. Do it
+ ;; only in current buffer to avoid verifying semantic structure
+ ;; multiple times in indirect buffers that have exactly same
+ ;; text anyway.
+ (unless (or org-fold-core--ignore-fragility-checks
+ (memql 'ignore-fragility-checks org-fold-core--optimise-for-huge-buffers))
+ (dolist (func org-fold-core-extend-changed-region-functions)
+ (let ((new-region (funcall func from to)))
+ (setq from (car new-region))
+ (setq to (cdr new-region))))
+ (org-fold-core-cycle-over-indirect-buffers
+ (dolist (spec (org-fold-core-folding-spec-list))
+ ;; No action is needed when :fragile is nil for the spec.
+ (when (org-fold-core-get-folding-spec-property spec :fragile)
+ (org-with-wide-buffer
+ ;; Expand the considered region to include partially present fold.
+ ;; Note: It is important to do this inside loop over all
+ ;; specs. Otherwise, the region may be expanded to huge
+ ;; outline fold, potentially involving majority of the
+ ;; buffer. That would cause the below code to loop over
+ ;; almost all the folds in buffer, which would be too slow.
+ (let ((local-from from)
+ (local-to to)
+ (region-from (org-fold-core-get-region-at-point spec (max (point-min) (1- from))))
+ (region-to (org-fold-core-get-region-at-point spec (min to (1- (point-max))))))
+ (when region-from (setq local-from (car region-from)))
+ (when region-to (setq local-to (cdr region-to)))
+ (let ((pos local-from))
+ ;; Move to the first hidden region.
+ (unless (org-fold-core-get-folding-spec spec pos)
+ (setq pos (org-fold-core-next-folding-state-change spec pos local-to)))
+ ;; Cycle over all the folds.
+ (while (< pos local-to)
+ (save-match-data ; we should not clobber match-data in after-change-functions
+ (let ((fold-begin (and (org-fold-core-get-folding-spec spec pos)
+ pos))
+ (fold-end (org-fold-core-next-folding-state-change spec pos local-to)))
+ (when (and fold-begin fold-end)
+ (when (save-excursion
+ (funcall (org-fold-core-get-folding-spec-property spec :fragile)
+ (cons fold-begin fold-end)
+ spec))
+ ;; Reveal completely, not just from the SPEC.
+ (org-fold-core-region fold-begin fold-end nil)))))
+ ;; Move to next fold.
+ (setq pos (org-fold-core-next-folding-state-change spec pos local-to)))))))))))))
+
+;;; Handling killing/yanking of folded text
+
+;; By default, all the text properties of the killed text are
+;; preserved, including the folding text properties. This can be
+;; awkward when we copy a text from an indirect buffer to another
+;; indirect buffer (or the base buffer). The copied text might be
+;; visible in the source buffer, but might disappear if we yank it in
+;; another buffer. This happens in the following situation:
+;; ---- base buffer ----
+;; * Headline<begin fold>
+;; Some text hidden in the base buffer, but revealed in the indirect
+;; buffer.<end fold>
+;; * Another headline
+;;
+;; ---- end of base buffer ----
+;; ---- indirect buffer ----
+;; * Headline
+;; Some text hidden in the base buffer, but revealed in the indirect
+;; buffer.
+;; * Another headline
+;;
+;; ---- end of indirect buffer ----
+;; If we copy the text under "Headline" from the indirect buffer and
+;; insert it under "Another headline" in the base buffer, the inserted
+;; text will be hidden since it's folding text properties are copied.
+;; Basically, the copied text would have two sets of folding text
+;; properties: (1) Properties for base buffer telling that the text is
+;; hidden; (2) Properties for the indirect buffer telling that the
+;; text is visible. The first set of the text properties in inactive
+;; in the indirect buffer, but will become active once we yank the
+;; text back into the base buffer.
+;;
+;; To avoid the above situation, we simply clear all the properties,
+;; unrealated to current buffer when a text is copied.
+;; FIXME: Ideally, we may want to carry the folding state of copied
+;; text between buffer (probably via user customization).
+(defun org-fold-core--buffer-substring-filter (beg end &optional delete)
+ "Clear folding state in killed text.
+This function is intended to be used as `filter-buffer-substring-function'.
+The arguments and return value are as specified for `filter-buffer-substring'."
+ (let ((return-string (buffer-substring--filter beg end delete))
+ ;; The list will be used as an argument to `remove-text-properties'.
+ props-list)
+ ;; There is no easy way to examine all the text properties of a
+ ;; string, so we utilize the fact that printed string
+ ;; representation lists all its properties.
+ ;; Loop over the elements of string representation.
+ (unless (or (string= "" return-string)
+ (<= end beg)
+ (eq org-fold-core-style 'overlays))
+ ;; Collect all the text properties the string is completely
+ ;; hidden with.
+ (dolist (spec (org-fold-core-folding-spec-list))
+ (when (and (org-fold-core-region-folded-p beg end spec)
+ (org-region-invisible-p beg end))
+ (push (org-fold-core--property-symbol-get-create spec nil t) props-list)))
+ (dolist (plist
+ (if (fboundp 'object-intervals)
+ (object-intervals return-string)
+ ;; Backward compatibility with Emacs <28.
+ ;; FIXME: Is there any better way to do it?
+ ;; Yes, it is a hack.
+ ;; The below gives us string representation as a list.
+ ;; Note that we need to remove unreadable values, like markers (#<...>).
+ (seq-partition
+ (cdr (let ((data (read (replace-regexp-in-string
+ "^#(" "("
+ (replace-regexp-in-string
+ " #(" " ("
+ (replace-regexp-in-string
+ "#<[^>]+>" "dummy"
+ ;; Get text representation of the string object.
+ ;; Make sure to print everything (see `prin1' docstring).
+ ;; `prin1' is used to print "%S" format.
+ (let (print-level print-length)
+ (format "%S" return-string))))))))
+ (if (listp data) data (list data))))
+ 3)))
+ (let* ((start (car plist))
+ (fin (cadr plist))
+ (plist (car (cddr plist))))
+ ;; Only lists contain text properties.
+ (when (listp plist)
+ ;; Collect all the relevant text properties.
+ (while plist
+ (let* ((prop (car plist))
+ (prop-name (symbol-name prop)))
+ ;; Reveal hard-hidden text. See
+ ;; `org-fold-core--optimise-for-huge-buffers'.
+ (when (and (eq prop 'invisible)
+ (member (cadr plist) (org-fold-core-folding-spec-list)))
+ (remove-text-properties start fin '(invisible t) return-string))
+ ;; We do not care about values now.
+ (setq plist (cddr plist))
+ (when (string-match-p org-fold-core--spec-property-prefix prop-name)
+ ;; Leave folding specs from current buffer. See
+ ;; comments in `org-fold-core--property-symbol-get-create' to
+ ;; understand why it works.
+ (unless (member prop (cdr (assq 'invisible char-property-alias-alist)))
+ (push prop props-list))))))))
+ (remove-text-properties 0 (length return-string) props-list return-string))
+ return-string))
+
+(defun org-fold-core-update-optimisation (beg end)
+ "Update huge buffer optimization between BEG and END.
+See `org-fold-core--optimise-for-huge-buffers'."
+ (when (and (memql 'grab-invisible org-fold-core--optimise-for-huge-buffers)
+ (eq org-fold-core-style 'text-properties))
+ (let ((pos beg))
+ (while (< pos end)
+ (when (and (org-fold-core-folded-p pos (caar org-fold-core--specs))
+ (not (eq (caar org-fold-core--specs) (get-text-property pos 'invisible))))
+ (put-text-property pos (org-fold-core-next-folding-state-change (caar org-fold-core--specs) pos end)
+ 'invisible (caar org-fold-core--specs)))
+ (setq pos (org-fold-core-next-folding-state-change (caar org-fold-core--specs) pos end))))))
+
+(defun org-fold-core-remove-optimisation (beg end)
+ "Remove huge buffer optimization between BEG and END.
+See `org-fold-core--optimise-for-huge-buffers'."
+ (when (and (memql 'grab-invisible org-fold-core--optimise-for-huge-buffers)
+ (eq org-fold-core-style 'text-properties))
+ (let ((pos beg))
+ (while (< pos end)
+ (if (and (org-fold-core-folded-p pos (caar org-fold-core--specs))
+ (eq (caar org-fold-core--specs) (get-text-property pos 'invisible)))
+ (remove-text-properties pos (org-fold-core-next-folding-state-change (caar org-fold-core--specs) pos end)
+ '(invisible t)))
+ (setq pos (org-fold-core-next-folding-state-change (caar org-fold-core--specs) pos end))))))
+
+(provide 'org-fold-core)
+
+;;; org-fold-core.el ends here
diff --git a/lisp/org/org-fold.el b/lisp/org/org-fold.el
new file mode 100644
index 00000000000..4d213e9648a
--- /dev/null
+++ b/lisp/org/org-fold.el
@@ -0,0 +1,906 @@
+;;; org-fold.el --- Folding of Org entries -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020-2020 Free Software Foundation, Inc.
+;;
+;; Author: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: folding, invisible text
+;; URL: 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 code handling temporary invisibility (folding
+;; and unfolding) of text in org buffers.
+
+;; The folding is implemented using generic org-fold-core library. This file
+;; contains org-specific implementation of the folding. Also, various
+;; useful functions from org-fold-core are aliased under shorted `org-fold'
+;; prefix.
+
+;; The following features are implemented:
+;; - Folding/unfolding various Org mode elements and regions of Org buffers:
+;; + Region before first heading;
+;; + Org headings, their text, children (subtree), siblings, parents, etc;
+;; + Org blocks and drawers
+;; - Revealing Org structure around invisible point location
+;; - Revealing folded Org elements broken by user edits
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
+(require 'org-fold-core)
+
+(defvar org-inlinetask-min-level)
+(defvar org-link--link-folding-spec)
+(defvar org-link--description-folding-spec)
+(defvar org-odd-levels-only)
+(defvar org-drawer-regexp)
+(defvar org-property-end-re)
+(defvar org-link-descriptive)
+(defvar org-outline-regexp-bol)
+(defvar org-archive-tag)
+(defvar org-custom-properties-overlays)
+(defvar org-element-headline-re)
+
+(declare-function isearch-filter-visible "isearch" (beg end))
+(declare-function org-element-type "org-element" (element))
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
+(declare-function org-element-property "org-element" (property element))
+(declare-function org-element--current-element "org-element" (limit &optional granularity mode structure))
+(declare-function org-element--cache-active-p "org-element" ())
+(declare-function org-toggle-custom-properties-visibility "org" ())
+(declare-function org-item-re "org-list" ())
+(declare-function org-up-heading-safe "org" ())
+(declare-function org-get-tags "org" (&optional pos local fontify))
+(declare-function org-get-valid-level "org" (level &optional change))
+(declare-function org-before-first-heading-p "org" ())
+(declare-function org-goto-sibling "org" (&optional previous))
+(declare-function org-block-map "org" (function &optional start end))
+(declare-function org-map-region "org" (fun beg end))
+(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
+(declare-function org-back-to-heading-or-point-min "org" (&optional invisible-ok))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
+(declare-function org-cycle-hide-drawers "org-cycle" (state))
+
+(declare-function outline-show-branches "outline" ())
+(declare-function outline-hide-sublevels "outline" (levels))
+(declare-function outline-get-next-sibling "outline" ())
+(declare-function outline-invisible-p "outline" (&optional pos))
+(declare-function outline-next-heading "outline" ())
+
+;;; Customization
+
+(defgroup org-fold-reveal-location nil
+ "Options about how to make context of a location visible."
+ :tag "Org Reveal Location"
+ :group 'org-structure)
+
+(defcustom org-fold-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-fold-reveal' (`\\[org-fold-reveal]') to show
+more context."
+ :group 'org-fold-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))))))
+
+(defvar org-fold-reveal-start-hook nil
+ "Hook run before revealing a location.")
+
+(defcustom org-fold-catch-invisible-edits 'smart
+ "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)))
+
+;;; Core functionality
+
+;;; API
+
+;;;; Modifying folding specs
+
+(defalias 'org-fold-folding-spec-p #'org-fold-core-folding-spec-p)
+(defalias 'org-fold-add-folding-spec #'org-fold-core-add-folding-spec)
+(defalias 'org-fold-remove-folding-spec #'org-fold-core-remove-folding-spec)
+
+(defun org-fold-initialize (ellipsis)
+ "Setup folding in current Org buffer."
+ (setq-local org-fold-core-isearch-open-function #'org-fold--isearch-reveal)
+ (setq-local org-fold-core-extend-changed-region-functions (list #'org-fold--extend-changed-region))
+ ;; FIXME: Converting org-link + org-description to overlays when
+ ;; search matches hidden "[[" part of the link, reverses priority of
+ ;; link and description and hides the whole link. Working around
+ ;; this until there will be no need to convert text properties to
+ ;; overlays for isearch.
+ (setq-local org-fold-core--isearch-special-specs '(org-link))
+ (org-fold-core-initialize
+ `((,(if (eq org-fold-core-style 'text-properties) 'org-fold-outline 'outline)
+ (:ellipsis . ,ellipsis)
+ (:fragile . ,#'org-fold--reveal-outline-maybe)
+ (:isearch-open . t)
+ ;; This is needed to make sure that inserting a
+ ;; new planning line in folded heading is not
+ ;; revealed. Also, the below combination of :front-sticky and
+ ;; :rear-sticky conforms to the overlay properties in outline.el
+ ;; and the older Org versions as in `outline-flag-region'.
+ (:front-sticky . t)
+ (:rear-sticky . nil)
+ (:alias . (headline heading outline inlinetask plain-list)))
+ (,(if (eq org-fold-core-style 'text-properties) 'org-fold-block 'org-hide-block)
+ (:ellipsis . ,ellipsis)
+ (:fragile . ,#'org-fold--reveal-drawer-or-block-maybe)
+ (:isearch-open . t)
+ (:front-sticky . t)
+ (:alias . ( block center-block comment-block
+ dynamic-block example-block export-block
+ quote-block special-block src-block
+ verse-block)))
+ (,(if (eq org-fold-core-style 'text-properties) 'org-fold-drawer 'org-hide-drawer)
+ (:ellipsis . ,ellipsis)
+ (:fragile . ,#'org-fold--reveal-drawer-or-block-maybe)
+ (:isearch-open . t)
+ (:front-sticky . t)
+ (:alias . (drawer property-drawer)))
+ ,org-link--description-folding-spec
+ ,org-link--link-folding-spec)))
+
+;;;; Searching and examining folded text
+
+(defalias 'org-fold-folded-p #'org-fold-core-folded-p)
+(defalias 'org-fold-get-folding-spec #'org-fold-core-get-folding-spec)
+(defalias 'org-fold-get-folding-specs-in-region #'org-fold-core-get-folding-specs-in-region)
+(defalias 'org-fold-get-region-at-point #'org-fold-core-get-region-at-point)
+(defalias 'org-fold-get-regions #'org-fold-core-get-regions)
+(defalias 'org-fold-next-visibility-change #'org-fold-core-next-visibility-change)
+(defalias 'org-fold-previous-visibility-change #'org-fold-core-previous-visibility-change)
+(defalias 'org-fold-next-folding-state-change #'org-fold-core-next-folding-state-change)
+(defalias 'org-fold-previous-folding-state-change #'org-fold-core-previous-folding-state-change)
+(defalias 'org-fold-search-forward #'org-fold-core-search-forward)
+
+;;;;; Macros
+
+(defalias 'org-fold-save-outline-visibility #'org-fold-core-save-visibility)
+
+;;;; Changing visibility (regions, blocks, drawers, headlines)
+
+;;;;; Region visibility
+
+(defalias 'org-fold-region #'org-fold-core-region)
+(defalias 'org-fold-regions #'org-fold-core-regions)
+
+(defun org-fold-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 TYPES is a list of symbols among `blocks',
+`drawers' and `headings', to only expand one specific type."
+ (interactive)
+ (dolist (type (or types '(blocks drawers headings)))
+ (org-fold-region (point-min) (point-max) nil
+ (pcase type
+ (`blocks 'block)
+ (`drawers 'drawer)
+ (`headings 'headline)
+ (_ (error "Invalid type: %S" type))))))
+
+(defun org-fold-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-fold-region 1 (1- (point)) (not arg) 'outline)))
+
+;;;;; Heading visibility
+
+(defun org-fold-heading (flag &optional entry)
+ "Fold/unfold 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-fold-region
+ (line-end-position 0) (line-end-position) flag 'outline)
+ (org-fold-show-entry)
+ (save-excursion
+ ;; FIXME: potentially catches inlinetasks
+ (and (outline-next-heading)
+ (org-fold-heading nil))))))
+
+(defun org-fold-hide-entry ()
+ "Hide the body directly following this heading."
+ (interactive)
+ (save-excursion
+ (org-back-to-heading-or-point-min t)
+ (when (org-at-heading-p) (forward-line))
+ (unless (or (eobp) (org-at-heading-p)) ; Current headline is empty.
+ (org-fold-region
+ (line-end-position 0)
+ (save-excursion
+ (if (re-search-forward
+ (concat "[\r\n]" (org-get-limited-outline-regexp)) nil t)
+ (line-end-position 0)
+ (point-max)))
+ t
+ 'outline))))
+
+(defun org-fold-subtree (flag)
+"Hide (when FLAG) or reveal subtree at point."
+ (save-excursion
+ (org-back-to-heading t)
+ (org-fold-region
+ (line-end-position)
+ (progn (org-end-of-subtree t t) (if (eobp) (point) (1- (point))))
+ flag
+ 'outline)))
+
+;; Replaces `outline-hide-subtree'.
+(defun org-fold-hide-subtree ()
+ "Hide everything after this heading at deeper levels."
+ (interactive)
+ (org-fold-subtree t))
+
+;; Replaces `outline-hide-sublevels'
+(defun org-fold-hide-sublevels (levels)
+ "Hide everything but the top LEVELS levels of headers, in whole buffer.
+This also unhides the top heading-less body, if any.
+
+Interactively, the prefix argument supplies the value of LEVELS.
+When invoked without a prefix argument, LEVELS defaults to the level
+of the current heading, or to 1 if the current line is not a heading."
+ (interactive (list
+ (cond
+ (current-prefix-arg (prefix-numeric-value current-prefix-arg))
+ ((save-excursion (beginning-of-line)
+ (looking-at outline-regexp))
+ (funcall outline-level))
+ (t 1))))
+ (if (< levels 1)
+ (error "Must keep at least one level of headers"))
+ (save-excursion
+ (let* ((beg (progn
+ (goto-char (point-min))
+ ;; Skip the prelude, if any.
+ (unless (org-at-heading-p) (outline-next-heading))
+ (point)))
+ (end (progn
+ (goto-char (point-max))
+ ;; Keep empty last line, if available.
+ (max (point-min) (if (bolp) (1- (point)) (point))))))
+ (if (< end beg)
+ (setq beg (prog1 end (setq end beg))))
+ ;; First hide everything.
+ (org-fold-region beg end t 'headline)
+ ;; Then unhide the top level headers.
+ (org-map-region
+ (lambda ()
+ (when (<= (funcall outline-level) levels)
+ (org-fold-heading nil)))
+ beg end)
+ ;; Finally unhide any trailing newline.
+ (goto-char (point-max))
+ (if (and (bolp) (not (bobp)) (outline-invisible-p (1- (point))))
+ (org-fold-region (max (point-min) (1- (point))) (point) nil)))))
+
+(defun org-fold-show-entry (&optional hide-drawers)
+ "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-fold-region
+ (line-end-position 0)
+ (save-excursion
+ (if (re-search-forward
+ (concat "[\r\n]\\(" (org-get-limited-outline-regexp) "\\)") nil t)
+ (match-beginning 1)
+ (point-max)))
+ nil
+ 'outline)
+ (when hide-drawers (org-cycle-hide-drawers 'children))))
+
+(defalias 'org-fold-show-hidden-entry #'org-fold-show-entry
+ "Show an entry where even the heading is hidden.")
+
+(defun org-fold-show-siblings ()
+ "Show all siblings of the current headline."
+ (save-excursion
+ (while (org-goto-sibling) (org-fold-heading nil)))
+ (save-excursion
+ (while (org-goto-sibling 'previous)
+ (org-fold-heading nil))))
+
+(defun org-fold-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-fold-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-fold-heading nil))))))
+
+(defun org-fold-show-subtree ()
+ "Show everything after this heading at deeper levels."
+ (interactive)
+ (org-fold-region
+ (point) (save-excursion (org-end-of-subtree t t)) nil 'outline))
+
+(defun org-fold-show-branches ()
+ "Show all subheadings of this heading, but not their bodies."
+ (interactive)
+ (org-fold-show-children 1000))
+
+(defun org-fold-show-branches-buffer ()
+ "Show all branches in the buffer."
+ (org-fold-flag-above-first-heading)
+ (org-fold-hide-sublevels 1)
+ (unless (eobp)
+ (org-fold-show-branches)
+ (while (outline-get-next-sibling)
+ (org-fold-show-branches)))
+ (goto-char (point-min)))
+
+;;;;; Blocks and drawers visibility
+
+(defun org-fold--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)))
+ (org-fold-region start end
+ (cond ((eq force 'off) nil)
+ (force t)
+ ((org-fold-folded-p start category) nil)
+ (t t))
+ category)
+ ;; 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 (format "%s@%s: %s"
+ (buffer-file-name (buffer-base-buffer))
+ (point)
+ (if (eq category 'drawer)
+ "Not at a drawer"
+ "Not at a block")))))))
+
+(defun org-fold-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-fold--hide-wrapper-toggle
+ (or element (org-element-at-point)) 'block force no-error))
+
+(defun org-fold-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-fold--hide-wrapper-toggle
+ (or element (org-element-at-point)) 'drawer force no-error))
+
+(defun org-fold-hide-block-all ()
+ "Fold all blocks in the current buffer."
+ (interactive)
+ (org-block-map (apply-partially #'org-fold-hide-block-toggle 'hide)))
+
+(defun org-fold-hide-drawer-all ()
+ "Fold all drawers in the current buffer."
+ (let ((begin (point-min))
+ (end (point-max)))
+ (org-fold--hide-drawers begin end)))
+
+(defun org-fold--hide-drawers (begin end)
+ "Hide all drawers between BEGIN and END."
+ (save-excursion
+ (goto-char begin)
+ (while (and (< (point) end)
+ (re-search-forward org-drawer-regexp end t))
+ ;; Skip folded drawers
+ (if (org-fold-folded-p nil 'drawer)
+ (goto-char (org-fold-next-folding-state-change 'drawer nil end))
+ (let* ((drawer (org-element-at-point))
+ (type (org-element-type drawer)))
+ (when (memq type '(drawer property-drawer))
+ (org-fold-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))))))))
+
+(defun org-fold-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-fold-subtree t)
+ (org-end-of-subtree t))))))
+
+;;;;; Reveal point location
+
+(defun org-fold-show-context (&optional key)
+ "Make sure point and context are visible.
+Optional argument KEY, when non-nil, is a symbol. See
+`org-fold-show-context-detail' for allowed values and how much is to
+be shown."
+ (org-fold-show-set-visibility
+ (cond ((symbolp org-fold-show-context-detail) org-fold-show-context-detail)
+ ((cdr (assq key org-fold-show-context-detail)))
+ (t (cdr (assq 'default org-fold-show-context-detail))))))
+
+
+(defvar org-hide-emphasis-markers); Defined in org.el
+(defvar org-pretty-entities); Defined in org.el
+(defun org-fold-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-fold-heading nil)
+ (org-fold-show-entry)
+ ;; If point is hidden make sure to expose it.
+ (when (org-invisible-p)
+ ;; FIXME: No clue why, but otherwise the following might not work.
+ (redisplay)
+ (let ((region (org-fold-get-region-at-point)))
+ ;; Reveal emphasis markers.
+ (when (eq detail 'local)
+ (let (org-hide-emphasis-markers
+ org-link-descriptive
+ org-pretty-entities
+ (org-hide-macro-markers nil)
+ (region (or (org-find-text-property-region (point) 'org-emphasis)
+ (org-find-text-property-region (point) 'org-macro)
+ (org-find-text-property-region (point) 'invisible)
+ region)))
+ ;; Silence byte-compiler.
+ (ignore org-hide-macro-markers)
+ (when region
+ (org-with-point-at (car region)
+ (beginning-of-line)
+ (let (font-lock-extend-region-functions)
+ (font-lock-fontify-region (max (point-min) (1- (car region))) (cdr region))))))
+ ;; Unfold links.
+ (when region
+ (dolist (spec '(org-link org-link-description))
+ (org-fold-region (car region) (cdr region) nil spec))))
+ (when region
+ (dolist (spec (org-fold-core-folding-spec-list))
+ ;; Links are taken care by above.
+ (unless (memq spec '(org-link org-link-description))
+ (org-fold-region (car region) (cdr region) nil spec))))))
+ (unless (org-before-first-heading-p)
+ (org-with-limited-levels
+ (cl-case detail
+ ((tree canonical t) (org-fold-show-children))
+ ((nil minimal ancestors ancestors-full))
+ (t (save-excursion
+ (outline-next-heading)
+ (org-fold-heading nil)))))))
+ ;; Show whole subtree.
+ (when (eq detail 'ancestors-full) (org-fold-show-subtree))
+ ;; Show all siblings.
+ (when (eq detail 'lineage) (org-fold-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-fold-heading nil)
+ (when (memq detail '(canonical t)) (org-fold-show-entry))
+ (when (memq detail '(tree canonical t)) (org-fold-show-children))))))
+
+(defun org-fold-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-fold-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-fold-reveal-start-hook)
+ (cond ((equal siblings '(4)) (org-fold-show-set-visibility 'canonical))
+ ((equal siblings '(16))
+ (save-excursion
+ (when (org-up-heading-safe)
+ (org-fold-show-subtree)
+ (run-hook-with-args 'org-cycle-hook 'subtree))))
+ (t (org-fold-show-set-visibility 'lineage))))
+
+;;; Make isearch search in some text hidden via text properties.
+
+(defun org-fold--isearch-reveal (&rest _)
+ "Reveal text at POS found by isearch."
+ (org-fold-show-context 'isearch))
+
+;;; Handling changes in folded elements
+
+(defun org-fold--extend-changed-region (from to)
+ "Consider folded regions in the next/previous line when fixing
+region visibility.
+This function is intended to be used as a member of
+`org-fold-core-extend-changed-region-functions'."
+ ;; If the edit is done in the first line of a folded drawer/block,
+ ;; the folded text is only starting from the next line and needs to
+ ;; be checked.
+ (setq to (save-excursion (goto-char to) (line-beginning-position 2)))
+ ;; If the ":END:" line of the drawer is deleted, the folded text is
+ ;; only ending at the previous line and needs to be checked.
+ (setq from (save-excursion (goto-char from) (line-beginning-position 0)))
+ (cons from to))
+
+(defun org-fold--reveal-headline-at-point ()
+ "Reveal header line and empty contents inside.
+Reveal the header line and, if present, also reveal its contents, when
+the contents consists of blank lines.
+
+Assume that point is located at the header line."
+ (org-with-wide-buffer
+ (beginning-of-line)
+ (org-fold-region
+ (max (point-min) (1- (point)))
+ (let ((endl (line-end-position)))
+ (save-excursion
+ (goto-char endl)
+ (skip-chars-forward "\n\t\r ")
+ ;; Unfold blank lines after newly inserted headline.
+ (if (equal (point)
+ (save-excursion
+ (goto-char endl)
+ (org-end-of-subtree)
+ (skip-chars-forward "\n\t\r ")))
+ (point)
+ endl)))
+ nil 'headline)))
+
+(defun org-fold--reveal-outline-maybe (region _)
+ "Reveal folded outline in REGION when needed.
+
+This function is intended to be used as :fragile property of
+`org-fold-outline' spec. See `org-fold-core--specs' for details."
+ (save-match-data
+ (org-with-wide-buffer
+ (goto-char (car region))
+ ;; The line before beginning of the fold should be either a
+ ;; headline or a list item.
+ (backward-char)
+ (beginning-of-line)
+ ;; Make sure that headline is not partially hidden.
+ (unless (org-fold-folded-p nil 'headline)
+ (org-fold--reveal-headline-at-point))
+ ;; Never hide level 1 headlines
+ (save-excursion
+ (goto-char (line-end-position))
+ (unless (>= (point) (cdr region))
+ (when (re-search-forward (rx bol "* ") (cdr region) t)
+ (org-fold--reveal-headline-at-point))))
+ ;; Make sure that headline after is not partially hidden.
+ (goto-char (cdr region))
+ (beginning-of-line)
+ (unless (org-fold-folded-p nil 'headline)
+ (when (looking-at-p org-element-headline-re)
+ (org-fold--reveal-headline-at-point)))
+ ;; Check the validity of headline
+ (goto-char (car region))
+ (backward-char)
+ (beginning-of-line)
+ (unless (let ((case-fold-search t))
+ (looking-at (rx-to-string
+ `(or (regex ,(org-item-re))
+ (regex ,org-outline-regexp-bol)))))
+ t))))
+
+(defun org-fold--reveal-drawer-or-block-maybe (region spec)
+ "Reveal folded drawer/block (according to SPEC) in REGION when needed.
+
+This function is intended to be used as :fragile property of
+`org-fold-drawer' or `org-fold-block' spec."
+ (let ((begin-re (cond
+ ((eq spec (org-fold-core-get-folding-spec-from-alias 'drawer))
+ org-drawer-regexp)
+ ;; Group one below contains the type of the block.
+ ((eq spec (org-fold-core-get-folding-spec-from-alias 'block))
+ (rx bol (zero-or-more (any " " "\t"))
+ "#+begin"
+ (or ":"
+ (seq "_"
+ (group (one-or-more (not (syntax whitespace))))))))))
+ ;; To be determined later. May depend on `begin-re' match (i.e. for blocks).
+ end-re)
+ (save-match-data ; we should not clobber match-data in after-change-functions
+ (let ((fold-begin (car region))
+ (fold-end (cdr region)))
+ (let (unfold?)
+ (catch :exit
+ ;; The line before folded text should be beginning of
+ ;; the drawer/block.
+ (save-excursion
+ (goto-char fold-begin)
+ ;; The line before beginning of the fold should be the
+ ;; first line of the drawer/block.
+ (backward-char)
+ (beginning-of-line)
+ (unless (let ((case-fold-search t))
+ (looking-at begin-re)) ; the match-data will be used later
+ (throw :exit (setq unfold? t))))
+ ;; Set `end-re' for the current drawer/block.
+ (setq end-re
+ (cond
+ ((eq spec (org-fold-core-get-folding-spec-from-alias 'drawer))
+ org-property-end-re)
+ ((eq spec (org-fold-core-get-folding-spec-from-alias 'block))
+ (let ((block-type (match-string 1))) ; the last match is from `begin-re'
+ (concat (rx bol (zero-or-more (any " " "\t")) "#+end")
+ (if block-type
+ (concat "_"
+ (regexp-quote block-type)
+ (rx (zero-or-more (any " " "\t")) eol))
+ (rx (opt ":") (zero-or-more (any " " "\t")) eol)))))))
+ ;; The last line of the folded text should match `end-re'.
+ (save-excursion
+ (goto-char fold-end)
+ (beginning-of-line)
+ (unless (let ((case-fold-search t))
+ (looking-at end-re))
+ (throw :exit (setq unfold? t))))
+ ;; There should be no `end-re' or
+ ;; `org-outline-regexp-bol' anywhere in the
+ ;; drawer/block body.
+ (save-excursion
+ (goto-char fold-begin)
+ (when (save-excursion
+ (let ((case-fold-search t))
+ (re-search-forward (rx-to-string `(or (regex ,end-re)
+ (regex ,org-outline-regexp-bol)))
+ (max (point)
+ (1- (save-excursion
+ (goto-char fold-end)
+ (line-beginning-position))))
+ t)))
+ (throw :exit (setq unfold? t)))))
+ unfold?)))))
+
+;; Catching user edits inside invisible text
+(defun org-fold-check-before-invisible-edit (kind)
+ "Check if editing KIND is dangerous with invisible text around.
+The detailed reaction depends on the user option
+`org-fold-catch-invisible-edits'."
+ ;; First, try to get out of here as quickly as possible, to reduce overhead
+ (when (and org-fold-catch-invisible-edits
+ (or (not (boundp 'visible-mode)) (not visible-mode))
+ (or (org-invisible-p)
+ (org-invisible-p (max (point-min) (1- (point))))))
+ ;; OK, we need to take a closer look. Only consider invisibility
+ ;; caused by folding of headlines, drawers, and blocks. Edits
+ ;; inside links will be handled by font-lock.
+ (let* ((invisible-at-point (org-fold-folded-p (point) '(headline drawer block)))
+ (invisible-before-point
+ (and (not (bobp))
+ (org-fold-folded-p (1- (point)) '(headline drawer block))))
+ (border-and-ok-direction
+ (or
+ ;; Check if we are acting predictably before invisible
+ ;; text.
+ (and invisible-at-point (not invisible-before-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-fold-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
+ (org-fold-show-set-visibility 'local))
+ (when invisible-before-point
+ (org-with-point-at (1- (point)) (org-fold-show-set-visibility 'local)))
+ (cond
+ ((eq org-fold-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-fold-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"))))))))
+
+(provide 'org-fold)
+
+;;; org-fold.el ends here
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index 112d6504fe7..aedd413351c 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -4,7 +4,7 @@
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
;;;; Declarations
(require 'cl-lib)
@@ -39,7 +42,7 @@
(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-at-point "org-element" (&optional pom cached-only))
(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))
@@ -52,7 +55,7 @@
(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 org-fold-show-context "org-fold" (&optional key))
(declare-function outline-next-heading "outline")
(defvar electric-indent-mode)
@@ -91,13 +94,13 @@ Match group 1 contains definition's label.")
(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 can be nil, to place footnotes locally at the end of the current
+outline node. It can also be a string representing 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
+the notes. However, by hand, you may place definitions
*anywhere*.
If this is a string, during export, all subtrees starting with
@@ -110,7 +113,7 @@ you will need to run the following command after the change:
:group 'org-footnote
:initialize 'custom-initialize-default
:set (lambda (var val)
- (set var val)
+ (set-default-toplevel-value var val)
(when (fboundp 'org-element-cache-reset)
(org-element-cache-reset 'all)))
:type '(choice
@@ -555,7 +558,7 @@ value if point was successfully moved."
(goto-char def-start)
(looking-at (format "\\[fn:%s[]:]" (regexp-quote label)))
(goto-char (match-end 0))
- (org-show-context 'link-search)
+ (org-fold-show-context 'link-search)
(when (derived-mode-p 'org-mode)
(message "%s" (substitute-command-keys
"Edit definition and go back with \
@@ -581,7 +584,7 @@ value if point was successfully moved."
(user-error "Reference is outside narrowed part of buffer")))
(org-mark-ring-push)
(goto-char start)
- (org-show-context 'link-search)))
+ (org-fold-show-context 'link-search)))
;;;; Getters
diff --git a/lisp/org/org-goto.el b/lisp/org/org-goto.el
index 860b0a3de41..6801303840b 100644
--- a/lisp/org/org-goto.el
+++ b/lisp/org/org-goto.el
@@ -22,6 +22,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(require 'org-refile)
@@ -110,10 +113,8 @@ When nil, you can use these keybindings to navigate the buffer:
(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)
+ (define-key-after map [t] 'org-goto-local-auto-isearch)
+ (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)
@@ -157,7 +158,7 @@ When nil, you can use these keybindings to navigate the buffer:
(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))))
+ (font-lock-ensure))))
(defun org-goto-ret (&optional _arg)
"Finish `org-goto' by going to the new location."
@@ -222,13 +223,13 @@ position or nil."
" 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)
+ (org-cycle-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)))
+ (org-fold-show-set-visibility 'lineage)))
(goto-char (point-min)))
(let (org-special-ctrl-a/e) (org-beginning-of-line))
(message "Select location and press RET")
@@ -279,7 +280,7 @@ With a prefix argument, use the alternative interface: e.g., if
(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)))
+ (org-fold-show-context 'org-goto)))
(message "Quit"))))
(provide 'org-goto)
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 3bf4307f4a1..677b7adb6f0 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -4,7 +4,7 @@
;; Author: John Wiegley <johnw at gnu dot org>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org)
(require 'org-agenda)
@@ -423,8 +426,7 @@ current time."
"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))))
+ (moment (time-subtract nil (* 3600 org-extend-today-until))))
(save-excursion
(goto-char (if line (line-beginning-position) (point-min)))
(while (not (eobp))
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index 2fb299d5e89..8cb5666a299 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -4,7 +4,7 @@
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -70,12 +70,17 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(require 'org-refile)
(require 'ol)
(declare-function message-make-fqdn "message" ())
(declare-function org-goto-location "org-goto" (&optional _buf help))
+;; Declared inside `org-element-with-disabled-cache' macro.
+(declare-function org-element--cache-active-p "org-element.el" (&optional called-from-cache-change-func-p))
;;; Customization
@@ -330,7 +335,7 @@ Move the cursor to that entry in that buffer."
(pop-to-buffer-same-window (marker-buffer m))
(goto-char m)
(move-marker m nil)
- (org-show-context)))
+ (org-fold-show-context)))
;;;###autoload
(defun org-id-find (id &optional markerp)
@@ -488,8 +493,8 @@ and TIME is a Lisp time value (HI LO USEC)."
(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'.
+This will scan all agenda files, all associated archives, all open Org
+files, 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)
@@ -512,6 +517,8 @@ If SILENT is non-nil, messages are suppressed."
org-id-extra-files)
;; All files known to have IDs.
org-id-files
+ ;; All Org files open in Emacs.
+ (mapcar #'buffer-file-name (org-buffer-list 'files t))
;; Additional files from function call.
files)))))
(nfiles (length files))
@@ -521,30 +528,31 @@ If SILENT is non-nil, messages are suppressed."
(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)))))))))))
+ (org-element-with-disabled-cache
+ (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.
@@ -741,7 +749,7 @@ or filename if no title."
(funcall cmd (marker-buffer m)))
(goto-char m)
(move-marker m nil)
- (org-show-context)))
+ (org-fold-show-context)))
(org-link-set-parameters "id" :follow #'org-id-open)
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index fd19b14db6b..de237415cc8 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -4,7 +4,7 @@
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -37,6 +37,9 @@
;;; Code:
(require 'org-macs)
+(org-assert-version)
+
+(require 'org-macs)
(require 'org-compat)
(require 'org)
@@ -330,7 +333,7 @@ stopped."
(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))))
+ (time-limit (and delay (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).
@@ -343,7 +346,7 @@ stopped."
;; 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))
+ ((and delay (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)
@@ -409,7 +412,13 @@ This function is meant to be called by `after-change-functions'."
(goto-char beg)
(beginning-of-line)
(re-search-forward
- (org-with-limited-levels org-outline-regexp-bol) end t)))
+ (org-with-limited-levels org-outline-regexp-bol)
+ (save-excursion
+ (goto-char end)
+ ;; Extend to headline if END is within its
+ ;; headline stars.
+ (line-end-position))
+ t)))
(let ((end (save-excursion
(goto-char end)
(org-with-limited-levels (outline-next-heading))
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index 2cbbf7f7ac3..1c4124d4c72 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -4,7 +4,7 @@
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -78,6 +78,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(defgroup org-inlinetask nil
@@ -305,8 +308,10 @@ If the task has an end part, also demote it."
(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."
+(defun org-inlinetask-toggle-visibility (&optional state)
+ "Toggle visibility of inline task at point.
+When optional argument STATE is `fold', fold unconditionally.
+When STATE is `unfold', unfold unconditionally."
(let ((end (save-excursion
(org-inlinetask-goto-end)
(if (bolp) (1- (point)) (point))))
@@ -317,9 +322,11 @@ If the task has an end part, also demote it."
;; 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)))))
+ ((and (not (eq state 'fold))
+ (or (eq state 'unfold)
+ (org-fold-get-folding-spec 'headline (1+ start))))
+ (org-fold-region start end nil 'headline))
+ (t (org-fold-region start end t 'headline)))))
(defun org-inlinetask-hide-tasks (state)
"Hide inline tasks in buffer when STATE is `contents' or `children'.
@@ -330,14 +337,14 @@ This function is meant to be used in `org-cycle-hook'."
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
- (org-inlinetask-toggle-visibility)
+ (org-inlinetask-toggle-visibility 'fold)
(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-toggle-visibility 'fold)
(org-inlinetask-goto-end))))))
(defun org-inlinetask-remove-END-maybe ()
diff --git a/lisp/org/org-install.el b/lisp/org/org-install.el
deleted file mode 100644
index d521d819db2..00000000000
--- a/lisp/org/org-install.el
+++ /dev/null
@@ -1,17 +0,0 @@
-;;; org-install.el --- backward compatibility file for obsolete configuration -*- lexical-binding: t -*-
-;;
-;;; Code:
-;;
-;; The file org-install is obsolete.
-;;
-;; It is provided here so that (require 'org-install) does not
-;; trigger an error for users with obsolete Emacs configuration.
-;; You can safely remove (require 'org-install) from your config."
-
-(provide 'org-install)
-
-;; Local Variables:
-;; no-byte-compile: t
-;; coding: utf-8
-;; End:
-;;; org-install.el ends here
diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el
index b3ba5dc85b6..95f64a3f9eb 100644
--- a/lisp/org/org-keys.el
+++ b/lisp/org/org-keys.el
@@ -27,6 +27,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(defvar org-outline-regexp)
@@ -67,8 +70,8 @@
(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-cycle "org-cycle" (&optional arg))
+(declare-function org-cycle-agenda-files "org-cycle" ())
(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))
@@ -81,7 +84,7 @@
(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-at-point "org-element" (&optional pom cached-only))
(declare-function org-element-type "org-element" (element))
(declare-function org-emphasize "org" (&optional char))
(declare-function org-end-of-line "org" (&optional n))
@@ -94,7 +97,7 @@
(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-cycle-force-archived "org-cycle" ())
(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))
@@ -128,7 +131,7 @@
(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-narrow-to-subtree "org" (&optional element))
(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))
@@ -143,8 +146,8 @@
(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 "org-refile" (&optional arg1 default-buffer rfloc msg))
+(declare-function org-refile-copy "org-refile" ())
(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))
@@ -152,7 +155,7 @@
(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-fold-reveal "org-fold" (&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))
@@ -172,9 +175,9 @@
(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-fold-show-all "org-fold" (&optional types))
+(declare-function org-fold-show-children "org-fold" (&optional level))
+(declare-function org-fold-show-subtree "org-fold" ())
(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))
@@ -201,7 +204,7 @@
(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-toggle-inline-images "org" (&optional include-linked beg end))
(declare-function org-latex-preview "org" (&optional arg))
(declare-function org-toggle-narrow-to-subtree "org" ())
(declare-function org-toggle-ordered-property "org" ())
@@ -244,7 +247,7 @@ become effective."
(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
+This happens automatically if `display-graphic-p' returns nil. This
variable lets you do the same manually. You must set it before
loading Org."
:group 'org-startup
@@ -423,7 +426,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
(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-show-subtree] #'org-fold-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]
@@ -437,14 +440,14 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
#'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)
+(define-key org-mode-map [remap outline-show-children] #'org-fold-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)
+(org-defkey org-mode-map (kbd "C-c C-<tab>") #'org-cycle-force-archived)
;; Override text-mode binding to expose `complete-symbol' for
;; pcomplete functionality.
(org-defkey org-mode-map (kbd "M-TAB") nil)
@@ -462,6 +465,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
;;;; Cursor keys with modifiers
(org-defkey org-mode-map (kbd "M-<left>") #'org-metaleft)
+(org-defkey org-mode-map (kbd "ESC <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)
@@ -495,7 +499,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
;; 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))
+(when (or org-use-extra-keys (not (display-graphic-p)))
(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)
@@ -544,7 +548,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
;;;; 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-c C-r") #'org-fold-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)
@@ -804,10 +808,6 @@ command."
(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
diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el
index 6d8cf3f2374..ff2999cb8fa 100644
--- a/lisp/org/org-lint.el
+++ b/lisp/org/org-lint.el
@@ -22,282 +22,331 @@
;;; Commentary:
-;; This library implements linting for Org syntax. The sole public
-;; function is `org-lint', which see.
+;; This library implements linting for Org syntax. The process is
+;; started by calling `org-lint' command, 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'.
+;; New checkers are added by `org-lint-add-checker' function.
+;; Internally, all checks are 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
+;; Checks currently implemented report the following:
+
+;; - duplicates CUSTOM_ID properties,
+;; - duplicate NAME values,
+;; - duplicate targets,
+;; - duplicate footnote definitions,
+;; - orphaned affiliated keywords,
+;; - obsolete affiliated keywords,
+;; - deprecated export block syntax,
+;; - deprecated Babel header syntax,
+;; - missing language in source blocks,
+;; - missing back-end in export blocks,
+;; - invalid Babel call blocks,
+;; - NAME values with a colon,
+;; - wrong babel headers,
+;; - invalid value in babel headers,
+;; - 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 misleading link parameter,
+;; - obsolete markup in INCLUDE keyword,
+;; - unknown items in OPTIONS keyword,
+;; - spurious macro arguments or invalid macro templates,
+;; - special properties in properties drawers,
+;; - obsolete syntax for properties drawers,
+;; - invalid duration in EFFORT property,
+;; - 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,
+;; - probable incomplete drawers,
+;; - probable indented diary-sexps,
+;; - obsolete QUOTE section,
+;; - obsolete "file+application" link,
+;; - obsolete escape syntax in links,
+;; - spurious colons in tags,
+;; - invalid bibliography file,
+;; - missing "print_bibliography" keyword,
+;; - invalid value for "cite_export" keyword,
+;; - incomplete citation object.
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ob)
+(require 'oc)
(require 'ol)
(require 'org-attach)
(require 'org-macro)
+(require 'org-fold)
(require 'ox)
+(require 'seq)
-;;; Checkers
+;;; Checkers structure
(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.")
+ name summary function trust categories)
+
+(defvar org-lint--checkers nil
+ "List of all available checkers.
+This list is populated by `org-lint-add-checker' function.")
+
+;;;###autoload
+(defun org-lint-add-checker (name summary fun &rest props)
+ "Add a new checker for linter.
+
+NAME is a unique check identifier, as a non-nil symbol. SUMMARY
+is a short description of the check, as a string.
+
+The check is done calling the function FUN 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) where POSITION refer to the buffer
+position of the error, as an integer, and MESSAGE is a one-line
+string describing the error.
+
+Optional argument PROPS provides additional information about the
+checker. Currently, two properties are supported:
+
+ `: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."
+ (declare (indent 1))
+ ;; Sanity checks.
+ (pcase name
+ (`nil (error "Name field is mandatory for checkers"))
+ ((pred symbolp) nil)
+ (_ (error "Invalid type for name field")))
+ (unless (functionp fun)
+ (error "Checker field is expected to be a valid function"))
+ ;; Install checker in `org-lint--checkers'; uniquify by name.
+ (setq org-lint--checkers
+ (cons (apply #'make-org-lint-checker
+ :name name
+ :summary summary
+ :function fun
+ props)
+ (seq-remove (lambda (c) (eq name (org-lint-checker-name c)))
+ org-lint--checkers))))
+
+
+;;; 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 (org-lint-checker-function 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-fold-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))
+
+
+;;; Main 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 category (org-lint-checker-categories c)))
+ 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"))))
+
+
+;;; Checker functions
(defun org-lint--collect-duplicates
(ast type extract-key extract-position build-message)
@@ -334,7 +383,7 @@ called with one argument, the key used for comparison."
ast
'node-property
(lambda (property)
- (and (string-equal-ignore-case
+ (and (org-string-equal-ignore-case
"CUSTOM_ID" (org-element-property :key property))
(org-element-property :value property)))
(lambda (property _) (org-element-property :begin property))
@@ -601,39 +650,40 @@ in description"
(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))))))))))))
+ (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)))))
+ (unless (org-url-p file)
+ (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"
@@ -1016,8 +1066,10 @@ Use \"export %s\" instead"
(`keyword
(when (string= (org-element-property :key datum) "PROPERTY")
(let ((value (org-element-property :value datum)))
- (when (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)?\\+? *"
- value)
+ (when (or (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)?\\+ *"
+ value)
+ (string-match "\\`header-args\\(?::\\(\\S-+\\)\\)? *"
+ value))
(funcall verify
datum
(match-string 1 value)
@@ -1026,8 +1078,10 @@ Use \"export %s\" instead"
(`node-property
(let ((key (org-element-property :key datum)))
(when (let ((case-fold-search t))
- (string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?\\+?"
- key))
+ (or (string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?\\+"
+ key)
+ (string-match "\\`HEADER-ARGS\\(?::\\(\\S-+\\)\\)?"
+ key)))
(funcall verify
datum
(match-string 1 key)
@@ -1123,196 +1177,278 @@ Use \"export %s\" instead"
(list (org-element-property :begin h)
"Tags contain a spurious colon")))))
+(defun org-lint-non-existent-bibliography (ast)
+ (org-element-map ast 'keyword
+ (lambda (k)
+ (when (equal "BIBLIOGRAPHY" (org-element-property :key k))
+ (let ((file (org-strip-quotes (org-element-property :value k))))
+ (and (not (file-remote-p file))
+ (not (file-exists-p file))
+ (list (org-element-property :begin k)
+ (format "Non-existent bibliography %S" file))))))))
+
+(defun org-lint-missing-print-bibliography (ast)
+ (and (org-element-map ast 'citation #'identity nil t)
+ (not (org-element-map ast 'keyword
+ (lambda (k)
+ (equal "PRINT_BIBLIOGRAPHY" (org-element-property :key k)))
+ nil t))
+ (list
+ (list (point-max) "Possibly missing \"PRINT_BIBLIOGRAPHY\" keyword"))))
+
+(defun org-lint-invalid-cite-export-declaration (ast)
+ (org-element-map ast 'keyword
+ (lambda (k)
+ (when (equal "CITE_EXPORT" (org-element-property :key k))
+ (let ((value (org-element-property :value k))
+ (source (org-element-property :begin k)))
+ (if (equal value "")
+ (list source "Missing export processor name")
+ (condition-case _
+ (pcase (org-cite-read-processor-declaration value)
+ (`(,(and (pred symbolp) name)
+ ,(pred string-or-null-p)
+ ,(pred string-or-null-p))
+ (unless (org-cite-get-processor name)
+ (list source "Unknown cite export processor %S" name)))
+ (_
+ (list source "Invalid cite export processor declaration")))
+ (error
+ (list source "Invalid cite export processor declaration")))))))))
+
+(defun org-lint-incomplete-citation (ast)
+ (org-element-map ast 'plain-text
+ (lambda (text)
+ (and (string-match-p org-element-citation-prefix-re text)
+ ;; XXX: The code below signals the error at the beginning
+ ;; of the paragraph containing the faulty object. It is
+ ;; not very accurate but may be enough for now.
+ (list (org-element-property :contents-begin
+ (org-element-property :parent text))
+ "Possibly incomplete citation markup")))))
-;;; 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"))))
+;;; Checkers declaration
+
+(org-lint-add-checker 'duplicate-custom-id
+ "Report duplicates CUSTOM_ID properties"
+ #'org-lint-duplicate-custom-id
+ :categories '(link))
+
+(org-lint-add-checker 'duplicate-name
+ "Report duplicate NAME values"
+ #'org-lint-duplicate-name
+ :categories '(babel 'link))
+
+(org-lint-add-checker 'duplicate-target
+ "Report duplicate targets"
+ #'org-lint-duplicate-target
+ :categories '(link))
+
+(org-lint-add-checker 'duplicate-footnote-definition
+ "Report duplicate footnote definitions"
+ #'org-lint-duplicate-footnote-definition
+ :categories '(footnote))
+
+(org-lint-add-checker 'orphaned-affiliated-keywords
+ "Report orphaned affiliated keywords"
+ #'org-lint-orphaned-affiliated-keywords
+ :trust 'low)
+
+(org-lint-add-checker 'obsolete-affiliated-keywords
+ "Report obsolete affiliated keywords"
+ #'org-lint-obsolete-affiliated-keywords
+ :categories '(obsolete))
+
+(org-lint-add-checker 'deprecated-export-blocks
+ "Report deprecated export block syntax"
+ #'org-lint-deprecated-export-blocks
+ :trust 'low :categories '(obsolete export))
+
+(org-lint-add-checker 'deprecated-header-syntax
+ "Report deprecated Babel header syntax"
+ #'org-lint-deprecated-header-syntax
+ :trust 'low :categories '(obsolete babel))
+
+(org-lint-add-checker 'missing-language-in-src-block
+ "Report missing language in source blocks"
+ #'org-lint-missing-language-in-src-block
+ :categories '(babel))
+
+(org-lint-add-checker 'missing-backend-in-export-block
+ "Report missing back-end in export blocks"
+ #'org-lint-missing-backend-in-export-block
+ :categories '(export))
+
+(org-lint-add-checker 'invalid-babel-call-block
+ "Report invalid Babel call blocks"
+ #'org-lint-invalid-babel-call-block
+ :categories '(babel))
+
+(org-lint-add-checker 'colon-in-name
+ "Report NAME values with a colon"
+ #'org-lint-colon-in-name
+ :categories '(babel))
+
+(org-lint-add-checker 'wrong-header-argument
+ "Report wrong babel headers"
+ #'org-lint-wrong-header-argument
+ :categories '(babel))
+
+(org-lint-add-checker 'wrong-header-value
+ "Report invalid value in babel headers"
+ #'org-lint-wrong-header-value
+ :categories '(babel) :trust 'low)
+
+(org-lint-add-checker 'deprecated-category-setup
+ "Report misuse of CATEGORY keyword"
+ #'org-lint-deprecated-category-setup
+ :categories '(obsolete))
+
+(org-lint-add-checker 'invalid-coderef-link
+ "Report \"coderef\" links with unknown destination"
+ #'org-lint-invalid-coderef-link
+ :categories '(link))
+
+(org-lint-add-checker 'invalid-custom-id-link
+ "Report \"custom-id\" links with unknown destination"
+ #'org-lint-invalid-custom-id-link
+ :categories '(link))
+
+(org-lint-add-checker 'invalid-fuzzy-link
+ "Report \"fuzzy\" links with unknown destination"
+ #'org-lint-invalid-fuzzy-link
+ :categories '(link))
+
+(org-lint-add-checker 'invalid-id-link
+ "Report \"id\" links with unknown destination"
+ #'org-lint-invalid-id-link
+ :categories '(link))
+
+(org-lint-add-checker 'link-to-local-file
+ "Report links to non-existent local files"
+ #'org-lint-link-to-local-file
+ :categories '(link) :trust 'low)
+
+(org-lint-add-checker 'non-existent-setupfile-parameter
+ "Report SETUPFILE keywords with non-existent file parameter"
+ #'org-lint-non-existent-setupfile-parameter
+ :trust 'low)
+
+(org-lint-add-checker 'wrong-include-link-parameter
+ "Report INCLUDE keywords with misleading link parameter"
+ #'org-lint-wrong-include-link-parameter
+ :categories '(export) :trust 'low)
+
+(org-lint-add-checker 'obsolete-include-markup
+ "Report obsolete markup in INCLUDE keyword"
+ #'org-lint-obsolete-include-markup
+ :categories '(obsolete export) :trust 'low)
+
+(org-lint-add-checker 'unknown-options-item
+ "Report unknown items in OPTIONS keyword"
+ #'org-lint-unknown-options-item
+ :categories '(export) :trust 'low)
+
+(org-lint-add-checker 'invalid-macro-argument-and-template
+ "Report spurious macro arguments or invalid macro templates"
+ #'org-lint-invalid-macro-argument-and-template
+ :categories '(export) :trust 'low)
+
+(org-lint-add-checker 'special-property-in-properties-drawer
+ "Report special properties in properties drawers"
+ #'org-lint-special-property-in-properties-drawer
+ :categories '(properties))
+
+(org-lint-add-checker 'obsolete-properties-drawer
+ "Report obsolete syntax for properties drawers"
+ #'org-lint-obsolete-properties-drawer
+ :categories '(obsolete properties))
+
+(org-lint-add-checker 'invalid-effort-property
+ "Report invalid duration in EFFORT property"
+ #'org-lint-invalid-effort-property
+ :categories '(properties))
+
+(org-lint-add-checker 'undefined-footnote-reference
+ "Report missing definition for footnote references"
+ #'org-lint-undefined-footnote-reference
+ :categories '(footnote))
+
+(org-lint-add-checker 'unreferenced-footnote-definition
+ "Report missing reference for footnote definitions"
+ #'org-lint-unreferenced-footnote-definition
+ :categories '(footnote))
+
+(org-lint-add-checker 'extraneous-element-in-footnote-section
+ "Report non-footnote definitions in footnote section"
+ #'org-lint-extraneous-element-in-footnote-section
+ :categories '(footnote))
+
+(org-lint-add-checker 'invalid-keyword-syntax
+ "Report probable invalid keywords"
+ #'org-lint-invalid-keyword-syntax
+ :trust 'low)
+
+(org-lint-add-checker 'invalid-block
+ "Report invalid blocks"
+ #'org-lint-invalid-block
+ :trust 'low)
+
+(org-lint-add-checker 'misplaced-planning-info
+ "Report misplaced planning info line"
+ #'org-lint-misplaced-planning-info
+ :trust 'low)
+
+(org-lint-add-checker 'incomplete-drawer
+ "Report probable incomplete drawers"
+ #'org-lint-incomplete-drawer
+ :trust 'low)
+
+(org-lint-add-checker 'indented-diary-sexp
+ "Report probable indented diary-sexps"
+ #'org-lint-indented-diary-sexp
+ :trust 'low)
+
+(org-lint-add-checker 'quote-section
+ "Report obsolete QUOTE section"
+ #'org-lint-quote-section
+ :categories '(obsolete) :trust 'low)
+
+(org-lint-add-checker 'file-application
+ "Report obsolete \"file+application\" link"
+ #'org-lint-file-application
+ :categories '(link obsolete))
+
+(org-lint-add-checker 'percent-encoding-link-escape
+ "Report obsolete escape syntax in links"
+ #'org-lint-percent-encoding-link-escape
+ :categories '(link obsolete) :trust 'low)
+
+(org-lint-add-checker 'spurious-colons
+ "Report spurious colons in tags"
+ #'org-lint-spurious-colons
+ :categories '(tags))
+
+(org-lint-add-checker 'non-existent-bibliography
+ "Report invalid bibliography file"
+ #'org-lint-non-existent-bibliography
+ :categories '(cite))
+
+(org-lint-add-checker 'missing-print-bibliography
+ "Report missing \"print_bibliography\" keyword"
+ #'org-lint-missing-print-bibliography
+ :categories '(cite))
+
+(org-lint-add-checker 'invalid-cite-export-declaration
+ "Report invalid value for \"cite_export\" keyword"
+ #'org-lint-invalid-cite-export-declaration
+ :categories '(cite))
+
+(org-lint-add-checker 'incomplete-citation
+ "Report incomplete citation object"
+ #'org-lint-incomplete-citation
+ :categories '(cite) :trust 'low)
(provide 'org-lint)
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index 978e36ed617..606bdb3d8e7 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Bastien Guerry <bzg@gnu.org>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -76,9 +76,14 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-macs)
(require 'org-compat)
+(require 'org-fold-core)
+(require 'org-footnote)
(defvar org-M-RET-may-split-line)
(defvar org-adapt-indentation)
@@ -103,7 +108,7 @@
(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-at-point "org-element" (&optional pom cached-only))
(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))
@@ -133,12 +138,13 @@
(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-narrow-to-subtree "org" (&optional element))
(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-fold-show-subtree "org-fold" ())
+(declare-function org-fold-region "org-fold" (from to flag &optional spec))
(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))
@@ -233,7 +239,7 @@ interface or run the following code after updating it:
: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)
+ :set (lambda (var val) (set-default-toplevel-value var val)
(when (featurep 'org-element) (org-element-update-syntax))))
(defcustom org-list-allow-alphabetical nil
@@ -251,7 +257,7 @@ interface or run the following code after updating it:
:group 'org-plain-lists
:version "24.1"
:type 'boolean
- :set (lambda (var val) (set var val)
+ :set (lambda (var val) (set-default-toplevel-value var val)
(when (featurep 'org-element) (org-element-update-syntax))))
(defcustom org-list-two-spaces-after-bullet-regexp nil
@@ -406,7 +412,7 @@ group 4: description tag")
(ind-ref (if (or (looking-at "^[ \t]*$")
(and inlinetask-re (looking-at inlinetask-re)))
10000
- (current-indentation))))
+ (org-current-text-indentation))))
(cond
((eq (nth 2 context) 'invalid) nil)
((looking-at item-re) (point))
@@ -428,7 +434,7 @@ group 4: description tag")
;; Look for an item, less indented that reference line.
(catch 'exit
(while t
- (let ((ind (current-indentation)))
+ (let ((ind (org-current-text-indentation)))
(cond
;; This is exactly what we want.
((and (looking-at item-re) (< ind ind-ref))
@@ -598,7 +604,7 @@ Assume point is at an item."
(item-re (org-item-re))
(inlinetask-re (and (featurep 'org-inlinetask)
(org-inlinetask-outline-regexp)))
- (beg-cell (cons (point) (current-indentation)))
+ (beg-cell (cons (point) (org-current-text-indentation)))
itm-lst itm-lst-2 end-lst end-lst-2 struct
(assoc-at-point
;; Return association at point.
@@ -624,7 +630,7 @@ Assume point is at an item."
(save-excursion
(catch 'exit
(while t
- (let ((ind (current-indentation)))
+ (let ((ind (org-current-text-indentation)))
(cond
((<= (point) lim-up)
;; At upward limit: if we ended at an item, store it,
@@ -684,7 +690,7 @@ Assume point is at an item."
;; position of items in END-LST-2.
(catch 'exit
(while t
- (let ((ind (current-indentation)))
+ (let ((ind (org-current-text-indentation)))
(cond
((>= (point) lim-down)
;; At downward limit: this is de facto the end of the
@@ -1089,79 +1095,64 @@ 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)))
+ (org-fold-core-ignore-modifications
+ (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 inner folds responsible for visibility status.
+ (folds
+ (cons
+ (org-fold-core-get-regions :from beg-A :to end-A :relative t)
+ (org-fold-core-get-regions :from beg-B :to end-B :relative t))))
+ ;; Clear up the folds.
+ (org-fold-region beg-A end-B-no-blank nil)
+ ;; 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))
+ ;; Restore visibility status.
+ (org-fold-core-regions (cdr folds) :relative beg-A)
+ (org-fold-core-regions
+ (car folds)
+ :relative (+ beg-B (- size-B size-A (length between-A-no-blank-and-B))))
+ ;; 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))
+ ;; Return structure.
+ struct))))
(defun org-list-separating-blank-lines-number (pos struct prevs)
"Return number of blank lines that should separate items in list.
@@ -1850,7 +1841,7 @@ Initial position of cursor is restored after the changes."
(org-inlinetask-goto-beginning))
;; Shift only non-empty lines.
((looking-at-p "^[ \t]*\\S-")
- (indent-line-to (+ (current-indentation) delta))))
+ (indent-line-to (+ (org-current-text-indentation) delta))))
(forward-line -1))))
(modify-item
;; Replace ITEM first line elements with new elements from
@@ -1858,7 +1849,7 @@ Initial position of cursor is restored after the changes."
(lambda (item)
(goto-char item)
(let* ((new-ind (org-list-get-ind item struct))
- (old-ind (current-indentation))
+ (old-ind (org-current-text-indentation))
(new-bul (org-list-bullet-string
(org-list-get-bullet item struct)))
(old-bul (org-list-get-bullet item old-struct))
@@ -1866,7 +1857,22 @@ Initial position of cursor is restored after the changes."
(looking-at org-list-full-item-re)
;; a. Replace bullet
(unless (equal old-bul new-bul)
- (replace-match new-bul nil nil nil 1))
+ (let ((keep-space ""))
+ (save-excursion
+ ;; If origin is inside the bullet, preserve the
+ ;; spaces after origin.
+ (when (<= (match-beginning 1) origin (match-end 1))
+ (org-with-point-at origin
+ (save-match-data
+ (when (looking-at "[ \t]+")
+ (setq keep-space (match-string 0))))))
+ (replace-match "" nil nil nil 1)
+ (goto-char (match-end 1))
+ (insert-before-markers new-bul)
+ (insert keep-space))))
+ ;; Refresh potentially shifted match markers.
+ (goto-char item)
+ (looking-at org-list-full-item-re)
;; b. Replace checkbox.
(cond
((equal (match-string 3) new-box))
@@ -1933,7 +1939,7 @@ Initial position of cursor is restored after the changes."
;; Ignore empty lines. Also ignore blocks and
;; drawers contents.
(unless (looking-at-p "[ \t]*$")
- (setq min-ind (min (current-indentation) min-ind))
+ (setq min-ind (min (org-current-text-indentation) min-ind))
(cond
((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)")
(re-search-forward
@@ -2029,7 +2035,7 @@ Possible values are: `folded', `children' or `subtree'. See
((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))
+ (org-fold-region (save-excursion (goto-char item) (line-end-position))
item-end t 'outline)))
((eq view 'children)
;; First show everything.
@@ -2042,7 +2048,7 @@ Possible values are: `folded', `children' or `subtree'. See
((eq view 'subtree)
;; Show everything
(let ((item-end (org-list-get-item-end item struct)))
- (org-flag-region item item-end nil 'outline)))))
+ (org-fold-region item item-end nil 'outline)))))
(defun org-list-item-body-column (item)
"Return column at which body of ITEM should start."
@@ -2212,6 +2218,7 @@ item is invisible."
(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))
+ (beginning-of-line)
(looking-at org-list-full-item-re)
(goto-char (if (and (match-beginning 4)
(save-match-data
@@ -2240,12 +2247,19 @@ 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
+ (let ((origin (point-marker)))
(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))
+ ;; Record relative point position to bullet beginning.
+ (origin-offset (- origin
+ (+ (point) (org-list-get-ind (point) struct))))
+ ;; Record relative point position to bullet end.
+ (origin-offset2 (- origin
+ (+ (point) (org-list-get-ind (point) struct)
+ (length (org-list-get-bullet (point) struct)))))
(bullet (org-list-get-bullet list-beg struct))
(alpha-p (org-list-use-alpha-bul-p list-beg struct prevs))
(case-fold-search nil)
@@ -2291,7 +2305,24 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is
(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)))))
+ (org-list-struct-apply-struct struct old-struct))
+ (goto-char origin)
+ (setq struct (org-list-struct))
+ (cond
+ ((>= origin-offset2 0)
+ (beginning-of-line)
+ (move-marker origin (+ (point)
+ (org-list-get-ind (point) struct)
+ (length (org-list-get-bullet (point) struct))
+ origin-offset2))
+ (goto-char origin))
+ ((>= origin-offset 0)
+ (beginning-of-line)
+ (move-marker origin (+ (point)
+ (org-list-get-ind (point) struct)
+ origin-offset))
+ (goto-char origin)))
+ (move-marker origin nil))))
;;;###autoload
(define-minor-mode org-list-checkbox-radio-mode
@@ -2455,7 +2486,7 @@ subtree, ignoring planning line and any drawer following it."
(save-restriction
(save-excursion
(org-narrow-to-subtree)
- (org-show-subtree)
+ (org-fold-show-subtree)
(goto-char (point-min))
(let ((end (point-max)))
(while (< (point) end)
@@ -2910,7 +2941,7 @@ function is being called interactively."
(error "Missing key extractor"))))
(sort-func
(cond
- ((= dcst ?a) #'org-string-collate-lessp)
+ ((= dcst ?a) #'string-collate-lessp)
((= dcst ?f)
(or compare-func
(and interactive?
@@ -2991,7 +3022,38 @@ 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
+ (let ((extract-footnote-definitions
+ (lambda (end)
+ ;; Remove footnote definitions from point to END.
+ ;; Return the list of the extracted definitions.
+ (let (definitions element)
+ (save-excursion
+ (while (re-search-forward org-footnote-definition-re end t)
+ (setq element (org-element-at-point))
+ (when (eq 'footnote-definition
+ (org-element-type element))
+ (push (buffer-substring-no-properties
+ (org-element-property :begin element)
+ (org-element-property :end element))
+ definitions)
+ ;; Ensure at least 2 blank lines after the last
+ ;; footnote definition, thus not slurping the
+ ;; following element.
+ (unless (<= 2 (org-element-property
+ :post-blank
+ (org-element-at-point)))
+ (setf (car definitions)
+ (concat (car definitions)
+ (make-string
+ (- 2 (org-element-property
+ :post-blank
+ (org-element-at-point)))
+ ?\n))))
+ (delete-region
+ (org-element-property :begin element)
+ (org-element-property :end element))))
+ definitions))))
+ (shift-text
(lambda (ind end)
;; Shift text in current section to IND, from point to END.
;; The function leaves point to END line.
@@ -3001,7 +3063,7 @@ With a prefix argument ARG, change the region in a single item."
(save-excursion
(catch 'exit
(while (< (point) end)
- (let ((i (current-indentation)))
+ (let ((i (org-current-text-indentation)))
(cond
;; Skip blank lines and inline tasks.
((looking-at "^[ \t]*$"))
@@ -3017,7 +3079,7 @@ With a prefix argument ARG, change the region in a single item."
(while (< (point) end)
(unless (or (looking-at "^[ \t]*$")
(looking-at org-outline-regexp-bol))
- (indent-line-to (+ (current-indentation) delta)))
+ (indent-line-to (+ (org-current-text-indentation) delta)))
(forward-line))))))
(skip-blanks
(lambda (pos)
@@ -3049,7 +3111,7 @@ With a prefix argument ARG, change the region in a single item."
(skip-chars-forward " \t")
(delete-region (point) (match-end 0)))
(forward-line)))
- ;; Case 2. Start at an heading: convert to items.
+ ;; Case 2. Start at a heading: convert to items.
((org-at-heading-p)
;; Remove metadata
(let (org-loop-over-headlines-in-active-region)
@@ -3065,7 +3127,9 @@ With a prefix argument ARG, change the region in a single item."
(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))))
+ (ref-level (org-reduced-level (org-outline-level)))
+ (footnote-definitions
+ (funcall extract-footnote-definitions end)))
(while (< (point) end)
(let* ((level (org-reduced-level (org-outline-level)))
(delta (max 0 (- level ref-level)))
@@ -3094,8 +3158,8 @@ With a prefix argument ARG, change the region in a single item."
"[X]"
"[ ]"))
(org-list-write-struct struct
- (org-list-parents-alist struct)
- old)))
+ (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
@@ -3103,13 +3167,23 @@ With a prefix argument ARG, change the region in a single item."
(forward-line)
(funcall shift-text
(+ start-ind (* (1+ delta) bul-len))
- (min end section-end)))))))
+ (min end section-end)))))
+ (when footnote-definitions
+ (goto-char end)
+ ;; Insert footnote definitions after the list.
+ (unless (bolp) (beginning-of-line 2))
+ ;; At (point-max).
+ (unless (bolp) (insert "\n"))
+ (dolist (def footnote-definitions)
+ (insert def)))))
;; 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)))
+ (ref-ind (org-current-text-indentation))
+ (footnote-definitions
+ (funcall extract-footnote-definitions end)))
(skip-chars-forward " \t")
(insert bul)
(forward-line)
@@ -3120,7 +3194,21 @@ With a prefix argument ARG, change the region in a single item."
(+ ref-ind bul-len)
(min end (save-excursion (or (outline-next-heading)
(point)))))
- (forward-line))))
+ (forward-line))
+ (when footnote-definitions
+ ;; If the new list is followed by same-level items,
+ ;; move past them as well.
+ (goto-char (org-element-property
+ :end
+ (org-element-lineage
+ (org-element-at-point (1- end))
+ '(plain-list) t)))
+ ;; Insert footnote definitions after the list.
+ (unless (bolp) (beginning-of-line 2))
+ ;; At (point-max).
+ (unless (bolp) (insert "\n"))
+ (dolist (def footnote-definitions)
+ (insert def)))))
;; Case 4. Normal line without ARG: turn each non-item line
;; into an item.
(t
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index b58c51f3fb4..a7fb8f858eb 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -46,22 +46,28 @@
;; {{{email}}} and {{{title}}} macros.
;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
(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-at-point "org-element" (&optional pom cached-only))
(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-keyword-parser "org-element" (limit affiliated))
+(declare-function org-element-put-property "org-element" (element property value))
(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-in-commented-heading-p "org" (&optional no-inheritance element))
(declare-function org-link-search "ol" (s &optional avoid-pos stealth))
(declare-function org-mode "org" ())
(declare-function vc-backend "vc-hooks" (f))
@@ -239,6 +245,13 @@ a definition in TEMPLATES."
(goto-char (match-beginning 0))
(org-element-macro-parser))))))
(when macro
+ ;; `:parent' property might change as we modify buffer.
+ ;; We do not care about it when checking for circular
+ ;; dependencies. So, setting `:parent' to nil making sure
+ ;; that actual macro element (if org-element-cache is
+ ;; active) is unchanged.
+ (setq macro (cl-copy-list macro))
+ (org-element-put-property macro :parent nil)
(let* ((key (org-element-property :key macro))
(value (org-macro-expand macro templates))
(begin (org-element-property :begin macro))
@@ -338,7 +351,7 @@ in the buffer."
(result nil))
(catch :exit
(while (re-search-forward regexp nil t)
- (let ((element (org-element-at-point)))
+ (let ((element (org-with-point-at (match-beginning 0) (org-element-keyword-parser (line-end-position) (list (match-beginning 0))))))
(when (eq 'keyword (org-element-type element))
(let ((value (org-element-property :value element)))
(if (not collect) (throw :exit value)
@@ -355,12 +368,13 @@ Return value as a string."
(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)"
+ (format "(org-format-timestamp '%S $1)"
(org-element-copy (car date)))
value)
value)))
(defun org-macro--vc-modified-time (file)
+ (require 'vc) ; Not everything we need is autoloaded.
(save-window-excursion
(when (vc-backend file)
(let ((buf (get-buffer-create " *org-vc*"))
@@ -378,7 +392,7 @@ Return value as a string."
(buffer-substring
(point) (line-end-position)))))
(when (cl-some #'identity time)
- (setq date (apply #'encode-time time))))))))
+ (setq date (org-encode-time time))))))))
(let ((proc (get-buffer-process buf)))
(while (and proc (accept-process-output proc .5 nil t)))))
(kill-buffer buf))
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index cf0eb48f2da..0c6a2173d26 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -34,13 +34,71 @@
(require 'cl-lib)
(require 'format-spec)
+;;; Org version verification.
+
+(defmacro org-assert-version ()
+ "Assert compile time and runtime version match."
+ ;; We intentionally use a more permissive `org-release' instead of
+ ;; `org-git-version' to work around deficiencies in Elisp
+ ;; compilation after pulling latest changes. Unchanged files will
+ ;; not be re-compiled and thus their macro-expanded
+ ;; `org-assert-version' calls would fail using strict
+ ;; `org-git-version' check because the generated Org version strings
+ ;; will not match.
+ `(unless (equal (org-release) ,(org-release))
+ (warn "Org version mismatch. Make sure that correct `load-path' is set early in init.el
+This warning usually appears when a built-in Org version is loaded
+prior to the more recent Org version.
+
+Version mismatch is commonly encountered in the following situations:
+
+1. Emacs is loaded using literate Org config and more recent Org
+ version is loaded inside the file loaded by `org-babel-load-file'.
+ `org-babel-load-file' triggers the built-in Org version clashing
+ the newer Org version attempt to be loaded later.
+
+ It is recommended to move the Org loading code before the
+ `org-babel-load-file' call.
+
+2. New Org version is loaded manually by setting `load-path', but some
+ other package depending on Org is loaded before the `load-path' is
+ configured.
+ This \"other package\" is triggering built-in Org version, again
+ causing the version mismatch.
+
+ It is recommended to set `load-path' as early in the config as
+ possible.
+
+3. New Org version is loaded using straight.el package manager and
+ other package depending on Org is loaded before straight triggers
+ loading of the newer Org version.
+
+ It is recommended to put
+ (straight-use-package 'org)
+ early in the config. Ideally, right after the straight.el
+ bootstrap. Moving `use-package' :straight declaration may not be
+ sufficient if the corresponding `use-package' statement is
+ deferring the loading.")
+ (error "Org version mismatch. Make sure that correct `load-path' is set early in init.el")))
+
+;; We rely on org-macs when generating Org version. Checking Org
+;; version here will interfere with Org build process.
+;; (org-assert-version)
+
(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))
+(declare-function org-agenda-files "org" (&optional unrestricted archives))
+(declare-function org-time-string-to-seconds "org" (s))
+(declare-function org-fold-show-context "org-fold" (&optional key))
+(declare-function org-fold-save-outline-visibility "org-fold" (use-markers &rest body))
+(declare-function org-fold-next-visibility-change "org-fold" (&optional pos limit ignore-hidden-p previous-p))
+(declare-function org-fold-core-with-forced-fontification "org-fold" (&rest body))
+(declare-function org-fold-folded-p "org-fold" (&optional pos limit ignore-hidden-p previous-p))
+(declare-function string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
(declare-function org-time-convert-to-integer "org-compat" (time))
(defvar org-ts-regexp0)
(defvar ffap-url-regexp)
+(defvar org-fold-core-style)
;;; Macros
@@ -65,16 +123,12 @@
,@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))
+(defmacro org-with-base-buffer (buffer &rest body)
+ "Run BODY in base buffer for BUFFER.
+If BUFFER is nil, use base buffer for `current-buffer'."
+ (declare (debug (body)) (indent 1))
+ `(with-current-buffer (or (buffer-base-buffer ,buffer)
+ (or ,buffer (current-buffer)))
,@body))
(defmacro org-with-point-at (pom &rest body)
@@ -118,38 +172,7 @@
(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))))))))
+(defalias 'org-save-outline-visibility #'org-fold-save-outline-visibility)
(defmacro org-with-wide-buffer (&rest body)
"Execute body while temporarily widening the buffer."
@@ -192,27 +215,31 @@ because otherwise all these markers will point to nowhere."
(and (re-search-backward "^[ \t]*# +Local Variables:"
(max (- (point) 3000) 1)
t)
- (delete-and-extract-region (point) (point-max)))))))
+ (let ((buffer-undo-list t))
+ (delete-and-extract-region (point) (point-max)))))))
+ (tick-counter-before (buffer-modified-tick)))
(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"))
+ (unless (bolp) (insert "\n"))
+ (let ((modified (< tick-counter-before (buffer-modified-tick)))
+ (buffer-undo-list t))
(insert local-variables)
- (when overlay
- (move-overlay overlay (overlay-start overlay) (point-max)))))))))
+ (unless modified
+ (restore-buffer-modified-p nil))))))))
(defmacro org-no-popups (&rest body)
"Suppress popup windows and evaluate BODY."
`(let (pop-up-frames pop-up-windows)
,@body))
+(defmacro org-element-with-disabled-cache (&rest body)
+ "Run BODY without active org-element-cache."
+ (declare (debug (form body)) (indent 0))
+ `(cl-letf (((symbol-function #'org-element--cache-active-p) (lambda (&rest _) nil)))
+ ,@body))
+
;;; Buffer and windows
@@ -242,32 +269,74 @@ 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))
+ (cond ((not (window-full-width-p window))
+ ;; Do nothing if another window would suffer.
+ )
+ ((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)))
+ (t (shrink-window-if-larger-than-buffer window)))
(or window (selected-window)))
+(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)))))
+
;;; 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 Lisp time value, 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 (org-time-convert-to-integer
- (nth 5 (file-attributes file)))
- (org-time-convert-to-integer time)))))
+ "Non-nil if FILE modification time is greater than TIME.
+TIME should be obtained earlier for the same FILE name using
+
+ \(file-attribute-modification-time (file-attributes file))
+
+If TIME is nil (file did not exist) then any existing FILE
+is considered as a newer one. Some file systems have coarse
+timestamp resolution, for example 1 second on HFS+ or 2 seconds on FAT,
+so nil may be returned when file is updated twice within a short period
+of time. File timestamp and system clock `current-time' may have
+different resolution, so attempts to compare them may give unexpected
+results.
+
+Consider `file-newer-than-file-p' to check up to date state
+in target-prerequisite files relation."
+ (let ((mtime (file-attribute-modification-time (file-attributes file))))
+ (and mtime (or (not time) (time-less-p time mtime)))))
(defun org-compile-file (source process ext &optional err-msg log-buf spec)
"Compile a SOURCE file using PROCESS.
@@ -301,7 +370,7 @@ it for output."
(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))
+ (time (file-attribute-modification-time (file-attributes output)))
(err-msg (if (stringp err-msg) (concat ". " err-msg) "")))
(save-window-excursion
(pcase process
@@ -314,8 +383,13 @@ it for output."
(?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))
+ ;; Combine output of all commands in PROCESS.
+ (with-current-buffer log-buf
+ (let (buffer-read-only)
+ (erase-buffer)))
+ (let ((shell-command-dont-erase-buffer t))
+ (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
@@ -328,6 +402,11 @@ it for output."
;;; Indentation
+(defmacro org-current-text-indentation ()
+ "Like `current-indentation', but ignore display/invisible properties."
+ `(let ((buffer-invisibility-spec nil))
+ (current-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
@@ -342,7 +421,7 @@ line. Return nil if it fails."
(save-excursion
(when skip-fl (forward-line))
(while (re-search-forward "^[ \t]*\\S-" nil t)
- (let ((ind (current-indentation)))
+ (let ((ind (org-current-text-indentation)))
(if (zerop ind) (throw :exit nil)
(setq min-ind (min min-ind ind))))))
min-ind))))
@@ -521,7 +600,7 @@ is selected, only the bare key is returned."
For example, in this alist:
\(org-uniquify-alist \\='((a 1) (b 2) (a 3)))
- => \\='((a 1 3) (b 2))
+ => ((a 1 3) (b 2))
merge (a 1) and (a 3) into (a 1 3).
@@ -578,7 +657,18 @@ ones and overrule settings in the other lists."
(defconst org-unique-local-variables
'(org-element--cache
- org-element--cache-objects
+ org-element--headline-cache
+ org-element--cache-change-tic
+ org-element--cache-last-buffer-size
+ org-element--cache-change-warning
+ org-element--cache-gapless
+ org-element--cache-hash-left
+ org-element--cache-hash-right
+ org-element--cache-size
+ org-element--headline-cache-size
+ org-element--cache-sync-keys-value
+ org-element--cache-diagnostics-ring
+ org-element--cache-diagnostics-ring-size
org-element--cache-sync-keys
org-element--cache-sync-requests
org-element--cache-sync-timer)
@@ -724,7 +814,7 @@ When NEXT is non-nil, check the next line instead."
-;;; Overlays
+;;; Overlays and text properties
(defun org-overlay-display (ovl text &optional face evap)
"Make overlay OVL display TEXT with face FACE."
@@ -747,20 +837,22 @@ If DELETE is non-nil, delete all those overlays."
(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))))))
-
+(defun org-find-text-property-region (pos prop)
+ "Find a region around POS containing same non-nil value of PROP text property.
+Return nil when PROP is not set at POS."
+ (let* ((beg (and (get-text-property pos prop) pos))
+ (end beg))
+ (when beg
+ (unless (or (equal beg (point-min))
+ (not (eq (get-text-property beg prop)
+ (get-text-property (1- beg) prop))))
+ (setq beg (previous-single-property-change pos prop nil (point-min))))
+ (unless (or (equal end (point-max))
+ ;; (not (eq (get-text-property end prop)
+ ;; (get-text-property (1+ end) prop)))
+ )
+ (setq end (next-single-property-change pos prop nil (point-max))))
+ (cons beg end))))
;;; Regexp matching
@@ -827,17 +919,17 @@ return nil."
;;; String manipulation
(defun org-string< (a b)
- (org-string-collate-lessp a b))
+ (string-collate-lessp a b))
(defun org-string<= (a b)
- (or (string= a b) (org-string-collate-lessp a b)))
+ (or (string= a b) (string-collate-lessp a b)))
(defun org-string>= (a b)
- (not (org-string-collate-lessp a b)))
+ (not (string-collate-lessp a b)))
(defun org-string> (a b)
(and (not (string= a b))
- (not (org-string-collate-lessp a b))))
+ (not (string-collate-lessp a b))))
(defun org-string<> (a b)
(not (string= a b)))
@@ -892,14 +984,13 @@ delimiting S."
(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))
+ (spec (get-text-property beg property s))
(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.
+ ;; If `invisible' property 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))
@@ -940,7 +1031,7 @@ delimiting S."
((= cursor end) 0)
(t (string-width (substring s cursor end)))))))
-(defun org-string-width (string)
+(defun org--string-width-1 (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
@@ -949,6 +1040,104 @@ Results may be off sometimes if it cannot handle a given
`display' value."
(org--string-from-props string 'display 0 (length string)))
+(defun org-string-width (string &optional pixels)
+ "Return width of STRING when displayed in the current buffer.
+Return width in pixels when PIXELS is non-nil."
+ (if (and (version< emacs-version "28") (not pixels))
+ ;; FIXME: Fallback to old limited version, because
+ ;; `window-pixel-width' is buggy in older Emacs.
+ (org--string-width-1 string)
+ ;; Wrap/line prefix will make `window-text-pizel-size' return too
+ ;; large value including the prefix.
+ (remove-text-properties 0 (length string)
+ '(wrap-prefix t line-prefix t)
+ string)
+ ;; Face should be removed to make sure that all the string symbols
+ ;; are using default face with constant width. Constant char width
+ ;; is critical to get right string width from pixel width (not needed
+ ;; when PIXELS are requested though).
+ (unless pixels
+ (remove-text-properties 0 (length string) '(face t) string))
+ (let (;; We need to remove the folds to make sure that folded table
+ ;; alignment is not messed up.
+ (current-invisibility-spec
+ (or (and (not (listp buffer-invisibility-spec))
+ buffer-invisibility-spec)
+ (let (result)
+ (dolist (el buffer-invisibility-spec)
+ (unless (or (memq el
+ '(org-fold-drawer
+ org-fold-block
+ org-fold-outline))
+ (and (listp el)
+ (memq (car el)
+ '(org-fold-drawer
+ org-fold-block
+ org-fold-outline))))
+ (push el result)))
+ result)))
+ (current-char-property-alias-alist char-property-alias-alist))
+ (with-temp-buffer
+ (setq-local display-line-numbers nil)
+ (setq-local buffer-invisibility-spec
+ (if (listp current-invisibility-spec)
+ (mapcar (lambda (el)
+ ;; Consider ellipsis to have 0 width.
+ ;; It is what Emacs 28+ does, but we have
+ ;; to force it in earlier Emacs versions.
+ (if (and (consp el) (cdr el))
+ (list (car el))
+ el))
+ current-invisibility-spec)
+ current-invisibility-spec))
+ (setq-local char-property-alias-alist
+ current-char-property-alias-alist)
+ (let (pixel-width symbol-width)
+ (with-silent-modifications
+ (erase-buffer)
+ (insert string)
+ (setq pixel-width
+ (if (get-buffer-window (current-buffer))
+ (car (window-text-pixel-size
+ nil (line-beginning-position) (point-max)))
+ (let ((dedicatedp (window-dedicated-p))
+ (oldbuffer (window-buffer)))
+ (unwind-protect
+ (progn
+ ;; Do not throw error in dedicated windows.
+ (set-window-dedicated-p nil nil)
+ (set-window-buffer nil (current-buffer))
+ (car (window-text-pixel-size
+ nil (line-beginning-position) (point-max))))
+ (set-window-buffer nil oldbuffer)
+ (set-window-dedicated-p nil dedicatedp)))))
+ (unless pixels
+ (erase-buffer)
+ (insert "a")
+ (setq symbol-width
+ (if (get-buffer-window (current-buffer))
+ (car (window-text-pixel-size
+ nil (line-beginning-position) (point-max)))
+ (let ((dedicatedp (window-dedicated-p))
+ (oldbuffer (window-buffer)))
+ (unwind-protect
+ (progn
+ ;; Do not throw error in dedicated windows.
+ (set-window-dedicated-p nil nil)
+ (set-window-buffer nil (current-buffer))
+ (car (window-text-pixel-size
+ nil (line-beginning-position) (point-max))))
+ (set-window-buffer nil oldbuffer)
+ (set-window-dedicated-p nil dedicatedp)))))))
+ (if pixels
+ pixel-width
+ (/ pixel-width symbol-width)))))))
+
+(defmacro org-current-text-column ()
+ "Like `current-column' but ignore display properties."
+ `(string-width (buffer-substring-no-properties
+ (line-beginning-position) (point))))
+
(defun org-not-nil (v)
"If V not nil, and also not the string \"nil\", then return V.
Otherwise return nil."
@@ -962,7 +1151,8 @@ removed. Return the new string. If STRING is nil, return nil."
(and string
(if (and (string-prefix-p pre string)
(string-suffix-p post string))
- (substring string (length pre) (- (length post)))
+ (substring string (length pre)
+ (and (not (string-equal "" post)) (- (length post))))
string)))
(defun org-strip-quotes (string)
@@ -1054,7 +1244,10 @@ as-is if removal failed."
"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))))))
+ ; Sort from longest key to shortest, so that
+ ; "noweb-ref" and "tangle-mode" get processed
+ ; before "noweb" and "tangle", respectively.
+ (lambda (a b) (< (length (car b)) (length (car a))))))
(setq template
(replace-regexp-in-string
(concat "%" (regexp-quote (car entry)))
@@ -1096,6 +1289,25 @@ so values can contain further %-escapes if they are define later in TABLE."
org-emphasis t)
"Properties to remove when a string without properties is wanted.")
+(defun org-buffer-substring-fontified (beg end)
+ "Return fontified region between BEG and END."
+ (when (bound-and-true-p jit-lock-mode)
+ (when (text-property-not-all beg end 'fontified t)
+ (save-excursion (save-match-data (font-lock-fontify-region beg end)))))
+ (buffer-substring beg end))
+
+(defun org-looking-at-fontified (re)
+ "Call `looking-at' RE and make sure that the match is fontified."
+ (prog1 (looking-at re)
+ (when (bound-and-true-p jit-lock-mode)
+ (when (text-property-not-all
+ (match-beginning 0) (match-end 0)
+ 'fontified t)
+ (save-excursion
+ (save-match-data
+ (font-lock-fontify-region (match-beginning 0)
+ (match-end 0))))))))
+
(defsubst org-no-properties (s &optional restricted)
"Remove all text properties from string S.
When RESTRICTED is non-nil, only remove the properties listed
@@ -1112,15 +1324,14 @@ that will be added to PLIST. Returns the string that was modified."
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)))))
+(defun org-make-parameter-alist (plist)
+ "Return alist based on PLIST.
+PLIST is a property 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 plist
+ (cons (list (car plist) (cadr plist))
+ (org-make-parameter-alist (cddr plist)))))
(defsubst org-get-at-bol (property)
"Get text property PROPERTY at the beginning of line."
@@ -1136,18 +1347,19 @@ the value in cadr."
(get-text-property (or (next-single-property-change 0 prop s) 0)
prop s)))
+;; FIXME: move to org-fold?
(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)))
+ (let ((value (invisible-p (or pos (point)))))
(cond ((not value) nil)
- (folding-only (memq value '(org-hide-block outline)))
+ (folding-only (org-fold-folded-p (or pos (point))))
(t value))))
-(defun org-truely-invisible-p ()
+(defun org-truly-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'."
@@ -1163,17 +1375,23 @@ move it back by one char before doing this check."
(backward-char 1))
(org-invisible-p)))
+(defun org-region-invisible-p (beg end)
+ "Check if region if completely hidden."
+ (org-with-wide-buffer
+ (and (org-invisible-p beg)
+ (org-invisible-p (org-fold-next-visibility-change beg end)))))
+
(defun org-find-visible ()
"Return closest visible buffer position, or `point-max'."
(if (org-invisible-p)
- (next-single-char-property-change (point) 'invisible)
+ (org-fold-next-visibility-change (point))
(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)))
+ (org-fold-next-visibility-change (point))))
;;; Time
@@ -1187,7 +1405,7 @@ nil, just return 0."
((numberp s) s)
((stringp s)
(condition-case nil
- (float-time (apply #'encode-time (org-parse-time-string s)))
+ (org-time-string-to-seconds s)
(error 0)))
(t 0)))
@@ -1221,6 +1439,39 @@ nil, just return 0."
(b (org-2ft b)))
(and (> a 0) (> b 0) (\= a b))))
+(defmacro org-encode-time (&rest time)
+ "Compatibility and convenience helper for `encode-time'.
+TIME may be a 9 components list (SECONDS ... YEAR IGNORED DST ZONE)
+as the recommended way since Emacs-27 or 6 or 9 separate arguments
+similar to the only possible variant for Emacs-26 and earlier.
+6 elements list as the only argument causes wrong type argument till
+Emacs-29.
+
+Warning: use -1 for DST to guess the actual value, nil means no
+daylight saving time and may be wrong at particular time.
+
+DST value is ignored prior to Emacs-27. Since Emacs-27 DST value matters
+even when multiple arguments is passed to this macro and such
+behavior is different from `encode-time'. See
+Info node `(elisp)Time Conversion' for details and caveats,
+preferably the latest version."
+ (if (version< emacs-version "27.1")
+ (if (cdr time)
+ `(encode-time ,@time)
+ `(apply #'encode-time ,@time))
+ (if (ignore-errors (with-no-warnings (encode-time '(0 0 0 1 1 1971))))
+ (pcase (length time) ; Emacs-29 since d75e2c12eb
+ (1 `(encode-time ,@time))
+ ((or 6 9) `(encode-time (list ,@time)))
+ (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments but %d given"
+ (length time))))
+ (pcase (length time)
+ (1 `(encode-time ,@time))
+ (6 `(encode-time (list ,@time nil -1 nil)))
+ (9 `(encode-time (list ,@time)))
+ (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments but %d given"
+ (length time)))))))
+
(defun org-parse-time-string (s &optional nodefault)
"Parse Org time string S.
@@ -1244,7 +1495,7 @@ This should be a lot faster than the `parse-time-string'."
(string-to-number (match-string 4 s))
(string-to-number (match-string 3 s))
(string-to-number (match-string 2 s))
- nil nil nil))
+ nil -1 nil))
(defun org-matcher-time (s)
"Interpret a time comparison value S as a floating point time.
@@ -1254,8 +1505,8 @@ 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)))))))
+ (let ((today (float-time (org-encode-time
+ (append '(0 0 0) (nthcdr 3 (decode-time)))))))
(save-match-data
(cond
((string= s "<now>") (float-time))
@@ -1301,6 +1552,13 @@ window."
(message "Beginning of buffer")
(sit-for 1))))))
+(cl-defun org-knuth-hash (number &optional (base 32))
+ "Calculate Knuth's multiplicative hash for NUMBER.
+BASE is the maximum bitcount.
+Credit: https://stackoverflow.com/questions/11871245/knuth-multiplicative-hash#41537995"
+ (cl-assert (and (<= 0 base 32)))
+ (ash (* number 2654435769) (- base 32)))
+
(provide 'org-macs)
;; Local variables:
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index 6f0a60125c5..a95c4e4769d 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -3,7 +3,7 @@
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -31,6 +31,9 @@
;; iPhone and Android - any external viewer/flagging/editing
;; application that uses the same conventions could be used.
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org)
(require 'org-agenda)
@@ -1064,7 +1067,7 @@ be returned that indicates what went wrong."
(progn
;; Workaround a `org-insert-heading-respect-content' bug
;; which prevents correct insertion when point is invisible
- (org-show-subtree)
+ (org-fold-show-subtree)
(end-of-line 1)
(org-insert-heading-respect-content t)
(org-demote))
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index aa4c20050ff..817a2d1b05e 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -136,6 +136,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(require 'cl-lib)
@@ -208,7 +211,11 @@ 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 (/ (mouse-double-click-time) 1000.0))))
+ (sit-for
+ (/ (if (fboundp 'mouse-double-click-time) ; Emacs >= 29
+ (mouse-double-click-time)
+ double-click-time)
+ 1000.0))))
(progn
(select-window (posn-window (event-start event)))
(when (not (org-mouse-mark-active))
@@ -217,10 +224,7 @@ this function is called. Otherwise, the current major mode menu is used."
(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)))))
+ (popup-menu (mouse-menu-major-mode-map) event prefix)))
(setq this-command 'mouse-save-then-kill)
(mouse-save-then-kill event)))
@@ -580,15 +584,17 @@ This means, between the beginning of line and the point."
(insert text)
(beginning-of-line))
-(defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate)
+(advice-add 'dnd-insert-text :around #'org--mouse-dnd-insert-text)
+(defun org--mouse-dnd-insert-text (orig-fun window action text &rest args)
(if (derived-mode-p 'org-mode)
(org-mouse-insert-item text)
- ad-do-it))
+ (apply orig-fun window action text args)))
-(defadvice dnd-open-file (around org-mouse-dnd-open-file activate)
+(advice-add 'dnd-open-file :around #'org--mouse-dnd-open-file)
+(defun org--mouse-dnd-open-file (orig-fun uri &rest args)
(if (derived-mode-p 'org-mode)
(org-mouse-insert-item uri)
- ad-do-it))
+ (apply orig-fun uri args)))
(defun org-mouse-match-closure (function)
(let ((match (match-data t)))
@@ -894,15 +900,17 @@ This means, between the beginning of line and the point."
(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))))))
+ (advice-add 'org-open-at-point :around #'org--mouse-open-at-point)))
+
+(defun org--mouse-open-at-point (orig-fun &rest args)
+ (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 (apply orig-fun args)))))
(defun org-mouse-move-tree-start (_event)
(interactive "e")
@@ -1003,10 +1011,10 @@ This means, between the beginning of line and the point."
(with-current-buffer buffer
(widen)
(goto-char pos)
- (org-show-hidden-entry)
+ (org-fold-show-hidden-entry)
(save-excursion
(and (outline-next-heading)
- (org-flag-heading nil))) ; show the next heading
+ (org-fold-heading nil))) ; show the next heading
(org-back-to-heading)
(setq marker (point-marker))
(goto-char (max (line-beginning-position) (- (line-end-position) anticol)))
diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el
index 4de62630e9a..4a57e6a9e3d 100644
--- a/lisp/org/org-num.el
+++ b/lisp/org/org-num.el
@@ -61,6 +61,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-macs)
(require 'org) ;Otherwise `org-num--comment-re' burps on `org-comment-string'
@@ -458,6 +461,7 @@ NUMBERING is a list of numbers."
(org-num-mode
(unless (derived-mode-p 'org-mode)
(user-error "Cannot activate headline numbering outside Org mode"))
+ (org-num--clear)
(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)
diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el
index d1172d8988e..5e5e48d3f42 100644
--- a/lisp/org/org-pcomplete.el
+++ b/lisp/org/org-pcomplete.el
@@ -5,7 +5,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; John Wiegley <johnw at gnu dot org>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -27,15 +27,18 @@
;;;; Require other packages
(require 'org-macs)
+(org-assert-version)
+
+(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-babel-get-src-block-info "ob-core" (&optional no-eval 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-at-point "org-element" (&optional pom cached-only))
(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))
@@ -47,6 +50,7 @@
(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))
+(declare-function org-time-stamp-format "org" (&optional with-time inactive custom))
(defvar org-babel-common-header-args-w-values)
(defvar org-current-tag-alist)
@@ -67,7 +71,6 @@
(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)
@@ -227,7 +230,7 @@ When completing for #+STARTUP, for example, this function returns
(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)))))
+ (pcomplete-here (list (format-time-string (org-time-stamp-format)))))
(defun pcomplete/org-mode/file-option/email ()
"Complete arguments for the #+EMAIL file option."
@@ -361,7 +364,11 @@ This needs more work, to handle headings with lots of spaces in them."
(pcomplete-uniquify-list tbl)))
;; When completing a bracketed link, i.e., "[[*", argument
;; starts at the star, so remove this character.
- (substring pcomplete-stub 1))))
+ ;; Also, if the completion is done inside [[*head<point>]],
+ ;; drop the closing parentheses.
+ (replace-regexp-in-string
+ "\\]+$" ""
+ (substring pcomplete-stub 1)))))
(defun pcomplete/org-mode/tag ()
"Complete a tag name. Omit tags already set."
@@ -421,7 +428,7 @@ switches."
(symbol-plist
'org-babel-load-languages)
'custom-type)))))))
- (let* ((info (org-babel-get-src-block-info 'light))
+ (let* ((info (org-babel-get-src-block-info 'no-eval))
(lang (car info))
(lang-headers (intern (concat "org-babel-header-args:" lang)))
(headers (org-babel-combine-header-arg-lists
diff --git a/lisp/org/org-persist.el b/lisp/org/org-persist.el
new file mode 100644
index 00000000000..108292f1e92
--- /dev/null
+++ b/lisp/org/org-persist.el
@@ -0,0 +1,978 @@
+;;; org-persist.el --- Persist cached data across Emacs sessions -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
+
+;; Author: Ihor Radchenko <yantar92 at gmail dot com>
+;; Keywords: cache, storage
+
+;; 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 persistent cache storage across Emacs sessions.
+;; Both global and buffer-local data can be stored. This
+;; implementation is not meant to be used to store important data -
+;; all the caches should be safe to remove at any time.
+;;
+;; Example usage:
+;;
+;; 1. Temporarily cache Elisp symbol value to disk. Remove upon
+;; closing Emacs:
+;; (org-persist-write 'variable-symbol)
+;; (org-persist-read 'variable-symbol) ;; read the data later
+;; 2. Temporarily cache a remote URL file to disk. Remove upon
+;; closing Emacs:
+;; (org-persist-write 'url "https://static.fsf.org/common/img/logo-new.png")
+;; (org-persist-read 'url "https://static.fsf.org/common/img/logo-new.png")
+;; `org-persist-read' will return the cached file location or nil if cached file
+;; has been removed.
+;; 3. Temporarily cache a file, including TRAMP path to disk:
+;; (org-persist-write 'file "/path/to/file")
+;; 4. Cache file or URL while some other file exists.
+;; (org-persist-register '(url "https://static.fsf.org/common/img/logo-new.png") '(:file "/path to the other file") :expiry 'never :write-immediately t)
+;; or, if the other file is current buffer file
+;; (org-persist-register '(url "https://static.fsf.org/common/img/logo-new.png") (current-buffer) :expiry 'never :write-immediately t)
+;; 5. Cache value of a Elisp variable to disk. The value will be
+;; saved and restored automatically (except buffer-local
+;; variables).
+;; ;; Until `org-persist-default-expiry'
+;; (org-persist-register 'variable-symbol)
+;; ;; Specify expiry explicitly
+;; (org-persist-register 'variable-symbol :expiry 'never)
+;; ;; Save buffer-local variable (buffer-local will not be
+;; ;; autoloaded!)
+;; (org-persist-register 'org-element--cache (current-buffer))
+;; ;; Save buffer-local variable preserving circular links:
+;; (org-persist-register 'org-element--headline-cache (current-buffer)
+;; :inherit 'org-element--cache)
+;; 6. Load variable by side effects assigning variable symbol:
+;; (org-persist-load 'variable-symbol (current-buffer))
+;; 7. Version variable value:
+;; (org-persist-register '((elisp variable-symbol) (version "2.0")))
+;; 8. Cancel variable persistence:
+;; (org-persist-unregister 'variable-symbol 'all) ; in all buffers
+;; (org-persist-unregister 'variable-symbol) ;; global variable
+;; (org-persist-unregister 'variable-symbol (current-buffer)) ;; buffer-local
+;;
+;; Most common data type is variable data. However, other data types
+;; can also be stored.
+;;
+;; Persistent data is stored in individual files. Each of the files
+;; can contain a collection of related data, which is particularly
+;; useful when, say, several variables cross-reference each-other's
+;; data-cells and we want to preserve their circular structure.
+;;
+;; Each data collection can be associated with a local or remote file,
+;; its inode number, or contents hash. The persistent data collection
+;; can later be accessed using either file buffer, file, inode, or
+;; contents hash.
+;;
+;; The data collections can be versioned and removed upon expiry.
+;;
+;; In the code below I will use the following naming conventions:
+;; 1. Container :: a type of data to be stored
+;; Containers can store elisp variables, files, and version
+;; numbers. Each container can be customized with container
+;; options. For example, `elisp' container is customized with
+;; variable symbol. (elisp variable) is a container storing
+;; Lisp variable value. Similarly, (version "2.0") container
+;; will store version number.
+;; 2. Associated :: an object the container is associated with. The
+;; object can be a buffer, file, inode number, file contents hash,
+;; a generic key, or multiple of them. Associated can also be nil.
+;; 3. Data collection :: a list of containers linked to an associated
+;; object/objects. Each data collection can also have auxiliary
+;; records. Their only purpose is readability of the collection
+;; index.
+;; 4. Index file :: a file listing all the stored data collections.
+;; 5. Persist file :: a file holding data values or references to
+;; actual data values for a single data collection. This file
+;; contains an alist associating each data container in data
+;; collection with its value or a reference to the actual value.
+;;
+;; All the persistent data is stored in `org-persist-directory'. The data
+;; collections are listed in `org-persist-index-file' and the actual data is
+;; stored in UID-style subfolders.
+;;
+;; The `org-persist-index-file' stores the value of `org-persist--index'.
+;;
+;; Each collection is represented as a plist containing the following
+;; properties:
+;; - `:container' : list of data continers to be stored in single
+;; file;
+;; - `:persist-file': data file name;
+;; - `:associated' : list of associated objects;
+;; - `:last-access' : last date when the container has been accessed;
+;; - `:expiry' : list of expiry conditions.
+;; - all other keywords are ignored
+;;
+;; The available types of data containers are:
+;; 1. (file variable-symbol) or just variable-symbol :: Storing
+;; elisp variable data.
+;; 2. (file) :: Store a copy of the associated file preserving the
+;; extension.
+;; (file "/path/to/a/file") :: Store a copy of the file in path.
+;; 3. (version "version number") :: Version the data collection.
+;; If the stored collection has different version than "version
+;; number", disregard it.
+;; 4. (url) :: Store a downloaded copy of URL object.
+;;
+;; The data collections can expire, in which case they will be removed
+;; from the persistent storage at the end of Emacs session. The
+;; expiry condition can be set when saving/registering data
+;; containers. The expirty condition can be `never' - data will never
+;; expire; `nil' - data will expire at the end of current Emacs session;
+;; a number - data will expire after the number days from last access;
+;; a function - data will expire if the function, called with a single
+;; argument - collection, returns non-nil.
+;;
+;;
+;; Data collections associated with files will automatically expire
+;; when the file is removed. If the associated file is remote, the
+;; expiry is controlled by `org-persist-remote-files' instead.
+;;
+;; Data loading/writing can be more accurately controlled using
+;; `org-persist-before-write-hook', `org-persist-before-read-hook', and `org-persist-after-read-hook'.
+
+;;; Code:
+
+(require 'org-macs)
+(org-assert-version)
+
+(require 'org-compat)
+(require 'org-id)
+(require 'xdg nil t)
+
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
+(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
+
+
+(defconst org-persist--storage-version "2.5"
+ "Persistent storage layout version.")
+
+(defgroup org-persist nil
+ "Persistent cache for Org mode."
+ :tag "Org persist"
+ :group 'org)
+
+(defcustom org-persist-directory (expand-file-name
+ (org-file-name-concat
+ (let ((cache-dir (when (fboundp 'xdg-cache-home)
+ (xdg-cache-home))))
+ (if (or (seq-empty-p cache-dir)
+ (not (file-exists-p cache-dir))
+ (file-exists-p (org-file-name-concat
+ user-emacs-directory
+ "org-persist")))
+ user-emacs-directory
+ cache-dir))
+ "org-persist/"))
+ "Directory where the data is stored."
+ :group 'org-persist
+ :package-version '(Org . "9.6")
+ :type 'directory)
+
+(defcustom org-persist-remote-files 100
+ "Whether to keep persistent data for remote files.
+
+When this variable is nil, never save persistent data associated with
+remote files. When t, always keep the data. When
+`check-existence', contact remote server containing the file and only
+keep the data when the file exists on the server. When a number, keep
+up to that number persistent values for remote files.
+
+Note that the last option `check-existence' may cause Emacs to show
+password prompts to log in."
+ :group 'org-persist
+ :package-version '(Org . "9.6")
+ :type '(choice (const :tag "Never" nil)
+ (const :tag "Always" t)
+ (number :tag "Keep not more than X files")
+ (const :tag "Check if exist on remote" check-existence)))
+
+(defcustom org-persist-default-expiry 30
+ "Default expiry condition for persistent data.
+
+When this variable is nil, all the data vanishes at the end of Emacs
+session. When `never', the data never vanishes. When a number, the
+data is deleted that number days after last access. When a function,
+it should be a function returning non-nil when the data is expired. The
+function will be called with a single argument - collection."
+ :group 'org-persist
+ :package-version '(Org . "9.6")
+ :type '(choice (const :tag "Never" never)
+ (const :tag "Always" nil)
+ (number :tag "Keep N days")
+ (function :tag "Function")))
+
+(defconst org-persist-index-file "index"
+ "File name used to store the data index.")
+
+(defvar org-persist-disable-when-emacs-Q t
+ "Disable persistence when Emacs is called with -Q command line arg.")
+
+(defvar org-persist-before-write-hook nil
+ "Abnormal hook ran before saving data.
+The hook must accept the same arguments as `org-persist-write'.
+The hooks will be evaluated until a hook returns non-nil.
+If any of the hooks return non-nil, do not save the data.")
+
+(defvar org-persist-before-read-hook nil
+ "Abnormal hook ran before reading data.
+The hook must accept the same arguments as `org-persist-read'.
+The hooks will be evaluated until a hook returns non-nil.
+If any of the hooks return non-nil, do not read the data.")
+
+(defvar org-persist-after-read-hook nil
+ "Abnormal hook ran after reading data.
+The hook must accept the same arguments as `org-persist-read'.")
+
+(defvar org-persist--index nil
+ "Global index.
+
+The index is a list of plists. Each plist contains information about
+persistent data storage. Each plist contains the following
+properties:
+
+ - `:container' : list of data continers to be stored in single file
+ - `:persist-file': data file name
+ - `:associated' : list of associated objects
+ - `:last-access' : last date when the container has been read
+ - `:expiry' : list of expiry conditions
+ - all other keywords are ignored.")
+
+(defvar org-persist--index-hash nil
+ "Hash table storing `org-persist--index'. Used for quick access.
+They keys are conses of (container . associated).")
+
+(defvar org-persist--report-time 0.5
+ "Whether to report read/write time.
+
+When the value is a number, it is a threshold number of seconds. If
+the read/write time of a single variable exceeds the threshold, a
+message is displayed.
+
+When the value is a non-nil non-number, always display the message.
+When the value is nil, never display the message.")
+
+;;;; Common functions
+
+(defun org-persist--display-time (duration format &rest args)
+ "Report DURATION according to FORMAT + ARGS message.
+FORMAT and ARGS are passed to `message'."
+ (when (or (and org-persist--report-time
+ (numberp org-persist--report-time)
+ (>= duration org-persist--report-time))
+ (and org-persist--report-time
+ (not (numberp org-persist--report-time))))
+ (apply #'message
+ (format "org-persist: %s took %%.2f sec" format)
+ (append args (list duration)))))
+
+(defun org-persist--read-elisp-file (&optional buffer-or-file)
+ "Read elisp data from BUFFER-OR-FILE or current buffer."
+ (unless buffer-or-file (setq buffer-or-file (current-buffer)))
+ (with-temp-buffer
+ (if (bufferp buffer-or-file)
+ (set-buffer buffer-or-file)
+ (insert-file-contents buffer-or-file))
+ (condition-case err
+ (let ((coding-system-for-read 'utf-8)
+ (read-circle t)
+ (start-time (float-time)))
+ ;; FIXME: Reading sometimes fails to read circular objects.
+ ;; I suspect that it happens when we have object reference
+ ;; #N# read before object definition #N=. If it is really
+ ;; so, it should be Emacs bug - either in `read' or in
+ ;; `prin1'. Meanwhile, just fail silently when `read'
+ ;; fails to parse the saved cache object.
+ (prog1
+ (read (current-buffer))
+ (org-persist--display-time
+ (- (float-time) start-time)
+ "Reading from %S" buffer-or-file)))
+ ;; Recover gracefully if index file is corrupted.
+ (error
+ ;; Remove problematic file.
+ (unless (bufferp buffer-or-file) (delete-file buffer-or-file))
+ ;; Do not report the known error to user.
+ (if (string-match-p "Invalid read syntax" (error-message-string err))
+ (message "Emacs reader failed to read data in %S. The error was: %S"
+ buffer-or-file (error-message-string err))
+ (warn "Emacs reader failed to read data in %S. The error was: %S"
+ buffer-or-file (error-message-string err)))
+ nil))))
+
+(defun org-persist--write-elisp-file (file data &optional no-circular pp)
+ "Write elisp DATA to FILE."
+ (let ((print-circle (not no-circular))
+ print-level
+ print-length
+ print-quoted
+ (print-escape-control-characters t)
+ (print-escape-nonascii t)
+ (print-continuous-numbering t)
+ print-number-table
+ (start-time (float-time)))
+ (unless (file-exists-p (file-name-directory file))
+ (make-directory (file-name-directory file) t))
+ (with-temp-file file
+ (if pp
+ (pp data (current-buffer))
+ (prin1 data (current-buffer))))
+ (org-persist--display-time
+ (- (float-time) start-time)
+ "Writing to %S" file)))
+
+(defmacro org-persist-gc:generic (container collection)
+ "Garbage collect CONTAINER data from COLLECTION."
+ `(let* ((c (org-persist--normalize-container ,container))
+ (gc-func-symbol (intern (format "org-persist-gc:%s" (car c)))))
+ (unless (fboundp gc-func-symbol)
+ (error "org-persist: GC function %s not defined"
+ gc-func-symbol))
+ (funcall gc-func-symbol c ,collection)))
+
+(defmacro org-persist--gc-expired-p (cnd collection)
+ "Check if expiry condition CND triggers for COLLECTION."
+ `(pcase ,cnd
+ (`nil t)
+ (`never nil)
+ ((pred numberp)
+ (when (plist-get ,collection :last-access)
+ (> (float-time) (+ (plist-get ,collection :last-access) (* ,cnd 24 60 60)))))
+ ((pred functionp)
+ (funcall ,cnd ,collection))
+ (_ (error "org-persist: Unsupported expiry type %S" ,cnd))))
+
+;;;; Working with index
+
+(defmacro org-persist-collection-let (collection &rest body)
+ "Bind container and associated from COLLECTION and execute BODY."
+ (declare (debug (form body)) (indent 1))
+ `(with-no-warnings
+ (let* ((container (plist-get ,collection :container))
+ (associated (plist-get ,collection :associated))
+ (path (plist-get associated :file))
+ (inode (plist-get associated :inode))
+ (hash (plist-get associated :hash))
+ (key (plist-get associated :key)))
+ ;; Suppress "unused variable" warnings.
+ (ignore container associated path inode hash key)
+ ,@body)))
+
+(defun org-persist--find-index (collection)
+"Find COLLECTION in `org-persist--index'."
+(org-persist-collection-let collection
+ (and org-persist--index-hash
+ (catch :found
+ (dolist (cont (cons container container))
+ (let (r)
+ (setq r (or (gethash (cons cont associated) org-persist--index-hash)
+ (and path (gethash (cons cont (list :file path)) org-persist--index-hash))
+ (and inode (gethash (cons cont (list :inode inode)) org-persist--index-hash))
+ (and hash (gethash (cons cont (list :hash hash)) org-persist--index-hash))
+ (and key (gethash (cons cont (list :key key)) org-persist--index-hash))))
+ (when r (throw :found r))))))))
+
+(defun org-persist--add-to-index (collection &optional hash-only)
+ "Add or update COLLECTION in `org-persist--index'.
+When optional HASH-ONLY is non-nil, only modify the hash table.
+Return PLIST."
+ (org-persist-collection-let collection
+ (let ((existing (org-persist--find-index collection)))
+ (if existing
+ (progn
+ (plist-put existing :container container)
+ (plist-put (plist-get existing :associated) :file path)
+ (plist-put (plist-get existing :associated) :inode inode)
+ (plist-put (plist-get existing :associated) :hash hash)
+ (plist-put (plist-get existing :associated) :key key)
+ existing)
+ (unless hash-only (push collection org-persist--index))
+ (unless org-persist--index-hash (setq org-persist--index-hash (make-hash-table :test 'equal)))
+ (dolist (cont (cons container container))
+ (puthash (cons cont associated) collection org-persist--index-hash)
+ (when path (puthash (cons cont (list :file path)) collection org-persist--index-hash))
+ (when inode (puthash (cons cont (list :inode inode)) collection org-persist--index-hash))
+ (when hash (puthash (cons cont (list :hash inode)) collection org-persist--index-hash))
+ (when key (puthash (cons cont (list :key inode)) collection org-persist--index-hash)))
+ collection))))
+
+(defun org-persist--remove-from-index (collection)
+ "Remove COLLECTION from `org-persist--index'."
+ (let ((existing (org-persist--find-index collection)))
+ (when existing
+ (org-persist-collection-let collection
+ (dolist (cont (cons container container))
+ (unless (listp (car container))
+ (org-persist-gc:generic cont collection))
+ (remhash (cons cont associated) org-persist--index-hash)
+ (when path (remhash (cons cont (list :file path)) org-persist--index-hash))
+ (when inode (remhash (cons cont (list :inode inode)) org-persist--index-hash))
+ (when hash (remhash (cons cont (list :hash hash)) org-persist--index-hash))
+ (when key (remhash (cons cont (list :key key)) org-persist--index-hash))))
+ (setq org-persist--index (delq existing org-persist--index)))))
+
+(defun org-persist--get-collection (container &optional associated &rest misc)
+ "Return or create collection used to store CONTAINER for ASSOCIATED.
+When ASSOCIATED is nil, it is a global CONTAINER.
+ASSOCIATED can also be a (:buffer buffer) or buffer, (:file file-path)
+or file-path, (:inode inode), (:hash hash), or or (:key key).
+MISC, if non-nil will be appended to the collection."
+ (unless (and (listp container) (listp (car container)))
+ (setq container (list container)))
+ (setq associated (org-persist--normalize-associated associated))
+ (unless (equal misc '(nil))
+ (setq associated (append associated misc)))
+ (or (org-persist--find-index
+ `( :container ,(org-persist--normalize-container container)
+ :associated ,associated))
+ (org-persist--add-to-index
+ (list :container (org-persist--normalize-container container)
+ :persist-file
+ (replace-regexp-in-string "^.." "\\&/" (org-id-uuid))
+ :associated associated))))
+
+;;;; Reading container data.
+
+(defun org-persist--normalize-container (container)
+ "Normalize CONTAINER representation into (type . settings)."
+ (if (and (listp container) (listp (car container)))
+ (mapcar #'org-persist--normalize-container container)
+ (pcase container
+ ((or `elisp `version `file `index `url)
+ (list container nil))
+ ((pred symbolp)
+ (list `elisp container))
+ (`(,(or `elisp `version `file `index `url) . ,_)
+ container)
+ (_ (error "org-persist: Unknown container type: %S" container)))))
+
+(defvar org-persist--associated-buffer-cache (make-hash-table :weakness 'key)
+ "Buffer hash cache.")
+
+(defun org-persist--normalize-associated (associated)
+ "Normalize ASSOCIATED representation into (:type value)."
+ (pcase associated
+ ((or (pred stringp) `(:file ,_))
+ (unless (stringp associated)
+ (setq associated (cadr associated)))
+ (let* ((rtn `(:file ,associated))
+ (inode (and (fboundp 'file-attribute-inode-number)
+ (file-attribute-inode-number
+ (file-attributes associated)))))
+ (when inode (plist-put rtn :inode inode))
+ rtn))
+ ((or (pred bufferp) `(:buffer ,_))
+ (unless (bufferp associated)
+ (setq associated (cadr associated)))
+ (let ((cached (gethash associated org-persist--associated-buffer-cache))
+ file inode hash)
+ (if (and cached (eq (buffer-modified-tick associated)
+ (car cached)))
+ (progn
+ (setq file (nth 1 cached)
+ inode (nth 2 cached)
+ hash (nth 3 cached)))
+ (setq file (buffer-file-name
+ (or (buffer-base-buffer associated)
+ associated)))
+ (setq inode (when (and file
+ (fboundp 'file-attribute-inode-number))
+ (file-attribute-inode-number
+ (file-attributes file))))
+ (setq hash (secure-hash 'md5 associated))
+ (puthash associated
+ (list (buffer-modified-tick associated)
+ file inode hash)
+ org-persist--associated-buffer-cache))
+ (let ((rtn `(:hash ,hash)))
+ (when file (setq rtn (plist-put rtn :file file)))
+ (when inode (setq rtn (plist-put rtn :inode inode)))
+ rtn)))
+ ((pred listp)
+ associated)
+ (_ (error "Unknown associated object %S" associated))))
+
+(defmacro org-persist-read:generic (container reference-data collection)
+ "Read and return the data stored in CONTAINER.
+REFERENCE-DATA is associated with CONTAINER in the persist file.
+COLLECTION is the plist holding data collection."
+ `(let* ((c (org-persist--normalize-container ,container))
+ (read-func-symbol (intern (format "org-persist-read:%s" (car c)))))
+ (setf ,collection (plist-put ,collection :last-access (float-time)))
+ (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time))))
+ (unless (fboundp read-func-symbol)
+ (error "org-persist: Read function %s not defined"
+ read-func-symbol))
+ (funcall read-func-symbol c ,reference-data ,collection)))
+
+(defun org-persist-read:elisp (_ lisp-value __)
+ "Read elisp container and return LISP-VALUE."
+ lisp-value)
+
+(defun org-persist-read:version (container _ __)
+ "Read version CONTAINER."
+ (cadr container))
+
+(defun org-persist-read:file (_ path __)
+ "Read file container from PATH."
+ (when (and path (file-exists-p (concat org-persist-directory path)))
+ (concat org-persist-directory path)))
+
+(defun org-persist-read:url (_ path __)
+ "Read file container from PATH."
+ (when (and path (file-exists-p (concat org-persist-directory path)))
+ (concat org-persist-directory path)))
+
+(defun org-persist-read:index (cont index-file _)
+ "Read index container CONT from INDEX-FILE."
+ (when (file-exists-p index-file)
+ (let ((index (org-persist--read-elisp-file index-file)))
+ (when index
+ (catch :found
+ (dolist (collection index)
+ (org-persist-collection-let collection
+ (when (and (not associated)
+ (pcase container
+ (`((index ,version))
+ (equal version (cadr cont)))
+ (_ nil)))
+ (throw :found index)))))))))
+
+;;;; Applying container data for side effects.
+
+(defmacro org-persist-load:generic (container reference-data collection)
+ "Load the data stored in CONTAINER for side effects.
+REFERENCE-DATA is associated with CONTAINER in the persist file.
+COLLECTION is the plist holding data collection."
+ `(let* ((container (org-persist--normalize-container ,container))
+ (load-func-symbol (intern (format "org-persist-load:%s" (car container)))))
+ (setf ,collection (plist-put ,collection :last-access (float-time)))
+ (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time))))
+ (unless (fboundp load-func-symbol)
+ (error "org-persist: Load function %s not defined"
+ load-func-symbol))
+ (funcall load-func-symbol container ,reference-data ,collection)))
+
+(defun org-persist-load:elisp (container lisp-value collection)
+ "Assign elisp CONTAINER in COLLECTION LISP-VALUE."
+ (let ((lisp-symbol (cadr container))
+ (buffer (when (plist-get (plist-get collection :associated) :file)
+ (get-file-buffer (plist-get (plist-get collection :associated) :file)))))
+ (if buffer
+ (with-current-buffer buffer
+ (make-variable-buffer-local lisp-symbol)
+ (set lisp-symbol lisp-value))
+ (set lisp-symbol lisp-value))))
+
+(defalias 'org-persist-load:version #'org-persist-read:version)
+(defalias 'org-persist-load:file #'org-persist-read:file)
+
+(defun org-persist-load:index (container index-file _)
+ "Load `org-persist--index' from INDEX-FILE according to CONTAINER."
+ (unless org-persist--index
+ (setq org-persist--index (org-persist-read:index container index-file nil))
+ (setq org-persist--index-hash nil)
+ (if org-persist--index
+ (mapc (lambda (collection) (org-persist--add-to-index collection 'hash)) org-persist--index)
+ (setq org-persist--index nil)
+ (when (file-exists-p org-persist-directory)
+ (dolist (file (directory-files org-persist-directory 'absolute
+ "\\`[^.][^.]"))
+ (if (file-directory-p file)
+ (delete-directory file t)
+ (delete-file file))))
+ (plist-put (org-persist--get-collection container) :expiry 'never))))
+
+(defun org-persist--load-index ()
+ "Load `org-persist--index."
+ (org-persist-load:index
+ `(index ,org-persist--storage-version)
+ (org-file-name-concat org-persist-directory org-persist-index-file)
+ nil))
+
+;;;; Writing container data
+
+(defmacro org-persist-write:generic (container collection)
+ "Write CONTAINER in COLLECTION."
+ `(let* ((c (org-persist--normalize-container ,container))
+ (write-func-symbol (intern (format "org-persist-write:%s" (car c)))))
+ (setf ,collection (plist-put ,collection :last-access (float-time)))
+ (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time))))
+ (unless (fboundp write-func-symbol)
+ (error "org-persist: Write function %s not defined"
+ write-func-symbol))
+ (funcall write-func-symbol c ,collection)))
+
+(defun org-persist-write:elisp (container collection)
+ "Write elisp CONTAINER according to COLLECTION."
+ (if (and (plist-get (plist-get collection :associated) :file)
+ (get-file-buffer (plist-get (plist-get collection :associated) :file)))
+ (let ((buf (get-file-buffer (plist-get (plist-get collection :associated) :file))))
+ ;; FIXME: There is `buffer-local-boundp' introduced in Emacs 28.
+ ;; Not using it yet to keep backward compatibility.
+ (condition-case nil
+ (buffer-local-value (cadr container) buf)
+ (void-variable nil)))
+ (when (boundp (cadr container))
+ (symbol-value (cadr container)))))
+
+(defalias 'org-persist-write:version #'ignore)
+
+(defun org-persist-write:file (c collection)
+ "Write file container C according to COLLECTION."
+ (org-persist-collection-let collection
+ (when (or (and path (file-exists-p path))
+ (and (stringp (cadr c)) (file-exists-p (cadr c))))
+ (when (and (stringp (cadr c)) (file-exists-p (cadr c)))
+ (setq path (cadr c)))
+ (let* ((persist-file (plist-get collection :persist-file))
+ (ext (file-name-extension path))
+ (file-copy (org-file-name-concat
+ org-persist-directory
+ (format "%s-%s.%s" persist-file (md5 path) ext))))
+ (unless (file-exists-p (file-name-directory file-copy))
+ (make-directory (file-name-directory file-copy) t))
+ (copy-file path file-copy 'overwrite)
+ (format "%s-%s.%s" persist-file (md5 path) ext)))))
+
+(defun org-persist-write:url (c collection)
+ "Write url container C according to COLLECTION."
+ (org-persist-collection-let collection
+ (when (or path (cadr c))
+ (when (cadr c) (setq path (cadr c)))
+ (let* ((persist-file (plist-get collection :persist-file))
+ (ext (file-name-extension path))
+ (file-copy (org-file-name-concat
+ org-persist-directory
+ (format "%s-%s.%s" persist-file (md5 path) ext))))
+ (unless (file-exists-p (file-name-directory file-copy))
+ (make-directory (file-name-directory file-copy) t))
+ (if (org--should-fetch-remote-resource-p path)
+ (url-copy-file path file-copy 'overwrite)
+ (error "The remote resource %S is considered unsafe, and will not be downloaded."
+ path))
+ (format "%s-%s.%s" persist-file (md5 path) ext)))))
+
+(defun org-persist-write:index (container _)
+ "Write index CONTAINER."
+ (org-persist--get-collection container)
+ (unless (file-exists-p org-persist-directory)
+ (make-directory org-persist-directory))
+ (unless (file-exists-p org-persist-directory)
+ (warn "Failed to create org-persist storage in %s."
+ org-persist-directory)
+ (let ((dir (directory-file-name
+ (file-name-as-directory org-persist-directory))))
+ (while (and (not (file-exists-p dir))
+ (not (equal dir (setq dir (directory-file-name
+ (file-name-directory dir)))))))
+ (unless (file-writable-p dir)
+ (message "Missing write access rights to org-persist-directory: %S"
+ org-persist-directory))))
+ (when (file-exists-p org-persist-directory)
+ (org-persist--write-elisp-file
+ (org-file-name-concat org-persist-directory org-persist-index-file)
+ org-persist--index
+ t t)
+ (org-file-name-concat org-persist-directory org-persist-index-file)))
+
+(defun org-persist--save-index ()
+ "Save `org-persist--index."
+ (org-persist-write:index
+ `(index ,org-persist--storage-version) nil))
+
+;;;; Public API
+
+(cl-defun org-persist-register (container &optional associated &rest misc
+ &key inherit
+ &key (expiry org-persist-default-expiry)
+ &key (write-immediately nil)
+ &allow-other-keys)
+ "Register CONTAINER in ASSOCIATED to be persistent across Emacs sessions.
+Optional key INHERIT makes CONTAINER dependent on another container.
+Such dependency means that data shared between variables will be
+preserved (see elisp#Circular Objects).
+Optional key EXPIRY will set the expiry condition of the container.
+It can be `never', nil - until end of session, a number of days since
+last access, or a function accepting a single argument - collection.
+EXPIRY key has no effect when INHERIT is non-nil.
+Optional key WRITE-IMMEDIATELY controls whether to save the container
+data immediately.
+MISC will be appended to CONTAINER.
+When WRITE-IMMEDIATELY is non-nil, the return value will be the same
+with `org-persist-write'."
+ (unless org-persist--index (org-persist--load-index))
+ (setq container (org-persist--normalize-container container))
+ (when inherit
+ (setq inherit (org-persist--normalize-container inherit))
+ (let ((inherited-collection (org-persist--get-collection inherit associated))
+ new-collection)
+ (unless (member container (plist-get inherited-collection :container))
+ (setq new-collection
+ (plist-put (copy-sequence inherited-collection) :container
+ (cons container (plist-get inherited-collection :container))))
+ (org-persist--remove-from-index inherited-collection)
+ (org-persist--add-to-index new-collection))))
+ (let ((collection (org-persist--get-collection container associated misc)))
+ (when (and expiry (not inherit))
+ (when expiry (plist-put collection :expiry expiry))))
+ (when (or (bufferp associated) (bufferp (plist-get associated :buffer)))
+ (with-current-buffer (if (bufferp associated)
+ associated
+ (plist-get associated :buffer))
+ (add-hook 'kill-buffer-hook #'org-persist-write-all-buffer nil 'local)))
+ (when write-immediately (org-persist-write container associated)))
+
+(defun org-persist-unregister (container &optional associated)
+ "Unregister CONTAINER in ASSOCIATED to be persistent.
+When ASSOCIATED is `all', unregister CONTAINER everywhere."
+ (unless org-persist--index (org-persist--load-index))
+ (setq container (org-persist--normalize-container container))
+ (setq associated (org-persist--normalize-associated associated))
+ (if (eq associated 'all)
+ (mapc (lambda (collection)
+ (when (member container (plist-get collection :container))
+ (org-persist-unregister container (plist-get collection :associated))))
+ org-persist--index)
+ (let ((collection (org-persist--find-index `(:container ,container :associated ,associated))))
+ (when collection
+ (if (= (length (plist-get collection :container)) 1)
+ (org-persist--remove-from-index collection)
+ (plist-put collection :container
+ (remove container (plist-get collection :container)))
+ (org-persist--add-to-index collection))))))
+
+(defvar org-persist--write-cache (make-hash-table :test #'equal)
+ "Hash table storing as-written data objects.
+
+This data is used to avoid reading the data multiple times.")
+(defun org-persist-read (container &optional associated hash-must-match load?)
+ "Restore CONTAINER data for ASSOCIATED.
+When HASH-MUST-MATCH is non-nil, do not restore data if hash for
+ASSOCIATED file or buffer does not match.
+ASSOCIATED can be a plist, a buffer, or a string.
+A buffer is treated as (:buffer ASSOCIATED).
+A string is treated as (:file ASSOCIATED).
+When LOAD? is non-nil, load the data instead of reading."
+ (setq associated (org-persist--normalize-associated associated))
+ (setq container (org-persist--normalize-container container))
+ (unless (and org-persist-disable-when-emacs-Q
+ ;; FIXME: This is relying on undocumented fact that
+ ;; Emacs sets `user-init-file' to nil when loaded with
+ ;; "-Q" argument.
+ (not user-init-file))
+ (let* ((collection (org-persist--find-index `(:container ,container :associated ,associated)))
+ (persist-file
+ (when collection
+ (org-file-name-concat
+ org-persist-directory
+ (plist-get collection :persist-file))))
+ (data nil))
+ (when (and collection
+ (file-exists-p persist-file)
+ (or (not (plist-get collection :expiry)) ; current session
+ (not (org-persist--gc-expired-p
+ (plist-get collection :expiry) collection)))
+ (or (not hash-must-match)
+ (and (plist-get associated :hash)
+ (equal (plist-get associated :hash)
+ (plist-get (plist-get collection :associated) :hash)))))
+ (unless (seq-find (lambda (v)
+ (run-hook-with-args-until-success 'org-persist-before-read-hook v associated))
+ (plist-get collection :container))
+ (setq data (or (gethash persist-file org-persist--write-cache)
+ (org-persist--read-elisp-file persist-file)))
+ (when data
+ (cl-loop for container in (plist-get collection :container)
+ with result = nil
+ do
+ (if load?
+ (push (org-persist-load:generic container (alist-get container data nil nil #'equal) collection) result)
+ (push (org-persist-read:generic container (alist-get container data nil nil #'equal) collection) result))
+ (run-hook-with-args 'org-persist-after-read-hook container associated)
+ finally return (if (= 1 (length result)) (car result) result))))))))
+
+(defun org-persist-load (container &optional associated hash-must-match)
+ "Load CONTAINER data for ASSOCIATED.
+The arguments have the same meaning as in `org-persist-read'."
+ (org-persist-read container associated hash-must-match t))
+
+(defun org-persist-load-all (&optional associated)
+ "Restore all the persistent data associated with ASSOCIATED."
+ (unless org-persist--index (org-persist--load-index))
+ (setq associated (org-persist--normalize-associated associated))
+ (let (all-containers)
+ (dolist (collection org-persist--index)
+ (when collection
+ (cl-pushnew (plist-get collection :container) all-containers :test #'equal)))
+ (dolist (container all-containers)
+ (condition-case err
+ (org-persist-load container associated t)
+ (error
+ (message "%s. Deleting bad index entry." err)
+ (org-persist--remove-from-index (org-persist--find-index `(:container ,container :associated ,associated)))
+ nil)))))
+
+(defun org-persist-load-all-buffer ()
+ "Call `org-persist-load-all' in current buffer."
+ (org-persist-load-all (current-buffer)))
+
+(defun org-persist-write (container &optional associated ignore-return)
+ "Save CONTAINER according to ASSOCIATED.
+ASSOCIATED can be a plist, a buffer, or a string.
+A buffer is treated as (:buffer ASSOCIATED).
+A string is treated as (:file ASSOCIATED).
+The return value is nil when writing fails and the written value (as
+returned by `org-persist-read') on success.
+When IGNORE-RETURN is non-nil, just return t on success without calling
+`org-persist-read'."
+ (unless (and org-persist-disable-when-emacs-Q
+ ;; FIXME: This is relying on undocumented fact that
+ ;; Emacs sets `user-init-file' to nil when loaded with
+ ;; "-Q" argument.
+ (not user-init-file))
+ (setq associated (org-persist--normalize-associated associated))
+ ;; Update hash
+ (when (and (plist-get associated :file)
+ (plist-get associated :hash)
+ (get-file-buffer (plist-get associated :file)))
+ (setq associated (org-persist--normalize-associated (get-file-buffer (plist-get associated :file)))))
+ (let ((collection (org-persist--get-collection container associated)))
+ (setf collection (plist-put collection :associated associated))
+ (unless (seq-find (lambda (v)
+ (run-hook-with-args-until-success 'org-persist-before-write-hook v associated))
+ (plist-get collection :container))
+ (when (or (file-exists-p org-persist-directory) (org-persist--save-index))
+ (let ((file (org-file-name-concat org-persist-directory (plist-get collection :persist-file)))
+ (data (mapcar (lambda (c) (cons c (org-persist-write:generic c collection)))
+ (plist-get collection :container))))
+ (puthash file data org-persist--write-cache)
+ (org-persist--write-elisp-file file data)
+ (or ignore-return (org-persist-read container associated))))))))
+
+(defun org-persist-write-all (&optional associated)
+ "Save all the persistent data.
+When ASSOCIATED is non-nil, only save the matching data."
+ (unless org-persist--index (org-persist--load-index))
+ (setq associated (org-persist--normalize-associated associated))
+ (let (all-containers)
+ (dolist (collection org-persist--index)
+ (if associated
+ (when collection
+ (cl-pushnew (plist-get collection :container) all-containers :test #'equal))
+ (condition-case err
+ (org-persist-write (plist-get collection :container) (plist-get collection :associated) t)
+ (error
+ (message "%s. Deleting bad index entry." err)
+ (org-persist--remove-from-index collection)
+ nil))))
+ (dolist (container all-containers)
+ (let ((collection (org-persist--find-index `(:container ,container :associated ,associated))))
+ (when collection
+ (condition-case err
+ (org-persist-write container associated t)
+ (error
+ (message "%s. Deleting bad index entry." err)
+ (org-persist--remove-from-index collection)
+ nil)))))))
+
+(defun org-persist-write-all-buffer ()
+ "Call `org-persist-write-all' in current buffer.
+Do nothing in an indirect buffer."
+ (unless (buffer-base-buffer (current-buffer))
+ (org-persist-write-all (current-buffer))))
+
+(defalias 'org-persist-gc:elisp #'ignore)
+(defalias 'org-persist-gc:index #'ignore)
+
+(defun org-persist-gc:file (container collection)
+ "Garbage collect file CONTAINER in COLLECTION."
+ (let ((file (org-persist-read container (plist-get collection :associated))))
+ (when (file-exists-p file)
+ (delete-file file))))
+
+(defun org-persist-gc:url (container collection)
+ "Garbage collect url CONTAINER in COLLECTION."
+ (let ((file (org-persist-read container (plist-get collection :associated))))
+ (when (file-exists-p file)
+ (delete-file file))))
+
+(defmacro org-persist--gc-persist-file (persist-file)
+ "Garbage collect PERSIST-FILE."
+ `(when (file-exists-p ,persist-file)
+ (delete-file ,persist-file)
+ (when (org-directory-empty-p (file-name-directory ,persist-file))
+ (delete-directory (file-name-directory ,persist-file)))))
+
+(defun org-persist-gc ()
+ "Remove expired or unregistered containers.
+Also, remove containers associated with non-existing files."
+ (unless (and org-persist-disable-when-emacs-Q
+ ;; FIXME: This is relying on undocumented fact that
+ ;; Emacs sets `user-init-file' to nil when loaded with
+ ;; "-Q" argument.
+ (not user-init-file))
+ (let (new-index (remote-files-num 0))
+ (dolist (collection org-persist--index)
+ (let* ((file (plist-get (plist-get collection :associated) :file))
+ (file-remote (when file (file-remote-p file)))
+ (persist-file (when (plist-get collection :persist-file)
+ (org-file-name-concat
+ org-persist-directory
+ (plist-get collection :persist-file))))
+ (expired? (org-persist--gc-expired-p
+ (plist-get collection :expiry) collection)))
+ (when persist-file
+ (when file
+ (when file-remote (cl-incf remote-files-num))
+ (unless (if (not file-remote)
+ (file-exists-p file)
+ (pcase org-persist-remote-files
+ ('t t)
+ ('check-existence
+ (file-exists-p file))
+ ((pred numberp)
+ (<= org-persist-remote-files remote-files-num))
+ (_ nil)))
+ (setq expired? t)))
+ (if expired?
+ (org-persist--gc-persist-file persist-file)
+ (push collection new-index)))))
+ (setq org-persist--index (nreverse new-index)))))
+
+;; Automatically write the data, but only when we have write access.
+(let ((dir (directory-file-name
+ (file-name-as-directory org-persist-directory))))
+ (while (and (not (file-exists-p dir))
+ (not (equal dir (setq dir (directory-file-name
+ (file-name-directory dir)))))))
+ (if (not (file-writable-p dir))
+ (message "Missing write access rights to org-persist-directory: %S"
+ org-persist-directory)
+ (add-hook 'kill-emacs-hook #'org-persist-write-all)
+ ;; `org-persist-gc' should run before `org-persist-write-all'.
+ ;; So we are adding the hook after `org-persist-write-all'.
+ (add-hook 'kill-emacs-hook #'org-persist-gc)))
+
+(add-hook 'after-init-hook #'org-persist-load-all)
+
+(provide 'org-persist)
+
+;;; org-persist.el ends here
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index 1912f6762ae..ef6b5aa057d 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -3,9 +3,9 @@
;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
;;
;; Author: Eric Schulte <schulte dot eric at gmail dot com>
-;; Maintainer: TEC <tecosaur@gmail.com>
+;; Maintainer: TEC <orgmode@tec.tecosaur.net>
;; Keywords: tables, plotting
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -31,6 +31,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org)
(require 'org-table)
@@ -280,7 +283,7 @@ When NORMALIZE is non-nil, the count is divided by the number of 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)."
+ "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))
@@ -291,6 +294,11 @@ When NORMALIZE is non-nil, the count is divided by the number of values."
))
(cl-subseq factors 0 -1)))
+(defgroup org-plot nil
+ "Options for plotting in Org mode."
+ :tag "Org Plot"
+ :group 'org)
+
(defcustom org-plot/gnuplot-script-preamble ""
"String of function to be inserted before the gnuplot plot command is run.
@@ -668,7 +676,8 @@ line directly before or after the table."
(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)))
+ org-plot/preset-plot-types))
+ gnuplot-script)
(unless type
(user-error "Org-plot type `%s' is undefined" (plist-get params :plot-type)))
@@ -702,16 +711,17 @@ line directly before or after the table."
ind-column))
(plist-put params :textind t))))) ; ind holds text
;; Write script.
+ (setq gnuplot-script
+ (org-plot/gnuplot-script
+ table data-file num-cols params (plist-get params :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")
+ (progn (insert gnuplot-script "\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)))
+ (insert gnuplot-script))
;; Graph table.
(gnuplot-mode)
(condition-case nil
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index cd99f30e7bd..9ce21cf2ac2 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -128,12 +128,14 @@
;;
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(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)
@@ -173,7 +175,6 @@ 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
@@ -232,7 +233,6 @@ Example:
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
@@ -283,20 +283,17 @@ Here is an example:
(\"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)
@@ -308,7 +305,8 @@ This should be a single regexp string."
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) "/")))))
+ (setq uri (concat (car splitparts) "//"
+ (mapconcat #'identity (cdr splitparts) "/")))))
uri)
(defun org-protocol-split-data (data &optional unhexify separator)
@@ -370,6 +368,7 @@ returned list."
ret)
l)))
+;; `flatten-tree' was added in Emacs 27.1.
(defalias 'org-protocol-flatten
(if (fboundp 'flatten-tree) 'flatten-tree
(lambda (list)
@@ -548,10 +547,10 @@ Now template ?b will be used."
"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 "&"))))))
+ (cl-mapcan (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.
@@ -640,7 +639,7 @@ 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
+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
@@ -670,7 +669,8 @@ CLIENT is ignored."
(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))
+ ;; If not fboundp, there's no client to kill.
+ (if (fboundp 'server-edit) (server-edit)))
(when (fboundp func)
(unless greedy
(throw 'fname
@@ -686,12 +686,12 @@ to deal with new-style links.")
(throw 'fname t))))))))
fname)))
-(defadvice server-visit-files (before org-protocol-detect-protocol-server activate)
+(advice-add 'server-visit-files :around #'org--protocol-detect-protocol-server)
+(defun org--protocol-detect-protocol-server (orig-fun files client &rest args)
"Advice server-visit-flist to call `org-protocol-check-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)))
+ (reverse files)
+ files)))
(catch 'greedy
(dolist (var flist)
;; `\' to `/' on windows. FIXME: could this be done any better?
@@ -700,11 +700,16 @@ to deal with new-style links.")
fname (member var flist) client))
(if (eq fname t) ;; greedy? We need the t return value.
(progn
- (ad-set-arg 0 nil)
+ ;; FIXME: Doesn't this just ignore all the files before
+ ;; this one (the remaining ones have been passed to
+ ;; `org-protocol-check-filename-for-protocol' but not
+ ;; the ones before).
+ (setq files nil)
(throw 'greedy t))
(if (stringp fname) ;; probably filename
(setcar var fname)
- (ad-set-arg 0 (delq var (ad-get-arg 0))))))))))
+ (setq files (delq var files)))))))
+ (apply orig-fun files client args)))
;;; Org specific functions:
diff --git a/lisp/org/org-refile.el b/lisp/org/org-refile.el
index 3b3344b2709..8c514b9d0b2 100644
--- a/lisp/org/org-refile.el
+++ b/lisp/org/org-refile.el
@@ -25,6 +25,8 @@
;; Org Refile allows you to refile subtrees to various locations.
;;; Code:
+(require 'org-macs)
+(org-assert-version)
(require 'org)
@@ -95,7 +97,7 @@ 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))'."
+are used, equivalent to the value `((nil . (:level . 1)))'."
:group 'org-refile
:type '(repeat
(cons
@@ -153,12 +155,14 @@ When `full-file-path', include the full file path.
When `buffer-name', use the buffer name."
:group 'org-refile
+ :package-version '(Org . "9.6")
: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)))
+ (const :tag "Start with buffer name" buffer-name)
+ (const :tag "Start with document title" title)))
(defcustom org-outline-path-complete-in-steps t
"Non-nil means complete the outline path in hierarchical steps.
@@ -317,6 +321,11 @@ converted to a headline before refiling."
(push (list (and (buffer-file-name (buffer-base-buffer))
(file-truename (buffer-file-name (buffer-base-buffer))))
f nil nil) tgs))
+ (when (eq org-refile-use-outline-path 'title)
+ (push (list (or (org-get-title)
+ (and f (file-name-nondirectory f)))
+ f nil nil)
+ tgs))
(org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)
@@ -343,7 +352,12 @@ converted to a headline before refiling."
(and (buffer-file-name (buffer-base-buffer))
(file-name-nondirectory
(buffer-file-name (buffer-base-buffer))))))
- (`full-file-path
+ (`title (list
+ (or (org-get-title)
+ (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
@@ -521,7 +535,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(goto-char (cond (pos)
((org-notes-order-reversed-p) (point-min))
(t (point-max))))
- (org-show-context 'org-goto))
+ (org-fold-show-context 'org-goto))
(if regionp
(progn
(org-kill-new (buffer-substring region-start region-end))
@@ -631,7 +645,7 @@ this function appends the default value from
(tbl (mapcar
(lambda (x)
(if (and (not (member org-refile-use-outline-path
- '(file full-file-path)))
+ '(file full-file-path title)))
(not (equal filename (nth 1 x))))
(cons (concat (car x) extra " ("
(file-name-nondirectory (nth 1 x)) ")")
@@ -643,10 +657,7 @@ this function appends the default value from
(prompt (let ((default (or (car org-refile-history)
(and (assoc cbnex tbl) (setq cdef cbnex)
cbnex))))
- ;; `format-prompt' is new in Emacs 28.1.
- (if (fboundp 'format-prompt)
- (format-prompt prompt default)
- (concat prompt " (default " default ": "))))
+ (org-format-prompt prompt default)))
pa answ parent-target child parent old-hist)
(setq old-hist org-refile-history)
(setq answ (funcall cfunc prompt tbl nil (not new-nodes)
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 89d0c28a432..7d5f5d5431e 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -6,7 +6,7 @@
;; 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
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -31,19 +31,25 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ob-comint)
(require 'org-macs)
(require 'org-compat)
(require 'org-keys)
+(declare-function org--get-expected-indentation "org" (element contentsp))
(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-fold-region "org-fold" (from to flag &optional spec-or-alias))
+(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(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--parse-paired-brackets "org-element" (char))
(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"
@@ -169,6 +175,7 @@ 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 plain)
(const current-window)
(const split-window-below)
(const split-window-right)
@@ -196,12 +203,14 @@ but which mess up the display of a snippet in Org exported files.")
("calc" . fundamental)
("cpp" . c++)
("ditaa" . artist)
+ ("desktop" . conf-desktop)
("dot" . fundamental)
("elisp" . emacs-lisp)
("ocaml" . tuareg)
("screen" . shell-script)
("shell" . sh)
- ("sqlite" . sql))
+ ("sqlite" . sql)
+ ("toml" . conf-toml))
"Alist mapping languages to their major mode.
The key is the language name. The value is the mode name, as
@@ -212,6 +221,7 @@ 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
+ :package-version '(Org . "9.6")
:type '(repeat
(cons
(string "Language name")
@@ -225,12 +235,13 @@ Each element is a cell of the format
Where FACE is either a defined face or an anonymous face.
-For instance, the following value would color the background of
+For instance, the following 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\")))"
+ (setq org-src-block-faces
+ \\='((\"emacs-lisp\" (:background \"#EEE2FF\"))
+ (\"python\" (:background \"#e5ffb8\"))))"
:group 'org-edit-structure
:type '(repeat (list (string :tag "language")
(choice
@@ -240,8 +251,7 @@ green, respectability.
: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."
+ "If non-nil, TAB uses the language's major-mode binding in code blocks."
:type 'boolean
:package-version '(Org . "9.4")
:group 'org-babel)
@@ -304,7 +314,8 @@ is 0.")
(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."
+ "Construct the buffer name for a source editing buffer.
+Format is \"*Org Src ORG-BUFFER-NAME [ LANG ]*\"."
(concat "*Org Src " org-buffer-name "[ " lang " ]*"))
(defun org-src--edit-buffer (beg end)
@@ -378,7 +389,7 @@ where BEG and END are buffer positions and CONTENTS is a string."
(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))
+ ((memq type '(example-block export-block src-block comment-block))
(list (progn (goto-char (org-element-property :post-affiliated datum))
(line-beginning-position 2))
(progn (goto-char (org-element-property :end datum))
@@ -524,11 +535,11 @@ Leave point in edit buffer."
(block-ind (org-with-point-at (org-element-property :begin datum)
(cond
((save-excursion (skip-chars-backward " \t") (bolp))
- (current-indentation))
+ (org-current-text-indentation))
((org-element-property :parent datum)
(org--get-expected-indentation
(org-element-property :parent datum) nil))
- (t (current-indentation)))))
+ (t (org-current-text-indentation)))))
(content-ind org-edit-src-content-indentation)
(blank-line (save-excursion (beginning-of-line)
(looking-at-p "^[[:space:]]*$")))
@@ -613,8 +624,9 @@ Leave point in edit buffer."
;;; Fontification of source blocks
+(defvar org-src-fontify-natively) ; Defined in org.el
(defun org-src-font-lock-fontify-block (lang start end)
- "Fontify code block.
+ "Fontify code block between START and END using LANG's syntax.
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)))
@@ -631,27 +643,123 @@ as `org-src-fontify-natively' is non-nil."
;; 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)
+ (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))
+ ;; FIXME: We copy 'font-lock-face property explicitly because
+ ;; `font-lock-mode' is not enabled in the buffers starting from
+ ;; space and the remapping between 'font-lock-face and 'face
+ ;; text properties may thus not be set. See commit
+ ;; 453d634bc.
+ (dolist (prop (append '(font-lock-face 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))))
+ (when new-prop
+ (if (not (eq prop 'invisible))
+ (put-text-property
+ (+ start (1- pos)) (1- (+ start next)) prop new-prop
+ org-buffer)
+ ;; Special case. `invisible' text property may
+ ;; clash with Org folding. Do not assign
+ ;; `invisible' text property directly. Use
+ ;; property alias instead.
+ (let ((invisibility-spec
+ (or
+ ;; ATOM spec.
+ (and (memq new-prop buffer-invisibility-spec)
+ new-prop)
+ ;; (ATOM . ELLIPSIS) spec.
+ (assq new-prop buffer-invisibility-spec))))
+ (with-current-buffer org-buffer
+ ;; Add new property alias.
+ (unless (memq 'org-src-invisible
+ (cdr (assq 'invisible char-property-alias-alist)))
+ (setq-local
+ char-property-alias-alist
+ (cons (cons 'invisible
+ (nconc (cdr (assq 'invisible char-property-alias-alist))
+ '(org-src-invisible)))
+ (remove (assq 'invisible char-property-alias-alist)
+ char-property-alias-alist))))
+ ;; Carry over the invisibility spec, unless
+ ;; already present. Note that there might
+ ;; be conflicting invisibility specs from
+ ;; different major modes. We cannot do much
+ ;; about this then.
+ (when invisibility-spec
+ (add-to-invisibility-spec invisibility-spec))
+ (put-text-property
+ (+ start (1- pos)) (1- (+ start next))
+ 'org-src-invisible new-prop
+ org-buffer)))))))
+ (setq pos next)))
+ (set-buffer-modified-p nil))
;; 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))
+ ;; Clear abbreviated link folding.
+ (org-fold-region start end nil 'org-link)
(add-text-properties
start end
'(font-lock-fontified t fontified t font-lock-multiline t))
(set-buffer-modified-p modified)))))
+(defun org-fontify-inline-src-blocks (limit)
+ "Try to apply `org-fontify-inline-src-blocks-1'."
+ (condition-case nil
+ (org-fontify-inline-src-blocks-1 limit)
+ (error (message "Org mode fontification error in %S at %d"
+ (current-buffer)
+ (line-number-at-pos)))))
+
+(defun org-fontify-inline-src-blocks-1 (limit)
+ "Fontify inline src_LANG blocks, from `point' up to LIMIT."
+ (let ((case-fold-search t))
+ ;; The regexp below is copied from `org-element-inline-src-block-parser'.
+ (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t)
+ (let ((beg (match-beginning 0))
+ (lang-beg (match-beginning 1))
+ (lang-end (match-end 1))
+ pt)
+ (font-lock-append-text-property
+ lang-beg lang-end 'face 'org-meta-line)
+ (font-lock-append-text-property
+ beg lang-beg 'face 'shadow)
+ (font-lock-append-text-property
+ beg lang-end 'face 'org-inline-src-block)
+ (setq pt (goto-char lang-end))
+ ;; `org-element--parse-paired-brackets' doesn't take a limit, so to
+ ;; prevent it searching the entire rest of the buffer we temporarily
+ ;; narrow the active region.
+ (save-restriction
+ (narrow-to-region beg
+ (min limit (or (save-excursion
+ (and (search-forward"\n" limit t 2)
+ (point)))
+ (point-max))))
+ (when (ignore-errors (org-element--parse-paired-brackets ?\[))
+ (font-lock-append-text-property
+ pt (point) 'face 'org-inline-src-block)
+ (setq pt (point)))
+ (when (ignore-errors (org-element--parse-paired-brackets ?\{))
+ (remove-text-properties pt (point) '(face nil))
+ (font-lock-append-text-property
+ pt (1+ pt) 'face '(org-inline-src-block shadow))
+ (unless (= (1+ pt) (1- (point)))
+ (if org-src-fontify-natively
+ (org-src-font-lock-fontify-block
+ (buffer-substring-no-properties lang-beg lang-end)
+ (1+ pt) (1- (point)))
+ (font-lock-append-text-property
+ (1+ pt) (1- (point)) 'face 'org-inline-src-block)))
+ (font-lock-append-text-property
+ (1- (point)) (point) 'face '(org-inline-src-block shadow))
+ (setq pt (point)))))
+ t)))
+
;;; Escape contents
@@ -760,7 +868,9 @@ See also `org-src-mode-hook'."
;;; Babel related functions
(defun org-src-associate-babel-session (info)
- "Associate edit buffer with comint session."
+ "Associate edit buffer with comint session.
+INFO should be a list similar in format to the return value of
+`org-babel-get-src-block-info'."
(interactive)
(let ((session (cdr (assq :session (nth 2 info)))))
(and session (not (string= session "none"))
@@ -770,6 +880,7 @@ See also `org-src-mode-hook'."
(and (fboundp f) (funcall f session))))))
(defun org-src-babel-configure-edit-buffer ()
+ "Configure src editing buffer."
(when org-src--babel-info
(org-src-associate-babel-session org-src--babel-info)))
@@ -842,6 +953,7 @@ Raise an error when current buffer is not a source editing buffer."
org-src--source-type)
(defun org-src-switch-to-buffer (buffer context)
+ "Switch to BUFFER considering CONTEXT and `org-src-window-setup'."
(pcase org-src-window-setup
(`plain
(when (eq context 'exit) (quit-restore-window))
@@ -1090,6 +1202,29 @@ Throw an error when not at an export block."
(lambda () (org-escape-code-in-region (point-min) (point-max)))))
t))
+(defun org-edit-comment-block ()
+ "Edit comment 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 Org mode.
+
+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 a comment block."
+ (interactive)
+ (let ((element (org-element-at-point)))
+ (unless (and (eq (org-element-type element) 'comment-block)
+ (org-src--on-datum-p element))
+ (user-error "Not in a comment block"))
+ (org-src--edit-element
+ element
+ (org-src--construct-edit-buffer-name (buffer-name) "org")
+ 'org-mode
+ (lambda () (org-escape-code-in-region (point-min) (point-max)))
+ (org-unescape-code-in-string (org-element-property :value element)))
+ t))
+
(defun org-edit-src-code (&optional code edit-buffer-name)
"Edit the source or example block at point.
\\<org-src-mode-map>
@@ -1116,7 +1251,7 @@ name of the sub-editing buffer."
"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)))
+ (org-babel-get-src-block-info 'no-eval)))
deactivate-mark)
(when (and (eq type 'src-block) (not (functionp lang-f)))
(error "No such language mode: %s" lang-f))
@@ -1148,7 +1283,7 @@ name of the sub-editing buffer."
(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))
+ (babel-info (org-babel-get-src-block-info 'no-eval))
deactivate-mark)
(unless (functionp lang-f) (error "No such language mode: %s" lang-f))
(org-src--edit-element
@@ -1204,11 +1339,12 @@ the area in the Org mode buffer."
(interactive)
(let (org-src--allow-write-back) (org-edit-src-exit)))
-(defun org-edit-src-continue (e)
+(defun org-edit-src-continue (event)
"Unconditionally return to buffer editing area under point.
-Throw an error if there is no such buffer."
+Throw an error if there is no such buffer.
+EVENT is passed to `mouse-set-point'."
(interactive "e")
- (mouse-set-point e)
+ (mouse-set-point event)
(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"))))
@@ -1272,8 +1408,8 @@ Throw an error if there is no such buffer."
(org-with-wide-buffer
(when (and write-back
(not (equal (buffer-substring beg end)
- (with-current-buffer write-back-buf
- (buffer-string)))))
+ (with-current-buffer write-back-buf
+ (buffer-string)))))
(undo-boundary)
(goto-char beg)
(let ((expecting-bol (bolp)))
@@ -1294,8 +1430,10 @@ Throw an error if there is no such buffer."
(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)))
+ ((if (eq org-fold-core-style 'text-properties)
+ (org-fold-folded-p nil '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.
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 9b692d09736..8e0e8e6cf86 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -34,6 +34,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-macs)
(require 'org-compat)
@@ -47,7 +50,7 @@
(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-at-point "org-element" (&optional pom cached-only))
(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))
@@ -56,6 +59,7 @@
(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-element-cache-reset "org-element" (&optional all no-persistence))
(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))
@@ -566,11 +570,23 @@ This works for both table types.")
(concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)")
"Match a reference that needs translation, for reference display.")
-(defconst org-table-separator-space
+(defconst org-table--separator-space-pre
(propertize " " 'display '(space :relative-width 1))
- "Space used around fields when aligning the table.
+ "Space used in front of fields when aligning the table.
This space serves as a segment separator for the purposes of the
-bidirectional reordering.")
+bidirectional reordering.
+Note that `org-table--separator-space-pre' is not `eq' to
+`org-table--separator-space-post'. This is done to prevent Emacs from
+visually merging spaces in an empty table cell. See bug#45915.")
+
+(defconst org-table--separator-space-post
+ (propertize " " 'display '(space :relative-width 1.001))
+ "Space used after fields when aligning the table.
+This space serves as a segment separator for the purposes of the
+bidirectional reordering.
+Note that `org-table--separator-space-pre' is not `eq' to
+`org-table--separator-space-post'. This is done to prevent Emacs from
+visually merging spaces in an empty table cell. See bug#45915.")
;;; Internal Variables
@@ -843,7 +859,11 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
"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.
+slightly, to make sure a beginning of line in the first line is
+included.
+
+Throw an error when the region has more than
+`org-table-convert-region-max-lines' lines.
SEPARATOR specifies the field separator in the lines. It can have the
following values:
@@ -1339,6 +1359,9 @@ However, when FORCE is non-nil, create new columns if necessary."
"Insert a new column into the table."
(interactive)
(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-find-dataline)
(let ((col (max 1 (org-table-current-column)))
(beg (org-table-begin))
@@ -1633,6 +1656,9 @@ Swap with anything in target cell."
With prefix ARG, insert below 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 (buffer-substring (line-beginning-position) (line-end-position)))
(new (org-table-clean-line line)))
@@ -2254,13 +2280,14 @@ For all numbers larger than LIMIT, shift them by DELTA."
(format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
s n a)
(when remove
- (while (re-search-forward re2 (line-end-position) 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 "")))))
+ (save-excursion
+ (while (re-search-forward re2 (line-end-position) 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 (line-end-position) t)
(unless (save-match-data (org-in-regexp "remote([^)]+?)"))
(setq s (match-string 1) n (string-to-number s))
@@ -2607,8 +2634,7 @@ location of point."
(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))))))
+ (save-match-data (org-time-string-to-time ts)))))
form t t))
(setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form))
@@ -2869,7 +2895,7 @@ 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)))
+ (if (or (not t1) (time-less-p 1 (time-subtract curtime t1)))
(progn (apply 'message args)
curtime)
t1)))
@@ -3415,7 +3441,9 @@ full TBLFM line."
(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."
+full TBLFM line.
+
+Leave the relative references unchanged."
(while (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" s)
(setq s (replace-match
(format "%s%d"
@@ -3423,7 +3451,7 @@ full TBLFM line."
(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)
+ (while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([1-9][0-9]*\\)" s)
(setq s (replace-match (concat "\\1"
(org-number-to-letters
(string-to-number (match-string 2 s))) "&")
@@ -3667,8 +3695,6 @@ With prefix ARG, apply the new formulas to the table."
(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))
@@ -3890,7 +3916,7 @@ 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--separator-space-pre' to it. Otherwise, concatenate
`org-table-shrunk-column-indicator' at its end.
Return the overlay."
@@ -3909,7 +3935,7 @@ Return the overlay."
;; 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)
+ (let ((d (if pre (concat org-table--separator-space-pre display)
(concat display org-table-shrunk-column-indicator))))
(org-overlay-display o d 'org-table t))
o))
@@ -4082,7 +4108,7 @@ 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)
+ (font-lock-ensure beg end)
(dolist (c columns)
(goto-char beg)
(let ((align nil)
@@ -4204,7 +4230,7 @@ beginning and end position of the current table."
(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)
+ (font-lock-ensure begin end)
(org-table--shrink-columns (sort columns #'<) begin end))))
;;;###autoload
@@ -4322,11 +4348,11 @@ FIELD is a string. WIDTH is a number. ALIGN is either \"c\",
("r" (make-string spaces ?\s))
("c" (make-string (/ spaces 2) ?\s))))
(suffix (make-string (- spaces (length prefix)) ?\s)))
- (concat org-table-separator-space
+ (concat org-table--separator-space-pre
prefix
field
suffix
- org-table-separator-space)))
+ org-table--separator-space-post)))
(defun org-table-align ()
"Align the table at point by aligning all vertical bars."
@@ -4336,7 +4362,7 @@ FIELD is a string. WIDTH is a number. ALIGN is either \"c\",
(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)
+ (font-lock-ensure beg end)
(move-marker org-table-aligned-begin-marker beg)
(move-marker org-table-aligned-end-marker end)
(goto-char beg)
@@ -4564,8 +4590,8 @@ function is being called interactively."
(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))))
+ ((?a ?A) (if with-case #'string-collate-lessp
+ (lambda (s1 s2) (string-collate-lessp s1 s2 nil t))))
((?f ?F)
(or compare-func
(and interactive?
@@ -5168,15 +5194,13 @@ When LOCAL is non-nil, show references for the table at point."
(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)))
+ (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))
+ (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)
@@ -5291,6 +5315,7 @@ to execute outside of tables."
(org-remap orgtbl-mode-map
'self-insert-command 'orgtbl-self-insert-command
'delete-char 'org-delete-char
+ 'delete-forward-char 'org-delete-char
'delete-backward-char 'org-delete-backward-char)
(org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
t))
@@ -5544,10 +5569,14 @@ First element has index 0, or I0 if given."
beg end)
(save-excursion
(beginning-of-line 1)
- (while (looking-at re) (beginning-of-line 0))
- (beginning-of-line 2)
+ (while (and (not (eq (point) (point-min)))
+ (looking-at re))
+ (beginning-of-line 0))
+ (unless (eq (point) (point-min)) (beginning-of-line 2))
(setq beg (point))
- (while (looking-at re) (beginning-of-line 2))
+ (while (and (not (eq (point) (point-max)))
+ (looking-at re))
+ (beginning-of-line 2))
(setq end (point)))
(comment-region beg end (if commented '(4) nil))))
@@ -5651,6 +5680,9 @@ strings, or the current cell) returning a string:
(:fmt (2 \"$%s$\" 4 (lambda (c) (format \"$%s$\" c))))
+ The format is ignored for empty fields. Use :raw t with non-nil
+ :backend option to force formatting empty fields.
+
:hlstart :hllstart :hlend :hllend :hsep :hlfmt :hllfmt :hfmt
Same as above, specific for the header lines in the table.
@@ -5696,6 +5728,7 @@ This may be either a string or a function of two arguments:
((consp e)
(princ "| ") (dolist (c e) (princ c) (princ " |"))
(princ "\n")))))
+ (org-element-cache-reset)
;; Add back-end specific filters, but not user-defined ones. In
;; particular, make sure to call parse-tree filters on the
;; table.
diff --git a/lisp/org/org-tempo.el b/lisp/org/org-tempo.el
index b34007bf787..0902a45e8ac 100644
--- a/lisp/org/org-tempo.el
+++ b/lisp/org/org-tempo.el
@@ -4,7 +4,7 @@
;;
;; Author: Rasmus Pank Roulund <emacs at pank dot eu>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -38,6 +38,9 @@
;;
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'tempo)
(require 'cl-lib)
(require 'org)
@@ -67,7 +70,6 @@ just like `org-structure-template-alist'. The tempo snippet
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"))
@@ -102,8 +104,8 @@ Tempo templates will be added."
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))
+ (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)))
@@ -119,11 +121,18 @@ Go through `org-structure-template-alist' and
"Add block entry from `org-structure-template-alist'."
(let* ((key (format "<%s" (car entry)))
(name (cdr entry))
- (special (member name '("src" "export"))))
+ (special (member name '("src" "export")))
+ (upcase? (string= (car (split-string name))
+ (upcase (car (split-string name))))))
(tempo-define-template (format "org-%s" (replace-regexp-in-string " " "-" name))
- `(,(format "#+begin_%s%s" name (if special " " ""))
+ `(,(format "#+%s_%s%s"
+ (if upcase? "BEGIN" "begin")
+ name
+ (if special " " ""))
,(when special 'p) '> n ,(unless special 'p) n
- ,(format "#+end_%s" (car (split-string name " ")))
+ ,(format "#+%s_%s"
+ (if upcase? "END" "end")
+ (car (split-string name " ")))
>)
key
(format "Insert a %s block" name)
@@ -176,8 +185,8 @@ didn't succeed."
;; 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)
+(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))
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index 4c9c1ba2765..9741ac67973 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -35,6 +35,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-clock)
@@ -139,7 +142,7 @@ the region 0:00:00."
(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-start-time (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"
@@ -163,9 +166,9 @@ With prefix arg STOP, stop it entirely."
(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 (time-add nil new-secs)))
(setq org-timer-start-time
- (org-time-since (- pause-secs start-secs))))
+ (time-since (- pause-secs start-secs))))
(setq org-timer-pause-time nil)
(org-timer-set-mode-line 'on)
(run-hooks 'org-timer-continue-hook)
@@ -387,7 +390,7 @@ VALUE can be `on', `off', or `paused'."
;; 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))))))
+ (time-subtract (timer--time org-timer-countdown-timer) nil))))))
;;;###autoload
(defun org-timer-set-timer (&optional opt)
@@ -448,7 +451,7 @@ using three \\[universal-argument] prefix arguments."
(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-start-time (time-add nil secs))
(setq org-timer-pause-time nil)
(org-timer-set-mode-line 'on))))))
@@ -478,7 +481,6 @@ Try to use an Org header, otherwise use the buffer name."
(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)
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 3273d8707d6..e9339690409 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -5,13 +5,13 @@
(defun org-release ()
"The release version of Org.
Inserted by installing Org mode or when a release is made."
- (let ((org-release "9.5.5"))
+ (let ((org-release "9.6"))
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 "release_9.5.5"))
+ (let ((org-git-version "release_9.6-3-ga4d38e"))
org-git-version))
(provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 7de907590ed..ab6212daccd 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -6,10 +6,10 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Maintainer: Bastien Guerry <bzg@gnu.org>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; Package-Requires: ((emacs "25.1"))
-;; Version: 9.5.5
+;; Version: 9.6
;; This file is part of GNU Emacs.
;;
@@ -56,10 +56,10 @@
;; 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.
+;; distribution also contains a PDF version of it. At the Org mode website,
+;; 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
@@ -71,6 +71,9 @@
;;;; Require other packages
+(require 'org-compat)
+(org-assert-version)
+
(require 'cl-lib)
(eval-when-compile (require 'gnus-sum))
@@ -79,24 +82,33 @@
(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")
- nil t nil 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))))
+(condition-case nil
+ (load (concat (file-name-directory load-file-name)
+ "org-loaddefs")
+ nil t nil 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)
+(require 'org-fold)
+
+(require 'org-cycle)
+(defvaralias 'org-hide-block-startup 'org-cycle-hide-block-startup)
+(defvaralias 'org-pre-cycle-hook 'org-cycle-pre-hook)
+(defvaralias 'org-tab-first-hook 'org-cycle-tab-first-hook)
+(defalias 'org-global-cycle #'org-cycle-global)
+(defalias 'org-overview #'org-cycle-overview)
+(defalias 'org-content #'org-cycle-content)
+(defalias 'org-reveal #'org-fold-reveal)
+(defalias 'org-force-cycle-archived #'org-cycle-force-archived)
;; `org-outline-regexp' ought to be a defconst but is let-bound in
;; some places -- e.g. see the macro `org-with-limited-levels'.
@@ -119,6 +131,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
(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-todo-yesterday "org-agenda" (&optional arg))
(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))
@@ -152,9 +165,11 @@ Stars are put in group 1 and the trimmed body in group 2.")
(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-at-point "org-element" (&optional pom cached-only))
+(declare-function org-element-at-point-no-context "org-element" (&optional pom))
(declare-function org-element-cache-refresh "org-element" (pos))
-(declare-function org-element-cache-reset "org-element" (&optional all))
+(declare-function org-element-cache-reset "org-element" (&optional all no-persistence))
+(declare-function org-element-cache-map "org-element" (func &rest keys))
(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))
@@ -162,6 +177,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
(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-keyword-parser "org-element" (limit affiliated))
(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))
@@ -174,6 +190,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
(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-element--cache-active-p "org-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))
@@ -188,6 +205,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
(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-persist-load "org-persist" (container &optional associated hash-must-match))
(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))
@@ -198,7 +216,9 @@ Stars are put in group 1 and the trimmed body in group 2.")
(declare-function org-toggle-archive-tag "org-archive" (&optional find-done))
(declare-function org-update-radio-target-regexp "ol" ())
+(defvar org-agenda-buffer-name)
(defvar org-element-paragraph-separate)
+(defvar org-element-cache-map-continue-from)
(defvar org-element--timestamp-regexp)
(defvar org-indent-indentation-per-level)
(defvar org-radio-target-regexp)
@@ -214,7 +234,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
;;;###autoload
(defun org-babel-do-load-languages (sym value)
"Load the languages defined in `org-babel-load-languages'."
- (set-default sym value)
+ (set-default-toplevel-value sym value)
(dolist (pair org-babel-load-languages)
(let ((active (cdr pair)) (lang (symbol-name (car pair))))
(if active
@@ -234,16 +254,22 @@ 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))))
+ ;; Tangle only if the Elisp file is older than the Org file.
+ ;; Catch the case when the .el file exists while the .org file is missing.
+ (unless (file-exists-p file)
+ (error "File to tangle does not exist: %s" file))
+ (when (file-newer-than-file-p file tangled-file)
(org-babel-tangle-file file
tangled-file
(rx string-start
(or "emacs-lisp" "elisp")
- string-end)))
+ string-end))
+ ;; Make sure that tangled file modification time is
+ ;; updated even when `org-babel-tangle-file' does not make changes.
+ ;; This avoids re-tangling changed FILE where the changes did
+ ;; not affect the tangled code.
+ (when (file-exists-p tangled-file)
+ (set-file-times tangled-file)))
(if compile
(progn
(byte-compile-file tangled-file)
@@ -255,9 +281,10 @@ byte-compiled before it is loaded."
(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.
+This list can be used to load support for any of the available
+languages with babel support (see info node `(org) Languages'). 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
@@ -334,7 +361,7 @@ 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))
+ (save-load-suffixes load-suffixes)
(load-suffixes (list ".el"))
(org-install-dir
(ignore-errors (org-find-library-dir "org-loaddefs"))))
@@ -409,7 +436,7 @@ FULL is given."
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\\}\\)\\)?\\)"
+(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\\}>")
@@ -441,8 +468,17 @@ The time stamps may be either active or inactive.")
"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.")
+(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.
+
+The value is a cons cell containing two strings. The `car' and `cdr'
+of the cons cell are used to format time stamps that do not and do
+contain time, respectively.
+
+Leading \"<\"/\"[\" and trailing \">\"/\"]\" pair will be stripped
+from the format strings.
+
+Also, see `org-time-stamp-format'.")
;;;; Clock and Planning
@@ -567,7 +603,7 @@ Group 1 contains drawer's name or \"END\".")
(defconst org-property-drawer-re
(concat "^[ \t]*:PROPERTIES:[ \t]*\n"
- "\\(?:[ \t]*:\\S-+:\\(?: .*\\)?[ \t]*\n\\)*?"
+ "\\(?:[ \t]*:\\S-+:\\(?:[ \t].*\\)?[ \t]*\n\\)*?"
"[ \t]*:END:[ \t]*$")
"Matches an entire property drawer.")
@@ -683,7 +719,7 @@ defined in org-duration.el.")
(defun org-set-modules (var value)
"Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
- (set var value)
+ (set-default-toplevel-value var value)
(when (featurep 'org)
(org-load-modules-maybe 'force)
(org-element-cache-reset 'all)))
@@ -814,7 +850,7 @@ depends on, if any."
:package-version '(Org . "9.0")
:initialize 'custom-initialize-set
:set (lambda (var val)
- (if (not (featurep 'ox)) (set-default var val)
+ (if (not (featurep 'ox)) (set-default-toplevel-value 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.
@@ -839,7 +875,7 @@ depends on, if any."
backend))
((not (memq backend new-list)) (push backend new-list))))
;; Set VAR to that list with fixed dependencies.
- (set-default var new-list))))
+ (set-default-toplevel-value 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)
@@ -941,6 +977,11 @@ equivalent option for agenda views."
:group 'org-todo
:group 'org-archive)
+(defgroup org-startup nil
+ "Startup options Org uses when first visiting a file."
+ :tag "Org Startup"
+ :group 'org)
+
(defcustom org-startup-folded 'showeverything
"Non-nil means entering Org mode will switch to OVERVIEW.
@@ -1173,90 +1214,6 @@ are matched against file names, and values."
: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?
@@ -1356,6 +1313,16 @@ Possible values for the file identifier are:
\"evince -p %1 %s\")
to open [[file:document.pdf::5]] with evince at page 5.
+ Likely, you will need more entries: without page
+ number; with search pattern; with cross-reference
+ anchor; some combination of options. Consider simple
+ pattern here and a Lisp function to determine command
+ line arguments instead. Passing argument list to
+ `call-process' or `make-process' directly allows to
+ avoid treating some character in peculiar file names
+ as shell specialls causing executing part of file
+ name as a subcommand.
+
`directory' Matches a directory
`remote' Matches a remote file, accessible through tramp.
Remote files most likely should be visited through Emacs
@@ -1413,6 +1380,36 @@ For more examples, see the system specific constants
(string :tag "Command")
(function :tag "Function")))))
+(defcustom org-resource-download-policy 'prompt
+ "The policy applied to requests to obtain remote resources.
+
+This affects keywords like #+setupfile and #+include on export,
+`org-persist-write:url',and `org-attach-url' in non-interactive
+Emacs sessions.
+
+This recognizes four possible values:
+- t, remote resources should always be downloaded.
+- prompt, you will be prompted to download resources not considered safe.
+- safe, only resources considered safe will be downloaded.
+- nil, never download remote resources.
+
+A resource is considered safe if it matches one of the patterns
+in `org-safe-remote-resources'."
+ :group 'org
+ :package-version '(Org . "9.6")
+ :type '(choice (const :tag "Always download remote resources" t)
+ (const :tag "Prompt before downloading an unsafe resource" prompt)
+ (const :tag "Only download resources considered safe" safe)
+ (const :tag "Never download any resources" nil)))
+
+(defcustom org-safe-remote-resources nil
+ "A list of regexp patterns matching safe URIs.
+URI regexps are applied to both URLs and Org files requesting
+remote resources."
+ :group 'org
+ :package-version '(Org . "9.6")
+ :type '(repeat regexp))
+
(defcustom org-open-non-existing-files nil
"Non-nil means `org-open-file' opens non-existing files.
@@ -1448,130 +1445,6 @@ 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"
@@ -1670,13 +1543,15 @@ This may also be a cons cell where the behavior for `C-a' and
(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:
+ "Non-nil means that \\<org-mode-map>\\[org-kill-line] \
+will behave specially in headlines.
+
+When nil, \\[org-kill-line] will call the default `kill-line' command.
+Otherwise, the following will happen when point is in a 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."
+- At the beginning of a headline, kill the entire line.
+- In the middle of the headline text, kill the text up to the tags.
+- After the headline text and before the tags, kill all the tags."
:group 'org-edit-structure
:type 'boolean)
@@ -1698,29 +1573,6 @@ OK to kill that hidden subtree. When nil, kill without remorse."
: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
@@ -1763,7 +1615,6 @@ default the value to be used for all contexts not explicitly
(const default))
(boolean)))))
-
(defcustom org-insert-heading-respect-content nil
"Non-nil means insert new headings after the current subtree.
\\<org-mode-map>
@@ -2024,9 +1875,9 @@ 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))))
+ ((eq var t) (set-default-toplevel-value var 'auto))
+ ((eq var 'prefix) (set-default-toplevel-value var nil))
+ (t (set-default-toplevel-value var val))))
:type '(choice
(const :tag "Never" nil)
(const :tag "Automatically, when key letter have been defined" auto)
@@ -2108,7 +1959,7 @@ 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)
+ (set-default-toplevel-value var val)
(if val
(add-hook 'org-blocker-hook
'org-block-todo-from-children-or-siblings-or-parent)
@@ -2126,7 +1977,7 @@ 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)
+ (set-default-toplevel-value var val)
(if val
(add-hook 'org-blocker-hook
'org-block-todo-from-checkboxes)
@@ -2577,27 +2428,53 @@ 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.
+ '("%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)
+commands, if custom time display is turned on at the time of export.
-(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)))
+Leading \"<\" and trailing \">\" pair will be stripped from the format
+strings."
+ :group 'org-time
+ :package-version '(Org . "9.6")
+ :type '(cons string string))
+
+(defun org-time-stamp-format (&optional with-time inactive custom)
+ "Get timestamp format for a time string.
+
+The format is based on `org-time-stamp-formats' (if CUSTOM is nil) or or
+`org-time-stamp-custom-formats' (if CUSTOM if non-nil).
+
+When optional argument WITH-TIME is non-nil, the timestamp will contain
+time.
+
+When optional argument INACTIVE is nil, format active timestamp.
+When `no-brackets', strip timestamp brackets.
+Otherwise, format inactive timestamp."
+ (let ((format (funcall
+ (if with-time #'cdr #'car)
+ (if custom
+ org-time-stamp-custom-formats
+ org-time-stamp-formats))))
+ ;; Strip brackets, if any.
+ (when (or (and (string-prefix-p "<" format)
+ (string-suffix-p ">" format))
+ (and (string-prefix-p "[" format)
+ (string-suffix-p "]" format)))
+ (setq format (substring format 1 -1)))
+ (pcase inactive
+ (`no-brackets format)
+ (`nil (concat "<" format ">"))
+ (_ (concat "[" format "]")))))
(defcustom org-deadline-warning-days 14
"Number of days before expiration during which a deadline becomes active.
@@ -2976,7 +2853,7 @@ is better to limit inheritance to certain tags using the variables
:group 'org-tags
:type '(choice
(const :tag "No sorting" nil)
- (const :tag "Alphabetical" org-string-collate-lessp)
+ (const :tag "Alphabetical" string-collate-lessp)
(const :tag "Reverse alphabetical" org-string-collate-greaterp)
(function :tag "Custom function" nil)))
@@ -3065,6 +2942,35 @@ in this variable)."
(member-ignore-case property org-use-property-inheritance))
(t (error "Invalid setting of `org-use-property-inheritance'"))))
+(defcustom org-property-separators nil
+ "An alist to control how properties are combined.
+
+The car of each item should be either a list of property names or
+a regular expression, while the cdr should be the separator to
+use when combining that property.
+
+If an alist item cannot be found that matches a given property, a
+single space will be used as the separator."
+ :group 'org-properties
+ :package-version '(Org . "9.6")
+ :type '(alist :key-type (choice (repeat :tag "Properties" string)
+ (string :tag "Regular Expression"))
+ :value-type (restricted-sexp :tag "Separator"
+ :match-alternatives (stringp)
+ :value " ")))
+
+(defun org--property-get-separator (property)
+ "Get the separator to use for combining PROPERTY."
+ (or
+ (catch 'separator
+ (dolist (spec org-property-separators)
+ (if (listp (car spec))
+ (if (member property (car spec))
+ (throw 'separator (cdr spec)))
+ (if (string-match-p (car spec) property)
+ (throw 'separator (cdr spec))))))
+ " "))
+
(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
@@ -3326,7 +3232,9 @@ All available processes and theirs documents can be found in
: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"))
+ :image-converter ("dvipng -D %D -T tight -o %O %f")
+ :transparent-image-converter
+ ("dvipng -D %D -T tight -bg Transparent -o %O %f"))
(dvisvgm
:programs ("latex" "dvisvgm")
:description "dvi > svg"
@@ -3335,7 +3243,7 @@ All available processes and theirs documents can be found in
: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"))
+ :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S --output=%O"))
(imagemagick
:programs ("latex" "convert")
:description "pdf > png"
@@ -3381,6 +3289,9 @@ PROPERTIES accepts the following attributes:
given to the shell and supports any of the following
place-holders defined below.
+If set, :transparent-image-converter is used instead of :image-converter to
+convert an image when the background color is nil or \"Transparent\".
+
Place-holders used by `:image-converter' and `:latex-compiler':
%f input file name
@@ -3394,8 +3305,7 @@ Place-holders only used by `:image-converter':
%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")
+ :package-version '(Org . "9.6")
:type '(alist :tag "LaTeX to image backends"
:value-type (plist)))
@@ -3424,8 +3334,8 @@ images at the same place."
(defcustom org-format-latex-header "\\documentclass{article}
\\usepackage[usenames]{color}
-\[PACKAGES]
\[DEFAULT-PACKAGES]
+\[PACKAGES]
\\pagestyle{empty} % do not remove
% The settings below are copied from fullpage.sty
\\setlength{\\textwidth}{\\paperwidth}
@@ -3451,7 +3361,7 @@ header, or they will be appended."
(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)
+ (set-default-toplevel-value var (mapcar (lambda (x)
(if (and (consp x) (= (length x) 2))
(list (car x) (nth 1 x) t)
x))
@@ -3605,7 +3515,7 @@ lines to the buffer:
(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
+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")
@@ -3724,7 +3634,7 @@ After a match, the match groups contain these elements:
(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)
+ (set-default-toplevel-value var val)
(when (and (boundp 'org-emphasis-alist)
(boundp 'org-emphasis-regexp-components)
org-emphasis-alist org-emphasis-regexp-components)
@@ -3823,7 +3733,7 @@ This is needed for font-lock setup.")
"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-agenda-skip "org-agenda" (&optional element))
(declare-function org-attach-expand "org-attach" (file))
(declare-function org-attach-reveal "org-attach" ())
(declare-function org-attach-reveal-in-emacs "org-attach" ())
@@ -3970,15 +3880,6 @@ Instead, use the key `v' to cycle the archives-mode in the agenda."
: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
@@ -4008,51 +3909,6 @@ Otherwise, these types are allowed:
: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
@@ -4105,7 +3961,8 @@ expected to be bound to nil when matching against this regexp.")
"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.")
+TODO state, priority, tags, statistics cookies (at the beginning
+or end of the headline title), or COMMENT keyword.")
(defvar-local org-todo-line-tags-regexp nil
"Matches a headline and puts TODO state into group 2 if present.
@@ -4214,6 +4071,8 @@ After a match, the following groups carry important information:
("noptag" org-tag-persistent-alist nil)
("hideblocks" org-hide-block-startup t)
("nohideblocks" org-hide-block-startup nil)
+ ("hidedrawers" org-hide-drawer-startup t)
+ ("nohidedrawers" org-hide-drawer-startup nil)
("beamer" org-startup-with-beamer-mode t)
("entitiespretty" org-pretty-entities t)
("entitiesplain" org-pretty-entities nil))
@@ -4368,7 +4227,11 @@ related expressions."
(delq nil
(mapcar
(lambda (value)
- (and (string-match "\\`\\(\\S-+\\)[ \t]+\\(.+\\)" value)
+ (and (or
+ ;; "abbrev with spaces" spec
+ (string-match "\\`\"\\(.+[^\\]\\)\"[ \t]+\\(.+\\)" value)
+ ;; abbrev spec
+ (string-match "\\`\\(\\S-+\\)[ \t]+\\(.+\\)" value))
(cons (match-string-no-properties 1 value)
(match-string-no-properties 2 value))))
(cdr (assoc "LINK" alist))))))
@@ -4472,6 +4335,8 @@ related expressions."
"\\(?: +" org-todo-regexp "\\)?"
"\\(?: +\\(\\[#.\\]\\)\\)?"
"\\(?: +"
+ ;; Headline might be commented
+ "\\(?:" org-comment-string " +\\)?"
;; Stats cookies can be stuck to body.
"\\(?:\\[[0-9%%/]+\\] *\\)*"
"\\(%s\\)"
@@ -4688,21 +4553,25 @@ is available. This option applies only if FILE is a URL."
(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)))
+ (if (org--should-fetch-remote-resource-p file)
+ (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))
+ (funcall (if noerror #'message #'user-error)
+ "The remote resource %S is considered unsafe, and will not be downloaded."
+ file)))
(t
(with-temp-buffer
(condition-case nil
@@ -4715,6 +4584,94 @@ is available. This option applies only if FILE is a URL."
file)
nil)))))))
+(defun org--should-fetch-remote-resource-p (uri)
+ "Return non-nil if the URI should be fetched."
+ (or (eq org-resource-download-policy t)
+ (org--safe-remote-resource-p uri)
+ (and (eq org-resource-download-policy 'prompt)
+ (org--confirm-resource-safe uri))))
+
+(defun org--safe-remote-resource-p (uri)
+ "Return non-nil if URI is considered safe.
+This checks every pattern in `org-safe-remote-resources', and
+returns non-nil if any of them match."
+ (let ((uri-patterns org-safe-remote-resources)
+ (file-uri (and buffer-file-name
+ (concat "file://" (file-truename buffer-file-name))))
+ match-p)
+ (while (and (not match-p) uri-patterns)
+ (setq match-p (or (string-match-p (car uri-patterns) uri)
+ (and file-uri (string-match-p (car uri-patterns) file-uri)))
+ uri-patterns (cdr uri-patterns)))
+ match-p))
+
+(defun org--confirm-resource-safe (uri)
+ "Ask the user if URI should be considered safe, returning non-nil if so."
+ (unless noninteractive
+ (let ((current-file (and buffer-file-name (file-truename buffer-file-name)))
+ (domain (and (string-match
+ (rx (seq "http" (? "s") "://")
+ (optional (+ (not (any "@/\n"))) "@")
+ (optional "www.")
+ (one-or-more (not (any ":/?\n"))))
+ uri)
+ (match-string 0 uri)))
+ (buf (get-buffer-create "*Org Remote Resource*")))
+ ;; Set up the contents of the *Org Remote Resource* buffer.
+ (with-current-buffer buf
+ (erase-buffer)
+ (insert "An org-mode document would like to download "
+ (propertize uri 'face '(:inherit org-link :weight normal))
+ ", which is not considered safe.\n\n"
+ "Do you want to download this? You can type\n "
+ (propertize "!" 'face 'success)
+ " to download this resource, and permanently mark it as safe.\n "
+ (if domain
+ (concat
+ (propertize "d" 'face 'success)
+ " to download this resource, and mark the domain ("
+ (propertize domain 'face '(:inherit org-link :weight normal))
+ ") as safe.\n ")
+ "")
+ (propertize "f" 'face 'success)
+ (if current-file
+ (concat
+ " to download this resource, and permanently mark all resources in "
+ (propertize current-file 'face 'underline)
+ " as safe.\n ")
+ "")
+ (propertize "y" 'face 'warning)
+ " to download this resource, just this once.\n "
+ (propertize "n" 'face 'error)
+ " to skip this resource.\n")
+ (setq-local cursor-type nil)
+ (set-buffer-modified-p nil)
+ (goto-char (point-min)))
+ ;; Display the buffer and read a choice.
+ (save-window-excursion
+ (pop-to-buffer buf)
+ (let* ((exit-chars (append '(?y ?n ?! ?d ?\s) (and current-file '(?f))))
+ (prompt (format "Please type y, n%s, d, or !%s: "
+ (if current-file ", f" "")
+ (if (< (line-number-at-pos (point-max))
+ (window-body-height))
+ ""
+ ", or C-v/M-v to scroll")))
+ char)
+ (setq char (read-char-choice prompt exit-chars))
+ (when (memq char '(?! ?f ?d))
+ (customize-push-and-save
+ 'org-safe-remote-resources
+ (list (if (eq char ?d)
+ (concat "\\`" (regexp-quote domain) "\\(?:/\\|\\'\\)")
+ (concat "\\`"
+ (regexp-quote
+ (if (and (= char ?f) current-file)
+ (concat "file://" current-file) uri))
+ "\\'")))))
+ (prog1 (memq char '(?y ?n ?! ?d ?\s ?f))
+ (quit-window t)))))))
+
(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@/!)\"."
@@ -4790,7 +4747,6 @@ This is for getting out of special buffers like capture.")
;; 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))
@@ -4805,6 +4761,14 @@ This is for getting out of special buffers like capture.")
;; babel
(require 'ob)
+(defvar org-element-cache-persistent); Defined in org-element.el
+(defvar org-element-use-cache); Defined in org-element.el
+(defvar org-mode-loading nil
+ "Non-nil during Org mode initialization.")
+
+(defvar org-agenda-file-menu-enabled t
+ "When non-nil, refresh Agenda files in Org menu when loading Org.")
+
;;;###autoload
(define-derived-mode org-mode outline-mode "Org"
"Outline-based notes management and organizer, alias
@@ -4824,14 +4788,22 @@ can be exported as a structured ASCII or HTML file.
The following commands are available:
\\{org-mode-map}"
+ (setq-local org-mode-loading t)
(org-load-modules-maybe)
- (org-install-agenda-files-menu)
- (when org-link-descriptive (add-to-invisibility-spec '(org-link)))
+ (when org-agenda-file-menu-enabled
+ (org-install-agenda-files-menu))
+ (when (and org-link-descriptive
+ (eq org-fold-core-style 'overlays))
+ (add-to-invisibility-spec '(org-link)))
+ (org-fold-initialize (or (and (stringp org-ellipsis) (not (equal "" org-ellipsis)) org-ellipsis)
+ "..."))
(make-local-variable 'org-link-descriptive)
- (add-to-invisibility-spec '(org-hide-block . t))
+ (when (eq org-fold-core-style 'overlays) (add-to-invisibility-spec '(org-hide-block . t)))
+ (if org-link-descriptive
+ (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible nil)
+ (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible 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)))
@@ -4859,6 +4831,11 @@ The following commands are available:
(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 cache.
+ (org-element-cache-reset)
+ (when (and org-element-cache-persistent
+ org-element-use-cache)
+ (org-persist-load 'org-element--cache (current-buffer) t))
;; Initialize macros templates.
(org-macro-initialize-templates)
;; Initialize radio targets.
@@ -4870,8 +4847,6 @@ The following commands are available:
(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
@@ -4933,7 +4908,7 @@ The following commands are available:
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))
+ (unless org-inhibit-startup-visibility-stuff (org-cycle-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))))
@@ -4960,7 +4935,8 @@ The following commands are available:
;; 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))
+ (org--set-faces-extend org-level-faces org-fontify-whole-heading-line)
+ (setq-local org-mode-loading nil))
;; Update `customize-package-emacs-version-alist'
(add-to-list 'customize-package-emacs-version-alist
@@ -4974,7 +4950,8 @@ The following commands are available:
("9.2" . "27.1")
("9.3" . "27.1")
("9.4" . "27.2")
- ("9.5" . "28.1")))
+ ("9.5" . "28.1")
+ ("9.6" . "29.1")))
(defvar org-mode-transpose-word-syntax-table
(let ((st (make-syntax-table text-mode-syntax-table)))
@@ -5010,16 +4987,18 @@ the rounding returns a past 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-encode-time
+ (apply #'list
+ 0 (* r (round (nth 1 time) r))
+ (nthcdr 2 time)))))
+ (if (or (not past) (time-less-p res now))
res
- (org-time-subtract res (* r 60)))))))
+ (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))))
+ (time-since (* 3600 org-extend-today-until))))
;;;; Font-Lock stuff, including the activators
@@ -5100,6 +5079,10 @@ stacked delimiters is N. Escaping delimiters is not possible."
(when verbatim?
(org-remove-flyspell-overlays-in
(match-beginning 0) (match-end 0))
+ (when (and (org-fold-core-folding-spec-p 'org-link)
+ (org-fold-core-folding-spec-p 'org-link-description))
+ (org-fold-region (match-beginning 0) (match-end 0) nil 'org-link)
+ (org-fold-region (match-beginning 0) (match-end 0) nil 'org-link-description))
(remove-text-properties (match-beginning 2) (match-end 2)
'(display t invisible t intangible t)))
(add-text-properties (match-beginning 2) (match-end 2)
@@ -5163,7 +5146,7 @@ prompted for."
(defsubst org-rear-nonsticky-at (pos)
(add-text-properties (1- pos) pos (list 'rear-nonsticky org-nonsticky-props)))
-(defun org-activate-links (limit)
+(defun org-activate-links--overlays (limit)
"Add link properties to links.
This includes angle, plain, and bracket links."
(catch :exit
@@ -5178,13 +5161,13 @@ This includes angle, plain, and bracket links."
(when (and (memq style org-highlight-links)
;; Do not span over paragraph boundaries.
(not (string-match-p org-element-paragraph-separate
- (match-string 0)))
+ (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 ((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))))
@@ -5234,6 +5217,99 @@ This includes angle, plain, and bracket links."
(funcall f start end path (eq style 'bracket))))
(throw :exit t))))) ;signal success
nil))
+(defun org-activate-links--text-properties (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))
+ ;; Initialize folding when used outside org-mode.
+ (unless (or (derived-mode-p 'org-mode)
+ (and (org-fold-folding-spec-p 'org-link-description)
+ (org-fold-folding-spec-p 'org-link)))
+ (org-fold-initialize (or (and (stringp org-ellipsis) (not (equal "" org-ellipsis)) org-ellipsis)
+ "...")))
+ ;; Handle invisible parts in bracket links.
+ (let ((spec (or (org-link-get-parameter type :display)
+ 'org-link)))
+ (unless (org-fold-folding-spec-p spec)
+ (org-fold-add-folding-spec spec
+ (cdr org-link--link-folding-spec)
+ nil
+ 'append)
+ (org-fold-core-set-folding-spec-property spec :visible t))
+ (org-fold-region start end nil 'org-link)
+ (org-fold-region start end nil 'org-link-description)
+ ;; We are folding the whole emphasized text with SPEC
+ ;; first. It makes everything invisible (or whatever
+ ;; the user wants).
+ (org-fold-region start end t spec)
+ ;; The visible part of the text is folded using
+ ;; 'org-link-description, which is forcing this part of
+ ;; the text to be visible.
+ (org-fold-region visible-start visible-end t 'org-link-description)
+ (add-text-properties start end properties)
+ (add-face-text-property start end face-property)
+ (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))
+(defsubst org-activate-links (limit)
+ "Add link properties to links.
+This includes angle, plain, and bracket links."
+ (if (eq org-fold-core-style 'text-properties)
+ (org-activate-links--text-properties limit)
+ (org-activate-links--overlays limit)))
(defun org-activate-code (limit)
(when (re-search-forward "^[ \t]*\\(:\\(?: .*\\|$\\)\n?\\)" limit t)
@@ -5765,8 +5841,13 @@ needs to be inserted at a specific position in the font-lock sequence.")
'(9 'org-special-keyword t))
;; Blocks and meta lines
'(org-fontify-meta-lines-and-blocks)
- ;; Citations
- '(org-cite-activate))))
+ '(org-fontify-inline-src-blocks)
+ ;; Citations. When an activate processor is specified, if
+ ;; specified, try loading it beforehand.
+ (progn
+ (unless (null org-cite-activate-processor)
+ (org-cite-try-load-processor org-cite-activate-processor))
+ '(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
@@ -5852,8 +5933,11 @@ needs to be inserted at a specific position in the font-lock sequence.")
(insert s)
(let ((org-odd-levels-only odd-levels))
(org-mode)
- (org-font-lock-ensure)
- (buffer-string))))
+ (font-lock-ensure)
+ (if org-link-descriptive
+ (org-link-display-format
+ (buffer-string))
+ (buffer-string)))))
(defun org-get-level-face (n)
"Get the right face for match N in font-lock matching of headlines."
@@ -5935,6 +6019,9 @@ If TAG is a number, get the corresponding match group."
'(mouse-face t keymap t org-linked-text t
invisible t intangible t
org-emphasis t))
+ (org-fold-region beg end nil 'org-link)
+ (org-fold-region beg end nil 'org-link-description)
+ (org-fold-core-update-optimisation beg end)
(org-remove-font-lock-display-properties beg end)))
(defconst org-script-display '(((raise -0.3) (height 0.7))
@@ -5980,6 +6067,8 @@ and subscripts."
(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)))
+ (put-text-property (match-beginning 2) (match-end 3)
+ 'org-emphasis t)
(add-text-properties (match-beginning 2) (match-end 2)
(list 'invisible t))
(when (and (eq (char-after (match-beginning 3)) ?{)
@@ -5999,6 +6088,7 @@ and subscripts."
(overlay-end o))))
(delete-overlay o))))
+;; FIXME: This function is unused.
(defun org-show-empty-lines-in-parent ()
"Move to the parent and re-show empty lines before visible headlines."
(save-excursion
@@ -6039,826 +6129,11 @@ open and agenda-wise Org files."
(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) (line-end-position)))
- (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)))))
+;; FIXME: It was in the middle of visibility section. Where should it go to?
(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 (line-end-position))
- (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 (line-beginning-position) 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)
- (line-end-position)
- (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
@@ -6927,24 +6202,27 @@ frame is not changed."
(pop-to-buffer ibuf))
(t (error "Invalid value")))
(narrow-to-region beg end)
- (org-show-all '(headings drawers blocks))
+ (org-fold-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)))))
+(cl-defun org-get-indirect-buffer (&optional (buffer (current-buffer)) heading)
+ "Return an indirect buffer based on BUFFER.
+If HEADING, append it to the name of the new buffer."
+ (let* ((base-buffer (or (buffer-base-buffer buffer) buffer))
+ (buffer-name (generate-new-buffer-name
+ (format "%s%s"
+ (buffer-name base-buffer)
+ (if heading
+ (concat "::" heading)
+ ""))))
+ (indirect-buffer (make-indirect-buffer base-buffer buffer-name 'clone)))
+ ;; Decouple folding state. We need to do it manually since
+ ;; `make-indirect-buffer' does not run
+ ;; `clone-indirect-buffer-hook'.
+ (org-fold-core-decouple-indirect-buffer-folds)
+ indirect-buffer))
(defun org-set-frame-title (title)
"Set the title of the current frame to the string TITLE."
@@ -7039,10 +6317,18 @@ unconditionally."
;; 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))))
+ (if (eq org-fold-core-style 'text-properties)
+ (cond
+ ((org-fold-folded-p
+ (max (point-min)
+ (1- (line-beginning-position)))
+ 'headline)
+ (org-fold-region (line-end-position 0) (line-end-position) nil 'headline))
+ (t nil))
+ (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)
@@ -7106,7 +6392,11 @@ Return nil before first heading."
(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)))
+ ;; When using `org-fold-core--optimise-for-huge-buffers',
+ ;; returned text will be invisible. Clear it up.
+ (save-match-data
+ (org-fold-core-remove-optimisation (match-beginning 0) (match-end 0)))
+ (let ((todo (and (not no-todo) (match-string 2)))
(priority (and (not no-priority) (match-string 3)))
(headline (pcase (match-string 4)
(`nil "")
@@ -7117,6 +6407,8 @@ Return nil before first heading."
"" h))
(h h)))
(tags (and (not no-tags) (match-string 5))))
+ ;; Restore cleared optimization.
+ (org-fold-core-update-optimisation (match-beginning 0) (match-end 0))
(mapconcat #'identity
(delq nil (list todo priority headline tags))
" "))))))
@@ -7133,18 +6425,21 @@ This is a list with the following elements:
(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)))))
+ (org-fold-core-remove-optimisation (match-beginning 0) (match-end 0))
+ (prog1
+ (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))
+ (org-fold-core-update-optimisation (match-beginning 0) (match-end 0))))))
(defun org-get-entry ()
"Get the entry text, after heading, entire subtree."
(save-excursion
(org-back-to-heading t)
- (buffer-substring (line-beginning-position 2) (org-end-of-subtree t))))
+ (filter-buffer-substring (line-beginning-position 2) (org-end-of-subtree t))))
(defun org-edit-headline (&optional heading)
"Edit the current headline.
@@ -7177,10 +6472,11 @@ Set it to HEADING when provided."
(interactive)
(org-insert-heading '(4) invisible-ok))
-(defun org-insert-todo-heading-respect-content (&optional force-state)
+(defun org-insert-todo-heading-respect-content (&optional _)
"Insert TODO heading with `org-insert-heading-respect-content' set to t."
(interactive)
- (org-insert-todo-heading force-state '(4)))
+ (let ((org-insert-heading-respect-content t))
+ (org-insert-todo-heading '(4) t)))
(defun org-insert-todo-heading (arg &optional force-heading)
"Insert a new heading with the same level and TODO state as current heading.
@@ -7253,7 +6549,9 @@ When a subtree is being promoted, the hook will be called for each node.")
See also `org-promote'."
(interactive)
(save-excursion
- (org-with-limited-levels (org-map-tree 'org-promote)))
+ (org-back-to-heading t)
+ (combine-change-calls (point) (save-excursion (org-end-of-subtree t))
+ (org-with-limited-levels (org-map-tree 'org-promote))))
(org-fix-position-after-promote))
(defun org-demote-subtree ()
@@ -7261,7 +6559,9 @@ See also `org-promote'."
See `org-demote' and `org-promote'."
(interactive)
(save-excursion
- (org-with-limited-levels (org-map-tree 'org-demote)))
+ (org-back-to-heading t)
+ (combine-change-calls (point) (save-excursion (org-end-of-subtree t))
+ (org-with-limited-levels (org-map-tree 'org-demote))))
(org-fix-position-after-promote))
(defun org-do-promote ()
@@ -7355,7 +6655,7 @@ odd number. Returns values greater than 0."
(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)))
+ (t (replace-match (apply #'propertize up-head (text-properties-at (match-beginning 0))) t)))
(unless (= level 1)
(when org-auto-align-tags (org-align-tags))
(when org-adapt-indentation (org-fixup-indentation (- diff))))
@@ -7370,9 +6670,10 @@ odd number. Returns values greater than 0."
(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))
+ (org-fold-core-ignore-fragility-checks
+ (replace-match (apply #'propertize down-head (text-properties-at (match-beginning 0))) 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 ()
@@ -7580,7 +6881,7 @@ case."
(goto-char (point-min))
;; First check if there are no even levels
(when (re-search-forward "^\\(\\*\\*\\)+ " nil t)
- (org-show-set-visibility 'canonical)
+ (org-fold-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)
@@ -7605,6 +6906,36 @@ case."
(interactive "p")
(org-move-subtree-down (- (prefix-numeric-value arg))))
+(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)
+ (line-end-position)
+ (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)))
+ (org-fold-heading nil))))
+ (org-cycle-hide-drawers 'all)
+ (org-cycle-show-empty-lines 'overview)))))
+
(defun org-move-subtree-down (&optional arg)
"Move the current subtree down past ARG headlines of the same level."
(interactive "p")
@@ -7643,9 +6974,9 @@ case."
(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))
+ (when (eq org-fold-core-style 'overlays) (org-remove-empty-overlays-at beg))
+ (unless (= beg (point-min)) (org-fold-region (1- beg) beg nil 'outline))
+ (unless (bobp) (org-fold-region (1- (point)) (point) nil 'outline))
(and (not (bolp)) (looking-at "\n") (forward-char 1))
(let ((bbb (point)))
(insert-before-markers txt)
@@ -7656,9 +6987,9 @@ case."
(org-skip-whitespace)
(move-marker ins-point nil)
(if folded
- (org-flag-subtree t)
- (org-show-entry)
- (org-show-children))
+ (org-fold-subtree t)
+ (org-fold-show-entry 'hide-drawers)
+ (org-fold-show-children))
(org-clean-visibility-after-subtree-move)
;; move back to the initial column we were at
(move-to-column col))))
@@ -7747,84 +7078,87 @@ 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))))
+ (setq tree (or tree (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)))))
+ (org-fold-core-ignore-fragility-checks
+ (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))
+ ;; Avoid re-parsing cache elements when i.e. level 1 heading
+ ;; is inserted and then promoted.
+ (combine-change-calls beg beg
+ (when (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
+ (insert 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 (org-fold-heading nil)))
+ ;; 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
+ (equal org-subtree-clip tree)
+ org-subtree-clip-folded)
+ ;; The tree was folded before it was killed/copied
+ (org-fold-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.
@@ -7833,7 +7167,7 @@ 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)) ""))
+ (let* ((kill (or txt (ignore-errors (current-kill 0))))
(re (org-get-limited-outline-regexp))
(^re (concat "^" re))
(start-level (and kill
@@ -7885,17 +7219,27 @@ If yes, remember the marker and the distance to BEG."
(move-marker (car x) (+ beg (cdr x))))
(setq org-markers-to-move nil))
-(defun org-narrow-to-subtree ()
+(defun org-narrow-to-subtree (&optional element)
"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)))))))
+ (if (org-element--cache-active-p)
+ (let* ((heading (org-element-lineage
+ (or element (org-element-at-point))
+ '(headline) t))
+ (end (org-element-property :end heading)))
+ (if (and heading end)
+ (narrow-to-region (org-element-property :begin heading)
+ (if (= end (point-max))
+ end (1- end)))
+ (signal 'outline-before-first-heading nil)))
+ (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."
@@ -8003,7 +7347,7 @@ with the original repeater."
(insert template)
(org-mode)
(goto-char (point-min))
- (org-show-subtree)
+ (org-fold-show-subtree)
(and idprop (if org-clone-delete-id
(org-entry-delete nil "ID")
(org-id-get-create t)))
@@ -8122,10 +7466,26 @@ the default is \"/\"."
(setf (substring fpath (- width 2)) "..")))
fpath))
-(defun org-display-outline-path (&optional file current separator just-return-string)
+(defun org-get-title (&optional buffer-or-file)
+ "Collect title from the provided `org-mode' BUFFER-OR-FILE.
+
+Returns nil if there are no #+TITLE property."
+ (let ((buffer (cond ((bufferp buffer-or-file) buffer-or-file)
+ ((stringp buffer-or-file) (find-file-noselect
+ buffer-or-file))
+ (t (current-buffer)))))
+ (with-current-buffer buffer
+ (org-macro-initialize-templates)
+ (let ((title (assoc-default "title" org-macro-templates)))
+ (unless (string= "" title)
+ title)))))
+
+(defun org-display-outline-path (&optional file-or-title 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 FILE-OR-TITLE is `title', prepend outline with file title. If
+it is non-nil or title is not present in document, prepend
+outline path 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 \"/\".
@@ -8133,6 +7493,7 @@ 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)))
+ (title-prop (when (eq file-or-title 'title) (org-get-title)))
(path (and (derived-mode-p 'org-mode) (org-get-outline-path)))
res)
(when current (setq path (append path
@@ -8144,7 +7505,10 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a message."
(org-format-outline-path
path
(1- (frame-width))
- (and file bfn (concat (file-name-nondirectory bfn) separator))
+ (and file-or-title bfn (concat (if (and (eq file-or-title 'title) title-prop)
+ title-prop
+ (file-name-nondirectory bfn))
+ separator))
separator))
(add-face-text-property 0 (length res)
`(:height ,(face-attribute 'default :height))
@@ -8275,7 +7639,7 @@ function is being called interactively."
(point))
what "children")
(goto-char start)
- (outline-show-subtree)
+ (org-fold-show-subtree)
(outline-next-heading))
(t
;; we will sort the top-level entries in this file
@@ -8291,7 +7655,7 @@ function is being called interactively."
(setq end (point-max))
(setq what "top-level")
(goto-char start)
- (org-show-all '(headings drawers blocks))))
+ (org-fold-show-all '(headings drawers blocks))))
(setq beg (point))
(when (>= beg end) (goto-char start) (user-error "Nothing to sort"))
@@ -8419,7 +7783,7 @@ function is being called interactively."
(t (error "Invalid sorting type `%c'" sorting-type))))
nil
(cond
- ((= dcst ?a) 'org-string-collate-lessp)
+ ((= dcst ?a) 'string-collate-lessp)
((= dcst ?f)
(or compare-func
(and interactive?
@@ -8519,7 +7883,7 @@ definitions."
;; 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)))
+ (not (string-collate-lessp s1 s2)))
;;;###autoload
(defun org-run-like-in-org-mode (cmd)
@@ -8528,23 +7892,30 @@ 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)
+ (let (vars vals)
(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))))))
+ (push (car var) vars)
+ (push (cadr var) vals)))
+ (cl-progv vars vals
+ (call-interactively 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))))))
+ (if (org-element--cache-active-p)
+ ;; Sync cache.
+ (org-with-point-at (org-element-property :begin (org-element-at-point pos))
+ (or (org-entry-get-with-inheritance "CATEGORY")
+ "???"))
+ (or (get-text-property pos 'org-category)
+ (progn
+ (org-refresh-category-properties)
+ (get-text-property pos 'org-category)))))))
;;; Refresh properties
@@ -8591,57 +7962,59 @@ the whole buffer."
(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)))))))
+ (with-silent-modifications
+ (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)))))))))
+ (unless (org-element--cache-active-p)
+ (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))))
+ (let ((category (catch 'buffer-category
+ (org-with-wide-buffer
+ (goto-char (point-max))
+ (while (re-search-backward "^[ \t]*#\\+CATEGORY:" (point-min) t)
+ (let ((element (org-element-at-point-no-context)))
+ (when (eq (org-element-type element) 'keyword)
+ (throw 'buffer-category
+ (org-element-property :value element))))))
+ default-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 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."
@@ -8692,7 +8065,7 @@ This is saved in case the need arises to restore it.")
(`windows-nt org-file-apps-windowsnt)
(_ org-file-apps-gnu)))
-(defun org--file-apps-entry-dlink-p (entry)
+(defun org--file-apps-entry-locator-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
@@ -8706,7 +8079,7 @@ a parameter."
(> (regexp-opt-depth selector) 0)
(or (and (stringp action)
(string-match "%[0-9]" action))
- (consp action))))
+ (functionp action))))
(_ nil)))
(defun org--file-apps-regexp-alist (list &optional add-auto-mode)
@@ -8729,6 +8102,74 @@ opened in Emacs."
(when add-auto-mode
(mapcar (lambda (x) (cons (car x) 'emacs)) auto-mode-alist))))
+(defun org--open-file-format-command
+ (mailcap-command file link match-data)
+ "Format MAILCAP-COMMAND to launch viewer for the FILE.
+
+MAILCAP-COMMAND may be an entry from the `org-file-apps' list or viewer
+field from mailcap file loaded to `mailcap-mime-data'. See \"RFC
+1524. A User Agent Configuration Mechanism For Multimedia Mail Format
+Information\" (URL `https://www.rfc-editor.org/rfc/rfc1524.html') for
+details, man page `mailcap(5)' for brief summary, and Info node
+`(emacs-mime) mailcap' for specific related to Emacs. Only a part of
+mailcap specification is supported.
+
+The following substitutions are interpolated in the MAILCAP-COMMAND
+string:
+
+- \"%s\" to FILE name passed through
+ `convert-standard-filename', so it must be absolute path.
+
+- \"%1\" to \"%9\" groups from MATCH-DATA found in the LINK string by
+ the regular expression in the key part of the `org-file-apps' entry.
+ (performed by caller). Not recommended, consider a lisp function
+ instead of a shell command. For example, the following link in an
+ Org file
+
+ <file:///usr/share/doc/bash/bashref.pdf::#Redirections::allocate a file>
+
+ may be handled by an `org-file-apps' entry like
+
+ (\"\\\\.pdf\\\\(?:\\\\.[gx]z\\\\|\\\\.bz2\\\\)?::\\\\(#[^:]+\\\\)::\\\\(.+\\\\)\\\\\\='\"
+ . \"okular --find %2 %s%1\")
+
+Use backslash \"\\\" to quote percent \"%\" or any other character
+including backslash itself.
+
+In addition, each argument is passed through `shell-quote-argument',
+so quotes around substitutions should not be used. For compliance
+with mailcap files shipped e.g. in Debian GNU/Linux, single or double
+quotes around substitutions are stripped. It deviates from mailcap
+specification that requires file name to be safe for shell and for the
+application."
+ (let ((spec (list (cons ?s (convert-standard-filename file))))
+ (ngroups (min 9 (- (/ (length match-data) 2) 1))))
+ (when (> ngroups 0)
+ (set-match-data match-data)
+ (dolist (i (number-sequence 1 ngroups))
+ (push (cons (+ ?0 i) (match-string-no-properties i link)) spec)))
+ (replace-regexp-in-string
+ (rx (or (and "\\" (or (group anything) string-end))
+ (and (optional (group (any "'\"")))
+ "%"
+ (or (group anything) string-end)
+ (optional (group (backref 2))))))
+ (lambda (fmt)
+ (let* ((backslash (match-string-no-properties 1 fmt))
+ (key (match-string 3 fmt))
+ (value (and key (alist-get (string-to-char key) spec))))
+ (cond
+ (backslash)
+ (value (let ((quot (match-string 2 fmt))
+ (subst (shell-quote-argument value)))
+ ;; Remove quotes around the file name - we use
+ ;; `shell-quote-argument'.
+ (if (match-string 4 fmt)
+ subst
+ (concat quot subst))))
+ (t (error "Invalid format `%s'" fmt)))))
+ mailcap-command nil 'literal)))
+
;;;###autoload
(defun org-open-file (path &optional in-emacs line search)
"Open the file at PATH.
@@ -8755,9 +8196,9 @@ 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))
+ (apps (cl-remove-if #'org--file-apps-entry-locator-p file-apps))
+ (apps-locator (cl-remove-if-not #'org--file-apps-entry-locator-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)
@@ -8770,7 +8211,6 @@ If the file does not exist, throw an error."
(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)))
@@ -8792,16 +8232,17 @@ If the file does not exist, throw an error."
(t
(setq cmd (or (and remp (cdr (assq 'remote apps)))
(and dirp (cdr (assq 'directory apps)))
- ;; First, try matching against apps-dlink if we
+ ;; First, try matching against apps-locator if we
;; get a match here, store the match data for
;; later.
- (let ((match (assoc-default dlink apps-dlink
- 'string-match)))
+ (let* ((case-fold-search t)
+ (match (assoc-default link apps-locator
+ '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,
+ nil))) ; if we have no match in apps-locator,
; always open the file in emacs if line or search
; is given (for backwards compatibility)
(assoc-default dfile
@@ -8826,27 +8267,8 @@ If the file does not exist, throw an error."
(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)))))
+ ((org-string-nw-p cmd)
+ (setq cmd (org--open-file-format-command cmd file link link-match-data))
(save-window-excursion
(message "Running %s...done" cmd)
@@ -8866,7 +8288,7 @@ If the file does not exist, throw an error."
(funcall (cdr (assq 'file org-link-frame-setup)) file)
(widen)
(cond (line (org-goto-line line)
- (when (derived-mode-p 'org-mode) (org-reveal)))
+ (when (derived-mode-p 'org-mode) (org-fold-reveal)))
(search (condition-case err
(org-link-search search)
;; Save position before error-ing out so user
@@ -8923,7 +8345,9 @@ 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.
+ "Open thing at point.
+The thing can be a link, citation, timestamp, footnote, src-block or
+tags.
When point is on a link, follow it. Normally, files will be
opened by an appropriate application. If the optional prefix
@@ -8938,6 +8362,10 @@ 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 src-block of inline src-block, open its result.
+
+When point is on a citation, follow it.
+
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.
@@ -9056,7 +8484,10 @@ there is one, return it."
(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))
+ ;; Only consider valid links or links openable via
+ ;; `org-open-at-point'.
+ (when (memq (org-element-type (org-element-context)) '(link comment comment-block node-property keyword))
+ (push (match-string 0) links)))
(setq links (org-uniquify (reverse links))))
(cond
((null links)
@@ -9162,7 +8593,7 @@ or to another Org file, automatically push the old position onto the ring."
(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))))
+ (when (or (org-invisible-p) (org-invisible-p2)) (org-fold-show-context 'mark-goto))))
;;; Following specific links
@@ -9417,11 +8848,12 @@ keywords relative to each registered export back-end."
(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:"))
+ '("ARCHIVE:" "AUTHOR:" "BIBLIOGRAPHY:" "BIND:" "CATEGORY:" "CITE_EXPORT:"
+ "COLUMNS:" "CREATOR:" "DATE:" "DESCRIPTION:" "DRAWERS:" "EMAIL:"
+ "EXCLUDE_TAGS:" "FILETAGS:" "INCLUDE:" "INDEX:" "KEYWORDS:" "LANGUAGE:"
+ "MACRO:" "OPTIONS:" "PROPERTY:" "PRINT_BIBLIOGRAPHY" "PRIORITIES:"
+ "SELECT_TAGS:" "SEQ_TODO:" "SETUPFILE:" "STARTUP:" "TAGS:" "TITLE:" "TODO:"
+ "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:"))
(defcustom org-structure-template-alist
'(("a" . "export ascii")
@@ -9435,9 +8867,11 @@ keywords relative to each registered export back-end."
("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.
+`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. If the block type
+consists of just uppercase letters, \"#+BEGIN_\" and \"#+END_\" are
+added instead.
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
@@ -9451,14 +8885,14 @@ block can be inserted by pressing TAB after the string \"<KEY\"."
:type '(repeat
(cons (string :tag "Key")
(string :tag "Template")))
- :package-version '(Org . "9.2"))
+ :package-version '(Org . "9.6"))
(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)
+ (or (symbol-value checklist)
org-structure-template-alist))))
(when elm
(org-display-warning
@@ -9569,18 +9003,24 @@ If an element cannot be made unique, an error is raised."
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."
+block.
+
+When foo is written as FOO, upcase the #+BEGIN/END as well."
(interactive
(list (pcase (org--insert-structure-template-mks)
(`("\t" . ,_) (read-string "Structure type: "))
(`(,_ ,choice . ,_) choice))))
- (let* ((region? (use-region-p))
+ (let* ((case-fold-search t) ; Make sure that matches are case-insensitive.
+ (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)))
+ (concat "\\`" (regexp-opt '("example" "export"
+ "src" "comment")))
+ type))
+ (upcase? (string= (car (split-string type))
+ (upcase (car (split-string type))))))
(when region? (goto-char region-start))
(let ((column (current-indentation)))
(if (save-excursion (skip-chars-backward " \t") (bolp))
@@ -9588,7 +9028,7 @@ block."
(insert "\n"))
(save-excursion
(indent-to column)
- (insert (format "#+begin_%s%s\n" type (if extended? " " "")))
+ (insert (format "#+%s_%s%s\n" (if upcase? "BEGIN" "begin") type (if extended? " " "")))
(when region?
(when verbatim? (org-escape-code-in-region (point) region-end))
(goto-char region-end)
@@ -9597,7 +9037,7 @@ block."
(end-of-line))
(unless (bolp) (insert "\n"))
(indent-to column)
- (insert (format "#+end_%s" (car (split-string type))))
+ (insert (format "#+%s_%s" (if upcase? "END" "end") (car (split-string type))))
(if (looking-at "[ \t]*$") (replace-match "")
(insert "\n"))
(when (and (eobp) (not (bolp))) (insert "\n")))
@@ -9652,7 +9092,7 @@ nil or a string to be used for the todo mark." )
(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)))
+ (org-encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)))
(t ct))))
ct1))
@@ -9660,7 +9100,7 @@ nil or a string to be used for the todo mark." )
"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)
+ (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)))
@@ -9735,7 +9175,8 @@ When called through ELisp, arg is also interpreted in the following way:
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))
+ (when (equal (prefix-numeric-value arg) -1) (org-cancel-repeater) (setq arg nil))
+ (when (< (prefix-numeric-value arg) -1) (user-error "Prefix argument %d not supported" arg))
(let ((org-blocker-hook org-blocker-hook)
commentp
case-fold-search)
@@ -9779,16 +9220,16 @@ When called through ELisp, arg is also interpreted in the following way:
((eq arg 'right)
;; Next state
(if this
- (if tail (car tail) nil)
- (car org-todo-keywords-1)))
+ (if tail (car tail) nil)
+ (car org-todo-keywords-1)))
((eq arg 'left)
;; Previous state
(unless (equal member org-todo-keywords-1)
- (if this
+ (if this
(nth (- (length org-todo-keywords-1)
(length tail) 2)
- org-todo-keywords-1)
- (org-last org-todo-keywords-1))))
+ org-todo-keywords-1)
+ (org-last org-todo-keywords-1))))
(arg
;; User or caller requests a specific state.
(cond
@@ -9796,15 +9237,15 @@ When called through ELisp, arg is also interpreted in the following way:
((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)))
+ (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)))
+ (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))
+ (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)
@@ -9815,10 +9256,10 @@ When called through ELisp, arg is also interpreted in the following way:
((null tail) nil) ;-> first entry
((memq interpret '(type priority))
(if (eq this-command last-command)
- (car tail)
- (if (> (length tail) 0)
+ (car tail)
+ (if (> (length tail) 0)
(or done-word (car org-done-keywords))
- nil)))
+ nil)))
(t
(car tail))))
(org-state (or
@@ -9849,7 +9290,20 @@ When called through ELisp, arg is also interpreted in the following way:
this org-state block-reason)
(throw 'exit nil)))))
(store-match-data match-data)
- (replace-match next t t)
+ (org-fold-core-ignore-modifications
+ (goto-char (match-beginning 0))
+ (replace-match "")
+ ;; We need to use `insert-before-markers-and-inherit'
+ ;; because: (1) We want to preserve the folding state
+ ;; text properties; (2) We do not want to make point
+ ;; move before new todo state when inserting a new todo
+ ;; into an empty heading. In (2), the above
+ ;; `save-excursion' is relying on markers saved before.
+ (insert-before-markers-and-inherit next)
+ (unless (org-invisible-p (line-beginning-position))
+ (org-fold-region (line-beginning-position)
+ (line-end-position)
+ nil)))
(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))
@@ -10163,9 +9617,9 @@ statistics everywhere."
(setq first nil cookie-present nil)
(unless (and level
(not (string-match
- "\\<checkbox\\>"
- (downcase (or (org-entry-get nil "COOKIE_DATA")
- "")))))
+ "\\<checkbox\\>"
+ (downcase (or (org-entry-get nil "COOKIE_DATA")
+ "")))))
(throw 'exit nil))
(while (re-search-forward box-re (line-end-position) t)
(setq cnt-all 0 cnt-done 0 cookie-present t)
@@ -10477,7 +9931,8 @@ This function is run automatically after each state change to a DONE state."
(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))))
+ (org-time-stamp-format t t)
+ (org-current-effective-time))))
(when org-log-repeat
(if org-log-setup
;; We are already setup for some record.
@@ -10535,7 +9990,7 @@ This function is run automatically after each state change to a DONE state."
(let ((nshiftmax 10)
(nshift 0))
(while (or (= nshift 0)
- (not (org-time-less-p nil time)))
+ (not (time-less-p nil time)))
(when (= nshiftmax (cl-incf nshift))
(or (y-or-n-p
(format "%d repeater intervals were not \
@@ -10592,81 +10047,86 @@ of `org-todo-keywords-1'."
"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]\
+ (org-fold-core-ignore-modifications
+ (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-ts-regexp-both' because we
+ ;; need to tell the difference between a
+ ;; real repeater and a time delta, e.g.
+ ;; "+2d".
+ (string-match-p org-ts-regexp-both time)
+ (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
+ 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)
- (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)))))
+ (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-and-inherit " " 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.
@@ -10751,15 +10211,18 @@ nil."
"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))))))
+ (or (let ((cached (org-element-at-point nil 'cached)))
+ (and cached
+ (eq 'planning (org-element-type cached))))
+ (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.
@@ -10768,101 +10231,102 @@ 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)))
+ (org-fold-core-ignore-modifications
+ (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.
+ (org-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
- (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)))))
+ (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-and-inherit "\n")
+ (when org-adapt-indentation
+ (indent-to-column (1+ (org-outline-level)))))
+ (t nil)))
+ (when what
+ ;; Insert planning keyword.
+ (insert-and-inherit (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.")
@@ -10876,6 +10340,10 @@ WHAT entry will also be removed."
"Remembered current time.
So that dynamically scoped `org-extend-today-until' affects
timestamps in state change log.")
+(defvar org-log-note-this-command
+ "`this-command' when `org-add-log-setup' is called.")
+(defvar org-log-note-recursion-depth
+ "`recursion-depth' when `org-add-log-setup' is called.")
(defvar org-log-post-message nil
"Message to be displayed after a log note has been stored.
@@ -10912,21 +10380,36 @@ narrowing."
(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)))))
+ ;; Unless current heading is the last heading in buffer
+ ;; and does not have a newline, `org-end-of-meta-data'
+ ;; should move us somewhere below the heading.
+ ;; Avoid situation when we insert drawer right before
+ ;; first "*". Otherwise, if the previous heading is
+ ;; folded, we are inserting after visible newline at
+ ;; the end of the fold, thus breaking the fold
+ ;; continuity.
+ (unless (eobp)
+ (when (org-at-heading-p) (backward-char)))
+ (org-fold-core-ignore-modifications
+ (unless (bolp) (insert-and-inherit "\n"))
+ (let ((beg (point)))
+ (insert-and-inherit ":" drawer ":\n:END:\n")
+ (org-indent-region beg (point))
+ (org-fold-region (line-end-position -1) (1- (point)) t (if (eq org-fold-core-style 'text-properties) 'drawer '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)))))
+ (let ((endpos (point)))
+ (skip-chars-forward " \t\n")
+ (beginning-of-line)
+ (unless org-log-states-order-reversed
+ (org-skip-over-state-notes)
+ (skip-chars-backward " \t\n")
+ (beginning-of-line 2))
+ ;; When current headline is at the end of buffer and does not
+ ;; end with trailing newline the above can move to the
+ ;; beginning of the headline.
+ (when (< (point) endpos) (goto-char endpos))))))
(if (bolp) (point) (line-beginning-position 2))))
(defun org-add-log-setup (&optional purpose state prev-state how extra)
@@ -10941,6 +10424,8 @@ EXTRA is additional text that will be inserted into the notes buffer."
org-log-note-how how
org-log-note-extra extra
org-log-note-effective-time (org-current-effective-time)
+ org-log-note-this-command this-command
+ org-log-note-recursion-depth (recursion-depth)
org-log-setup t)
(add-hook 'post-command-hook 'org-add-log-note 'append))
@@ -10969,37 +10454,39 @@ EXTRA is additional text that will be inserted into the notes buffer."
(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.
+ (when (and (equal org-log-note-this-command this-command)
+ (= org-log-note-recursion-depth (recursion-depth)))
+ (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)))
+ (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 ()
@@ -11052,34 +10539,36 @@ EXTRA is additional text that will be inserted into the notes buffer."
(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)))))
+ (org-fold-core-ignore-modifications
+ (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-and-inherit "\n")))
+ ((looking-at "[ \t]*\\S-") (save-excursion (insert-and-inherit "\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-and-inherit (org-list-bullet-string "-") (pop lines))
+ (let ((ind (org-list-item-body-column (line-beginning-position))))
+ (dolist (line lines)
+ (insert-and-inherit "\n")
+ (unless (string-empty-p line)
+ (indent-line-to ind)
+ (insert-and-inherit 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)
@@ -11174,7 +10663,7 @@ as well.")
"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.
+defined in `org-fold-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
@@ -11196,7 +10685,7 @@ The function must neither move point nor alter narrowing."
(when (or (not keep-previous) ; do not want to keep
(not org-occur-highlights)) ; no previous matches
;; hide everything
- (org-overview))
+ (org-cycle-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)))
@@ -11206,12 +10695,12 @@ The function must neither move point nor alter narrowing."
(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)))))
+ (org-fold-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)))
+ (org-fold-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))
@@ -11470,7 +10959,7 @@ headlines matching this string."
;; Get the correct level to match
(concat "\\*\\{" (number-to-string start-level) "\\} ")
org-outline-regexp)
- " *\\(" (regexp-opt org-todo-keywords-1 'words) "\\)?"
+ " *\\(?:\\(" (regexp-opt org-todo-keywords-1 t) "\\) \\)?"
" *\\(.*?\\)\\([ \t]:\\(?:" org-tag-re ":\\)+\\)?[ \t]*$"))
(props (list 'face 'default
'done-face 'org-agenda-done
@@ -11495,120 +10984,220 @@ headlines matching this string."
(save-excursion
(goto-char (point-min))
(when (eq action 'sparse-tree)
- (org-overview)
+ (org-cycle-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)))))
+ (if (org-element--cache-active-p)
+ (let ((fast-re (concat "^"
+ (if start-level
+ ;; Get the correct level to match
+ (concat "\\*\\{" (number-to-string start-level) "\\} ")
+ org-outline-regexp))))
+ (org-element-cache-map
+ (lambda (el)
+ (goto-char (org-element-property :begin el))
+ (setq todo (org-element-property :todo-keyword el)
+ level (org-element-property :level el)
+ category (org-entry-get-with-inheritance "CATEGORY" nil el)
+ tags-list (org-get-tags el)
+ org-scanner-tags tags-list)
+ (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)))
+ (catch :skip
+ (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 el))
+ 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-fold-show-context 'tags-tree))
+ ((eq action 'agenda)
+ (let* ((effort (org-entry-get (point) org-effort-property))
+ (effort-minutes (when effort (save-match-data (org-duration-to-minutes effort)))))
+ (setq txt (org-agenda-format-item
+ ""
+ ;; Add `effort' and `effort-minutes'
+ ;; properties for prefix format.
+ (org-add-props
+ (concat
+ (if (eq org-tags-match-list-sublevels 'indented)
+ (make-string (1- level) ?.) "")
+ (org-get-heading))
+ nil
+ 'effort effort
+ 'effort-minutes effort-minutes)
+ (make-string level ?\s)
+ category
+ tags-list)
+ priority (org-get-priority txt))
+ ;; Now add `effort' and `effort-minutes' to
+ ;; full agenda line.
+ (setq txt (org-add-props txt nil
+ 'effort effort
+ 'effort-minutes effort-minutes)))
+ (goto-char (org-element-property :begin el))
+ (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
+ (goto-char (1- (org-element-property :end el))))))
+ ;; Get the correct position from where to continue
+ (when org-map-continue-from
+ (setq org-element-cache-map-continue-from org-map-continue-from)
+ (goto-char org-map-continue-from))
+ ;; Return nil.
+ nil)
+ :next-re fast-re
+ :fail-re fast-re
+ :narrow t))
+ (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-fold-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)))
+ (org-fold-hide-archived-subtrees (point-min) (point-max)))
(nreverse rtn)))
(defun org-remove-uninherited-tags (tags)
@@ -11785,13 +11374,13 @@ See also `org-scan-tags'."
(propp
(let* ((gv (pcase (upcase (match-string 5 term))
("CATEGORY"
- '(get-text-property (point) 'org-category))
+ '(org-get-category (point)))
("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))
+ (timep (string-match-p "^\"[[<][0-9]+.*[]>]\"$" 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))
@@ -12027,24 +11616,29 @@ in Lisp code use `org-set-tags' instead."
(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.
+ (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
+ 'region-start-level 'region))
+ 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)
+ nil cl
(lambda () (when (org-invisible-p) (org-end-of-subtree nil t))))))
(t
(save-excursion
(org-back-to-heading)
(let* ((all-tags (org-get-tags))
+ (local-table (or org-current-tag-alist (org-get-buffer-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)))))
+ (append
+ ;; Put local tags in front.
+ local-table
+ (cl-set-difference
+ (org--tag-add-to-alist
+ (and org-complete-tags-always-offer-all-agenda-tags
+ (org-global-tags-completion-table
+ (org-agenda-files)))
+ local-table)
+ local-table))))
(current-tags
(cl-remove-if (lambda (tag) (get-text-property 0 'inherited tag))
all-tags))
@@ -12086,8 +11680,12 @@ 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)))
+ (save-excursion
+ (org-back-to-heading-or-point-min)
+ (length
+ (get-text-property
+ (line-end-position)
+ 'line-prefix)))
0)))
(+ org-tags-column
(if (> org-tags-column 0) (- offset) offset))))))
@@ -12110,34 +11708,35 @@ 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)))))
+ (org-fold-core-ignore-modifications
+ (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-and-inherit " " (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-fold-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.
@@ -12315,7 +11914,9 @@ Returns the new tags string, or nil to not change the current settings."
(while (equal (car tbl) '(:newline))
(insert "\n")
(setq tbl (cdr tbl)))))
- ((equal e '(:grouptags)) (insert " : "))
+ ((equal e '(:grouptags))
+ (delete-char -3)
+ (insert " : "))
(t
(setq tg (copy-sequence (car e)) c2 nil)
(if (cdr e)
@@ -12328,7 +11929,13 @@ Returns the new tags string, or nil to not change the current settings."
(while (or (rassoc char ntable) (rassoc char table))
(setq char (1+ char)))
(setq c2 c1))
- (setq c (or c2 char)))
+ (setq c (or c2
+ (if (> char ?~)
+ ?\s
+ char)))
+ ;; Consider characters A-Z after a-z.
+ (if (equal char ?z)
+ (setq char ?A)))
(when ingroup (push tg (car groups)))
(setq tg (org-add-props tg nil 'face
(cond
@@ -12434,8 +12041,7 @@ Returns the new tags string, or nil to not change the current settings."
(cond
((member tag current) c-face)
((member tag inherited) i-face)
- (t (get-text-property (match-beginning 1) '
- face))))))))
+ (t 'default)))))))
(goto-char (point-min)))))
(delete-overlay org-tags-overlay)
(if rtn
@@ -12451,13 +12057,21 @@ TAGS is a list of strings."
(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)
+ (let* ((cached (and (org-element--cache-active-p) (org-element-at-point nil 'cached)))
+ (cached-tags (org-element-property :tags cached)))
+ (if cached
+ ;; If we do not explicitly copy the result, reference would
+ ;; be returned and cache element might be modified directly.
+ (mapcar #'copy-sequence cached-tags)
+ ;; Parse tags manually.
+ (and (looking-at org-tag-line-re)
+ (split-string (match-string-no-properties 2) ":" t)))))
+
+(defun org-get-tags (&optional pos-or-element local)
"Get the list of tags specified in the current headline.
-When argument POS is non-nil, retrieve tags for headline at POS.
+When argument POS-OR-ELEMENT 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
@@ -12470,19 +12084,36 @@ 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)
+ (save-match-data
+ (if (and org-trust-scanner-tags
+ (or (not pos-or-element) (eq pos-or-element (point)))
+ (not local))
+ org-scanner-tags
+ (org-with-point-at (unless (org-element-type pos-or-element)
+ (or pos-or-element (point)))
+ (unless (or (org-element-type pos-or-element)
+ (org-before-first-heading-p))
+ (org-back-to-heading t))
+ (let ((ltags (if (org-element-type pos-or-element)
+ (org-element-property :tags (org-element-lineage pos-or-element '(headline inlinetask) t))
+ (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)))
+ (let ((cached (and (org-element--cache-active-p)
+ (if (org-element-type pos-or-element)
+ (org-element-lineage pos-or-element '(headline org-data inlinetask) t)
+ (org-element-at-point nil 'cached)))))
+ (if cached
+ (while (setq cached (org-element-property :parent cached))
+ (setq itags (nconc (mapcar #'org-add-prop-inherited
+ ;; If we do explicitly copy the result, reference would
+ ;; be returned and cache element might be modified directly.
+ (mapcar #'copy-sequence (org-element-property :tags cached)))
+ itags)))
+ (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
@@ -12490,12 +12121,24 @@ Inherited tags have the `inherited' text property."
(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))))))
+ (if (org-element--cache-active-p)
+ ;; `org-element-cache-map' is about 2x faster compared to regexp
+ ;; search.
+ (let ((hashed (make-hash-table :test #'equal)))
+ (org-element-cache-map
+ (lambda (el)
+ (dolist (tag (org-element-property :tags el))
+ ;; Do not carry over the text properties. They may look
+ ;; ugly in the completion.
+ (puthash (list (substring-no-properties tag)) t hashed))))
+ (dolist (tag org-file-tags) (puthash (list tag) t hashed))
+ (hash-table-keys hashed))
+ (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
@@ -12606,15 +12249,18 @@ a *different* entry, you cannot use these techniques."
(if (not scope)
(progn
- (org-agenda-prepare-buffers
- (and buffer-file-name (list buffer-file-name)))
+ ;; Agenda expects a file buffer. Skip over refreshing
+ ;; agenda cache for non-file buffers.
+ (when buffer-file-name
+ (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)))
+ (setq scope (eval scope t)))
((eq scope 'agenda)
(setq scope (org-agenda-files t)))
((eq scope 'agenda-with-archives)
@@ -12652,7 +12298,8 @@ but in some other way.")
"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")
+ "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS"
+ "ORG-IMAGE-ACTUAL-WIDTH")
"Some properties that are used by Org mode for various purposes.
Being in this list makes sure that they are offered for completion.")
@@ -12781,9 +12428,10 @@ variables is set."
;; 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)
+ (unless (org-element--cache-active-p)
+ (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)
@@ -12992,30 +12640,41 @@ strings."
;; Return value.
props)))))
-(defun org--property-local-values (property literal-nil)
- "Return value for PROPERTY in current entry.
+(defun org--property-local-values (property literal-nil &optional element)
+ "Return value for PROPERTY in current entry or ELEMENT.
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))))))
+ (let ((element (or element
+ (and (org-element--cache-active-p)
+ (org-element-at-point nil 'cached)))))
+ (if element
+ (let* ((element (org-element-lineage element '(headline org-data inlinetask) 'with-self))
+ (base-value (org-element-property (intern (concat ":" (upcase property))) element))
+ (base-value (if literal-nil base-value (org-not-nil base-value)))
+ (extra-value (org-element-property (intern (concat ":" (upcase property) "+")) element))
+ (extra-value (if (listp extra-value) extra-value (list extra-value)))
+ (value (cons base-value extra-value)))
+ (and (not (equal value '(nil))) value))
+ (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.
@@ -13056,7 +12715,9 @@ value higher up the hierarchy."
(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) " "))))
+ (value (and local (mapconcat #'identity
+ (delq nil local)
+ (org--property-get-separator property)))))
(if literal-nil value (org-not-nil value)))))))
(defun org-property-or-variable-value (var &optional inherit)
@@ -13153,7 +12814,7 @@ 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)
+(defun org-entry-get-with-inheritance (property &optional literal-nil element)
"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
@@ -13161,27 +12822,63 @@ 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)
+ (let (value at-bob-no-heading)
(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))))))
+ (let ((element (or element
+ (and (org-element--cache-active-p)
+ (org-element-at-point nil 'cached))))
+ (separator (org--property-get-separator property)))
+ (if element
+ (let ((element (org-element-lineage element '(headline org-data inlinetask) 'with-self)))
+ (while t
+ (let* ((v (org--property-local-values property literal-nil element))
+ (v (if (listp v) v (list v))))
+ (when v
+ (setq value
+ (concat (mapconcat #'identity (delq nil v) separator)
+ (and value separator)
+ value)))
+ (cond
+ ((car v)
+ (move-marker org-entry-property-inherited-from (org-element-property :begin element))
+ (throw 'exit nil))
+ ((org-element-property :parent element)
+ (setq element (org-element-property :parent element)))
+ (t
+ (let ((global (org--property-global-or-keyword-value property literal-nil)))
+ (cond ((not global))
+ (value (setq value (concat global separator value)))
+ (t (setq value global))))
+ (throw 'exit nil))))))
+ (while t
+ (let ((v (org--property-local-values property literal-nil)))
+ (when v
+ (setq value
+ (concat (mapconcat #'identity (delq nil v) separator)
+ (and value separator)
+ value)))
+ (cond
+ ((car v)
+ (org-back-to-heading-or-point-min t)
+ (move-marker org-entry-property-inherited-from (point))
+ (throw 'exit nil))
+ ((or (org-up-heading-safe)
+ (and (not (bobp))
+ (goto-char (point-min))
+ nil)
+ ;; `org-up-heading-safe' returned nil. We are at low
+ ;; level heading or bob. If there is headline
+ ;; there, do not try to fetch its properties.
+ (and (bobp)
+ (not at-bob-no-heading)
+ (not (org-at-heading-p))
+ (setq at-bob-no-heading t))))
+ (t
+ (let ((global (org--property-global-or-keyword-value property literal-nil)))
+ (cond ((not global))
+ (value (setq value (concat global separator value)))
+ (t (setq value global))))
+ (throw 'exit nil))))))))
(if literal-nil value (org-not-nil value)))))
(defvar org-property-changed-functions nil
@@ -13250,19 +12947,20 @@ decreases scheduled or deadline date by one day."
((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)))))
+ (org-fold-core-ignore-modifications
+ (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-and-inherit "\n")
+ (backward-char))
+ (insert-and-inherit ":" property ":")
+ (when value (insert-and-inherit " " value))
+ (org-indent-line))))))
(run-hook-with-args 'org-property-changed-functions property value))))
(defun org-buffer-property-keys (&optional specials defaults columns)
@@ -13364,9 +13062,8 @@ drawer is immediately hidden."
(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))))
+ (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
@@ -13376,7 +13073,7 @@ drawer is immediately hidden."
(inhibit-read-only t))
(unless (bobp) (insert "\n"))
(insert ":PROPERTIES:\n:END:")
- (org-flag-region (line-end-position 0) (point) t 'outline)
+ (org-fold-region (line-end-position 0) (point) t (if (eq org-fold-core-style 'text-properties) 'drawer 'outline))
(when (or (eobp) (= begin (point-min))) (insert "\n"))
(org-indent-region begin (point))))))
@@ -13685,10 +13382,11 @@ completion."
(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)
+ (unless (org-element--cache-active-p)
+ (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)))
@@ -13948,6 +13646,9 @@ 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 `<'.
+There are many other calendar navigation commands available, see
+Info node `(org) The date/time prompt' for a full list.
+
If you don't like the calendar, turn it off with
(setq org-read-date-popup-calendar nil)
@@ -13983,7 +13684,7 @@ user."
(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-def (org-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")
@@ -14056,7 +13757,7 @@ user."
"range representable on this machine"))
(ding))
- (setq final (apply #'encode-time final))
+ (setq final (org-encode-time final))
(setq org-read-date-final-answer ans)
@@ -14079,23 +13780,20 @@ user."
(save-excursion
(end-of-line 1)
(while (not (equal (buffer-substring
- (max (point-min) (- (point) 4)) (point))
- " "))
+ (max (point-min) (- (point) 4)) (point))
+ " "))
(insert " ")))
(let* ((ans (concat (buffer-substring (line-beginning-position)
(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))
+ (fmt (org-time-stamp-format
+ (or org-with-time
+ (and (boundp 'org-time-was-given) org-time-was-given))
+ org-read-date-inactive
+ org-display-custom-times))
+ (txt (format-time-string fmt (org-encode-time f)))
(txt (concat "=> " txt)))
(when (and org-end-time-was-given
(string-match org-plain-time-of-day-regexp txt))
@@ -14305,14 +14003,18 @@ user."
(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)))))
+ (cond ((member deltaw '("h" ""))
+ (when (boundp 'org-time-was-given)
+ (setq org-time-was-given t))
+ (setq hour (+ hour deltan)))
+ ((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))))
+ (setq wday1 (nth 6 (decode-time (org-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)
@@ -14327,12 +14029,12 @@ user."
(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))
+ (ignore (org-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)))
+ (list second minute hour day month year nil -1 nil)))
(defvar parse-time-weekdays)
(defun org-read-date-get-relative (s today default)
@@ -14345,12 +14047,14 @@ 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)
+ ;; Force case-insensitive.
+ (let ((case-fold-search t))
+ (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))
@@ -14389,10 +14093,10 @@ 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)
+ (eval form t)
(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))))
+ (time (org-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)
@@ -14404,7 +14108,7 @@ 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))))
+ (time (org-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))))
@@ -14417,23 +14121,23 @@ 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)))
+ (org-fold-core-ignore-modifications
+ (let ((fmt (org-time-stamp-format with-hm inactive))
+ stamp)
+ (insert-before-markers-and-inherit (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-and-inherit (setq stamp (format-time-string fmt time)))
+ (insert-before-markers-and-inherit (or post ""))
+ (setq org-last-inserted-timestamp stamp))))
(defun org-toggle-time-stamp-overlays ()
"Toggle the use of custom time stamp formats."
@@ -14464,11 +14168,10 @@ The command returns the inserted time stamp."
(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)
+ tf (org-time-stamp-format with-hm 'no-brackets 'custom)
time (org-fix-decoded-time t1)
str (org-add-props
- (format-time-string
- (substring tf 1 -1) (apply 'encode-time time))
+ (format-time-string tf (org-encode-time time))
nil 'mouse-face 'highlight))
(put-text-property beg end 'display str)))
@@ -14522,7 +14225,7 @@ This is used by `org-read-date' in a temporary keymap for the calendar buffer."
(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))))
+ (time (org-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))))
@@ -14723,13 +14426,13 @@ days in order to avoid rounding problems."
(defun org-time-string-to-time (s)
"Convert timestamp string S into internal time."
- (apply #'encode-time (org-parse-time-string s)))
+ (org-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")
+(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.
@@ -14786,7 +14489,7 @@ into a past one. Any year larger than 99 is returned unchanged."
"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)))
+ (org-encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d)))
(defvar org-agenda-current-date)
(defun org-calendar-holiday ()
@@ -14795,30 +14498,40 @@ D may be an absolute day number, or a calendar-type list (month day year)."
(let ((hl (calendar-check-holidays org-agenda-current-date)))
(and hl (mapconcat #'identity hl "; "))))
+(defvar org--diary-sexp-entry-cache (make-hash-table :test #'equal)
+ "Hash table holding return values of `org-diary-sexp-entry'.")
(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))))
+ (let ((cached (gethash (list sexp entry d) org--diary-sexp-entry-cache 'none)))
+ (if (not (eq 'none cached)) cached
+ (puthash (list sexp entry d)
+ (let* ((sexp `(let ((entry ,entry)
+ (date ',d))
+ ,(car (read-from-string sexp))))
+ ;; FIXME: Do not use (eval ... t) in the following sexp as
+ ;; diary vars are still using dynamic scope.
+ (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)))
+ org--diary-sexp-entry-cache))))
(defun org-diary-to-ical-string (frombuf)
"Get iCalendar entries from diary entries in buffer FROMBUF.
@@ -15138,14 +14851,15 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
(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)))
+ (org-encode-time
+ (apply #'list
+ (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))
@@ -15163,7 +14877,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
(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))))
+ (setq time (org-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).
@@ -15217,7 +14931,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
(message "No clock to adjust")
(save-excursion
(org-goto-marker-or-bmk clfixpos)
- (org-show-subtree)
+ (org-fold-show-subtree)
(when (re-search-forward clrgx nil t)
(goto-char (match-beginning 1))
(let (org-clock-adjust-closest)
@@ -15309,7 +15023,7 @@ If there is already a time stamp at the cursor position, update it."
(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))))))
+ (org-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.
@@ -15420,44 +15134,6 @@ prefix, restrict available buffers to agenda files."
(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
@@ -15667,72 +15343,56 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(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)
+ (let ((inhibit-read-only t)
(org-inhibit-startup org-agenda-inhibit-startup)
- (rea (org-make-tag-string (list org-archive-tag)))
- re pos)
+ ;; Do not refresh list of agenda files in the menu when
+ ;; opening every new file.
+ (org-agenda-file-menu-enabled nil))
(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 (line-beginning-position)
- (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))))
+ (dolist (file files)
+ (catch 'nextfile
+ (with-current-buffer
+ (if (bufferp file)
+ file
+ (org-check-agenda-file file)
+ (org-get-agenda-file-buffer file))
+ (org-with-wide-buffer
+ (org-set-regexps-and-options 'tags-only)
+ (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)
+ (unless org-element-use-cache
+ (org-refresh-effort-properties)))
+ (or (memq 'appt org-agenda-ignore-properties)
+ (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime))
+ (dolist (el org-todo-keywords-1)
+ (unless (member el org-todo-keywords-for-agenda)
+ (push el org-todo-keywords-for-agenda)))
+ (dolist (el org-done-keywords)
+ (unless (member el org-done-keywords-for-agenda)
+ (push el org-done-keywords-for-agenda)))
+ (setq org-todo-keyword-alist-for-agenda
+ (org--tag-add-to-alist
+ org-todo-key-alist
+ org-todo-keyword-alist-for-agenda))
+ (setq org-tag-alist-for-agenda
+ (org--tag-add-to-alist
+ org-current-tag-alist
+ org-tag-alist-for-agenda))
+ ;; 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)))))))))
+ ;; Refresh the menu once after loading all the agenda buffers.
+ (when org-agenda-file-menu-enabled
+ (org-install-agenda-files-menu))))
;;;; CDLaTeX minor mode
@@ -15761,25 +15421,29 @@ in Org mode.
(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.
+ (advice-add 'texmathp :around #'org--math-always-on)))
+
+(defun org--math-always-on (orig-fun &rest args)
+ "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)))))))))
+ (interactive)
+ (cond
+ ((not (derived-mode-p 'org-mode)) (apply orig-fun args))
+ ((eq this-command 'cdlatex-math-symbol)
+ (setq texmathp-why '("cdlatex-math-symbol in org-mode" . 0))
+ t)
+ (t
+ (let ((p (org-inside-LaTeX-fragment-p)))
+ (when p ;; FIXME: Shouldn't we return t when `p' is nil?
+ (if (member (car p)
+ (plist-get org-format-latex-options :matchers))
+ (progn
+ (setq texmathp-why '("Org mode embedded math" . 0))
+ t)
+ (apply orig-fun args)))))))
(defun turn-on-org-cdlatex ()
"Unconditionally turn on `org-cdlatex-mode'."
@@ -15982,7 +15646,8 @@ BEG and END are buffer positions."
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.
+all fragments in the current section. With an active region,
+display images for all fragments in the region.
With a `\\[universal-argument]' prefix argument ARG, clear images \
for all fragments
@@ -16010,10 +15675,18 @@ fragments in the buffer."
;; 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))))
+ (if (use-region-p)
+ (region-beginning)
+ (if (org-before-first-heading-p) (point-min)
+ (save-excursion
+ (org-with-limited-levels (org-back-to-heading t) (point)))))
+ (if (use-region-p)
+ (region-end)
+ (org-with-limited-levels (org-entry-end-position)))))
+ ((use-region-p)
+ (message "Creating LaTeX previews in region...")
+ (org--latex-preview-region (region-beginning) (region-end))
+ (message "Creating LaTeX previews in region... done."))
;; Toggle preview on LaTeX code at point.
((let ((datum (org-element-context)))
(and (memq (org-element-type datum) '(latex-environment latex-fragment))
@@ -16314,7 +15987,6 @@ a HTML file."
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)))
@@ -16323,12 +15995,16 @@ a HTML file."
'(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)))
+ (dpi (* scale (if (and buffer (display-graphic-p)) (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*"))
+ (image-converter
+ (or (and (string= bg "Transparent")
+ (plist-get processing-info :transparent-image-converter))
+ (plist-get processing-info :image-converter)))
+ (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))
@@ -16460,21 +16136,32 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML."
(defvar-local org-inline-image-overlays nil)
-(defun org-toggle-inline-images (&optional include-linked)
+(defun org--inline-image-overlays (&optional beg end)
+ "Return image overlays between BEG and END."
+ (let* ((beg (or beg (point-min)))
+ (end (or end (point-max)))
+ (overlays (overlays-in beg end))
+ result)
+ (dolist (ov overlays result)
+ (when (memq ov org-inline-image-overlays)
+ (push ov result)))))
+
+(defun org-toggle-inline-images (&optional include-linked beg end)
"Toggle the display of inline images.
INCLUDE-LINKED is passed to `org-display-inline-images'."
(interactive "P")
- (if org-inline-image-overlays
+ (if (org--inline-image-overlays beg end)
(progn
- (org-remove-inline-images)
- (when (called-interactively-p 'interactive)
+ (org-remove-inline-images beg end)
+ (when (called-interactively-p 'interactive)
(message "Inline image display turned off")))
- (org-display-inline-images include-linked)
+ (org-display-inline-images include-linked nil beg end)
(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")))))
+ (let ((new (org--inline-image-overlays beg end)))
+ (message (if new
+ (format "%d images displayed inline"
+ (length new))
+ "No images to display inline"))))))
(defun org-redisplay-inline-images ()
"Assure display of inline images and refresh them."
@@ -16529,7 +16216,7 @@ according to the value of `org-display-remote-inline-images'."
width
'imagemagick)
remote?
- :width width))))
+ :width width :scale 1))))
(defun org-display-inline-images (&optional include-linked refresh beg end)
"Display inline images.
@@ -16559,8 +16246,8 @@ 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 refresh
+ (org-remove-inline-images beg end)
(when (fboundp 'clear-image-cache) (clear-image-cache)))
(let ((end (or end (point-max))))
(org-with-point-at (or beg (point-min))
@@ -16658,44 +16345,51 @@ buffer boundaries with possible narrowing."
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)))
+ ;; Support subtree-level property "ORG-IMAGE-ACTUAL-WIDTH" specified
+ ;; width.
+ (let ((org-image-actual-width (org-property-or-variable-value 'org-image-actual-width)))
+ (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)))
+ (width
+ (cond
+ ;; Treat :width t as if `org-image-actual-width' were t.
+ ((string= attr-width "t") nil)
+ ;; Fallback to `org-image-actual-width' if no interprable width is given.
+ ((or (null attr-width)
+ (string-match-p "\\`[^0-9]" attr-width))
+ (car org-image-actual-width))
+ ;; Convert numeric widths to numbers, converting percentages.
+ ((string-match-p "\\`[0-9.]+%" attr-width)
+ (/ (string-to-number attr-width) 100.0))
+ (t (string-to-number attr-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) (line-number-display-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."
@@ -16703,21 +16397,38 @@ buffer boundaries with possible narrowing."
(delete ov org-inline-image-overlays)
(delete-overlay ov)))
-(defun org-remove-inline-images ()
+(defun org-remove-inline-images (&optional beg end)
"Remove inline display of images."
(interactive)
- (mapc #'delete-overlay org-inline-image-overlays)
- (setq org-inline-image-overlays nil))
+ (let* ((beg (or beg (point-min)))
+ (end (or end (point-max)))
+ (overlays (overlays-in beg end)))
+ (dolist (ov overlays)
+ (when (memq ov org-inline-image-overlays)
+ (setq org-inline-image-overlays (delq ov org-inline-image-overlays))
+ (delete-overlay ov)))
+ ;; Clear removed overlays.
+ (dolist (ov org-inline-image-overlays)
+ (unless (overlay-buffer ov)
+ (setq org-inline-image-overlays (delq ov org-inline-image-overlays))))))
(defvar org-self-insert-command-undo-counter 0)
(defvar org-speed-command nil)
+(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-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)
+ (org-fold-check-before-invisible-edit 'insert)
(cond
((and org-use-speed-commands
(let ((kv (this-command-keys-vector)))
@@ -16731,8 +16442,8 @@ overwritten, and the table is not marked as requiring realignment."
(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))
+ ((consp org-speed-command)
+ (eval org-speed-command t))
(t (let (org-use-speed-commands)
(call-interactively 'org-self-insert-command)))))
((and
@@ -16779,80 +16490,6 @@ overwritten, and the table is not marked as requiring realignment."
(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
@@ -16861,7 +16498,7 @@ 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)
+ (org-fold-check-before-invisible-edit 'delete-backward)
(if (and (= N 1)
(not overwrite-mode)
(not (org-region-active-p))
@@ -16881,7 +16518,7 @@ 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)
+ (org-fold-check-before-invisible-edit 'delete)
(cond
((or (/= N 1)
(eq (char-after) ?|)
@@ -16964,16 +16601,6 @@ 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.
@@ -17077,11 +16704,11 @@ When ARG is a numeric prefix, show contents of this level."
((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-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))))
+ (t (call-interactively 'org-cycle-global))))
(defun org-shiftmetaleft ()
"Promote subtree or delete table column.
@@ -17090,6 +16717,10 @@ Calls `org-promote-subtree', `org-outdent-item-tree', or
individual commands for more information."
(interactive)
(cond
+ ((and (eq system-type 'darwin)
+ (or (eq org-support-shift-select 'always)
+ (and org-support-shift-select (org-region-active-p))))
+ (org-call-for-shift-select 'backward-char))
((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))
@@ -17106,6 +16737,10 @@ Calls `org-demote-subtree', `org-indent-item-tree', or
individual commands for more information."
(interactive)
(cond
+ ((and (eq system-type 'darwin)
+ (or (eq org-support-shift-select 'always)
+ (and org-support-shift-select (org-region-active-p))))
+ (org-call-for-shift-select 'forward-char))
((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))
@@ -17235,14 +16870,14 @@ this function returns t, nil otherwise."
(setq beg (line-beginning-position))
(beginning-of-line 2)
(while (and (not (eobp)) ;; this is like `next-line'
- (get-char-property (1- (point)) 'invisible))
+ (org-invisible-p (1- (point))))
(beginning-of-line 2))
(setq end (point))
(goto-char beg)
(goto-char (line-end-position))
(setq end (max end (point)))
(while (re-search-forward re end t)
- (when (get-char-property (match-beginning 0) 'invisible)
+ (when (org-invisible-p (match-beginning 0))
(throw 'exit t))))
nil))))
@@ -17256,10 +16891,10 @@ for more information."
((run-hook-with-args-until-success 'org-metaup-hook))
((org-region-active-p)
(let* ((a (save-excursion
- (goto-char (min (region-beginning) (region-end)))
+ (goto-char (region-beginning))
(line-beginning-position)))
(b (save-excursion
- (goto-char (max (region-beginning) (region-end)))
+ (goto-char (region-end))
(if (bolp) (1- (point)) (line-end-position))))
(c (save-excursion
(goto-char a)
@@ -17289,10 +16924,10 @@ commands for more information."
((run-hook-with-args-until-success 'org-metadown-hook))
((org-region-active-p)
(let* ((a (save-excursion
- (goto-char (min (region-beginning) (region-end)))
+ (goto-char (region-beginning))
(line-beginning-position)))
(b (save-excursion
- (goto-char (max (region-beginning) (region-end)))
+ (goto-char (region-end))
(if (bolp) (1- (point)) (line-end-position))))
(c (save-excursion
(goto-char b)
@@ -17530,12 +17165,22 @@ this numeric value."
(interactive "r")
(let ((result ""))
(while (/= beg end)
- (if (invisible-p beg)
- (setq beg (next-single-char-property-change beg 'invisible nil end))
+ (if (eq org-fold-core-style 'text-properties)
+ (progn
+ (while (org-invisible-p beg)
+ (setq beg (org-fold-next-visibility-change beg end)))
+ (let ((next (org-fold-next-visibility-change beg end)))
+ (setq result (concat result (buffer-substring beg next)))
+ (setq beg next)))
+ (when (invisible-p beg)
+ (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)
+ (setq result (concat result (buffer-substring beg next)))
+ (setq beg next))))
+ ;; Prevent Emacs from adding full selected text to `kill-ring'
+ ;; when `select-enable-primary' is non-nil. This special value of
+ ;; `deactivate-mark' only works since Emacs 29.
+ (setq deactivate-mark 'dont-save)
(kill-new result)
(message "Visible strings have been copied to the kill ring.")))
@@ -17570,6 +17215,7 @@ 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 comment block, call `org-edit-comment-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'.
@@ -17616,6 +17262,7 @@ Otherwise, return a user error."
(`table-row (call-interactively 'org-table-edit-formulas))
(`example-block (org-edit-src-code))
(`export-block (org-edit-export-block))
+ (`comment-block (org-edit-comment-block))
(`fixed-width (org-edit-fixed-width-region))
(`latex-environment (org-edit-latex-environment))
(`planning
@@ -17741,8 +17388,13 @@ This command does many different things, depending on context:
"`\\[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))
+ (when info (org-babel-execute-src-block nil info nil type))))
+ (`clock
+ (if (org-at-timestamp-p 'lax)
+ ;; Update the timestamp as well. `org-timestamp-change'
+ ;; will call `org-clock-update-time-maybe'.
+ (org-timestamp-change 0 'day)
+ (org-clock-update-time-maybe)))
(`dynamic-block
(save-excursion
(goto-char (org-element-property :post-affiliated context))
@@ -17902,39 +17554,20 @@ Use `\\[org-edit-special]' to edit table.el tables")))
(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)))
+ (org-fold-show-branches-buffer)
+ (org-fold-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)))))
+ (org-fold-hide-subtree)
+ (org-fold-show-branches)
+ (org-fold-hide-archived-subtrees beg end)))))
(defun org-delete-indentation (&optional arg)
"Join current line to previous and fix whitespace at join.
@@ -18057,7 +17690,7 @@ object (e.g., within a comment). In these case, you need to use
(org-auto-align-tags (org-align-tags))
(t (org--align-tags-here tags-column))) ;preserve tags column
(end-of-line)
- (org-show-entry)
+ (org-fold-show-entry 'hide-drawers)
(org--newline indent arg interactive)
(when string (save-excursion (insert (org-trim string))))))
;; In a list, make sure indenting keeps trailing text within.
@@ -18095,11 +17728,11 @@ level to hide."
(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))))
+ (org-fold-flag-above-first-heading)
+ (org-fold-hide-sublevels (or arg 1))))
(t
- (outline-hide-subtree)
- (org-show-children arg))))
+ (org-fold-hide-subtree)
+ (org-fold-show-children arg))))
(defun org-ctrl-c-star ()
"Compute table, or change heading status of lines.
@@ -18147,6 +17780,9 @@ In a region:
universal prefix argument.
- If it is a plain list item, turn all plain list items into headings.
+ The checkboxes are converted to appropriate TODO or DONE keywords
+ (using `car' or `org-done-keywords' and `org-not-done-keywords' when
+ available).
When converting a line into a heading, the number of stars is chosen
such that the lines become children of the current entry. However,
@@ -18186,7 +17822,7 @@ number of stars to add."
;; Case 1. Started at an heading: de-star headings.
((org-at-heading-p)
(while (< (point) end)
- (when (org-at-heading-p t)
+ (when (org-at-heading-p)
(looking-at org-outline-regexp) (replace-match "")
(setq toggled t))
(forward-line)))
@@ -18205,7 +17841,15 @@ number of stars to add."
(org-list-to-lisp t)
(pcase (org-current-level)
(`nil 1)
- (l (1+ (org-reduced-level l)))))
+ (l (1+ (org-reduced-level l))))
+ ;; Keywords to replace checkboxes.
+ (list
+ ;; [X]
+ :cbon (concat (or (car org-done-keywords) "DONE") " ")
+ ;; [ ]
+ :cboff (concat (or (car org-not-done-keywords) "TODO") " ")
+ ;; [-]
+ :cbtrans (concat (or (car org-not-done-keywords) "TODO") " ")))
"\n")))
(setq toggled t))
(forward-line)))
@@ -18234,7 +17878,7 @@ 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)
+ (org-fold-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)
@@ -18254,8 +17898,8 @@ an argument, unconditionally call `org-insert-heading'."
["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]
+ ["Reveal Context" org-fold-reveal t]
+ ["Show All" org-fold-show-all t]
"--"
["Subtree to indirect buffer" org-tree-to-indirect-buffer t])
"--"
@@ -18560,7 +18204,8 @@ such private information before sending the email.")
(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)))))))
+ (not (equal (symbol-value v)
+ (eval (car (get v 'standard-value)) t)))))
(push v list)))))
(kill-buffer (get-buffer "*Warn about privacy*"))
list))
@@ -18576,7 +18221,6 @@ Your bug report will be posted to the Org mailing list.
(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)))
@@ -18615,7 +18259,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
(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\\)\\(-.*\\)?")
+ (feature-re "^\\(org\\|ob\\|ox\\|ol\\|oc\\)\\(-.*\\)?")
(remove-re (format "\\`%s\\'"
(regexp-opt '("org" "org-loaddefs" "org-version"))))
(feats (delete-dups
@@ -18635,18 +18279,17 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
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
+ (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)
+ t)
f))
lfeat)))
(when load-uncore
@@ -18713,7 +18356,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
(when (or (> marker (point-max)) (< marker (point-min)))
(widen))
(goto-char marker)
- (org-show-context 'org-goto))
+ (org-fold-show-context 'org-goto))
(if bookmark
(bookmark-jump bookmark)
(error "Cannot find location"))))
@@ -18748,10 +18391,10 @@ When ELEMENT is provided, it is considered to be element at point."
(when (eq 'src-block (org-element-type element))
(or (not inside)
(not (or (= (line-beginning-position)
- (org-element-property :post-affiliated element))
- (= (1+ (line-end-position))
- (- (org-element-property :end element)
- (org-element-property :post-blank element))))))))
+ (org-element-property :post-affiliated element))
+ (= (1+ (line-end-position))
+ (- (org-element-property :end element)
+ (org-element-property :post-blank element))))))))
(defun org-context ()
"Return a list of contexts of the current cursor position.
@@ -18787,7 +18430,7 @@ and :keyword."
(p (point)) clist o)
;; First the large context
(cond
- ((org-at-heading-p t)
+ ((org-at-heading-p)
(push (list :headline (line-beginning-position)
(line-end-position))
clist)
@@ -18952,7 +18595,7 @@ block from point."
regexp)))
(add-hook 'occur-mode-find-occurrence-hook
- (lambda () (when (derived-mode-p 'org-mode) (org-reveal))))
+ (lambda () (when (derived-mode-p 'org-mode) (org-fold-reveal))))
(defun org-occur-link-in-agenda-files ()
"Create a link and search for it in the agendas.
@@ -19003,14 +18646,14 @@ earliest time on the cursor date that Org treats as that date
(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))))
+ defd (org-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))))))
+ defd (org-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)
@@ -19030,6 +18673,37 @@ hierarchy of headlines by UP levels before marking the subtree."
;;; Indentation
+(defun org--at-headline-data-p (&optional beg element)
+ "Return non-nil when `point' or BEG is inside headline metadata.
+
+Metadata is planning line, properties drawer, logbook drawer right
+after property drawer, or clock log line immediately following
+properties drawer/planning line/ heading.
+
+Optional argument ELEMENT contains element at BEG."
+ (org-with-wide-buffer
+ (when beg (goto-char beg))
+ (setq element (or element (org-element-at-point)))
+ (if (or (eq (org-element-type element) 'headline)
+ (not (org-element-lineage element '(headline inlinetask))))
+ nil ; Not inside heading.
+ ;; Skip to top-level parent in section.
+ (while (not (eq 'section (org-element-type (org-element-property :parent element))))
+ (setq element (org-element-property :parent element)))
+ (pcase (org-element-type element)
+ ((or `planning `property-drawer)
+ t)
+ (`drawer
+ ;; LOGBOOK drawer with appropriate name.
+ (equal
+ (org-log-into-drawer)
+ (org-element-property :drawer-name element)))
+ (`clock
+ ;; Previous element must be headline metadata or headline.
+ (goto-char (1- (org-element-property :begin element)))
+ (or (org-at-heading-p)
+ (org--at-headline-data-p)))))))
+
(defvar org-element-greater-elements)
(defun org--get-expected-indentation (element contentsp)
"Expected indentation column for current line, according to ELEMENT.
@@ -19044,6 +18718,10 @@ ELEMENT."
(contentsp
(cl-case type
((diary-sexp footnote-definition) 0)
+ (section
+ (org--get-expected-indentation
+ (org-element-property :parent element)
+ t))
((headline inlinetask nil)
(if (not org-adapt-indentation) 0
(let ((level (org-current-level)))
@@ -19064,9 +18742,9 @@ ELEMENT."
(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))
+ ;; contents. If `org-adapt-indentation' is `headline-data', ignore
+ ;; previous headline data siblings.
+ ((= (line-beginning-position) start)
(catch 'exit
(while t
(if (= (point-min) start) (throw 'exit 0)
@@ -19083,6 +18761,14 @@ ELEMENT."
((memq (org-element-type previous)
'(footnote-definition inlinetask))
(setq start (org-element-property :begin previous)))
+ ;; Do not indent like previous when the previous
+ ;; element is headline data and `org-adapt-indentation'
+ ;; is set to `headline-data'.
+ ((and (eq 'headline-data org-adapt-indentation)
+ (not (org--at-headline-data-p start element))
+ (or (org-at-heading-p)
+ (org--at-headline-data-p (1- start) previous)))
+ (throw 'exit 0))
(t (goto-char (org-element-property :begin previous))
(throw 'exit
(if (bolp) (current-indentation)
@@ -19143,11 +18829,14 @@ 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)))
+ (combine-change-calls (match-beginning 0) (match-end 0)
+ (let ((newtext (concat (match-string 4)
+ (org-trim
+ (format org-property-format (match-string 1) (match-string 3))))))
+ ;; Do not use `replace-match' here as we want to inherit folding
+ ;; properties if inside fold.
+ (delete-region (match-beginning 0) (match-end 0))
+ (insert-and-inherit newtext)))))
(defun org-indent-line ()
"Indent line depending on context.
@@ -19193,17 +18882,15 @@ list structure. Instead, use \\<org-mode-map>`\\[org-shiftmetaleft]' or \
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:.*" (line-beginning-position))))))
- (let* ((element (save-excursion (beginning-of-line) (org-element-at-point)))
- (type (org-element-type element)))
+ (let* ((element (save-excursion (beginning-of-line) (org-element-at-point-no-context)))
+ (type (org-element-type element)))
+ (unless (or (org-at-heading-p)
+ (and (eq org-adapt-indentation 'headline-data)
+ (not (org--at-headline-data-p nil element))
+ (save-excursion
+ (goto-char (1- (org-element-property :begin element)))
+ (or (org-at-heading-p)
+ (org--at-headline-data-p)))))
(cond ((and (memq type '(plain-list item))
(= (line-beginning-position)
(org-element-property :post-affiliated element)))
@@ -19230,13 +18917,13 @@ Also align node properties according to `org-property-format'."
(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)
+ (setq block-content-ind (+ (org-current-text-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))))
+ block-content-ind (org-current-text-indentation))))
(indent-line-to (min block-content-ind some-ind))))
(org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))
(t
@@ -19345,7 +19032,7 @@ assumed to be significant there."
;; 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))))
+ (let ((offset (- ind (org-current-text-indentation))))
(unless (zerop offset)
(indent-rigidly (org-element-property :begin element)
(org-element-property :end element)
@@ -19381,7 +19068,7 @@ assumed to be significant there."
(beginning-of-line)
(looking-at-p org-drawer-regexp))
(user-error "Not at a drawer"))
- (let ((element (org-element-at-point)))
+ (let ((element (org-element-at-point-no-context)))
(unless (memq (org-element-type element) '(drawer property-drawer))
(user-error "Not at a drawer"))
(org-with-wide-buffer
@@ -19397,7 +19084,7 @@ assumed to be significant there."
(let ((case-fold-search t))
(looking-at-p "[ \t]*#\\+\\(begin\\|end\\)_")))
(user-error "Not at a block"))
- (let ((element (org-element-at-point)))
+ (let ((element (org-element-at-point-no-context)))
(unless (memq (org-element-type element)
'(comment-block center-block dynamic-block example-block
export-block quote-block special-block
@@ -19425,21 +19112,25 @@ assumed to be significant there."
;; `org-setup-filling' installs filling and auto-filling related
;; variables during `org-mode' initialization.
+(defvar org--single-lines-list-is-paragraph) ; defined later
+
(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)))))
+ (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 fill-forward-paragraph-function
+ (lambda (&optional arg)
+ (let ((org--single-lines-list-is-paragraph nil))
+ (org-forward-paragraph arg))))
(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)
@@ -19544,11 +19235,18 @@ a footnote definition, try to fill the first paragraph within."
;; 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)))
+ (src-block
+ (let ((regionp (region-active-p)))
+ (org-babel-do-in-edit-buffer
+ ;; `org-babel-do-in-edit-buffer' will preserve region if it
+ ;; is within src block contents. Otherwise, the region
+ ;; crosses src block boundaries. We re-fill the whole src
+ ;; block in such scenario.
+ (when (and regionp (not (region-active-p)))
+ (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
@@ -19669,9 +19367,11 @@ filling the current element."
(progn
(goto-char (region-end))
(skip-chars-backward " \t\n")
- (while (> (point) start)
- (org-fill-element justify)
- (org-backward-paragraph)))
+ (let ((org--single-lines-list-is-paragraph nil))
+ (while (> (point) start)
+ (org-fill-element justify)
+ (org-backward-paragraph)
+ (skip-chars-backward " \t\n"))))
(goto-char origin)
(set-marker origin nil))))
(t
@@ -19702,12 +19402,18 @@ filling the current element."
"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))
+non-nil.
+
+This function is a simplified version of `comment-indent-new-line'
+that bypasses the complex Emacs machinery dealing with comments.
+We instead rely on Org parser, utilizing `org-adaptive-fill-function'"
+ (let ((fill-prefix (org-adaptive-fill-function)))
+ (if soft (insert-and-inherit ?\n) (newline 1))
+ (save-excursion (forward-char -1) (delete-horizontal-space))
+ (delete-horizontal-space)
+ (indent-to-left-margin)
+ (when fill-prefix
+ (insert-before-markers-and-inherit fill-prefix))))
;;; Fixed Width Areas
@@ -19799,7 +19505,7 @@ region only contains such lines."
(catch 'zerop
(while (< (point) end)
(unless (looking-at-p "[ \t]*$")
- (let ((ind (current-indentation)))
+ (let ((ind (org-current-text-indentation)))
(setq min-ind (min min-ind ind))
(when (zerop ind) (throw 'zerop t))))
(forward-line)))))
@@ -19884,7 +19590,7 @@ Throw an error if no block is found."
(cl-decf count))))
(if (= count 0)
(prog1 (goto-char (org-element-property :post-affiliated last-element))
- (save-match-data (org-show-context)))
+ (save-match-data (org-fold-show-context)))
(goto-char origin)
(user-error "No %s code blocks" (if backward "previous" "further")))))
@@ -19959,10 +19665,10 @@ strictly within a source block, use appropriate comment syntax."
(line-end-position))
beg)
(>= (save-excursion
- (goto-char (org-element-property :end element))
- (skip-chars-backward " \r\t\n")
- (line-beginning-position))
- end)))
+ (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)))
@@ -20005,7 +19711,7 @@ strictly within a source block, use appropriate comment syntax."
(goto-char (point-min))
(while (and (not (eobp)) (not (zerop min-indent)))
(unless (looking-at "[ \t]*$")
- (setq min-indent (min min-indent (current-indentation))))
+ (setq min-indent (min min-indent (org-current-text-indentation))))
(forward-line)))
;; Then loop over all lines.
(save-excursion
@@ -20068,18 +19774,20 @@ return an active timestamp."
"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)))))
+ (org-encode-time
+ (append '(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)))
+ '(nil -1 nil))))
(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)
+(defun org-format-timestamp (timestamp format &optional end utc)
"Format a TIMESTAMP object into a string.
FORMAT is a format specifier to be passed to
@@ -20140,13 +19848,13 @@ 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)))
+ (let ((fmt (org-time-stamp-format
+ (org-timestamp-has-time-p timestamp) nil 'custom)))
(if (and (not boundary) (memq type '(active-range inactive-range)))
- (concat (org-timestamp-format timestamp fmt)
+ (concat (org-format-timestamp timestamp fmt)
"--"
- (org-timestamp-format timestamp fmt t))
- (org-timestamp-format timestamp fmt (eq boundary 'end)))))))
+ (org-format-timestamp timestamp fmt t))
+ (org-format-timestamp timestamp fmt (eq boundary 'end)))))))
;;; Other stuff
@@ -20359,13 +20067,17 @@ depending on context."
(call-interactively #'forward-sentence)))))))
(defun org-kill-line (&optional _arg)
- "Kill line, to tags or end of line."
+ "Kill line, to tags or end of line.
+
+The behavior of this command depends on the user options
+`org-special-ctrl-k' and `org-ctrl-k-protect-subtree' (which
+see)."
(interactive)
(cond
((or (not org-special-ctrl-k)
(bolp)
(not (org-at-heading-p)))
- (when (and (get-char-property (line-end-position) 'invisible)
+ (when (and (org-invisible-p (line-end-position))
org-ctrl-k-protect-subtree
(or (eq org-ctrl-k-protect-subtree 'error)
(not (y-or-n-p "Kill hidden subtree along with headline? "))))
@@ -20453,7 +20165,7 @@ interactive command with similar behavior."
(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-fold-subtree t)
(org-cycle-show-empty-lines 'folded)
(condition-case nil
(outline-forward-same-level 1)
@@ -20489,60 +20201,124 @@ interactive command with similar behavior."
(<= (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)))))
+ "Go back to beginning of heading."
+ (beginning-of-line)
+ (or (org-at-heading-p (not invisible-ok))
+ (if (org-element--cache-active-p)
+ (let ((heading (org-element-lineage (org-element-at-point)
+ '(headline inlinetask)
+ 'include-self)))
+ (when heading
+ (goto-char (org-element-property :begin heading)))
+ (while (and (not invisible-ok)
+ heading
+ (org-fold-folded-p))
+ (goto-char (org-fold-core-previous-visibility-change))
+ (setq heading (org-element-lineage (org-element-at-point)
+ '(headline inlinetask)
+ 'include-self))
+ (when heading
+ (goto-char (org-element-property :begin heading))))
+ (unless heading
+ (user-error "Before first headline at position %d in buffer %s"
+ (point) (current-buffer)))
+ (point))
+ (let (found)
+ (save-excursion
+ ;; At inlinetask end. Move to bol, so that the following
+ ;; search goes to the beginning of the inlinetask.
+ (when (and (featurep 'org-inlinetask)
+ (fboundp 'org-inlinetask-end-p)
+ (org-inlinetask-end-p))
+ (goto-char (line-beginning-position)))
+ (while (not found)
+ (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
+ nil t)
+ (user-error "Before first headline at position %d in buffer %s"
+ (point) (current-buffer)))
+ ;; Skip inlinetask end.
+ (if (and (featurep 'org-inlinetask)
+ (fboundp 'org-inlinetask-end-p)
+ (org-inlinetask-end-p))
+ (org-inlinetask-goto-beginning)
+ (setq found (and (or invisible-ok (not (org-fold-folded-p)))
+ (point))))))
+ (goto-char found)
+ found))))
(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)))))
+ (if (org-before-first-heading-p)
+ (goto-char (point-min))
+ (org-back-to-heading invisible-ok)))
(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)))))
+ "Before first heading?
+Respect narrowing."
+ (let ((cached (org-element-at-point nil 'cached)))
+ (if cached
+ (let ((cached-headline (org-element-lineage cached '(headline) t)))
+ (or (not cached-headline)
+ (< (org-element-property :begin cached-headline) (point-min))))
+ (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-at-heading-p (&optional invisible-not-ok)
+ "Return t if point is on a (possibly invisible) heading line.
+If INVISIBLE-NOT-OK is non-nil, an invisible heading line is not ok."
+ (save-excursion
+ (beginning-of-line)
+ (and (bolp) (or (not invisible-not-ok) (not (org-fold-folded-p)))
+ (looking-at outline-regexp))))
-(defun org-in-commented-heading-p (&optional no-inheritance)
+(defun org-in-commented-heading-p (&optional no-inheritance element)
"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))))))
+unless optional argument NO-INHERITANCE is non-nil.
-(defun org-in-archived-heading-p (&optional no-inheritance)
+Optional argument ELEMENT contains element at point."
+ (save-match-data
+ (let ((el (or element
+ (org-element-at-point nil 'cached)
+ (org-with-wide-buffer
+ (org-back-to-heading-or-point-min t)
+ (org-element-at-point)))))
+ (catch :found
+ (setq el (org-element-lineage el '(headline inlinetask) 'include-self))
+ (if no-inheritance
+ (org-element-property :commentedp el)
+ (while el
+ (when (org-element-property :commentedp el)
+ (throw :found t))
+ (setq el (org-element-property :parent el))))))))
+
+(defun org-in-archived-heading-p (&optional no-inheritance element)
"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."
+unless optional argument NO-INHERITANCE is non-nil.
+
+Optional argument ELEMENT contains element at point."
(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))))
+ ((and (not element) (org-before-first-heading-p)) nil)
+ ((if element
+ (org-element-property :archivedp element)
+ (let ((tags (org-get-tags element '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))))))
+ (if (or element (org-element--cache-active-p))
+ (catch :archived
+ (unless element (setq element (org-element-at-point)))
+ (while element
+ (when (org-element-property :archivedp element)
+ (throw :archived t))
+ (setq element (org-element-property :parent element))))
+ (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."
@@ -20602,29 +20378,43 @@ 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)))))
+ (let ((element (and (org-element--cache-active-p)
+ (org-element-at-point nil t))))
+ (if element
+ (let* ((current-heading (org-element-lineage element '(headline inlinetask) 'with-self))
+ (parent (org-element-lineage current-heading '(headline))))
+ (if (and parent
+ (<= (point-min) (org-element-property :begin parent)))
+ (progn
+ (goto-char (org-element-property :begin parent))
+ (org-element-property :level parent))
+ (when (and current-heading
+ (<= (point-min) (org-element-property :begin current-heading)))
+ (goto-char (org-element-property :begin current-heading))
+ nil)))
+ (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.
@@ -20634,7 +20424,9 @@ 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)
+ (or (org-up-heading-safe)
+ ;; The first heading may not be level 1 heading.
+ (goto-char (point-min)))
(unless (= (point) (point-min)) (goto-char (point-min))))))
(defun org-first-sibling-p ()
@@ -20671,44 +20463,33 @@ move point."
(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 ()
+(defun org-goto-first-child (&optional element)
"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))))))
+ (if (org-element--cache-active-p)
+ (let ((heading (org-element-lineage
+ (or element (org-element-at-point))
+ '(headline inlinetask org-data)
+ t)))
+ (when heading
+ (unless (or (eq 'inlinetask (org-element-type heading))
+ (not (org-element-property :contents-begin heading)))
+ (let ((pos (point)))
+ (goto-char (org-element-property :contents-begin heading))
+ (if (re-search-forward
+ org-outline-regexp-bol
+ (org-element-property :end heading)
+ t)
+ (progn (goto-char (match-beginning 0)) t)
+ (goto-char pos) 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-get-next-sibling ()
"Move to next heading of the same level, and return point.
@@ -20734,8 +20515,8 @@ If there is no such heading, return nil."
(unless (< (funcall outline-level) level)
(point)))))
-(defun org-end-of-subtree (&optional invisible-ok to-heading)
- "Goto to the end of a subtree."
+(defun org-end-of-subtree (&optional invisible-ok to-heading element)
+ "Goto to the end of a subtree at point or for ELEMENT heading."
;; 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.
@@ -20743,32 +20524,40 @@ If there is no such heading, return nil."
;; 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
+ (if element
+ (setq element (org-element-lineage element '(headline inlinetask) 'include-self))
+ (org-back-to-heading-or-point-min invisible-ok))
+ (unless (and (org-element--cache-active-p)
+ (let ((cached (or element (org-element-at-point nil t))))
+ (and cached
+ (eq 'headline (org-element-type cached))
+ (goto-char (org-element-property
+ :end cached)))))
+ (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))
- ;; Go to end of line before heading
- (forward-char -1)
- (when (memq (preceding-char) '(?\n ?\^M))
- ;; leave blank line before heading
- (forward-char -1)))))
+ ;; leave blank line before heading
+ (forward-char -1))))
(point))
(defun org-end-of-meta-data (&optional full)
@@ -20867,20 +20656,16 @@ With ARG, repeats or can move backward if negative."
(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))))
+ (when (org-fold-folded-p)
+ (goto-char (org-fold-previous-visibility-change))
+ (unless (looking-at-p regexp)
+ (re-search-backward regexp nil :mode))))
(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
+ (while (and (> arg 0) (re-search-forward regexp nil :move))
+ (when (org-fold-folded-p)
+ (goto-char (org-fold-next-visibility-change))
+ (skip-chars-forward " \t\n")
+ (end-of-line))
(cl-decf arg))
(if (> arg 0) (goto-char (point-max)) (beginning-of-line))))
@@ -20938,6 +20723,9 @@ It also provides the following special moves for convenience:
;; Return moves left.
arg))
+(defvar org--single-lines-list-is-paragraph t
+ "Treat plain lists with single line items as a whole paragraph")
+
(defun org--paragraph-at-point ()
"Return paragraph, or equivalent, element at point.
@@ -20999,7 +20787,7 @@ Function may return a real element, or a pseudo-element with type
(while (memq (org-element-type (org-element-property :parent l))
'(item plain-list))
(setq l (org-element-property :parent l)))
- (and l
+ (and l org--single-lines-list-is-paragraph
(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)))
@@ -21025,12 +20813,10 @@ See `org-forward-paragraph'."
(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)))
+ ((when (org-invisible-p nil t)
+ (goto-char (cdr (org-fold-get-region-at-point)))
+ (forward-line)
+ t))
(t
(let* ((element (org--paragraph-at-point))
(type (org-element-type element))
@@ -21042,14 +20828,13 @@ See `org-forward-paragraph'."
(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)))
+ ((when (org-with-point-at post-affiliated (org-invisible-p (line-end-position) t))
+ (goto-char (cdr (org-fold-get-region-at-point
+ nil
+ (org-with-point-at post-affiliated
+ (line-end-position)))))
+ (forward-line)
+ t))
;; At a greater element, move inside.
((and contents-begin
(> contents-begin (point))
@@ -21101,12 +20886,10 @@ See `org-backward-paragraph'."
(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)))
+ ((when (org-invisible-p (1- (point)) t)
+ (goto-char (1- (car (org-fold-get-region-at-point nil (1- (point))))))
+ (org--backward-paragraph-once)
+ t))
(t
(let* ((element (org--paragraph-at-point))
(type (org-element-type element))
@@ -21132,15 +20915,13 @@ See `org-backward-paragraph'."
(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)))))))
+ (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)))
+ ((and parent
+ (not (eq 'section (org-element-type 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.
@@ -21153,8 +20934,7 @@ See `org-backward-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))
+ ((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
@@ -21249,7 +21029,12 @@ Move to the previous element at the same level, when possible."
(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))
+ ;; Skip sections
+ (when (eq 'section (org-element-type parent))
+ (setq parent (org-element-property :parent parent)))
+ (if (and parent
+ (not (eq (org-element-type parent) 'org-data)))
+ (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)))))))
@@ -21485,9 +21270,9 @@ Started from `gnus-info-find-node'."
;;; Finish up
-(add-hook 'org-mode-hook ;remove overlays when changing major mode
+(add-hook 'org-mode-hook ;remove folds when changing major mode
(lambda () (add-hook 'change-major-mode-hook
- 'org-show-all 'append 'local)))
+ 'org-fold-show-all 'append 'local)))
(provide 'org)
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el
index 1452f36c11e..7e5ba104ff6 100644
--- a/lisp/org/ox-ascii.el
+++ b/lisp/org/ox-ascii.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs.
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ox)
(require 'ox-publish)
(require 'cl-lib)
@@ -35,6 +38,9 @@
;;; Function Declarations
(declare-function aa2u "ext:ascii-art-to-unicode" ())
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
;;; Define Back-End
;;
diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el
index a70f6e4a0f8..51684448d68 100644
--- a/lisp/org/ox-beamer.el
+++ b/lisp/org/ox-beamer.el
@@ -4,7 +4,7 @@
;; 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>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: org, wp, tex
;; This file is part of GNU Emacs.
@@ -30,6 +30,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ox-latex)
@@ -734,13 +737,23 @@ 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))))
+ (let* ((latex-link (org-export-with-backend 'latex link contents info))
+ (parent (org-export-get-parent-element link))
+ (attr (org-export-read-attribute :attr_beamer parent))
+ (overlay (plist-get attr :overlay)))
+ (cond ((string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)
+ (replace-match
+ (format "\\\\hyperlink%s{\\1}"
+ (or (org-beamer--element-has-overlay-p link) ""))
+ nil nil latex-link))
+ ((string-match "\\\\include\\(graphics\\|svg\\)\\([[{]?\\)" latex-link)
+ ;; Check for overlay specification and insert if
+ ;; present.
+ (replace-match
+ (format "\\\\include\\1%s\\2"
+ (if overlay overlay ""))
+ nil nil latex-link))
+ (t latex-link)))))
;;;; Plain List
@@ -857,6 +870,12 @@ holding export options."
(let ((template (plist-get info :latex-hyperref-template)))
(and (stringp template)
(format-spec template (org-latex--format-spec info))))
+ ;; engrave-faces-latex preamble
+ (when (and (eq org-latex-src-block-backend 'engraved)
+ (org-element-map (plist-get info :parse-tree)
+ '(src-block inline-src-block) #'identity
+ info t))
+ (org-latex-generate-engraved-preamble info))
;; Document start.
"\\begin{document}\n\n"
;; Title command.
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index 9cf9125aebd..86b10cbf785 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Jambunathan K <kjambunathan at gmail dot com>
-;; Maintainer: TEC <tecosaur@gmail.com>
+;; Maintainer: TEC <orgmode@tec.tecosaur.net>
;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs.
@@ -31,6 +31,9 @@
;;; Dependencies
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'format-spec)
(require 'ox)
@@ -43,6 +46,9 @@
(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" ())
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
(defvar htmlize-css-name-prefix)
(defvar htmlize-output-type)
@@ -211,7 +217,7 @@
("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\">")
+\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">")
("html5" . "<!DOCTYPE html>")
("xhtml5" . "<!DOCTYPE html>"))
@@ -833,6 +839,8 @@ 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.
+Links to \"file.org.gpg\" are also converted.
+
When nil, the links still point to the plain \".org\" file."
:group 'org-export-html
:type 'boolean)
@@ -889,7 +897,8 @@ 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)))
+ :type '(choice (const css) (const inline-css) (const nil))
+ :safe #'symbolp)
(defcustom org-html-htmlize-font-prefix "org-"
"The prefix for CSS class names for htmlize font specifications."
@@ -1158,72 +1167,116 @@ See `format-time-string' for more information on its components."
;;;; 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")
+ '((path "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js")
+ (scale 1.0)
(align "center")
- (font "TeX")
- (linebreaks "false")
- (autonumber "AMS")
+ (font "mathjax-modern")
+ (overflow "overflow")
+ (tags "ams")
(indent "0em")
(multlinewidth "85%")
(tagindent ".8em")
(tagside "right"))
"Options for MathJax setup.
-Alist of the following elements. All values are strings.
+Alist of the following elements.
-path The path to MathJax.
+path The path to MathJax version 3 or later.
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\".
+font The font to use with HTML-CSS and SVG output. Needs
+ MathJax version 4+. MathJax 4 provides 11 fonts:
+ \"mathjax-modern\" Latin-Modern font, default in MathJax 4+
+ \"mathjax-asana\" Asana-Math font
+ \"mathjax-bonum\" Gyre Bonum font
+ \"mathjax-dejavu\" Gyre DejaVu font
+ \"mathjax-pagella\" Gyre Pagella font
+ \"mathjax-schola\" Gyre Schola font
+ \"mathjax-termes\" Gyre Termes font
+ \"mathjax-stix2\" STIX2 font
+ \"mathjax-fira\" Fira and Fira-Math fonts
+ \"mathjax-euler\" Neo Euler font that extends Latin-Modern
+ \"mathjax-tex\" The original MathJax TeX font
+overflow How to break displayed equations when too large. Needs
+ MathJax 4 or newer. Supported options include
+ \"overflow\", \"scale\", \"scroll\", \"truncate\",
+ \"linebreak\", and \"elide\".
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\"
+indent If align is not center, how far from the left/right side? For
+ example, \"1em\".
multlinewidth The width of the multline environment.
-autonumber How to number equations. Valid values are \"None\",
- \"all\" and \"AMS Math\".
+tags How to number equations. Valid values are \"none\",
+ \"all\" and \"ams\".
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
+You can also customize this for some buffer, using something like
-#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
+#+HTML_MATHJAX: align: left indent: 5em tagside: left
For further information about MathJax options, see the MathJax documentation:
- https://docs.mathjax.org/"
+ https://docs.mathjax.org/
+
+To maintain compatibility with pre-9.6 Org that used MathJax 2,
+the following conversions take place.
+
+The legacy \"autonumber\" option, with the value \"AMS\",
+\"None\", or \"All\", becomes the \"tags\" option set to the
+value \"ams\", \"none\", or \"all\", respectively.
+
+Any legacy values of the \"scale\" option, specified as
+percentage strings, become converted to unit-interval numbers.
+For example, a legacy scale of \"150\" becomes a scale of 1.5.
+
+The legacy \"linebreaks\" option, with the value \"true\" or
+\"false\", becomes the \"overflow\" option set to the value
+\"linebreak\" or \"overflow\", respectively.
+
+The legacy values of the \"font\" option, namely \"TeX\",
+\"STIX-Web\", \"Asana-Math\", \"Neo-Euler\", \"Gyre-Pagella\",
+\"Gyre-Termes\", \"Latin-Modern\", become converted to the
+corresponding MathJax 4+ font names.
+
+Legacy options and values always take precedence.
+"
:group 'org-export-html
- :package-version '(Org . "8.3")
+ :package-version '(Org . "9.6")
: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))
+ (const :format " " scale) (float))
(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 "font (used to typeset math)"
+ (const :format " " font)
+ (choice (const "mathjax-modern")
+ (const "mathjax-asana")
+ (const "mathjax-bonum")
+ (const "mathjax-dejavu")
+ (const "mathjax-pagella")
+ (const "mathjax-schola")
+ (const "mathjax-termes")
+ (const "mathjax-stix2")
+ (const "mathjax-fira")
+ (const "mathjax-euler")
+ (const "mathjax-tex")))
+ (list :tag "overflow (how to break displayed math)"
+ (const :format " " overflow)
+ (choice (const "overflow")
+ (const "scale")
+ (const "scroll")
+ (const "truncate")
+ (const "linebreak")
+ (const "elide")))
+ (list :tag "tags (whether equations are numbered and how)"
+ (const :format " " tags)
+ (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)"
@@ -1236,27 +1289,38 @@ For further information about MathJax options, see the MathJax documentation:
(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>
+ window.MathJax = {
+ tex: {
+ ams: {
+ multlineWidth: '%MULTLINEWIDTH'
+ },
+ tags: '%TAGS',
+ tagSide: '%TAGSIDE',
+ tagIndent: '%TAGINDENT'
+ },
+ chtml: {
+ scale: %SCALE,
+ displayAlign: '%ALIGN',
+ displayIndent: '%INDENT'
+ },
+ svg: {
+ scale: %SCALE,
+ displayAlign: '%ALIGN',
+ displayIndent: '%INDENT'
+ },
+ output: {
+ font: '%FONT',
+ displayOverflow: '%OVERFLOW'
+ }
+ };
</script>
-<script src=\"%PATH\"></script>"
+
+<script
+ id=\"MathJax-script\"
+ async
+ src=\"%PATH\">
+</script>"
"The MathJax template. See also `org-html-mathjax-options'."
:group 'org-export-html
:type 'string)
@@ -1268,9 +1332,11 @@ For further information about MathJax options, see the MathJax documentation:
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'.
+content of the postamble. When t, insert a string as defined by the
+formatting string in `org-html-postamble-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
@@ -1881,7 +1947,6 @@ INFO is a plist used as a communication channel."
;; empty, which is invalid.
(title (if (org-string-nw-p title) title "&lrm;"))
(charset (or (and org-html-coding-system
- (fboundp 'coding-system-get)
(symbol-name
(coding-system-get org-html-coding-system
'mime-charset)))
@@ -1938,21 +2003,85 @@ INFO is a plist used as a communication channel."
"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))
+ (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) "")))
+ (options (let ((options (plist-get info :html-mathjax-options)))
+ ;; If the user customized some legacy option, set
+ ;; the corresponding new option to nil, so that
+ ;; the legacy user choice overrides the default.
+ ;; Otherwise, the user did not set the legacy
+ ;; option, in which case still set the legacy
+ ;; option but to no value, so that the code can
+ ;; find its in-buffer value, if set.
+ `((,(if (plist-member options 'autonumber)
+ 'tags 'autonumber)
+ nil)
+ (,(if (plist-member options 'linebreaks)
+ 'overflow 'linebreaks)
+ nil)
+ ,@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))))))))
+ (let ((symbol (car e))
+ (value (nth 1 e)))
+ (when (string-match (concat "\\<" (symbol-name symbol) ":")
+ in-buffer)
+ (setq value
+ (car (split-string (substring in-buffer
+ (match-end 0))))))
+ (when value
+ (pcase symbol
+ (`font
+ (when-let
+ ((value-new
+ (pcase value
+ ("TeX" "mathjax-tex")
+ ("STIX-Web" "mathjax-stix2")
+ ("Asana-Math" "mathjax-asana")
+ ("Neo-Euler" "mathjax-euler")
+ ("Gyre-Pagella" "mathjax-pagella")
+ ("Gyre-Termes" "mathjax-termes")
+ ("Latin-Modern" "mathjax-modern"))))
+ (setq value value-new)))
+ (`linebreaks
+ (org-display-warning
+ "Converting legacy MathJax option: linebreaks")
+ (setq symbol 'overflow
+ value (if (string= value "true")
+ "linebreak"
+ "overflow")))
+ (`scale
+ (when (stringp value)
+ (let ((value-maybe (string-to-number value)))
+ (setq value
+ (if (= value-maybe 0)
+ (progn
+ (org-display-warning
+ (format "Non-numerical MathJax scale: %s"
+ value))
+ 1.0)
+ value-maybe))))
+ (when (>= value 10)
+ (setq value
+ (let ((value-new (/ (float value) 100)))
+ (org-display-warning
+ (format "Converting legacy MathJax scale: %s to %s"
+ value
+ value-new))
+ value-new))))
+ (`autonumber
+ (org-display-warning
+ "Converting legacy MathJax option: autonumber")
+ (setq symbol 'tags
+ value (downcase value))))
+ (while (string-match (format "\\(%%%s\\)[^A-Z]"
+ (upcase (symbol-name symbol)))
+ template)
+ (setq template
+ (replace-match (format "%s" value)
+ t
+ t template 1)))))))))
(defun org-html-format-spec (info)
"Return format specification for preamble and postamble.
@@ -1986,7 +2115,7 @@ communication channel."
(if (functionp section) (funcall section info)
(cond
((stringp section) (format-spec section spec))
- ((eq section 'auto)
+ ((and (eq section 'auto) (eq type 'postamble))
(let ((date (cdr (assq ?d spec)))
(author (cdr (assq ?a spec)))
(email (cdr (assq ?e spec)))
@@ -2068,7 +2197,7 @@ holding export options."
(format "%s\n"
(format decl
(or (and org-html-coding-system
- (fboundp 'coding-system-get)
+ ;; FIXME: Use Emacs 22 style here, see `coding-system-get'.
(coding-system-get org-html-coding-system 'mime-charset))
"iso-8859-1"))))))
(org-html-doctype info)
@@ -2222,7 +2351,7 @@ is the language used for CODE, as a string, or nil."
(funcall lang-mode)
(insert code)
;; Fontify buffer.
- (org-font-lock-ensure)
+ (font-lock-ensure)
;; Remove formatting on newline characters.
(save-excursion
(let ((beg (point-min))
@@ -2872,11 +3001,14 @@ INFO is a plist containing export properties."
;; 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))))
+ (org-export-with-buffer-copy
+ :to-buffer (get-buffer-create " *Org HTML Export LaTeX*")
+ :drop-visibility t :drop-narrowing t :drop-contents t
+ (erase-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.
@@ -3060,12 +3192,13 @@ INFO is a plist holding contextual information. See
(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))))
+ (save-match-data
+ (cond
+ ((and (plist-get info :html-link-org-files-as-html)
+ (let ((case-fold-search t))
+ (string-match "\\(.+\\)\\.org\\(?:\\.gpg\\)?$" raw-path)))
+ (concat (match-string 1 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.
diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el
index 7a62145076b..cfbfabafb07 100644
--- a/lisp/org/ox-icalendar.el
+++ b/lisp/org/ox-icalendar.el
@@ -3,10 +3,10 @@
;; Copyright (C) 2004-2022 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
-;; Nicolas Goaziou <n dot goaziou at gmail dot com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -32,10 +32,16 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'org-agenda)
(require 'ox-ascii)
(declare-function org-bbdb-anniv-export-ical "ol-bbdb" nil)
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
@@ -66,6 +72,17 @@ for timed events. If non-zero, alarms are created.
:version "24.1"
:type 'integer)
+(defcustom org-icalendar-force-alarm nil
+ "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behavior where zero means no alarm. With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+ :group 'org-export-icalendar
+ :type 'boolean
+ :package-version '(Org . "9.6")
+ :safe #'booleanp)
+
(defcustom org-icalendar-combined-name "OrgMode"
"Calendar name for the combined iCalendar representing all agenda files."
:group 'org-export-icalendar
@@ -84,6 +101,21 @@ keyword."
:group 'org-export-icalendar
:type '(repeat (string :tag "Tag")))
+(defcustom org-icalendar-scheduled-summary-prefix "S: "
+ "String prepended to exported scheduled headlines."
+ :group 'org-export-icalendar
+ :type 'string
+ :package-version '(Org . "9.6")
+ :safe #'stringp)
+
+
+(defcustom org-icalendar-deadline-summary-prefix "DL: "
+ "String prepended to exported headlines with a deadline."
+ :group 'org-export-icalendar
+ :type 'string
+ :package-version '(Org . "9.6")
+ :safe #'stringp)
+
(defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
"Contexts where iCalendar export should use a deadline time stamp.
@@ -300,7 +332,9 @@ re-read the iCalendar file.")
(: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))
+ (:icalendar-use-scheduled nil nil org-icalendar-use-scheduled)
+ (:icalendar-scheduled-summary-prefix nil nil org-icalendar-scheduled-summary-prefix)
+ (:icalendar-deadline-summary-prefix nil nil org-icalendar-deadline-summary-prefix))
:filters-alist
'((:filter-headline . org-icalendar-clear-blank-lines))
:menu-entry
@@ -430,7 +464,7 @@ format (e.g. \"Europe/London\"). In either case, the value of
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)
+ (org-encode-time 0 mi h d m y)
(and (or (string-equal tz "UTC")
(and (null tz)
with-time-p
@@ -598,7 +632,9 @@ inlinetask within the section."
;; "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)))
+ (use-deadline (plist-get info :icalendar-use-deadline))
+ (deadline-summary-prefix (org-icalendar-cleanup-string
+ (plist-get info :icalendar-deadline-summary-prefix))))
(and deadline
(pcase todo-type
(`todo (or (memq 'event-if-todo-not-done use-deadline)
@@ -607,9 +643,12 @@ inlinetask within the section."
(_ (memq 'event-if-not-todo use-deadline)))
(org-icalendar--vevent
entry deadline (concat "DL-" uid)
- (concat "DL: " summary) loc desc cat tz class)))
+ (concat deadline-summary-prefix summary)
+ loc desc cat tz class)))
(let ((scheduled (org-element-property :scheduled entry))
- (use-scheduled (plist-get info :icalendar-use-scheduled)))
+ (use-scheduled (plist-get info :icalendar-use-scheduled))
+ (scheduled-summary-prefix (org-icalendar-cleanup-string
+ (plist-get info :icalendar-scheduled-summary-prefix))))
(and scheduled
(pcase todo-type
(`todo (or (memq 'event-if-todo-not-done use-scheduled)
@@ -618,7 +657,8 @@ inlinetask within the section."
(_ (memq 'event-if-not-todo use-scheduled)))
(org-icalendar--vevent
entry scheduled (concat "SC-" uid)
- (concat "S: " summary) loc desc cat tz class)))
+ (concat scheduled-summary-prefix 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.
@@ -792,8 +832,11 @@ Return VALARM component as a string, or nil if it isn't allowed."
(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))
+ (if warntime (string-to-number warntime) nil))))
+ (and (or (and alarm-time
+ (> alarm-time 0))
+ (> org-icalendar-alarm-time 0)
+ org-icalendar-force-alarm)
(org-element-property :hour-start timestamp)
(format "BEGIN:VALARM
ACTION:DISPLAY
@@ -801,8 +844,10 @@ DESCRIPTION:%s
TRIGGER:-P0DT0H%dM0S
END:VALARM\n"
summary
- (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)))))
-
+ (cond
+ ((and alarm-time org-icalendar-force-alarm) alarm-time)
+ ((and alarm-time (not (zerop alarm-time))) alarm-time)
+ (t org-icalendar-alarm-time))))))
;;;; Template
@@ -994,7 +1039,7 @@ FILES is a list of files to build the calendar from."
user-full-name
;; Timezone.
(or (org-string-nw-p org-icalendar-timezone)
- (format-time-string "Z"))
+ (format-time-string "%Z"))
;; Description.
org-icalendar-combined-description
;; Contents.
diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el
index 6b5edd20f5a..a6cfb24a9e8 100644
--- a/lisp/org/ox-koma-letter.el
+++ b/lisp/org/ox-koma-letter.el
@@ -165,6 +165,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ox-latex)
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index e4e146bc5f6..5b29a284c9f 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -3,6 +3,7 @@
;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Daniel Fleischer <danflscr@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs.
@@ -26,6 +27,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ox)
(require 'ox-publish)
@@ -36,6 +40,14 @@
(defvar org-latex-packages-alist)
(defvar orgtbl-exp-regexp)
+(declare-function engrave-faces-latex-gen-preamble "ext:engrave-faces-latex")
+(declare-function engrave-faces-latex-buffer "ext:engrave-faces-latex")
+(declare-function engrave-faces-latex-gen-preamble-line "ext:engrave-faces-latex")
+(declare-function engrave-faces-get-theme "ext:engrave-faces")
+
+(defvar engrave-faces-latex-output-style)
+(defvar engrave-faces-current-preset-style)
+(defvar engrave-faces-latex-mathescape)
;;; Define Back-End
@@ -124,6 +136,9 @@
(: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-engraved-options nil nil org-latex-engraved-options)
+ (:latex-engraved-preamble nil nil org-latex-engraved-preamble)
+ (:latex-engraved-theme "LATEX_ENGRAVED_THEME" nil org-latex-engraved-theme)
(: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)
@@ -138,7 +153,7 @@
(: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-src-block-backend nil nil org-latex-src-block-backend)
(: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)
@@ -160,148 +175,126 @@
;;; 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")
+(defconst org-latex-language-alist
+ '(("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name "Amharic")
+ ("ar" :babel "arabic" :polyglossia "arabic" :lang-name "Arabic")
+ ("ast" :babel-ini-only "asturian" :polyglossia "asturian" :lang-name "Asturian")
+ ("bg" :babel "bulgarian" :polyglossia "bulgarian" :lang-name "Bulgarian")
+ ("bn" :babel-ini-only "bengali" :polyglossia "bengali" :lang-name "Bengali")
+ ("bo" :babel-ini-only "tibetan" :polyglossia "tibetan" :lang-name "Tibetan")
+ ("br" :babel "breton" :polyglossia "breton" :lang-name "Breton")
+ ("ca" :babel "catalan" :polyglossia "catalan" :lang-name "Catalan")
+ ("cop" :babel-ini-only "coptic" :polyglossia "coptic" :lang-name "Coptic")
+ ("cs" :babel "czech" :polyglossia "czech" :lang-name "Czech")
+ ("cy" :babel "welsh" :polyglossia "welsh" :lang-name "Welsh")
+ ("da" :babel "danish" :polyglossia "danish" :lang-name "Danish")
+ ("de" :babel "ngerman" :polyglossia "german" :polyglossia-variant "german" :lang-name "German")
+ ("de-at" :babel "naustrian" :polyglossia "german" :polyglossia-variant "austrian" :lang-name "German")
+ ("dsb" :babel "lsorbian" :polyglossia "sorbian" :polyglossia-variant "lower" :lang-name "Lower Sorbian")
+ ("dv" :babel-ini-only "divehi" :polyglossia "divehi" :lang-name "Divehi")
+ ("el" :babel "greek" :polyglossia "greek" :lang-name "Greek")
+ ("el-polyton" :babel "polutonikogreek" :polyglossia "greek" :polyglossia-variant "polytonic" :lang-name "Polytonic Greek")
+ ("en" :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English")
+ ("en-au" :babel "australian" :polyglossia "english" :polyglossia-variant "australian" :lang-name "English")
+ ("en-gb" :babel "british" :polyglossia "english" :polyglossia-variant "uk" :lang-name "English")
+ ("en-nz" :babel "newzealand" :polyglossia "english" :polyglossia-variant "newzealand" :lang-name "English")
+ ("en-us" :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English")
+ ("eo" :babel "esperanto" :polyglossia "esperanto" :lang-name "Esperanto")
+ ("es" :babel "spanish" :polyglossia "spanish" :lang-name "Spanish")
+ ("es-mx" :babel "spanishmx" :polyglossia "spanish" :polyglossia-variant "mexican" :lang-name "Spanish")
+ ("et" :babel "estonian" :polyglossia "estonian" :lang-name "Estonian")
+ ("eu" :babel "basque" :polyglossia "basque" :lang-name "Basque")
+ ("fa" :babel "farsi" :polyglossia "farsi" :lang-name "Farsi")
+ ("fi" :babel "finnish" :polyglossia "finnish" :lang-name "Finnish")
+ ("fr" :babel "french" :polyglossia "french" :lang-name "French")
+ ("fr-ca" :babel "canadien" :polyglossia "french" :polyglossia-variant "canadian" :lang-name "French")
+ ("fur" :babel "friulan" :polyglossia "friulan" :lang-name "Friulian")
+ ("ga" :babel "irish" :polyglossia "irish" :lang-name "Irish")
+ ("gd" :babel "scottish" :polyglossia "scottish" :lang-name "Scottish Gaelic")
+ ("gl" :babel "galician" :polyglossia "galician" :lang-name "Galician")
+ ("he" :babel "hebrew" :polyglossia "hebrew" :lang-name "Hebrew")
+ ("hi" :babel "hindi" :polyglossia "hindi" :lang-name "Hindi")
+ ("hr" :babel "croatian" :polyglossia "croatian" :lang-name "Croatian")
+ ("hsb" :babel "uppersorbian" :polyglossia "sorbian" :polyglossia-variant "upper" :lang-name "Upper Sorbian")
+ ("hu" :babel "magyar" :polyglossia "magyar" :lang-name "Magyar")
+ ("hy" :babel-ini-only "armenian" :polyglossia "armenian" :lang-name "Armenian")
+ ("ia" :babel "interlingua" :polyglossia "interlingua" :lang-name "Interlingua")
+ ("id" :babel-ini-only "bahasai" :polyglossia "bahasai" :lang-name "Bahasai")
+ ("is" :babel "icelandic" :polyglossia "icelandic" :lang-name "Icelandic")
+ ("it" :babel "italian" :polyglossia "italian" :lang-name "Italian")
+ ("kn" :babel-ini-only "kannada" :polyglossia "kannada" :lang-name "Kannada")
+ ("la" :babel "latin" :polyglossia "latin" :lang-name "Latin")
+ ("la-classic" :babel "classiclatin" :polyglossia "latin" :polyglossia-variant "classic" :lang-name "Classic Latin")
+ ("la-medieval" :babel "medievallatin" :polyglossia "latin" :polyglossia-variant "medieval" :lang-name "Medieval Latin")
+ ("la-ecclesiastic" :babel "ecclesiasticlatin" :polyglossia "latin" :polyglossia-variant "ecclesiastic" :lang-name "Ecclesiastic Latin")
+ ("lo" :babel-ini-only "lao" :polyglossia "lao" :lang-name "Lao")
+ ("lt" :babel "lithuanian" :polyglossia "lithuanian" :lang-name "Lithuanian")
+ ("lv" :babel "latvian" :polyglossia "latvian" :lang-name "Latvian")
+ ("ml" :babel-ini-only "malayalam" :polyglossia "malayalam" :lang-name "Malayalam")
+ ("mr" :babel-ini-only "maranthi" :polyglossia "maranthi" :lang-name "Maranthi")
+ ("nb" :babel "norsk" :polyglossia "norwegian" :polyglossia-variant "bokmal" :lang-name "Norwegian Bokmål")
+ ("nl" :babel "dutch" :polyglossia "dutch" :lang-name "Dutch")
+ ("nn" :babel "nynorsk" :polyglossia "norwegian" :polyglossia-variant "nynorsk" :lang-name "Norwegian Nynorsk")
+ ("no" :babel "norsk" :polyglossia "norsk" :lang-name "Norwegian")
+ ("oc" :babel "occitan" :polyglossia "occitan" :lang-name "Occitan")
+ ("pl" :babel "polish" :polyglossia "polish" :lang-name "Polish")
+ ("pms" :babel "piedmontese" :polyglossia "piedmontese" :lang-name "Piedmontese")
+ ("pt" :babel "portuges" :polyglossia "portuges" :lang-name "Portuges")
+ ("pt-br" :babel "brazilian" :polyglossia "brazilian" :lang-name "Portuges")
+ ("rm" :babel-ini-only "romansh" :polyglossia "romansh" :lang-name "Romansh")
+ ("ro" :babel "romanian" :polyglossia "romanian" :lang-name "Romanian")
+ ("ru" :babel "russian" :polyglossia "russian" :lang-name "Russian")
+ ("sa" :babel-ini-only "sanskrit" :polyglossia "sanskrit" :lang-name "Sanskrit")
+ ("sk" :babel "slovak" :polyglossia "slovak" :lang-name "Slovak")
+ ("sl" :babel "slovene" :polyglossia "slovene" :lang-name "Slovene")
+ ("sq" :babel "albanian" :polyglossia "albanian" :lang-name "Albanian")
+ ("sr" :babel "serbian" :polyglossia "serbian" :lang-name "Serbian")
+ ("sv" :babel "swedish" :polyglossia "swedish" :lang-name "Swedish")
+ ("syr" :babel-ini-only "syriac" :polyglossia "syriac" :lang-name "Syriac")
+ ("ta" :babel-ini-only "tamil" :polyglossia "tamil" :lang-name "Tamil")
+ ("te" :babel-ini-only "telugu" :polyglossia "telugu" :lang-name "Telugu")
+ ("th" :babel "thai" :polyglossia "thai" :lang-name "Thai")
+ ("tk" :babel "turkmen" :polyglossia "turkmen" :lang-name "Turkmen")
+ ("tr" :babel "turkish" :polyglossia "turkish" :lang-name "Turkish")
+ ("uk" :babel "ukrainian" :polyglossia "ukrainian" :lang-name "Ukrainian")
+ ("ur" :babel-ini-only "urdu" :polyglossia "urdu" :lang-name "Urdu")
+ ("vi" :babel "vietnamese" :polyglossia "vietnamese" :lang-name "Vietnamese"))
+ "Alist between language code and its properties for LaTeX export.
+
+In each element of the list car is always the code of the
+language and cdr is a property list. Valid keywords for this
+list can be:
+
+- `:babel' the name of the language loaded by the Babel LaTeX package
+
+- `:polyglossia' the name of the language loaded by the Polyglossia
+ LaTeX package
+
+- `:babel-ini-only' the name of the language loaded by Babel
+ exclusively through the new ini files method. See
+ `http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf'
+
+- `:polyglossia-variant' the language variant loaded by Polyglossia
+
+- `:lang-name' the actual name of the language.")
+
+(defconst org-latex-line-break-safe "\\\\[0pt]"
+ "Linebreak protecting the following [...].
+
+Without \"[0pt]\" it would be interpreted as an optional argument to
+the \\\\.
+
+This constant, for example, makes the below code not err:
+
+\\begin{tabular}{c|c}
+ [t] & s\\\\[0pt]
+ [I] & A\\\\[0pt]
+ [m] & kg
+\\end{tabular}")
+
+(defconst org-latex-table-matrix-macros `(("bordermatrix" . "\\cr")
("qbordermatrix" . "\\cr")
- ("kbordermatrix" . "\\\\"))
+ ("kbordermatrix" . ,org-latex-line-break-safe))
"Alist between matrix macros and their row ending.")
(defconst org-latex-math-environments-re
@@ -755,8 +748,11 @@ environment."
(defcustom org-latex-inline-image-rules
`(("file" . ,(rx "."
- (or "pdf" "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg")
- eos)))
+ (or "pdf" "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg")
+ eos))
+ ("https" . ,(rx "."
+ (or "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
@@ -769,7 +765,7 @@ 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")
+ :package-version '(Org . "9.6")
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
@@ -929,27 +925,38 @@ The function should return the string to be exported."
;; Src blocks
-(defcustom org-latex-listings nil
- "Non-nil means export source code using the listings package.
+(defcustom org-latex-src-block-backend 'verbatim
+ "Backend used to generate source code listings.
+
+This sets the behavior for fontifying source code, possibly even with
+color. There are four implementations of this functionality you may
+choose from (ordered from least to most capable):
+1. Verbatim
+2. Listings
+3. Minted
+4. Engraved
-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:
+The first two options provide basic syntax
+highlighting (listings), or none at all (verbatim).
+
+When using listings, you also need to make use of LaTeX package
+\"listings\". The \"color\" LaTeX package is also needed if you
+would like color too. These can simply be added to
+`org-latex-packages-alist', using customize or something like:
(require \\='ox-latex)
(add-to-list \\='org-latex-packages-alist \\='(\"\" \"listings\"))
(add-to-list \\='org-latex-packages-alist \\='(\"\" \"color\"))
-Alternatively,
+There are two further options for more comprehensive
+fontification. The first can be set with,
- (setq org-latex-listings \\='minted)
+ (setq org-latex-src-block-backend \\='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
+which causes source code to be exported using the LaTeX package
+minted 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\"))
@@ -962,13 +969,30 @@ 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'."
+URL `https://orgmode.org/worg/org-tutorials/org-latex-preview.html'.
+
+The most comprehensive option can be set with,
+
+ (setq org-latex-src-block-backend \\='engraved)
+
+which causes source code to be run through
+`engrave-faces-latex-buffer', which generates colorings using
+Emacs' font-lock information. This requires the Emacs package
+engrave-faces (available from ELPA), and the LaTeX package
+fvextra be installed.
+
+The styling of the engraved result can be customized with
+`org-latex-engraved-preamble' and `org-latex-engraved-options'.
+The default preamble also uses the LaTeX package tcolorbox in
+addition to fvextra."
:group 'org-export-latex
+ :package-version '(Org . "9.6")
:type '(choice
- (const :tag "Use listings" t)
+ (const :tag "Use listings" listings)
(const :tag "Use minted" minted)
- (const :tag "Export verbatim" nil))
- :safe (lambda (s) (memq s '(t nil minted))))
+ (const :tag "Use engrave-faces-latex" engraved)
+ (const :tag "Export verbatim" verbatim))
+ :safe (lambda (s) (memq s '(listings minted engraved verbatim))))
(defcustom org-latex-listings-langs
'((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp")
@@ -1002,12 +1026,16 @@ in this list - but it does not hurt if it is present."
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,
+a list or cons cell 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\")))
+ ; or
+ (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.
@@ -1055,11 +1083,14 @@ with:
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,
+be a list or cons cell containing two strings: the name of the
+option, and the value. For example,
(setq org-latex-minted-options
\\='((\"bgcolor\" \"bg\") (\"frame\" \"lines\")))
+ ; or
+ (setq org-latex-minted-options
+ \\='((\"bgcolor\" . \"bg\") (\"frame\" . \"lines\")))
will result in source blocks being exported with
@@ -1131,6 +1162,203 @@ will produce
:version "26.1"
:package-version '(Org . "9.0"))
+(defcustom org-latex-engraved-preamble
+ "\\usepackage{fvextra}
+
+[FVEXTRA-SETUP]
+
+% Make line numbers smaller and grey.
+\\renewcommand\\theFancyVerbLine{\\footnotesize\\color{black!40!white}\\arabic{FancyVerbLine}}
+
+\\usepackage{xcolor}
+
+% In case engrave-faces-latex-gen-preamble has not been run.
+\\providecolor{EfD}{HTML}{f7f7f7}
+\\providecolor{EFD}{HTML}{28292e}
+
+% Define a Code environment to prettily wrap the fontified code.
+\\usepackage[breakable,xparse]{tcolorbox}
+\\DeclareTColorBox[]{Code}{o}%
+{colback=EfD!98!EFD, colframe=EfD!95!EFD,
+ fontupper=\\footnotesize\\setlength{\\fboxsep}{0pt},
+ colupper=EFD,
+ IfNoValueTF={#1}%
+ {boxsep=2pt, arc=2.5pt, outer arc=2.5pt,
+ boxrule=0.5pt, left=2pt}%
+ {boxsep=2.5pt, arc=0pt, outer arc=0pt,
+ boxrule=0pt, leftrule=1.5pt, left=0.5pt},
+ right=2pt, top=1pt, bottom=0.5pt,
+ breakable}
+
+[LISTINGS-SETUP]"
+ "Preamble content injected when using engrave-faces-latex for source blocks.
+This is relevant when `org-latex-src-block-backend' is set to `engraved'.
+
+There is quite a lot of flexibility in what this preamble can be,
+as long as it:
+- Loads the fvextra package.
+- Loads the package xcolor (if it is not already loaded elsewhere).
+- Defines a \"Code\" environment (note the capital C), which all
+ \"Verbatim\" environments (provided by fvextra) will be wrapped with.
+
+In the default value the colors \"EFD\" and \"EfD\" are provided
+as they are respectively the foreground and background colors,
+just in case they aren't provided by the generated preamble, so
+we can assume they are always set.
+
+Within this preamble there are two recognized macro-like placeholders:
+
+ [FVEXTRA-SETUP]
+
+ [LISTINGS-SETUP]
+
+Unless you have a very good reason, both of these placeholders
+should be included in the preamble.
+
+FVEXTRA-SETUP sets fvextra's defaults according to
+`org-latex-engraved-options', and LISTINGS-SETUP creates the
+listings environment used for captioned or floating code blocks,
+as well as defining \\listoflistings."
+ :group 'org-export-latex
+ :type 'string
+ :package-version '(Org . "9.6"))
+
+(defcustom org-latex-engraved-options
+ '(("commandchars" . "\\\\\\{\\}")
+ ("highlightcolor" . "white!95!black!80!blue")
+ ("breaklines" . "true")
+ ("breaksymbol" . "\\color{white!60!black}\\tiny\\ensuremath{\\hookrightarrow}"))
+ "Association list of options for the latex fvextra package when engraving code.
+
+These options are set using \\fvset{...} in the preamble of the
+LaTeX export. Each element of the alist should be a list or cons
+cell containing two strings: the name of the option, and the
+value. For example,
+
+ (setq org-latex-engraved-options
+ \\='((\"highlightcolor\" \"green\") (\"frame\" \"lines\")))
+ ; or
+ (setq org-latex-engraved-options
+ \\='((\"highlightcolor\" . \"green\") (\"frame\" . \"lines\")))
+
+will result in the following LaTeX in the preamble
+
+\\fvset{%
+ bgcolor=bg,
+ frame=lines}
+
+This will affect all fvextra environments. Note that the same
+options will be applied to all blocks. If you need
+block-specific options, you may use the following syntax:
+
+ #+ATTR_LATEX: :options key1=value1,key2=value2
+ #+BEGIN_SRC <LANG>
+ ...
+ #+END_SRC"
+ :group 'org-export-latex
+ :package-version '(Org . "9.6")
+ :type '(alist :key-type (string :tag "option")
+ :value-type (string :tag "value")))
+
+(defcustom org-latex-engraved-theme nil
+ "The theme that should be used for engraved code, when non-nil.
+This can be set to any theme defined in `engrave-faces-themes' or
+loadable by Emacs. When set to t, the current Emacs theme is
+used. When nil, no theme is applied."
+ :group 'org-export-latex
+ :package-version '(Org . "9.6")
+ :type 'symbol)
+
+(defun org-latex-generate-engraved-preamble (info)
+ "Generate the preamble to setup engraved code.
+The result is constructed from the :latex-engraved-preamble and
+:latex-engraved-optionsn export options, the default values of
+which are given by `org-latex-engraved-preamble' and
+`org-latex-engraved-options' respectively."
+ (let* ((engraved-options
+ (plist-get info :latex-engraved-options))
+ (engraved-preamble (plist-get info :latex-engraved-preamble))
+ (engraved-theme (plist-get info :latex-engraved-theme))
+ (engraved-themes
+ (mapcar
+ #'intern
+ (cl-delete-duplicates
+ (org-element-map
+ (plist-get info :parse-tree)
+ '(src-block inline-src-block)
+ (lambda (src)
+ (plist-get
+ (org-export-read-attribute :attr_latex src)
+ :engraved-theme))
+ info))))
+ (gen-theme-spec
+ (lambda (theme)
+ (if (eq engrave-faces-latex-output-style 'preset)
+ (engrave-faces-latex-gen-preamble theme)
+ (engrave-faces-latex-gen-preamble-line
+ 'default
+ (alist-get 'default
+ (if theme
+ (engrave-faces-get-theme (intern theme))
+ engrave-faces-current-preset-style)))))))
+ (when (stringp engraved-theme)
+ (setq engraved-theme (intern engraved-theme)))
+ (when (string-match "^[ \t]*\\[FVEXTRA-SETUP\\][ \t]*\n?" engraved-preamble)
+ (setq engraved-preamble
+ (replace-match
+ (concat
+ "\\fvset{%\n "
+ (org-latex--make-option-string engraved-options ",\n ")
+ "}\n")
+ t t
+ engraved-preamble)))
+ (when (string-match "^[ \t]*\\[LISTINGS-SETUP\\][ \t]*\n?" engraved-preamble)
+ (setq engraved-preamble
+ (replace-match
+ (format
+ "%% Support listings with captions
+\\usepackage{float}
+\\floatstyle{%s}
+\\newfloat{listing}{htbp}{lst}
+\\newcommand{\\listingsname}{Listing}
+\\floatname{listing}{\\listingsname}
+\\newcommand{\\listoflistingsname}{List of Listings}
+\\providecommand{\\listoflistings}{\\listof{listing}{\\listoflistingsname}}\n"
+ (if (memq 'src-block org-latex-caption-above)
+ "plaintop" "plain"))
+ t t
+ engraved-preamble)))
+ (concat
+ "\n% Setup for code blocks [1/2]\n\n"
+ engraved-preamble
+ "\n\n% Setup for code blocks [2/2]: syntax highlighting colors\n\n"
+ (if (require 'engrave-faces-latex nil t)
+ (if engraved-themes
+ (concat
+ (mapconcat
+ (lambda (theme)
+ (format
+ "\n\\newcommand{\\engravedtheme%s}{%%\n%s\n}"
+ (replace-regexp-in-string "[^A-Za-z]" "" (symbol-name theme))
+ (replace-regexp-in-string
+ "newcommand" "renewcommand"
+ (replace-regexp-in-string
+ "#" "##"
+ (funcall gen-theme-spec theme)))))
+ engraved-themes
+ "\n")
+ "\n\n"
+ (cond
+ ((memq engraved-theme engraved-themes)
+ (concat "\\engravedtheme"
+ (replace-regexp-in-string
+ "[^A-Za-z]" "" engraved-theme)
+ "\n"))
+ (t (funcall gen-theme-spec engraved-theme))))
+ (funcall gen-theme-spec engraved-theme))
+ (message "Cannot engrave source blocks. Consider installing `engrave-faces'.")
+ "% WARNING syntax highlighting unavailable as engrave-faces-latex was missing.\n")
+ "\n")))
;;;; Compilation
@@ -1187,6 +1415,9 @@ A better approach is to use a compiler suit such as `latexmk'."
"%latex -interaction nonstopmode -output-directory %o %f"))
"Commands to process a LaTeX file to a PDF file.
+The command output will be parsed to extract compilation errors and
+warnings according to `org-latex-known-warnings'.
+
This is a list of strings, each of them will be given to the
shell as a command. %f in the command will be replaced by the
relative file name, %F by the absolute file name, %b by the file
@@ -1209,7 +1440,7 @@ Alternatively, this may be a Lisp function that does the
processing, so you could use this to apply the machinery of
AUCTeX or the Emacs LaTeX mode. This function should accept the
file name as its single argument."
- :group 'org-export-pdf
+ :group 'org-export-latex
:type '(choice
(repeat :tag "Shell command sequence"
(string :tag "Shell command"))
@@ -1315,6 +1546,7 @@ Eventually, if FULL is non-nil, wrap label within \"\\label{}\"."
(`paragraph
(and (org-element-property :caption datum)
"fig:"))
+ (`src-block "lst:")
(_ nil))
(org-export-get-reference datum info))))))
(cond ((not full) label)
@@ -1339,7 +1571,8 @@ For non-floats, see `org-latex--wrap-label'."
main)
(and (eq type 'src-block)
(not (plist-get attr :float))
- (null (plist-get info :latex-listings)))))
+ (memq (plist-get info :latex-src-block-backend)
+ '(verbatim nil)))))
(short (org-export-get-caption element t))
(caption-from-attr-latex (plist-get attr :caption)))
(cond
@@ -1359,7 +1592,8 @@ For non-floats, see `org-latex--wrap-label'."
(paragraph "figure")
(image "figure")
(special-block "figure")
- (src-block (if (plist-get info :latex-listings)
+ (src-block (if (not (memq (plist-get info :latex-src-block-backend)
+ '(verbatim nil)))
"listing"
"figure"))
(t (symbol-name type*)))
@@ -1396,31 +1630,52 @@ Insertion of guessed language only happens when Babel package has
explicitly been loaded. Then it is added to the rest of
package's options.
-The argument to Babel may be \"AUTO\" which is then replaced with
-the language of the document or `org-export-default-language'
-unless language in question is already loaded.
+The optional argument to Babel or the mandatory argument to
+`\babelprovide' command may be \"AUTO\" which is then replaced
+with the language of the document or
+`org-export-default-language' unless language in question is
+already loaded.
Return the new header."
- (let ((language-code (plist-get info :language)))
- ;; If no language is set or Babel package is not loaded, return
- ;; HEADER as-is.
- (if (or (not (stringp language-code))
- (not (string-match "\\\\usepackage\\[\\(.*\\)\\]{babel}" header)))
+ (let* ((language-code (plist-get info :language))
+ (plist (cdr
+ (assoc language-code org-latex-language-alist)))
+ (language (plist-get plist :babel))
+ (language-ini-only (plist-get plist :babel-ini-only))
+ ;; If no language is set, or Babel package is not loaded, or
+ ;; LANGUAGE keyword value is a language served by Babel
+ ;; exclusively through ini files, return HEADER as-is.
+ (header (if (or language-ini-only
+ (not (stringp language-code))
+ (not (string-match "\\\\usepackage\\[\\(.*\\)\\]{babel}" header)))
+ header
+ (let ((options (save-match-data
+ (org-split-string (match-string 1 header) ",[ \t]*"))))
+ ;; If LANGUAGE is already loaded, return header
+ ;; without AUTO. Otherwise, replace AUTO with language or
+ ;; append language if AUTO is not present. Languages that are
+ ;; served in Babel exclusively through ini files are not added
+ ;; to the babel argument, and must be loaded using
+ ;; `\babelprovide'.
+ (replace-match
+ (mapconcat (lambda (option) (if (equal "AUTO" option) language option))
+ (cond ((member language options) (delete "AUTO" options))
+ ((member "AUTO" options) options)
+ (t (append options (list language))))
+ ", ")
+ t nil header 1)))))
+ ;; If `\babelprovide[args]{AUTO}' is present, AUTO is
+ ;; replaced by LANGUAGE.
+ (if (not (string-match "\\\\babelprovide\\[.*\\]{\\(.+\\)}" header))
header
- (let ((options (save-match-data
- (org-split-string (match-string 1 header) ",[ \t]*")))
- (language (cdr (assoc-string language-code
- org-latex-babel-language-alist t))))
- ;; If LANGUAGE is already loaded, return header without AUTO.
- ;; Otherwise, replace AUTO with language or append language if
- ;; AUTO is not present.
- (replace-match
- (mapconcat (lambda (option) (if (equal "AUTO" option) language option))
- (cond ((member language options) (delete "AUTO" options))
- ((member "AUTO" options) options)
- (t (append options (list language))))
- ", ")
- t nil header 1)))))
+ (let ((prov (match-string 1 header)))
+ (if (equal "AUTO" prov)
+ (replace-regexp-in-string (format
+ "\\(\\\\babelprovide\\[.*\\]\\)\\({\\)%s}" prov)
+ (format "\\1\\2%s}"
+ (or language language-ini-only))
+ header t)
+ header)))))
(defun org-latex-guess-polyglossia-language (header info)
"Set the Polyglossia language according to the LANGUAGE keyword.
@@ -1437,7 +1692,7 @@ replaced with the language of the document or
using \setdefaultlanguage and not as an option to the package.
Return the new header."
- (let ((language (plist-get info :language)))
+ (let* ((language (plist-get info :language)))
;; If no language is set or Polyglossia is not loaded, return
;; HEADER as-is.
(if (or (not (stringp language))
@@ -1462,15 +1717,20 @@ Return the new header."
(concat "\\usepackage{polyglossia}\n"
(mapconcat
(lambda (l)
- (let ((l (or (assoc l org-latex-polyglossia-language-alist)
- l)))
- (format (if main-language-set "\\setotherlanguage%s{%s}\n"
+ (let* ((plist (cdr
+ (assoc language org-latex-language-alist)))
+ (polyglossia-variant (plist-get plist :polyglossia-variant))
+ (polyglossia-lang (plist-get plist :polyglossia))
+ (l (if (equal l language)
+ polyglossia-lang
+ l)))
+ (format (if main-language-set (format "\\setotherlanguage{%s}\n" l)
(setq main-language-set t)
"\\setmainlanguage%s{%s}\n")
- (if (and (consp l) (= (length l) 3))
- (format "[variant=%s]" (nth 2 l))
+ (if polyglossia-variant
+ (format "[variant=%s]" polyglossia-variant)
"")
- (nth 1 l))))
+ l)))
languages
""))
t t header 0)))))
@@ -1502,21 +1762,24 @@ This is used to choose a separator for constructs like \\verb."
when (not (string-match (regexp-quote (char-to-string c)) s))
return (char-to-string c))))
-(defun org-latex--make-option-string (options)
+(defun org-latex--make-option-string (options &optional separator)
"Return a comma separated string of keywords and values.
OPTIONS is an alist where the key is the options keyword as
a string, and the value a list containing the keyword value, or
nil."
(mapconcat (lambda (pair)
- (pcase-let ((`(,keyword ,value) pair))
- (concat keyword
- (and (> (length value) 0)
- (concat "="
- (if (string-match-p (rx (any "[]")) value)
- (format "{%s}" value)
- value))))))
- options
- ","))
+ (let ((keyword (car pair))
+ (value (pcase (cdr pair)
+ ((pred stringp) (cdr pair))
+ ((pred consp) (cadr pair)))))
+ (concat keyword
+ (when value
+ (concat "="
+ (if (string-match-p (rx (any "[]")) value)
+ (format "{%s}" value)
+ value))))))
+ options
+ (or separator ",")))
(defun org-latex--wrap-label (element output info)
"Wrap label associated to ELEMENT around OUTPUT, if appropriate.
@@ -1611,10 +1874,12 @@ INFO is a plist used as a communication channel."
(defun org-latex--format-spec (info)
"Create a format-spec for document meta-data.
INFO is a plist used as a communication channel."
- (let ((language (let ((lang (plist-get info :language)))
- (or (cdr (assoc-string lang org-latex-babel-language-alist t))
- (nth 1 (assoc-string lang org-latex-polyglossia-language-alist t))
- lang))))
+ (let ((language (let* ((lang (plist-get info :language))
+ (plist (cdr
+ (assoc lang org-latex-language-alist))))
+ ;; Here the actual name of the LANGUAGE or LANG is used.
+ (or (plist-get plist :lang-name)
+ lang))))
`((?a . ,(org-export-data (plist-get info :author) info))
(?t . ,(org-export-data (plist-get info :title) info))
(?s . ,(org-export-data (plist-get info :subtitle) info))
@@ -1627,7 +1892,7 @@ INFO is a plist used as a communication channel."
(?c . ,(plist-get info :creator))
(?l . ,language)
(?L . ,(capitalize language))
- (?D . ,(org-export-get-date info)))))
+ (?D . ,(org-export-data (org-export-get-date info) info)))))
(defun org-latex--insert-compiler (info)
"Insert LaTeX_compiler info into the document.
@@ -1724,6 +1989,9 @@ holding export options."
(format "\\author{%s\\thanks{%s}}\n" author email))
((or author email) (format "\\author{%s}\n" (or author email)))))
;; Date.
+ ;; LaTeX displays today's date by default. One can override this by
+ ;; inserting \date{} for no date, or \date{string} with any other
+ ;; string to be displayed as the date.
(let ((date (and (plist-get info :with-date) (org-export-get-date info))))
(format "\\date{%s}\n" (org-export-data date info)))
;; Title and subtitle.
@@ -1742,6 +2010,12 @@ holding export options."
(let ((template (plist-get info :latex-hyperref-template)))
(and (stringp template)
(format-spec template spec)))
+ ;; engrave-faces-latex preamble
+ (when (and (eq org-latex-src-block-backend 'engraved)
+ (org-element-map (plist-get info :parse-tree)
+ '(src-block inline-src-block) #'identity
+ info t))
+ (org-latex-generate-engraved-preamble info))
;; Document start.
"\\begin{document}\n\n"
;; Title command.
@@ -1805,7 +2079,7 @@ information."
(concat (org-timestamp-translate (org-element-property :value clock))
(let ((time (org-element-property :duration clock)))
(and time (format " (%s)" time)))))
- "\\\\"))
+ org-latex-line-break-safe))
;;;; Code
@@ -2123,36 +2397,51 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"Transcode an INLINE-SRC-BLOCK element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
- (let* ((code (org-element-property :value inline-src-block))
- (separator (org-latex--find-verb-separator code)))
- (cl-case (plist-get info :latex-listings)
- ;; Do not use a special package: transcode it verbatim, as code.
- ((nil) (org-latex--text-markup code 'code info))
- ;; Use minted package.
- (minted
- (let* ((org-lang (org-element-property :language inline-src-block))
- (mint-lang (or (cadr (assq (intern org-lang)
- (plist-get info :latex-minted-langs)))
- (downcase org-lang)))
- (options (org-latex--make-option-string
- (plist-get info :latex-minted-options))))
- (format "\\mintinline%s{%s}{%s}"
- (if (string= options "") "" (format "[%s]" options))
- mint-lang
- code)))
- ;; Use listings package.
- (otherwise
- ;; Maybe translate language's name.
- (let* ((org-lang (org-element-property :language inline-src-block))
- (lst-lang (or (cadr (assq (intern org-lang)
- (plist-get info :latex-listings-langs)))
- org-lang))
- (options (org-latex--make-option-string
- (append (plist-get info :latex-listings-options)
- `(("language" ,lst-lang))))))
- (concat (format "\\lstinline[%s]" options)
- separator code separator))))))
-
+ (let ((code (org-element-property :value inline-src-block))
+ (lang (org-element-property :language inline-src-block)))
+ (pcase (plist-get info :latex-src-block-backend)
+ (`verbatim (org-latex--text-markup code 'code info))
+ (`minted (org-latex-inline-src-block--minted info code lang))
+ (`engraved (org-latex-inline-src-block--engraved info code lang))
+ (`listings (org-latex-inline-src-block--listings info code lang))
+ (oldval
+ (message "Please update the LaTeX src-block-backend to %s"
+ (if oldval "listings" "verbatim"))
+ (if oldval
+ (org-latex-inline-src-block--listings info code lang)
+ (org-latex--text-markup code 'code info))))))
+
+(defun org-latex-inline-src-block--minted (info code lang)
+ "Transcode an inline src block's content from Org to LaTeX, using minted.
+INFO, CODE, and LANG are provided by `org-latex-inline-src-block'."
+ (let ((mint-lang (or (cadr (assq (intern lang)
+ (plist-get info :latex-minted-langs)))
+ (downcase lang)))
+ (options (org-latex--make-option-string
+ (plist-get info :latex-minted-options))))
+ (format "\\mintinline%s{%s}{%s}"
+ (if (string= options "") "" (format "[%s]" options))
+ mint-lang
+ code)))
+
+(defun org-latex-inline-src-block--engraved (info code lang)
+ "Transcode an inline src block's content from Org to LaTeX, using engrave-faces.
+INFO, CODE, and LANG are provided by `org-latex-inline-src-block'."
+ (org-latex-src--engrave-code
+ code lang nil (plist-get info :latex-engraved-options) t))
+
+(defun org-latex-inline-src-block--listings (info code lang)
+ "Transcode an inline src block's content from Org to LaTeX, using lstlistings.
+INFO, CODE, and LANG are provided by `org-latex-inline-src-block'."
+ (let* ((lst-lang (or (cadr (assq (intern lang)
+ (plist-get info :latex-listings-langs)))
+ lang))
+ (separator (org-latex--find-verb-separator code))
+ (options (org-latex--make-option-string
+ (append (plist-get info :latex-listings-options)
+ `(("language" ,lst-lang))))))
+ (concat (format "\\lstinline[%s]" options)
+ separator code separator)))
;;;; Inlinetask
@@ -2187,10 +2476,10 @@ See `org-latex-format-inlinetask-function' for details."
(mapcar #'org-latex--protect-text tags)))))))
(concat "\\begin{center}\n"
"\\fbox{\n"
- "\\begin{minipage}[c]{.6\\textwidth}\n"
+ "\\begin{minipage}[c]{.6\\linewidth}\n"
full-title "\n\n"
(and (org-string-nw-p contents)
- (concat "\\rule[.8em]{\\textwidth}{2pt}\n\n" contents))
+ (concat "\\rule[.8em]{\\linewidth}{2pt}\n\n" contents))
"\\end{minipage}\n"
"}\n"
"\\end{center}")))
@@ -2304,9 +2593,10 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(concat depth (and depth "\n") "\\tableofcontents"))))
((string-match-p "\\<tables\\>" value) "\\listoftables")
((string-match-p "\\<listings\\>" value)
- (cl-case (plist-get info :latex-listings)
+ (cl-case (plist-get info :latex-src-block-backend)
((nil) "\\listoffigures")
(minted "\\listoflistings")
+ (engraved "\\listoflistings")
(otherwise "\\lstlistoflistings")))))))))
@@ -2386,7 +2676,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(defun org-latex-line-break (_line-break _contents _info)
"Transcode a LINE-BREAK object from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
- "\\\\\n")
+ (concat org-latex-line-break-safe "\n"))
;;;; Link
@@ -2411,6 +2701,7 @@ used as a communication channel."
(cond ((string= float "wrap") 'wrap)
((string= float "sideways") 'sideways)
((string= float "multicolumn") 'multicolumn)
+ ((string= float "t") 'figure)
((and (plist-member attr :float) (not float)) 'nonfloat)
(float float)
((or (org-element-property :caption parent)
@@ -2493,7 +2784,12 @@ used as a communication channel."
((string-prefix-p "," options)
(format "[%s]" (substring options 1)))
(t (format "[%s]" options)))
- path))
+ ;; While \includegraphics is fine with unicode in the path,
+ ;; \includesvg is prone to producing errors.
+ (if (and (string-match-p "[^[:ascii:]]" path)
+ (equal filetype "svg"))
+ (concat "\\detokenize{" path "}")
+ path)))
(when (equal filetype "svg")
(setq image-code (replace-regexp-in-string "^\\\\includegraphics"
"\\includesvg"
@@ -2588,7 +2884,7 @@ INFO is a plist holding contextual information. See
;; Link type is handled by a special function.
((org-export-custom-protocol-maybe link desc 'latex info))
;; Image file.
- (imagep (org-latex--inline-image link info))
+ (imagep (org-latex--inline-image (org-export-link-localise link) info))
;; Radio link: Transcode target's contents and use them as link's
;; description.
((string= type "radio")
@@ -2726,7 +3022,9 @@ contextual information."
;; Handle break preservation if required.
(when (plist-get info :preserve-breaks)
(setq output (replace-regexp-in-string
- "\\(?:[ \t]*\\\\\\\\\\)?[ \t]*\n" "\\\\\n" output nil t)))
+ "\\(?:[ \t]*\\\\\\\\\\)?[ \t]*\n"
+ (concat org-latex-line-break-safe "\n")
+ output nil t)))
;; Return value.
output))
@@ -2762,7 +3060,7 @@ information."
(format (plist-get info :latex-active-timestamp-format)
(org-timestamp-translate scheduled)))))))
" ")
- "\\\\"))
+ org-latex-line-break-safe))
;;;; Property Drawer
@@ -2980,176 +3278,351 @@ CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(when (org-string-nw-p (org-element-property :value src-block))
(let* ((lang (org-element-property :language src-block))
- (caption (org-element-property :caption src-block))
- (caption-above-p (org-latex--caption-above-p src-block info))
- (label (org-element-property :name src-block))
- (custom-env (and lang
- (cadr (assq (intern lang)
- org-latex-custom-lang-environments))))
- (num-start (org-export-get-loc src-block info))
- (retain-labels (org-element-property :retain-labels src-block))
- (attributes (org-export-read-attribute :attr_latex src-block))
- (float (plist-get attributes :float))
- (listings (plist-get info :latex-listings)))
- (cond
- ;; Case 1. No source fontification.
- ((or (not lang) (not listings))
- (let ((caption-str (org-latex--caption/label-string src-block info))
- (verbatim (format "\\begin{verbatim}\n%s\\end{verbatim}"
- (org-export-format-code-default src-block info))))
- (cond ((string= "multicolumn" float)
- (format "\\begin{figure*}[%s]\n%s%s\n%s\\end{figure*}"
- (plist-get info :latex-default-figure-position)
- (if caption-above-p caption-str "")
- verbatim
- (if caption-above-p "" caption-str)))
- (caption (concat
- (if caption-above-p caption-str "")
- verbatim
- (if caption-above-p "" (concat "\n" caption-str))))
- (t verbatim))))
- ;; Case 2. Custom environment.
- (custom-env
- (let ((caption-str (org-latex--caption/label-string src-block info))
- (formatted-src (org-export-format-code-default src-block info)))
- (if (string-match-p "\\`[a-zA-Z0-9]+\\'" custom-env)
- (format "\\begin{%s}\n%s\\end{%s}\n"
- custom-env
- (concat (and caption-above-p caption-str)
- formatted-src
- (and (not caption-above-p) caption-str))
- custom-env)
- (format-spec custom-env
- `((?s . ,formatted-src)
- (?c . ,caption)
- (?f . ,float)
- (?l . ,(org-latex--label src-block info))
- (?o . ,(or (plist-get attributes :options) "")))))))
- ;; Case 3. Use minted package.
- ((eq listings 'minted)
- (let* ((caption-str (org-latex--caption/label-string src-block info))
- (placement (or (org-unbracket-string "[" "]" (plist-get attributes :placement))
- (plist-get info :latex-default-figure-position)))
- (float-env
- (cond
- ((string= "multicolumn" float)
- (format "\\begin{listing*}[%s]\n%s%%s\n%s\\end{listing*}"
- placement
- (if caption-above-p caption-str "")
- (if caption-above-p "" caption-str)))
- (caption
- (format "\\begin{listing}[%s]\n%s%%s\n%s\\end{listing}"
- placement
- (if caption-above-p caption-str "")
- (if caption-above-p "" caption-str)))
- ((string= "t" float)
- (concat (format "\\begin{listing}[%s]\n"
- placement)
- "%s\n\\end{listing}"))
- (t "%s")))
- (options (plist-get info :latex-minted-options))
- (body
- (format
- "\\begin{minted}[%s]{%s}\n%s\\end{minted}"
- ;; Options.
- (concat
- (org-latex--make-option-string
- (if (or (not num-start) (assoc "linenos" options))
- options
- (append
- `(("linenos")
- ("firstnumber" ,(number-to-string (1+ num-start))))
- options)))
- (let ((local-options (plist-get attributes :options)))
- (and local-options (concat "," local-options))))
- ;; Language.
- (or (cadr (assq (intern lang)
- (plist-get info :latex-minted-langs)))
- (downcase lang))
- ;; Source code.
- (let* ((code-info (org-export-unravel-code src-block))
- (max-width
- (apply 'max
- (mapcar 'length
- (org-split-string (car code-info)
- "\n")))))
- (org-export-format-code
- (car code-info)
- (lambda (loc _num ref)
- (concat
- loc
- (when ref
- ;; Ensure references are flushed to the right,
- ;; separated with 6 spaces from the widest line
- ;; of code.
- (concat (make-string (+ (- max-width (length loc)) 6)
- ?\s)
- (format "(%s)" ref)))))
- nil (and retain-labels (cdr code-info)))))))
- ;; Return value.
- (format float-env body)))
- ;; Case 4. Use listings package.
- (t
- (let ((lst-lang
- (or (cadr (assq (intern lang)
- (plist-get info :latex-listings-langs)))
- lang))
- (caption-str
- (when caption
- (let ((main (org-export-get-caption src-block))
- (secondary (org-export-get-caption src-block t)))
- (if (not secondary)
- (format "{%s}" (org-export-data main info))
- (format "{[%s]%s}"
- (org-export-data secondary info)
- (org-export-data main info))))))
- (lst-opt (plist-get info :latex-listings-options)))
- (concat
- ;; Options.
- (format
- "\\lstset{%s}\n"
- (concat
- (org-latex--make-option-string
- (append
- lst-opt
- (cond
- ((and (not float) (plist-member attributes :float)) nil)
- ((string= "multicolumn" float) '(("float" "*")))
- ((and float (not (assoc "float" lst-opt)))
- `(("float" ,(plist-get info :latex-default-figure-position)))))
- `(("language" ,lst-lang))
- (if label
- `(("label" ,(org-latex--label src-block info)))
- '(("label" " ")))
- (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
- `(("captionpos" ,(if caption-above-p "t" "b")))
- (cond ((assoc "numbers" lst-opt) nil)
- ((not num-start) '(("numbers" "none")))
- (t `(("firstnumber" ,(number-to-string (1+ num-start)))
- ("numbers" "left"))))))
- (let ((local-options (plist-get attributes :options)))
- (and local-options (concat "," local-options)))))
- ;; Source code.
- (format
- "\\begin{lstlisting}\n%s\\end{lstlisting}"
- (let* ((code-info (org-export-unravel-code src-block))
- (max-width
- (apply 'max
- (mapcar 'length
- (org-split-string (car code-info) "\n")))))
- (org-export-format-code
- (car code-info)
- (lambda (loc _num ref)
- (concat
- loc
- (when ref
- ;; Ensure references are flushed to the right,
- ;; separated with 6 spaces from the widest line of
- ;; code
- (concat (make-string (+ (- max-width (length loc)) 6) ?\s)
- (format "(%s)" ref)))))
- nil (and retain-labels (cdr code-info))))))))))))
-
+ (caption (org-element-property :caption src-block))
+ (caption-above-p (org-latex--caption-above-p src-block info))
+ (label (org-element-property :name src-block))
+ (custom-env (and lang
+ (cadr (assq (intern lang)
+ org-latex-custom-lang-environments))))
+ (num-start (org-export-get-loc src-block info))
+ (retain-labels (org-element-property :retain-labels src-block))
+ (attributes (org-export-read-attribute :attr_latex src-block))
+ (float (plist-get attributes :float)))
+ (funcall
+ (pcase (plist-get info :latex-src-block-backend)
+ ((or `verbatim (guard (not lang))) #'org-latex-src-block--verbatim)
+ (`minted #'org-latex-src-block--minted)
+ (`engraved #'org-latex-src-block--engraved)
+ (`listings #'org-latex-src-block--listings)
+ ((guard custom-env) #'org-latex-src-block--custom)
+ (oldval
+ (message "Please update the LaTeX src-block-backend to %s"
+ (if oldval "listings" "verbatim"))
+ (if oldval
+ #'org-latex-src-block--listings
+ #'org-latex-src-block--verbatim)))
+ :src-block src-block
+ :info info
+ :lang lang
+ :caption caption
+ :caption-above-p caption-above-p
+ :label label
+ :num-start num-start
+ :retain-labels retain-labels
+ :attributes attributes
+ :float float
+ :custom-env custom-env))))
+
+(cl-defun org-latex-src-block--verbatim
+ (&key src-block info caption caption-above-p float &allow-other-keys)
+ "Transcode a SRC-BLOCK element from Org to LaTeX, using verbatim.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+ (let ((caption-str (org-latex--caption/label-string src-block info))
+ (verbatim (format "\\begin{verbatim}\n%s\\end{verbatim}"
+ (org-export-format-code-default src-block info))))
+ (cond ((string= "multicolumn" float)
+ (format "\\begin{figure*}[%s]\n%s%s\n%s\\end{figure*}"
+ (plist-get info :latex-default-figure-position)
+ (if caption-above-p caption-str "")
+ verbatim
+ (if caption-above-p "" caption-str)))
+ (caption (concat
+ (if caption-above-p caption-str "")
+ verbatim
+ (if caption-above-p "" (concat "\n" caption-str))))
+ (t verbatim))))
+
+(cl-defun org-latex-src-block--custom
+ (&key src-block info caption caption-above-p attributes float custom-env &allow-other-keys)
+ "Transcode a SRC-BLOCK element from Org to LaTeX, using a custom environment.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+ (let ((caption-str (org-latex--caption/label-string src-block info))
+ (formatted-src (org-export-format-code-default src-block info)))
+ (if (string-match-p "\\`[a-zA-Z0-9]+\\'" custom-env)
+ (format "\\begin{%s}\n%s\\end{%s}\n"
+ custom-env
+ (concat (and caption-above-p caption-str)
+ formatted-src
+ (and (not caption-above-p) caption-str))
+ custom-env)
+ (format-spec custom-env
+ `((?s . ,formatted-src)
+ (?c . ,caption)
+ (?f . ,float)
+ (?l . ,(org-latex--label src-block info))
+ (?o . ,(or (plist-get attributes :options) "")))))))
+
+(cl-defun org-latex-src-block--minted
+ (&key src-block info lang caption caption-above-p num-start retain-labels attributes float &allow-other-keys)
+ "Transcode a SRC-BLOCK element from Org to LaTeX, using minted.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+ (let* ((caption-str (org-latex--caption/label-string src-block info))
+ (placement (or (org-unbracket-string "[" "]" (plist-get attributes :placement))
+ (plist-get info :latex-default-figure-position)))
+ (multicolumn-p (string= "multicolumn" float))
+ (float-env
+ (cond
+ ((or caption multicolumn-p)
+ (cons
+ (concat "\\begin{listing" (when multicolumn-p "*")
+ "}[" placement "]\n"
+ (if caption-above-p caption-str ""))
+ (concat "\n" (if caption-above-p "" caption-str)
+ "\\end{listing" (when multicolumn-p "*") "}")))
+ ((string= "t" float)
+ (cons
+ (concat "\\begin{listing}[" placement "]\n")
+ "\n\\end{listing}"))))
+ (options (plist-get info :latex-minted-options))
+ (body
+ (format
+ "\\begin{minted}[%s]{%s}\n%s\\end{minted}"
+ ;; Options.
+ (concat
+ (org-latex--make-option-string
+ (if (or (not num-start) (assoc "linenos" options))
+ options
+ (append
+ `(("linenos")
+ ("firstnumber" ,(number-to-string (1+ num-start))))
+ options)))
+ (let ((local-options (plist-get attributes :options)))
+ (and local-options (concat "," local-options))))
+ ;; Language.
+ (or (cadr (assq (intern lang)
+ (plist-get info :latex-minted-langs)))
+ (downcase lang))
+ ;; Source code.
+ (let* ((code-info (org-export-unravel-code src-block))
+ (max-width
+ (apply 'max
+ (mapcar 'string-width
+ (org-split-string (car code-info)
+ "\n")))))
+ (org-export-format-code
+ (car code-info)
+ (lambda (loc _num ref)
+ (concat
+ loc
+ (when ref
+ ;; Ensure references are flushed to the right,
+ ;; separated with 6 spaces from the widest line
+ ;; of code.
+ (concat (make-string (+ (- max-width (length loc)) 6)
+ ?\s)
+ (format "(%s)" ref)))))
+ nil (and retain-labels (cdr code-info)))))))
+ (concat (car float-env) body (cdr float-env))))
+
+(defun org-latex-src--engrave-mathescape-p (info options)
+ "From the export INFO plist, and the per-block OPTIONS, determine mathescape."
+ (let ((default-options (plist-get info :latex-engraved-options))
+ (mathescape-status
+ (lambda (opts)
+ (cl-some
+ (lambda (opt)
+ (or (and
+ (null (cdr opt))
+ (cond
+ ((string-match-p
+ "\\(?:^\\|,\\)mathescape=false\\(?:,\\|$\\)"
+ (car opt))
+ 'no)
+ ((or (string-match-p
+ "\\(?:^\\|,\\)mathescape\\(?:=true\\)?\\(?:,\\|$\\)"
+ (car opt))
+ (string= "mathescape" (car opt)))
+ 'yes)))
+ (and
+ (string= (car opt) "mathescape")
+ (cond
+ ((or (and (stringp (cdr opt)) (string= (cdr opt) "true"))
+ (equal '("true") (cdr opt)))
+ 'yes)
+ ((or (and (stringp (cdr opt)) (string= "false" (cdr opt)))
+ (equal '("false") (cdr opt)))
+ 'no)))))
+ opts))))
+ (let ((mathescape (or (funcall mathescape-status default-options)
+ (funcall mathescape-status options))))
+ (when (eq mathescape 'yes)
+ (or engrave-faces-latex-mathescape t)))))
+
+(defun org-latex-src--engrave-code (content lang &optional theme options inline)
+ "Engrave CONTENT to LaTeX in a LANG-mode buffer, and give the result.
+When the THEME symbol is non-nil, that theme will be used.
+
+When INLINE is nil, a Verbatim environment wrapped in a Code
+environment will be used. When t, a Verb command will be used.
+
+When OPTIONS is provided, as either a string or list of key-value
+pairs accepted by `org-latex--make-option-string', it is passed
+to the Verbatim environment or Verb command."
+ (if (require 'engrave-faces-latex nil t)
+ (let* ((lang-mode (and lang (org-src-get-lang-mode lang)))
+ (engrave-faces-current-preset-style
+ (if theme
+ (engrave-faces-get-theme theme)
+ engrave-faces-current-preset-style))
+ (engraved-buffer
+ (with-temp-buffer
+ (insert (replace-regexp-in-string "\n\\'" "" content))
+ (when lang-mode
+ (if (functionp lang-mode)
+ (funcall lang-mode)
+ (message "Cannot engrave code as %s. %s is undefined."
+ lang lang-mode)))
+ (engrave-faces-latex-buffer)))
+ (engraved-code
+ (with-current-buffer engraved-buffer
+ (buffer-string)))
+ (engraved-options
+ (when options
+ (concat "["
+ (if (listp options)
+ (org-latex--make-option-string options)
+ options)
+ "]")))
+ (engraved-wrapped
+ (if inline
+ (concat "\\Verb" engraved-options "{" engraved-code "}")
+ (concat "\\begin{Code}\n\\begin{Verbatim}" engraved-options "\n"
+ engraved-code "\n\\end{Verbatim}\n\\end{Code}"))))
+ (kill-buffer engraved-buffer)
+ (if theme
+ (concat "{\\engravedtheme"
+ (replace-regexp-in-string "[^A-Za-z]" ""
+ (symbol-name theme))
+ engraved-wrapped
+ "}")
+ engraved-wrapped))
+ (user-error "Cannot engrave code as `engrave-faces-latex' is unavailable.")))
+
+(cl-defun org-latex-src-block--engraved
+ (&key src-block info lang caption caption-above-p num-start retain-labels attributes float &allow-other-keys)
+ "Transcode a SRC-BLOCK element from Org to LaTeX, using engrave-faces-latex.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+ (let* ((caption-str (org-latex--caption/label-string src-block info))
+ (placement (or (org-unbracket-string "[" "]" (plist-get attributes :placement))
+ (plist-get info :latex-default-figure-position)))
+ (multicolumn-p (string= "multicolumn" float))
+ (float-env
+ (cond
+ ((or caption multicolumn-p)
+ (cons
+ (concat "\\begin{listing" (when multicolumn-p "*")
+ "}[" placement "]\n"
+ (if caption-above-p caption-str ""))
+ (concat "\n" (if caption-above-p "" caption-str)
+ "\\end{listing" (when multicolumn-p "*") "}")))
+ ((string= "t" float)
+ (cons
+ (concat "\\begin{listing}[" placement "]\n")
+ "\n\\end{listing}"))))
+ (options
+ (let ((engraved-options (plist-get info :latex-engraved-options))
+ (local-options (plist-get attributes :options)))
+ (append
+ (when (and num-start (not (assoc "linenos" engraved-options)))
+ `(("linenos")
+ ("firstnumber" ,(number-to-string (1+ num-start)))))
+ (and local-options `((,local-options))))))
+ (engraved-theme (plist-get attributes :engraved-theme))
+ (content
+ (let* ((code-info (org-export-unravel-code src-block))
+ (max-width
+ (apply 'max
+ (mapcar 'string-width
+ (org-split-string (car code-info)
+ "\n")))))
+ (org-export-format-code
+ (car code-info)
+ (lambda (loc _num ref)
+ (concat
+ loc
+ (when ref
+ ;; Ensure references are flushed to the right,
+ ;; separated with 6 spaces from the widest line
+ ;; of code.
+ (concat (make-string (+ (- max-width (length loc)) 6)
+ ?\s)
+ (format "(%s)" ref)))))
+ nil (and retain-labels (cdr code-info)))))
+ (body
+ (let ((engrave-faces-latex-mathescape
+ (org-latex-src--engrave-mathescape-p info options)))
+ (org-latex-src--engrave-code
+ content lang
+ (when engraved-theme (intern engraved-theme))
+ options))))
+ (concat (car float-env) body (cdr float-env))))
+
+(cl-defun org-latex-src-block--listings
+ (&key src-block info lang caption caption-above-p label num-start retain-labels attributes float &allow-other-keys)
+ "Transcode a SRC-BLOCK element from Org to LaTeX, using listings.
+LANG, CAPTION, CAPTION-ABOVE-P, LABEL, NUM-START, RETAIN-LABELS, ATTRIBUTES
+and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
+ (let ((lst-lang
+ (or (cadr (assq (intern lang)
+ (plist-get info :latex-listings-langs)))
+ lang))
+ (caption-str
+ (when caption
+ (let ((main (org-export-get-caption src-block))
+ (secondary (org-export-get-caption src-block t)))
+ (if (not secondary)
+ (format "{%s}" (org-export-data main info))
+ (format "{[%s]%s}"
+ (org-export-data secondary info)
+ (org-export-data main info))))))
+ (lst-opt (plist-get info :latex-listings-options)))
+ (concat
+ (format
+ "\\begin{lstlisting}[%s]\n%s\\end{lstlisting}"
+ ;; Options.
+ (concat
+ (org-latex--make-option-string
+ (append
+ lst-opt
+ (cond
+ ((and (not float) (plist-member attributes :float)) nil)
+ ((string= "multicolumn" float) '(("float" "*")))
+ ((and float (not (assoc "float" lst-opt)))
+ `(("float" ,(plist-get info :latex-default-figure-position)))))
+ `(("language" ,lst-lang))
+ (if label
+ `(("label" ,(org-latex--label src-block info)))
+ '(("label" " ")))
+ (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
+ `(("captionpos" ,(if caption-above-p "t" "b")))
+ (cond ((assoc "numbers" lst-opt) nil)
+ ((not num-start) '(("numbers" "none")))
+ (t `(("firstnumber" ,(number-to-string (1+ num-start)))
+ ("numbers" "left"))))))
+ (let ((local-options (plist-get attributes :options)))
+ (and local-options (concat "," local-options))))
+ ;; Source code.
+ (let* ((code-info (org-export-unravel-code src-block))
+ (max-width
+ (apply 'max
+ (mapcar 'string-width
+ (org-split-string (car code-info) "\n")))))
+ (org-export-format-code
+ (car code-info)
+ (lambda (loc _num ref)
+ (concat
+ loc
+ (when ref
+ ;; Ensure references are flushed to the right,
+ ;; separated with 6 spaces from the widest line of
+ ;; code
+ (concat (make-string (+ (- max-width (length loc)) 6) ?\s)
+ (format "(%s)" ref)))))
+ nil (and retain-labels (cdr code-info))))))))
;;;; Statistics Cookie
@@ -3190,7 +3663,8 @@ CONTENTS is the contents of the object."
;; `org-latex-table' is the entry point for table transcoding. It
;; takes care of tables with a "verbatim" mode. Otherwise, it
;; delegates the job to either `org-latex--table.el-table',
-;; `org-latex--org-table' or `org-latex--math-table' functions,
+;; `org-latex--org-table', `org-latex--math-table' or
+;; `org-latex--org-tabbing' functions,
;; depending of the type of the table and the mode requested.
;;
;; `org-latex--align-string' is a subroutine used to build alignment
@@ -3214,8 +3688,11 @@ contextual information."
`(table nil ,@(org-element-contents table))))))
;; Case 2: Matrix.
((or (string= type "math") (string= type "inline-math"))
- (org-latex--math-table table info))
- ;; Case 3: Standard table.
+ (org-latex--math-table table info))
+ ;; Case 3: Tabbing
+ ((string= type "tabbing")
+ (org-table--org-tabbing table contents info))
+ ;; Case 4: Standard table.
(t (concat (org-latex--org-table table contents info)
;; When there are footnote references within the
;; table, insert their definition just after it.
@@ -3252,6 +3729,30 @@ centered."
info)
(apply 'concat (nreverse align)))))
+(defun org-latex--align-string-tabbing (table info)
+ "Return LaTeX alignment string using tabbing environment.
+TABLE is the considered table. INFO is a plist used as
+a communication channel."
+ (or (org-export-read-attribute :attr_latex table :align)
+ (let* ((count
+ ;; Count the number of cells in the first row.
+ (length
+ (org-element-map
+ (org-element-map table 'table-row
+ (lambda (row)
+ (and (eq (org-element-property :type row)
+ 'standard)
+ row))
+ info 'first-match)
+ 'table-cell #'identity)))
+ ;; Calculate the column width, using a proportion of
+ ;; the document's textwidth.
+ (separator
+ (format "\\hspace{%s\\textwidth} \\= "
+ (- (/ 1.0 count) 0.01))))
+ (concat (apply 'concat (make-list count separator))
+ "\\kill"))))
+
(defun org-latex--decorate-table (table attributes caption above? info)
"Decorate TABLE string with caption and float environment.
@@ -3266,6 +3767,7 @@ Return new environment, as a string."
(cond ((and (not float) (plist-member attributes :float)) nil)
((member float '("sidewaystable" "sideways")) "sidewaystable")
((equal float "multicolumn") "table*")
+ ((string= float "t") "table")
(float float)
((org-string-nw-p caption) "table")
(t nil))))
@@ -3314,6 +3816,7 @@ This function assumes TABLE has `org' as its `:type' property and
`table' as its `:mode' attribute."
(let* ((attr (org-export-read-attribute :attr_latex table))
(alignment (org-latex--align-string table info))
+ (opt (org-export-read-attribute :attr_latex table :options))
(table-env (or (plist-get attr :environment)
(plist-get info :latex-default-table-environment)))
(width
@@ -3335,22 +3838,38 @@ This function assumes TABLE has `org' as its `:type' property and
(format "\\begin{%s}%s{%s}\n" table-env width alignment)
(and above?
(org-string-nw-p caption)
- (concat caption "\\\\\n"))
+ (concat caption org-latex-line-break-safe "\n"))
contents
(and (not above?)
(org-string-nw-p caption)
- (concat caption "\\\\\n"))
+ (concat caption org-latex-line-break-safe "\n"))
(format "\\end{%s}" table-env)
(and fontsize "}"))))
(t
- (let ((output (format "\\begin{%s}%s{%s}\n%s\\end{%s}"
+ (let ((output (format "\\begin{%s}%s%s{%s}\n%s\\end{%s}"
table-env
+ (if opt (format "[%s]" opt) "")
width
alignment
contents
table-env)))
(org-latex--decorate-table output attr caption above? info))))))
+
+(defun org-table--org-tabbing (table contents info)
+ "Return tabbing environment LaTeX code for Org table.
+TABLE is the table type element to transcode. CONTENTS is its
+contents, as a string. INFO is a plist used as a communication
+channel.
+
+This function assumes TABLE has `org' as its `:type' property and
+`tabbing' as its `:mode' attribute."
+ (format "\\begin{%s}\n%s\n%s\\end{%s}"
+ "tabbing"
+ (org-latex--align-string-tabbing table info)
+ contents
+ "tabbing"))
+
(defun org-latex--table.el-table (table info)
"Return appropriate LaTeX code for a table.el table.
@@ -3408,7 +3927,7 @@ This function assumes TABLE has `org' as its `:type' property and
(lambda (cell)
(substring (org-element-interpret-data cell) 0 -1))
(org-element-map row 'table-cell #'identity info) "&")
- (or (cdr (assoc env org-latex-table-matrix-macros)) "\\\\")
+ (or (cdr (assoc env org-latex-table-matrix-macros)) org-latex-line-break-safe)
"\n")))
(org-element-map table 'table-row #'identity info) "")))
(concat
@@ -3434,8 +3953,10 @@ This function assumes TABLE has `org' as its `:type' property and
"Transcode a TABLE-CELL element from Org to LaTeX.
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
- (concat
- (let ((scientific-format (plist-get info :latex-table-scientific-notation)))
+ (let ((type (org-export-read-attribute
+ :attr_latex (org-export-get-parent-table table-cell) :mode))
+ (scientific-format (plist-get info :latex-table-scientific-notation)))
+ (concat
(if (and contents
scientific-format
(string-match orgtbl-exp-regexp contents))
@@ -3444,8 +3965,9 @@ a communication channel."
(format scientific-format
(match-string 1 contents)
(match-string 2 contents))
- contents))
- (when (org-export-get-next-element table-cell info) " & ")))
+ contents)
+ (when (org-export-get-next-element table-cell info)
+ (if (string= type "tabbing") " \\> " " & ")))))
;;;; Table Row
@@ -3477,7 +3999,7 @@ a communication channel."
;; hline was specifically marked.
(and booktabsp (not (org-export-get-previous-element table-row info))
"\\toprule\n")
- contents "\\\\\n"
+ contents org-latex-line-break-safe "\n"
(cond
;; Special case for long tables. Define header and footers.
((and longtablep (org-export-table-row-ends-header-p table-row info))
@@ -3485,9 +4007,9 @@ a communication channel."
(org-export-get-parent-table table-row) info))))
(format "%s
\\endfirsthead
-\\multicolumn{%d}{l}{%s} \\\\
+\\multicolumn{%d}{l}{%s} \\\\[0pt]
%s
-%s \\\\\n
+%s \\\\[0pt]\n
%s
\\endhead
%s\\multicolumn{%d}{r}{%s} \\\\
@@ -3585,10 +4107,15 @@ contextual information."
(replace-regexp-in-string
"^[ \t]+" (lambda (m) (format "\\hspace*{%dem}" (length m)))
(replace-regexp-in-string
- "^[ \t]*\\\\\\\\$" "\\vspace*{1em}"
+ (concat "^[ \t]*" (regexp-quote org-latex-line-break-safe) "$")
+ "\\vspace*{1em}"
(replace-regexp-in-string
- "\\([ \t]*\\\\\\\\\\)?[ \t]*\n" "\\\\\n"
- contents nil t) nil t) nil t) linreset)
+ "\\([ \t]*\\\\\\\\\\)?[ \t]*\n"
+ (concat org-latex-line-break-safe "\n")
+ contents nil t)
+ nil t)
+ nil t)
+ linreset)
info)
;; Insert footnote definitions, if any, after the environment, so
;; the special formatting above is not applied to them.
@@ -3731,6 +4258,9 @@ produced."
t)
(progn (beginning-of-line) (looking-at-p "%"))
(match-string 0)))
+ ;; Cannot find the compiler inserted by
+ ;; `org-latex-template' -> `org-latex--insert-compiler'.
+ ;; Use a fallback.
"pdflatex"))
(process (if (functionp org-latex-pdf-process) org-latex-pdf-process
;; Replace "%latex" with "%L" and "%bib" and
diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el
index e808edcdfc2..111c46aed9c 100644
--- a/lisp/org/ox-man.el
+++ b/lisp/org/ox-man.el
@@ -37,6 +37,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ox)
@@ -223,7 +226,6 @@ By default, Org uses 3 runs of to do the processing.
Alternatively, this may be a Lisp function that does the
processing. This function should accept the file name as
its single argument."
- :group 'org-export-pdf
:group 'org-export-man
:version "24.4"
:package-version '(Org . "8.0")
diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el
index 3551e4184e5..01e0aa0491b 100644
--- a/lisp/org/ox-md.el
+++ b/lisp/org/ox-md.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: org, wp, markdown
;; This file is part of GNU Emacs.
@@ -29,6 +29,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ox-html)
(require 'ox-publish)
@@ -71,6 +74,22 @@ The %s will be replaced by the footnote reference itself."
:version "26.1"
:package-version '(Org . "9.0"))
+(defcustom org-md-toplevel-hlevel 1
+ "Heading level to use for level 1 Org headings in markdown export.
+
+If this is 1, headline levels will be preserved on export. If this is
+2, top level Org headings will be exported to level 2 markdown
+headings, level 2 Org headings will be exported to level 3 markdown
+headings, and so on.
+
+Incrementing this value may be helpful when creating markdown to be
+included into another document or application that reserves top-level
+headings for its own use."
+ :group 'org-export-md
+ :package-version '(Org . "9.6")
+ :type 'natnum)
+
+
;;; Define Back-End
@@ -120,7 +139,8 @@ The %s will be replaced by the footnote reference itself."
:options-alist
'((:md-footnote-format nil nil org-md-footnote-format)
(:md-footnotes-section nil nil org-md-footnotes-section)
- (:md-headline-style nil nil org-md-headline-style)))
+ (:md-headline-style nil nil org-md-headline-style)
+ (:md-toplevel-hlevel nil nil org-md-toplevel-hlevel)))
;;; Filters
@@ -229,9 +249,10 @@ When optional argument SCOPE is non-nil, build a table of
contents according to the specified element."
(concat
(unless scope
- (let ((style (plist-get info :md-headline-style))
+ (let ((level (plist-get info :md-toplevel-hlevel))
+ (style (plist-get info :md-headline-style))
(title (org-html--translate "Table of Contents" info)))
- (org-md--headline-title style 1 title nil)))
+ (org-md--headline-title style level title nil)))
(mapconcat
(lambda (headline)
(let* ((indentation
@@ -350,7 +371,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
CONTENTS is the headline contents. 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))
+ (let* ((level (+ (org-export-get-relative-level headline info)
+ (1- (plist-get info :md-toplevel-hlevel))))
(title (org-export-data (org-element-property :title headline) info))
(todo (and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
index 8c8c80136ae..402c754471b 100644
--- a/lisp/org/ox-odt.el
+++ b/lisp/org/ox-odt.el
@@ -4,7 +4,7 @@
;; Author: Jambunathan K <kjambunathan at gmail dot com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;; This file is part of GNU Emacs.
@@ -25,6 +25,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'format-spec)
(require 'org-compat)
@@ -32,6 +35,10 @@
(require 'ox)
(require 'table nil 'noerror)
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
+
;;; Define Back-End
(org-export-define-backend 'odt
@@ -362,7 +369,6 @@ When this option is turned on, `indent-region' is run on all
component xml buffers before they are saved. Turn this off for
regular use. Turn this on if you need to examine the xml
visually."
- :group 'org-export-odt
:version "24.1"
:type 'boolean)
@@ -399,14 +405,13 @@ with GNU ELPA tar or standard Emacs distribution."
:type '(choice
(const :tag "Not set" nil)
(directory :tag "Schema directory"))
- :group 'org-export-odt
:version "24.1"
:set
(lambda (var value)
"Set `org-odt-schema-dir'.
Also add it to `rng-schema-locating-files'."
(let ((schema-dir value))
- (set var
+ (set-default-toplevel-value var
(if (and
(file-expand-wildcards
(expand-file-name "od-manifest-schema*.rnc" schema-dir))
@@ -437,7 +442,6 @@ If unspecified, the file named \"OrgOdtContentTemplate.xml\"
under `org-odt-styles-dir' is used."
:type '(choice (const nil)
(file))
- :group 'org-export-odt
:version "24.3")
(defcustom org-odt-styles-file nil
@@ -471,7 +475,6 @@ a per-file basis. For example,
#+ODT_STYLES_FILE: \"/path/to/styles.xml\" or
#+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))."
- :group 'org-export-odt
:version "24.1"
:type
'(choice
@@ -486,7 +489,6 @@ a per-file basis. For example,
(defcustom org-odt-display-outline-level 2
"Outline levels considered for enumerating captioned entities."
- :group 'org-export-odt
:version "24.4"
:package-version '(Org . "8.0")
:type 'integer)
@@ -516,7 +518,6 @@ specifiers are interpreted as below:
%d output dir in full
%D output dir as a URL.
%x extra options as set in `org-odt-convert-capabilities'."
- :group 'org-export-odt
:version "24.1"
:type
'(choice
@@ -529,7 +530,6 @@ specifiers are interpreted as below:
"Use this converter to convert from \"odt\" format to other formats.
During customization, the list of converter names are populated
from `org-odt-convert-processes'."
- :group 'org-export-odt
:version "24.1"
:type '(choice :convert-widget
(lambda (w)
@@ -591,7 +591,6 @@ format) to be converted to any of the export formats associated
with that class.
See default setting of this variable for a typical configuration."
- :group 'org-export-odt
:version "24.1"
:type
'(choice
@@ -618,7 +617,6 @@ variable, the list of valid values are populated based on
You can set this option on per-file basis using file local
values. See Info node `(emacs) File Variables'."
- :group 'org-export-odt
:version "24.1"
:type '(choice :convert-widget
(lambda (w)
@@ -644,7 +642,6 @@ The function must accept two parameters:
The function should return the string to be exported.
The default value simply returns the value of CONTENTS."
- :group 'org-export-odt
:version "26.1"
:package-version '(Org . "8.3")
:type 'function)
@@ -664,7 +661,6 @@ TEXT the main headline text (string).
TAGS the tags string, separated with colons (string or nil).
The function result will be used as headline text."
- :group 'org-export-odt
:version "26.1"
:package-version '(Org . "8.3")
:type 'function)
@@ -685,7 +681,6 @@ The function must accept six parameters:
CONTENTS the contents of the inlinetask, as a string.
The function should return the string to be exported."
- :group 'org-export-odt
:version "26.1"
:package-version '(Org . "8.3")
:type 'function)
@@ -712,7 +707,6 @@ nil Ignore math snippets.
be loaded.
Any other symbol is a synonym for `mathjax'."
- :group 'org-export-odt
:version "24.4"
:package-version '(Org . "8.0")
:type '(choice
@@ -732,7 +726,6 @@ Any other symbol is a synonym for `mathjax'."
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-odt
:version "24.4"
:package-version '(Org . "8.0")
:type '(alist :key-type (string :tag "Type")
@@ -745,7 +738,6 @@ link's path."
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-odt
:version "26.1"
:package-version '(Org . "8.3")
:type '(alist :key-type (string :tag "Type")
@@ -756,7 +748,6 @@ link's path."
Use this for sizing of embedded images. See Info node `(org)
Images in ODT export' for more information."
:type 'float
- :group 'org-export-odt
:version "24.4"
:package-version '(Org . "8.1"))
@@ -778,7 +769,6 @@ styles.xml already contains needed styles for colorizing to work.
This variable is effective only if `org-odt-fontify-srcblocks' is
turned on."
- :group 'org-export-odt
:version "24.1"
:type 'boolean)
@@ -788,7 +778,6 @@ Turn this option on if you want to colorize the source code
blocks in the exported file. For colorization to work, you need
to make available an enhanced version of `htmlfontify' library."
:type 'boolean
- :group 'org-export-odt
:version "24.1")
@@ -873,7 +862,6 @@ implementation filed under `org-odt-get-table-cell-styles'.
The TABLE-STYLE-NAME \"OrgEquation\" is used internally for
formatting of numbered display equations. Do not delete this
style from the list."
- :group 'org-export-odt
:version "24.1"
:type '(choice
(const :tag "None" nil)
@@ -918,7 +906,6 @@ document by setting the default language and country either using
the application UI or through a custom styles file.
See `org-odt--build-date-styles' for implementation details."
- :group 'org-export-odt
:version "24.4"
:package-version '(Org . "8.0")
:type 'boolean)
@@ -933,7 +920,7 @@ See `org-odt--build-date-styles' for implementation details."
(let* ((format-timestamp
(lambda (timestamp format &optional end utc)
(if timestamp
- (org-timestamp-format timestamp format end utc)
+ (org-format-timestamp timestamp format end utc)
(format-time-string format nil utc))))
(has-time-p (or (not timestamp)
(org-timestamp-has-time-p timestamp)))
@@ -949,14 +936,8 @@ See `org-odt--build-date-styles' for implementation details."
;; don't bother about formatting the date contents to be
;; compatible with "OrgDate1" and "OrgDateTime" styles. A
;; simple Org-style date should suffice.
- (date (let* ((formats
- (if org-display-custom-times
- (cons (substring
- (car org-time-stamp-custom-formats) 1 -1)
- (substring
- (cdr org-time-stamp-custom-formats) 1 -1))
- '("%Y-%m-%d %a" . "%Y-%m-%d %a %H:%M")))
- (format (if has-time-p (cdr formats) (car formats))))
+ (date (let ((format (org-time-stamp-format
+ has-time-p 'no-brackets 'custom)))
(funcall format-timestamp timestamp format end)))
(repeater (let ((repeater-type (org-element-property
:repeater-type timestamp))
@@ -1435,8 +1416,10 @@ original parsed data. INFO is a plist holding export options."
;; value before moving on to temp-buffer context down below.
(custom-time-fmts
(if org-display-custom-times
- (cons (substring (car org-time-stamp-custom-formats) 1 -1)
- (substring (cdr org-time-stamp-custom-formats) 1 -1))
+ (cons (org-time-stamp-format
+ nil 'no-brackets 'custom)
+ (org-time-stamp-format
+ 'with-time 'no-brackets 'custom))
'("%Y-%M-%d %a" . "%Y-%M-%d %a %H:%M"))))
(with-temp-buffer
(insert-file-contents
@@ -2005,14 +1988,16 @@ information."
;;;; Latex Environment
-
;; (eval-after-load 'ox-odt '(ad-deactivate 'org-format-latex-as-mathml))
-;; (defadvice org-format-latex-as-mathml ; FIXME
-;; (after org-odt-protect-latex-fragment activate)
+;; (advice-add 'org-format-latex-as-mathml ; FIXME
+;; :around #'org--odt-protect-latex-fragment)
+;; (defun org--odt-protect-latex-fragment (orig-fun latex-frag &rest args)
;; "Encode LaTeX fragment as XML.
;; Do this when translation to MathML fails."
-;; (unless (> (length ad-return-value) 0)
-;; (setq ad-return-value (org-odt--encode-plain-text (ad-get-arg 0)))))
+;; (let ((retval (apply orig-fun latex-frag args)))
+;; (if (> (length retval) 0)
+;; retval
+;; (org-odt--encode-plain-text latex-frag))))
(defun org-odt-latex-environment (latex-environment _contents info)
"Transcode a LATEX-ENVIRONMENT element from Org to ODT.
@@ -2699,7 +2684,14 @@ INFO is a plist holding contextual information. See
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
((string= type "file")
- (org-export-file-uri raw-path))
+ (let ((path-uri (org-export-file-uri raw-path)))
+ (if (string-prefix-p "file://" path-uri)
+ path-uri
+ ;; Otherwise, it is a relative path.
+ ;; OpenOffice treats base directory inside the odt
+ ;; archive. The directory containing the odt file
+ ;; is "../".
+ (concat "../" path-uri))))
(t raw-path)))
;; Convert & to &amp; for correct XML representation
(path (replace-regexp-in-string "&" "&amp;" path)))
@@ -2748,6 +2740,16 @@ INFO is a plist holding contextual information. See
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-get-reference destination info)
(or desc (org-export-get-ordinal destination info))))
+ ;; Link to a file, corresponding to string return value of
+ ;; `org-export-resolve-id-link'. Export it is file link.
+ (plain-text
+ (let ((file-link (org-element-copy link)))
+ (org-element-put-property file-link :type "file")
+ (org-element-put-property file-link :path destination)
+ (org-element-put-property
+ file-link
+ :raw-link (format "file:%s" destination))
+ (org-odt-link file-link desc info)))
;; Fuzzy link points to some element (e.g., an inline image,
;; a math formula or a table).
(otherwise
@@ -2914,9 +2916,28 @@ contextual information."
(setq output
(replace-regexp-in-string (car pair) (cdr pair) output t nil))))
;; Handle break preservation if required.
- (when (plist-get info :preserve-breaks)
- (setq output (replace-regexp-in-string
- "\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>" output t)))
+ (if (plist-get info :preserve-breaks)
+ (setq output (replace-regexp-in-string
+ "\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>" output t))
+ ;; OpenDocument schema recognizes newlines as spaces, which may
+ ;; not be desired in scripts that do not separate words with
+ ;; spaces (for example, Han script). `fill-region' is able to
+ ;; handle such situations.
+ ;; FIXME: The unnecessary spaced may still remain when a newline
+ ;; is at a boundary between Org objects (e.g. italics markup
+ ;; followed by newline).
+ (setq output
+ (with-temp-buffer
+ (insert output)
+ (save-match-data
+ (let ((leading (and (string-match (rx bos (1+ blank)) output)
+ (match-string 0 output)))
+ (trailing (and (string-match (rx (1+ blank) eos) output)
+ (match-string 0 output))))
+ ;; Unfill, retaining leading/trailing space.
+ (let ((fill-column (point-max)))
+ (fill-region (point-min) (point-max)))
+ (concat leading (buffer-string) trailing))))))
;; Return value.
output))
@@ -3101,7 +3122,7 @@ and prefix with \"OrgSrc\". For example,
(with-temp-buffer
(insert code)
(funcall lang-mode)
- (org-font-lock-ensure)
+ (font-lock-ensure)
(buffer-string))))
(fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string
'org-odt--encode-plain-text))
diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el
index 0613ede3175..159a41b9835 100644
--- a/lisp/org/ox-org.el
+++ b/lisp/org/ox-org.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: org, wp
;; This file is part of GNU Emacs.
@@ -25,6 +25,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'ox)
(declare-function htmlize-buffer "ext:htmlize" (&optional buffer))
(defvar htmlize-output-type)
@@ -328,8 +331,8 @@ Return output file name."
(work-buffer (or visitingp (find-file-noselect filename)))
newbuf)
(with-current-buffer work-buffer
- (org-font-lock-ensure)
- (org-show-all)
+ (font-lock-ensure)
+ (org-fold-show-all)
(setq newbuf (htmlize-buffer)))
(with-current-buffer newbuf
(when org-org-htmlized-css-url
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index 51e2352b4e8..a5999ef7bd7 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
;; Author: David O'Toole <dto@gnu.org>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: hypermedia, outlines, wp
;; This file is part of GNU Emacs.
@@ -38,10 +38,16 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'format-spec)
(require 'ox)
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
;;; Variables
@@ -379,7 +385,7 @@ still decide about that independently."
"Update publishing timestamp for file FILENAME.
If there is no timestamp, create one."
(let ((key (org-publish-timestamp-filename filename pub-dir pub-func))
- (stamp (org-publish-cache-ctime-of-src filename)))
+ (stamp (org-publish-cache-mtime-of-src filename)))
(org-publish-cache-set key stamp)))
(defun org-publish-remove-all-timestamps ()
@@ -1289,7 +1295,7 @@ the file including them will be republished as well."
(let* ((key (org-publish-timestamp-filename filename pub-dir pub-func))
(pstamp (org-publish-cache-get key))
(org-inhibit-startup t)
- included-files-ctime)
+ included-files-mtime)
(when (equal (file-name-extension filename) "org")
(let ((case-fold-search t))
(with-temp-buffer
@@ -1310,14 +1316,14 @@ the file including them will be republished as well."
(substring m 0 (match-beginning 0))
m)))))
(when include-filename
- (push (org-publish-cache-ctime-of-src
+ (push (org-publish-cache-mtime-of-src
(expand-file-name include-filename (file-name-directory filename)))
- included-files-ctime))))))))))
+ included-files-mtime))))))))))
(or (null pstamp)
- (let ((ctime (org-publish-cache-ctime-of-src filename)))
- (or (time-less-p pstamp ctime)
- (cl-some (lambda (ct) (time-less-p ctime ct))
- included-files-ctime))))))
+ (let ((mtime (org-publish-cache-mtime-of-src filename)))
+ (or (time-less-p pstamp mtime)
+ (cl-some (lambda (ct) (time-less-p mtime ct))
+ included-files-mtime))))))
(defun org-publish-cache-set-file-property
(filename property value &optional project-name)
@@ -1362,8 +1368,8 @@ does not exist."
(error "`org-publish-cache-set' called, but no cache present"))
(puthash key value org-publish-cache))
-(defun org-publish-cache-ctime-of-src (file)
- "Get the ctime of FILE as an integer."
+(defun org-publish-cache-mtime-of-src (file)
+ "Get the mtime of FILE as an integer."
(let ((attr (file-attributes
(expand-file-name (or (file-symlink-p file) file)
(file-name-directory file)))))
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el
index 9a8217583e9..73ba349b1bb 100644
--- a/lisp/org/ox-texinfo.el
+++ b/lisp/org/ox-texinfo.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs.
@@ -26,11 +26,14 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ox)
(defvar orgtbl-exp-regexp)
-
+(defvar org-texinfo-supports-math--cache)
;;; Define Back-End
@@ -55,6 +58,8 @@
(italic . org-texinfo-italic)
(item . org-texinfo-item)
(keyword . org-texinfo-keyword)
+ (latex-environment . org-texinfo-latex-environment)
+ (latex-fragment . org-texinfo-latex-fragment)
(line-break . org-texinfo-line-break)
(link . org-texinfo-link)
(node-property . org-texinfo-node-property)
@@ -83,7 +88,8 @@
(verse-block . org-texinfo-verse-block))
:filters-alist
'((:filter-headline . org-texinfo--filter-section-blank-lines)
- (:filter-parse-tree . org-texinfo--normalize-headlines)
+ (:filter-parse-tree . (org-texinfo--normalize-headlines
+ org-texinfo--separate-definitions))
(:filter-section . org-texinfo--filter-section-blank-lines)
(:filter-final-output . org-texinfo--untabify))
:menu-entry
@@ -118,8 +124,10 @@
(:texinfo-table-default-markup nil nil org-texinfo-table-default-markup)
(:texinfo-text-markup-alist nil nil org-texinfo-text-markup-alist)
(:texinfo-format-drawer-function nil nil org-texinfo-format-drawer-function)
- (:texinfo-format-inlinetask-function nil nil org-texinfo-format-inlinetask-function)))
-
+ (:texinfo-format-inlinetask-function nil nil org-texinfo-format-inlinetask-function)
+ (:texinfo-compact-itemx nil "compact-itemx" org-texinfo-compact-itemx)
+ ;; Redefine regular options.
+ (:with-latex nil "tex" org-texinfo-with-latex)))
;;; User Configurable Variables
@@ -354,6 +362,37 @@ The function should return the string to be exported."
:group 'org-export-texinfo
:type 'function)
+;;;; LaTeX
+
+(defcustom org-texinfo-with-latex (and org-export-with-latex 'detect)
+ "When non-nil, the Texinfo exporter attempts to process LaTeX math.
+
+When set to t, the exporter will process LaTeX environments and
+fragments as Texinfo \"@displaymath\" and \"@math\" commands
+respectively. Alternatively, when set to `detect', the exporter
+does so only if the installed version of Texinfo supports the
+necessary commands."
+ :group 'org-export-texinfo
+ :package-version '(Org . "9.6")
+ :type '(choice
+ (const :tag "Detect" detect)
+ (const :tag "Yes" t)
+ (const :tag "No" nil)))
+
+;;;; Itemx
+
+(defcustom org-texinfo-compact-itemx nil
+ "Non-nil means certain items in description list become `@itemx'.
+
+If this is non-nil and an item in a description list has no
+body but is followed by another item, then the second item is
+transcoded to `@itemx'. See info node `(org)Plain lists in
+Texinfo export' for how to enable this for individual lists."
+ :package-version '(Org . "9.6")
+ :group 'org-export-texinfo
+ :type 'boolean
+ :safe t)
+
;;;; Compilation
(defcustom org-texinfo-info-process '("makeinfo --no-split %f")
@@ -407,6 +446,30 @@ If two strings share the same prefix (e.g. \"ISO-8859-1\" and
(regexp-opt '("eps" "pdf" "png" "jpg" "jpeg" "gif" "svg"))))
"Rules characterizing image files that can be inlined.")
+(defvar org-texinfo--quoted-keys-regexp
+ (regexp-opt '("BS" "TAB" "RET" "ESC" "SPC" "DEL"
+ "LFD" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt"
+ "Cmd" "Super" "UP" "LEFT" "RIGHT" "DOWN")
+ 'words)
+ "Regexp matching keys that have to be quoted using @key{KEY}.")
+
+(defconst org-texinfo--definition-command-alist
+ '(("deffn Command" . "Command")
+ ("defun" . "Function")
+ ("defmac" . "Macro")
+ ("defspec" . "Special Form")
+ ("defvar" . "Variable")
+ ("defopt" . "User Option")
+ (nil . "Key"))
+ "Alist mapping Texinfo definition commands to output in Info files.")
+
+(defconst org-texinfo--definition-command-regexp
+ (format "\\`%s: \\(.+\\)"
+ (regexp-opt
+ (delq nil (mapcar #'cdr org-texinfo--definition-command-alist))
+ t))
+ "Regexp used to match definition commands in descriptive lists.")
+
;;; Internal Functions
@@ -570,6 +633,130 @@ INFO is a plist holding export options."
(`(,_ ,_ . ,sections) sections)
(_ (user-error "Unknown Texinfo class: %S" class)))))
+(defun org-texinfo--separate-definitions (tree _backend info)
+ "Split up descriptive lists in TREE that contain Texinfo definition commands.
+INFO is a plist used as a communication channel.
+Return new tree."
+ (org-element-map tree 'plain-list
+ (lambda (plain-list)
+ (when (eq (org-element-property :type plain-list) 'descriptive)
+ (let ((contents (org-element-contents plain-list))
+ (items nil))
+ (dolist (item contents)
+ (pcase-let ((`(,cmd . ,args) (org-texinfo--match-definition item)))
+ (cond
+ (cmd
+ (when items
+ (org-texinfo--split-plain-list plain-list (nreverse items))
+ (setq items nil))
+ (org-texinfo--split-definition plain-list item cmd args))
+ (t
+ (when args
+ (org-texinfo--massage-key-item plain-list item args info))
+ (push item items)))))
+ (unless (org-element-contents plain-list)
+ (org-element-extract-element plain-list)))))
+ info)
+ tree)
+
+(defun org-texinfo--match-definition (item)
+ "Return a cons-cell if ITEM specifies a Texinfo definition command.
+The car is the command and the cdr is its arguments."
+ (let ((tag (car-safe (org-element-property :tag item))))
+ (and tag
+ (stringp tag)
+ (string-match org-texinfo--definition-command-regexp tag)
+ (pcase-let*
+ ((cmd (car (rassoc (match-string-no-properties 1 tag)
+ org-texinfo--definition-command-alist)))
+ (`(,cmd ,category)
+ (and cmd (save-match-data (split-string cmd " "))))
+ (args (match-string-no-properties 2 tag)))
+ (cons cmd (if category (concat category " " args) args))))))
+
+(defun org-texinfo--split-definition (plain-list item cmd args)
+ "Insert a definition command before list PLAIN-LIST.
+Replace list item ITEM with a special-block that inherits the
+contents of ITEM and whose type and Texinfo attributes are
+specified by CMD and ARGS."
+ (let ((contents (org-element-contents item)))
+ (org-element-insert-before
+ (apply #'org-element-create 'special-block
+ (list :type cmd
+ :attr_texinfo (list (format ":options %s" args))
+ :post-blank (if contents 1 0))
+ (mapc #'org-element-extract-element contents))
+ plain-list))
+ (org-element-extract-element item))
+
+(defun org-texinfo--split-plain-list (plain-list items)
+ "Insert a new plain list before the plain list PLAIN-LIST.
+Remove ITEMS from PLAIN-LIST and use them as the contents of the
+new plain list."
+ (org-element-insert-before
+ (apply #'org-element-create 'plain-list
+ (list :type 'descriptive
+ :attr_texinfo (org-element-property :attr_texinfo plain-list)
+ :post-blank 1)
+ (mapc #'org-element-extract-element items))
+ plain-list))
+
+(defun org-texinfo--massage-key-item (plain-list item args info)
+ "In PLAIN-LIST modify ITEM based on ARGS.
+
+Reformat ITEM's tag property and determine the arguments for the
+`@findex' and `@kindex' commands for ITEM and store them in ITEM
+using the `:findex' and `:kindex' properties.
+
+If PLAIN-LIST is a description list whose `:compact' attribute is
+non-nil and ITEM has no content but is followed by another item,
+then store the `@findex' and `@kindex' values in the next item.
+If the previous item stored its respective values in this item,
+then move them to the next item.
+
+INFO is a plist used as a communication channel."
+ (let ((key nil)
+ (cmd nil))
+ (if (string-match (rx (+ " ")
+ "(" (group (+ (not (any "()")))) ")"
+ (* " ")
+ eos)
+ args)
+ (setq key (substring args 0 (match-beginning 0))
+ cmd (match-string 1 args))
+ (setq key args))
+ (org-element-put-property
+ item :tag
+ (cons (org-export-raw-string (org-texinfo-kbd-macro key t))
+ (and cmd `(" (" (code (:value ,cmd :post-blank 0)) ")"))))
+ (let ((findex (org-element-property :findex item))
+ (kindex (org-element-property :kindex item))
+ (next-item (org-export-get-next-element item nil))
+ (mx (string-prefix-p "M-x " key)))
+ (when (and (not cmd) mx)
+ (setq cmd (substring key 4)))
+ (when (and cmd (not (member cmd findex)))
+ (setq findex (nconc findex (list cmd))))
+ (unless mx
+ (setq kindex (nconc kindex (list key))))
+ (cond
+ ((and next-item
+ (or (plist-get info :texinfo-compact-itemx)
+ (org-not-nil
+ (org-export-read-attribute :attr_texinfo plain-list :compact)))
+ (not (org-element-contents item))
+ (eq 1 (org-element-property :post-blank item)))
+ (org-element-put-property next-item :findex findex)
+ (org-element-put-property next-item :kindex kindex)
+ (org-element-put-property item :findex nil)
+ (org-element-put-property item :kindex nil))
+ (t
+ (org-element-set-contents
+ item
+ (nconc (mapcar (lambda (key) `(keyword (:key "KINDEX" :value ,key))) kindex)
+ (mapcar (lambda (cmd) `(keyword (:key "FINDEX" :value ,cmd))) findex)
+ (org-element-contents item))))))))
+
;;; Template
(defun org-texinfo-template (contents info)
@@ -990,25 +1177,42 @@ contextual information."
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((tag (org-element-property :tag item))
- (split (org-string-nw-p
- (org-export-read-attribute :attr_texinfo
- (org-element-property :parent item)
- :sep)))
- (items (and tag
- (let ((tag (org-export-data tag info)))
- (if split
- (split-string tag (regexp-quote split) t "[ \t\n]+")
- (list tag))))))
- (format "%s\n%s"
- (pcase items
- (`nil "@item")
- (`(,item) (concat "@item " item))
- (`(,item . ,items)
- (concat "@item " item "\n"
- (mapconcat (lambda (i) (concat "@itemx " i))
- items
- "\n"))))
- (or contents ""))))
+ (plain-list (org-element-property :parent item))
+ (compact (and (eq (org-element-property :type plain-list) 'descriptive)
+ (or (plist-get info :texinfo-compact-itemx)
+ (org-not-nil (org-export-read-attribute
+ :attr_texinfo plain-list :compact)))))
+ (previous-item nil))
+ (when (and compact
+ (org-export-get-next-element item info)
+ (not (org-element-contents item))
+ (eq 1 (org-element-property :post-blank item)))
+ (org-element-put-property item :post-blank 0))
+ (if (and compact
+ (setq previous-item (org-export-get-previous-element item info))
+ (not (org-element-contents previous-item))
+ (eq 0 (org-element-property :post-blank previous-item)))
+ (format "@itemx%s\n%s"
+ (if tag (concat " " (org-export-data tag info)) "")
+ (or contents ""))
+ (let* ((split (org-string-nw-p (org-export-read-attribute
+ :attr_texinfo plain-list :sep)))
+ (items (and tag
+ (let ((tag (org-export-data tag info)))
+ (if split
+ (split-string tag (regexp-quote split)
+ t "[ \t\n]+")
+ (list tag))))))
+ (format "%s\n%s"
+ (pcase items
+ (`nil "@item")
+ (`(,item) (concat "@item " item))
+ (`(,item . ,items)
+ (concat "@item " item "\n"
+ (mapconcat (lambda (i) (concat "@itemx " i))
+ items
+ "\n"))))
+ (or contents ""))))))
;;;; Keyword
@@ -1032,6 +1236,52 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(concat "@listoffloats "
(org-export-translate "Listing" :utf-8 info))))))))
+;;;; LaTeX Environment
+
+(defun org-texinfo-latex-environment (environment _contents info)
+ "Transcode a LaTeX ENVIRONMENT from Org to Texinfo.
+CONTENTS is ignored. INFO is a plist holding contextual information."
+ (let ((with-latex (plist-get info :with-latex)))
+ (when (or (eq with-latex t)
+ (and (eq with-latex 'detect)
+ (org-texinfo-supports-math-p)))
+ (let ((value (org-element-property :value environment)))
+ (string-join (list "@displaymath"
+ (string-trim (org-remove-indentation value))
+ "@end displaymath")
+ "\n")))))
+
+;;;; LaTeX Fragment
+
+(defun org-texinfo-latex-fragment (fragment _contents info)
+ "Transcode a LaTeX FRAGMENT from Org to Texinfo.
+INFO is a plist holding contextual information."
+ (let ((with-latex (plist-get info :with-latex)))
+ (when (or (eq with-latex t)
+ (and (eq with-latex 'detect)
+ (org-texinfo-supports-math-p)))
+ (let ((value (org-remove-indentation
+ (org-element-property :value fragment))))
+ (cond
+ ((or (string-match-p "^\\\\\\[" value)
+ (string-match-p "^\\$\\$" value))
+ (concat "\n"
+ "@displaymath"
+ "\n"
+ (string-trim (substring value 2 -2))
+ "\n"
+ "@end displaymath"
+ "\n"))
+ ((string-match-p "^\\$" value)
+ (concat "@math{"
+ (string-trim (substring value 1 -1))
+ "}"))
+ ((string-match-p "^\\\\(" value)
+ (concat "@math{"
+ (string-trim (substring value 2 -2))
+ "}"))
+ (t value))))))
+
;;;; Line Break
(defun org-texinfo-line-break (_line-break _contents _info)
@@ -1611,7 +1861,28 @@ contextual information."
(format "@display\n%s@end display" contents))
-;;; Interactive functions
+;;; Public Functions
+
+(defun org-texinfo-kbd-macro (key &optional noquote)
+ "Quote KEY using @kbd{...} and if necessary @key{...}.
+
+This is intended to be used as an Org macro like so:
+
+ #+macro: kbd (eval (org-texinfo-kbd-macro $1))
+ Type {{{kbd(C-c SPC)}}}.
+
+Also see info node `(org)Key bindings in Texinfo export'.
+
+If optional NOQOUTE is non-nil, then do not add the quoting
+that is necessary when using this in an Org macro."
+ (format (if noquote "@kbd{%s}" "@@texinfo:@kbd{@@%s@@texinfo:}@@")
+ (let ((case-fold-search nil))
+ (replace-regexp-in-string
+ org-texinfo--quoted-keys-regexp
+ (if noquote "@key{\\&}" "@@texinfo:@key{@@\\&@@texinfo:}@@")
+ key t))))
+
+;;; Interactive Functions
;;;###autoload
(defun org-texinfo-export-to-texinfo
@@ -1747,6 +2018,31 @@ Return INFO file name or an error if it couldn't be produced."
(message "Process completed.")
output))
+(defun org-texinfo-supports-math-p ()
+ "Return t if the installed version of Texinfo supports \"@math\".
+
+Once computed, the results remain cached."
+ (unless (boundp 'org-texinfo-supports-math--cache)
+ (setq org-texinfo-supports-math--cache
+ (let ((math-example "1 + 1 = 2"))
+ (let* ((input-file
+ (make-temp-file "test" nil ".info"))
+ (input-content
+ (concat (format "@setfilename %s" input-file) "\n"
+ "@node Top" "\n"
+ (format "@displaymath{%s}" math-example) "\n")))
+ (with-temp-file input-file
+ (insert input-content))
+ (let* ((output-file (org-texinfo-compile input-file))
+ (output-content (with-temp-buffer
+ (insert-file-contents output-file)
+ (buffer-string))))
+ (let ((result (string-match-p (regexp-quote math-example)
+ output-content)))
+ (delete-file input-file)
+ (delete-file output-file)
+ (if result t nil)))))))
+ org-texinfo-supports-math--cache)
(provide 'ox-texinfo)
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index ca6b3f22080..5c0a8f2424b 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -2,8 +2,8 @@
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
-;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
-;; Maintainer: Nicolas Goaziou <n.goaziou at gmail dot com>
+;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
;; Keywords: outlines, hypermedia, calendar, wp
;; This file is part of GNU Emacs.
@@ -72,15 +72,16 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'cl-lib)
(require 'ob-exp)
(require 'oc)
-(require 'oc-basic) ;default value for `org-cite-export-processors'
(require 'ol)
(require 'org-element)
(require 'org-macro)
(require 'tabulated-list)
-(require 'subr-x)
(declare-function org-src-coderef-format "org-src" (&optional element))
(declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
@@ -88,6 +89,9 @@
(declare-function org-publish-all "ox-publish" (&optional force async))
(declare-function org-publish-current-file "ox-publish" (&optional force async))
(declare-function org-publish-current-project "ox-publish" (&optional force async))
+(declare-function org-at-heading-p "org" (&optional _))
+(declare-function org-back-to-heading "org" (&optional invisible-ok))
+(declare-function org-next-visible-heading "org" (arg))
(defvar org-publish-project-alist)
(defvar org-table-number-fraction)
@@ -260,9 +264,13 @@ See `org-export-inline-image-p' for more information about
rules.")
(defconst org-export-ignored-local-variables
- '(org-font-lock-keywords
- org-element--cache org-element--cache-objects org-element--cache-sync-keys
- org-element--cache-sync-requests org-element--cache-sync-timer)
+ '( org-font-lock-keywords org-element--cache-change-tic
+ org-element--cache-change-tic org-element--cache-size
+ org-element--headline-cache-size
+ org-element--cache-sync-keys-value
+ org-element--cache-change-warning org-element--headline-cache
+ org-element--cache org-element--cache-sync-keys
+ org-element--cache-sync-requests org-element--cache-sync-timer)
"List of variables not copied through upon buffer duplication.
Export process takes place on a copy of the original buffer.
When this copy is created, all Org related local variables not in
@@ -869,8 +877,12 @@ This option can also be set with the OPTIONS keyword, e.g.,
This variable allows providing shortcuts for export snippets.
-For example, with a value of \\='((\"h\" . \"html\")), the
-HTML back-end will recognize the contents of \"@@h:<b>@@\" as
+For example, with:
+
+ (setq org-export-snippet-translation-alist
+ \\='((\"h\" . \"html\")))
+
+the HTML back-end will recognize the contents of \"@@h:<b>@@\" as
HTML code while every other back-end will ignore it."
:group 'org-export-general
:version "24.4"
@@ -1179,7 +1191,7 @@ keywords are understood:
Menu entry for the export dispatcher. It should be a list
like:
- \\='(KEY DESCRIPTION-OR-ORDINAL ACTION-OR-MENU)
+ (KEY DESCRIPTION-OR-ORDINAL ACTION-OR-MENU)
where :
@@ -1203,17 +1215,17 @@ keywords are understood:
If it is an alist, associations should follow the
pattern:
- \\='(KEY DESCRIPTION ACTION)
+ (KEY DESCRIPTION ACTION)
where KEY, DESCRIPTION and ACTION are described above.
Valid values include:
- \\='(?m \"My Special Back-end\" my-special-export-function)
+ (?m \"My Special Back-end\" my-special-export-function)
or
- \\='(?l \"Export to LaTeX\"
+ (?l \"Export to LaTeX\"
((?p \"As PDF file\" org-latex-export-to-pdf)
(?o \"As PDF file and open\"
(lambda (a s v b)
@@ -1224,7 +1236,7 @@ keywords are understood:
or the following, which will be added to the previous
sub-menu,
- \\='(?l 1
+ (?l 1
((?B \"As TEX buffer (Beamer)\" org-beamer-export-as-latex)
(?P \"As PDF file (Beamer)\" org-beamer-export-to-pdf)))
@@ -1392,14 +1404,15 @@ Optional argument BACKEND is an export back-end, as returned by,
e.g., `org-export-create-backend'. It specifies which back-end
specific items to read, if any."
(let ((line
- (let ((s 0) alist)
- (while (string-match "\\(.+?\\):\\((.*?)\\|\\S-+\\)?[ \t]*" options s)
- (setq s (match-end 0))
- (let ((value (match-string 2 options)))
- (when value
- (push (cons (match-string 1 options)
- (read value))
- alist))))
+ (let (alist)
+ (with-temp-buffer
+ (insert options)
+ (goto-char (point-min))
+ (while (re-search-forward "\\s-*\\(.+?\\):" nil t)
+ (when (looking-at-p "\\S-")
+ (push (cons (match-string 1)
+ (read (current-buffer))) ; moves point
+ alist))))
alist))
;; Priority is given to back-end specific options.
(all (append (org-export-get-all-options backend)
@@ -1422,7 +1435,7 @@ for export. Return options as a plist."
;; property is the keyword with "EXPORT_" appended to it.
(org-with-wide-buffer
;; Make sure point is at a heading.
- (if (org-at-heading-p) (org-up-heading-safe) (org-back-to-heading t))
+ (org-back-to-heading t)
(let ((plist
;; EXPORT_OPTIONS are parsed in a non-standard way. Take
;; care of them right from the start.
@@ -1926,34 +1939,28 @@ Return a string."
(and (not greaterp)
(memq type org-element-recursive-objects)))
(contents
- (let ((export-buffer (current-buffer)))
- (with-temp-buffer
- (dolist (element (org-element-contents
- (if (or greaterp objectp) data
- ;; Elements directly containing
- ;; objects must have their indentation
- ;; normalized first.
- (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 (car (org-element-contents parent))
- data)
- (eq (org-element-property :pre-blank parent)
- 0))))))
- (insert
- ;; Use right local variable
- ;; environment if there are, for
- ;; example, #+BIND variables.
- (with-current-buffer export-buffer
- (org-export-data element info))))
- (buffer-string)))))
+ (mapconcat
+ (lambda (element) (org-export-data element info))
+ (org-element-contents
+ (if (or greaterp objectp) data
+ ;; Elements directly containing
+ ;; objects must have their indentation
+ ;; normalized first.
+ (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 (car (org-element-contents parent))
+ data)
+ (eq (org-element-property :pre-blank parent)
+ 0)))))
+ "")))
(broken-link-handler
(funcall transcoder data
(if (not greaterp) contents
@@ -2084,8 +2091,8 @@ keywords before output."
;;;; Hooks
-(defvar org-export-before-processing-hook nil
- "Hook run at the beginning of the export process.
+(defvar org-export-before-processing-functions nil
+ "Abnormal hook run at the beginning of the export process.
This is run before include keywords and macros are expanded and
Babel code blocks executed, on a copy of the original buffer
@@ -2095,8 +2102,8 @@ is at the beginning of the buffer.
Every function in this hook will be called with one argument: the
back-end currently used, as a symbol.")
-(defvar org-export-before-parsing-hook nil
- "Hook run before parsing an export buffer.
+(defvar org-export-before-parsing-functions nil
+ "Abnormal hook run before parsing an export buffer.
This is run after include keywords and macros have been expanded
and Babel code blocks executed, on a copy of the original buffer
@@ -2538,100 +2545,176 @@ Return the updated communication channel."
;; a default template (or a back-end specific template) at point or in
;; current subtree.
-(defun org-export-copy-buffer ()
+(cl-defun org-export-copy-buffer (&key to-buffer drop-visibility
+ drop-narrowing drop-contents
+ drop-locals)
"Return a copy of the current buffer.
The copy preserves Org buffer-local variables, visibility and
-narrowing."
- (let ((copy-buffer-fun (org-export--generate-copy-script (current-buffer)))
- (new-buf (generate-new-buffer (buffer-name))))
+narrowing.
+
+IMPORTANT: The buffer copy may also have `buffer-file-name' copied.
+To prevent Emacs overwriting the original buffer file,
+`write-contents-functions' is set to (always). Do not alter this
+variable and do not do anything that might alter it (like calling a
+major mode) to prevent data corruption. Also, do note that Emacs may
+jump into the created buffer if the original file buffer is closed and
+then re-opened. Making edits in the buffer copy may also trigger
+Emacs save dialogue. Prefer using `org-export-with-buffer-copy' macro
+when possible.
+
+When optional key `:to-buffer' is non-nil, copy into BUFFER.
+
+Optional keys `:drop-visibility', `:drop-narrowing', `:drop-contents',
+and `:drop-locals' are passed to `org-export--generate-copy-script'."
+ (let ((copy-buffer-fun (org-export--generate-copy-script
+ (current-buffer)
+ :copy-unreadable 'do-not-check
+ :drop-visibility drop-visibility
+ :drop-narrowing drop-narrowing
+ :drop-contents drop-contents
+ :drop-locals drop-locals))
+ (new-buf (or to-buffer (generate-new-buffer (buffer-name)))))
(with-current-buffer new-buf
(funcall copy-buffer-fun)
(set-buffer-modified-p nil))
new-buf))
-(defmacro org-export-with-buffer-copy (&rest body)
+(cl-defmacro org-export-with-buffer-copy ( &rest body
+ &key to-buffer drop-visibility
+ drop-narrowing drop-contents
+ drop-locals
+ &allow-other-keys)
"Apply BODY in a copy of the current buffer.
The copy preserves local variables, visibility and contents of
the original buffer. Point is at the beginning of the buffer
-when BODY is applied."
+when BODY is applied.
+
+Optional keys can modify what is being copied and the generated buffer
+copy. `:to-buffer', `:drop-visibility', `:drop-narrowing',
+`:drop-contents', and `:drop-locals' are passed as arguments to
+`org-export-copy-buffer'."
(declare (debug t))
(org-with-gensyms (buf-copy)
- `(let ((,buf-copy (org-export-copy-buffer)))
+ `(let ((,buf-copy (org-export-copy-buffer
+ :to-buffer ,to-buffer
+ :drop-visibility ,drop-visibility
+ :drop-narrowing ,drop-narrowing
+ :drop-contents ,drop-contents
+ :drop-locals ,drop-locals)))
(unwind-protect
(with-current-buffer ,buf-copy
(goto-char (point-min))
- (progn ,@body))
+ (prog1
+ (progn ,@body)
+ ;; `org-export-copy-buffer' carried the value of
+ ;; `buffer-file-name' from the original buffer. When not
+ ;; killed, the new buffer copy may become a target of
+ ;; `find-file'. Prevent this.
+ (setq buffer-file-name nil)))
(and (buffer-live-p ,buf-copy)
;; Kill copy without confirmation.
(progn (with-current-buffer ,buf-copy
(restore-buffer-modified-p nil))
- (kill-buffer ,buf-copy)))))))
-
-(defun org-export--generate-copy-script (buffer)
+ (unless ,to-buffer
+ (kill-buffer ,buf-copy))))))))
+
+(cl-defun org-export--generate-copy-script (buffer
+ &key
+ copy-unreadable
+ drop-visibility
+ drop-narrowing
+ drop-contents
+ drop-locals)
"Generate a function duplicating BUFFER.
The copy will preserve local variables, visibility, contents and
narrowing of the original buffer. If a region was active in
BUFFER, contents will be narrowed to that region instead.
+When optional key `:copy-unreadable' is non-nil, do not ensure that all
+the copied local variables will be readable in another Emacs session.
+
+When optional keys `:drop-visibility', `:drop-narrowing',
+`:drop-contents', or `:drop-locals' are non-nil, do not preserve
+visibility, narrowing, contents, or local variables correspondingly.
+
The resulting function can be evaluated at a later time, from
another buffer, effectively cloning the original buffer there.
The function assumes BUFFER's major mode is `org-mode'."
(with-current-buffer buffer
- (let ((str (org-with-wide-buffer (buffer-string)))
+ (let ((str (unless drop-contents (org-with-wide-buffer (buffer-string))))
(narrowing
- (if (org-region-active-p)
- (list (region-beginning) (region-end))
- (list (point-min) (point-max))))
+ (unless drop-narrowing
+ (if (org-region-active-p)
+ (list (region-beginning) (region-end))
+ (list (point-min) (point-max)))))
(pos (point))
(varvals
- (let ((bound-variables (org-export--list-bound-variables))
- (varvals nil))
- (dolist (entry (buffer-local-variables (buffer-base-buffer)))
- (when (consp entry)
- (let ((var (car entry))
- (val (cdr entry)))
- (and (not (memq var org-export-ignored-local-variables))
- (or (memq var
- '(default-directory
- buffer-file-name
- buffer-file-coding-system))
- (assq var bound-variables)
- (string-match "^\\(org-\\|orgtbl-\\)"
- (symbol-name var)))
- ;; Skip unreadable values, as they cannot be
- ;; sent to external process.
- (or (not val) (ignore-errors (read (format "%S" val))))
- (push (cons var val) varvals)))))
- varvals))
+ (unless drop-locals
+ (let ((bound-variables (org-export--list-bound-variables))
+ (varvals nil))
+ (dolist (entry (buffer-local-variables (buffer-base-buffer)))
+ (when (consp entry)
+ (let ((var (car entry))
+ (val (cdr entry)))
+ (and (not (memq var org-export-ignored-local-variables))
+ (or (memq var
+ '(default-directory
+ ;; Required to convert file
+ ;; links in the #+INCLUDEd
+ ;; files. See
+ ;; `org-export--prepare-file-contents'.
+ buffer-file-name
+ buffer-file-coding-system
+ ;; Needed to preserve folding state
+ char-property-alias-alist))
+ (assq var bound-variables)
+ (string-match "^\\(org-\\|orgtbl-\\)"
+ (symbol-name var)))
+ ;; Skip unreadable values, as they cannot be
+ ;; sent to external process.
+ (or copy-unreadable (not val)
+ (ignore-errors (read (format "%S" val))))
+ (push (cons var val) varvals)))))
+ varvals)))
(ols
- (let (ov-set)
- (dolist (ov (overlays-in (point-min) (point-max)))
- (let ((invis-prop (overlay-get ov 'invisible)))
- (when invis-prop
- (push (list (overlay-start ov) (overlay-end ov)
- invis-prop)
- ov-set))))
- ov-set)))
+ (unless drop-visibility
+ (let (ov-set)
+ (dolist (ov (overlays-in (point-min) (point-max)))
+ (let ((invis-prop (overlay-get ov 'invisible)))
+ (when invis-prop
+ (push (list (overlay-start ov) (overlay-end ov)
+ invis-prop)
+ ov-set))))
+ ov-set))))
(lambda ()
(let ((inhibit-modification-hooks t))
- ;; Set major mode. Ignore `org-mode-hook' as it has been run
- ;; already in BUFFER.
- (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode))
+ ;; Set major mode. Ignore `org-mode-hook' and other hooks as
+ ;; they have been run already in BUFFER.
+ (unless (eq major-mode 'org-mode)
+ (delay-mode-hooks
+ (let ((org-inhibit-startup t)) (org-mode))))
;; Copy specific buffer local variables and variables set
;; through BIND keywords.
(pcase-dolist (`(,var . ,val) varvals)
(set (make-local-variable var) val))
- ;; Whole buffer contents.
- (insert str)
+ ;; Whole buffer contents when requested.
+ (when str (erase-buffer) (insert str))
+ ;; Make org-element-cache not complain about changed buffer
+ ;; state.
+ (org-element-cache-reset nil 'no-persistence)
;; Narrowing.
- (apply #'narrow-to-region narrowing)
+ (when narrowing
+ (apply #'narrow-to-region narrowing))
;; Current position of point.
(goto-char pos)
;; Overlays with invisible property.
(pcase-dolist (`(,start ,end ,invis) ols)
- (overlay-put (make-overlay start end) 'invisible invis)))))))
+ (overlay-put (make-overlay start end) 'invisible invis))
+ ;; Never write the buffer copy to disk, despite
+ ;; `buffer-file-name' not being nil.
+ (setq write-contents-functions (list (lambda (&rest _) t))))))))
(defun org-export--delete-comment-trees ()
"Delete commented trees and commented inlinetasks in the buffer.
@@ -2941,141 +3024,142 @@ still inferior to file-local settings.
Return code as a string."
(when (symbolp backend) (setq backend (org-export-get-backend backend)))
(org-export-barf-if-invalid-backend backend)
- (save-excursion
- (save-restriction
- ;; Narrow buffer to an appropriate region or subtree for
- ;; parsing. If parsing subtree, be sure to remove main
- ;; headline, planning data and property drawer.
- (cond ((org-region-active-p)
- (narrow-to-region (region-beginning) (region-end)))
- (subtreep
- (org-narrow-to-subtree)
- (goto-char (point-min))
- (org-end-of-meta-data)
- (narrow-to-region (point) (point-max))))
- ;; Initialize communication channel with original buffer
- ;; attributes, unavailable in its copy.
- (let* ((org-export-current-backend (org-export-backend-name backend))
- (info (org-combine-plists
- (org-export--get-export-attributes
- backend subtreep visible-only body-only)
- (org-export--get-buffer-attributes)))
- (parsed-keywords
- (delq nil
- (mapcar (lambda (o) (and (eq (nth 4 o) 'parse) (nth 1 o)))
- (append (org-export-get-all-options backend)
- org-export-options-alist))))
- tree modified-tick)
- ;; Update communication channel and get parse tree. Buffer
- ;; isn't parsed directly. Instead, all buffer modifications
- ;; and consequent parsing are undertaken in a temporary copy.
- (org-export-with-buffer-copy
- (font-lock-mode -1)
- ;; Run first hook with current back-end's name as argument.
- (run-hook-with-args 'org-export-before-processing-hook
- (org-export-backend-name backend))
- (org-export-expand-include-keyword)
- (org-export--delete-comment-trees)
- (org-macro-initialize-templates org-export-global-macros)
- (org-macro-replace-all org-macro-templates parsed-keywords)
- ;; Refresh buffer properties and radio targets after previous
- ;; potentially invasive changes.
- (org-set-regexps-and-options)
- (org-update-radio-target-regexp)
- (setq modified-tick (buffer-chars-modified-tick))
- ;; Possibly execute Babel code. Re-run a macro expansion
- ;; specifically for {{{results}}} since inline source blocks
- ;; may have generated some more. Refresh buffer properties
- ;; and radio targets another time.
- (when org-export-use-babel
- (org-babel-exp-process-buffer)
- (org-macro-replace-all '(("results" . "$1")) parsed-keywords)
+ (org-fold-core-ignore-modifications
+ (save-excursion
+ (save-restriction
+ ;; Narrow buffer to an appropriate region or subtree for
+ ;; parsing. If parsing subtree, be sure to remove main
+ ;; headline, planning data and property drawer.
+ (cond ((org-region-active-p)
+ (narrow-to-region (region-beginning) (region-end)))
+ (subtreep
+ (org-narrow-to-subtree)
+ (goto-char (point-min))
+ (org-end-of-meta-data)
+ (narrow-to-region (point) (point-max))))
+ ;; Initialize communication channel with original buffer
+ ;; attributes, unavailable in its copy.
+ (let* ((org-export-current-backend (org-export-backend-name backend))
+ (info (org-combine-plists
+ (org-export--get-export-attributes
+ backend subtreep visible-only body-only)
+ (org-export--get-buffer-attributes)))
+ (parsed-keywords
+ (delq nil
+ (mapcar (lambda (o) (and (eq (nth 4 o) 'parse) (nth 1 o)))
+ (append (org-export-get-all-options backend)
+ org-export-options-alist))))
+ tree modified-tick)
+ ;; Update communication channel and get parse tree. Buffer
+ ;; isn't parsed directly. Instead, all buffer modifications
+ ;; and consequent parsing are undertaken in a temporary copy.
+ (org-export-with-buffer-copy
+ (font-lock-mode -1)
+ ;; Run first hook with current back-end's name as argument.
+ (run-hook-with-args 'org-export-before-processing-hook
+ (org-export-backend-name backend))
+ (org-export-expand-include-keyword)
+ (org-export--delete-comment-trees)
+ (org-macro-initialize-templates org-export-global-macros)
+ (org-macro-replace-all org-macro-templates parsed-keywords)
+ ;; Refresh buffer properties and radio targets after previous
+ ;; potentially invasive changes.
+ (org-set-regexps-and-options)
+ (org-update-radio-target-regexp)
+ (setq modified-tick (buffer-chars-modified-tick))
+ ;; Possibly execute Babel code. Re-run a macro expansion
+ ;; specifically for {{{results}}} since inline source blocks
+ ;; may have generated some more. Refresh buffer properties
+ ;; and radio targets another time.
+ (when org-export-use-babel
+ (org-babel-exp-process-buffer)
+ (org-macro-replace-all '(("results" . "$1")) parsed-keywords)
+ (unless (eq modified-tick (buffer-chars-modified-tick))
+ (org-set-regexps-and-options)
+ (org-update-radio-target-regexp))
+ (setq modified-tick (buffer-chars-modified-tick)))
+ ;; Run last hook with current back-end's name as argument.
+ ;; Update buffer properties and radio targets one last time
+ ;; before parsing.
+ (goto-char (point-min))
+ (save-excursion
+ (run-hook-with-args 'org-export-before-parsing-hook
+ (org-export-backend-name backend)))
(unless (eq modified-tick (buffer-chars-modified-tick))
(org-set-regexps-and-options)
(org-update-radio-target-regexp))
- (setq modified-tick (buffer-chars-modified-tick)))
- ;; Run last hook with current back-end's name as argument.
- ;; Update buffer properties and radio targets one last time
- ;; before parsing.
- (goto-char (point-min))
- (save-excursion
- (run-hook-with-args 'org-export-before-parsing-hook
- (org-export-backend-name backend)))
- (unless (eq modified-tick (buffer-chars-modified-tick))
- (org-set-regexps-and-options)
- (org-update-radio-target-regexp))
- (setq modified-tick (buffer-chars-modified-tick))
- ;; Update communication channel with environment.
- (setq info
- (org-combine-plists
- info (org-export-get-environment backend subtreep ext-plist)))
- ;; Pre-process citations environment, i.e. install
- ;; bibliography list, and citation processor in INFO.
- (org-cite-store-bibliography info)
- (org-cite-store-export-processor info)
- ;; De-activate uninterpreted data from parsed keywords.
- (dolist (entry (append (org-export-get-all-options backend)
- org-export-options-alist))
- (pcase entry
- (`(,p ,_ ,_ ,_ parse)
- (let ((value (plist-get info p)))
- (plist-put info
- p
- (org-export--remove-uninterpreted-data value info))))
- (_ nil)))
- ;; Install user's and developer's filters.
- (setq info (org-export-install-filters info))
- ;; Call options filters and update export options. We do not
- ;; use `org-export-filter-apply-functions' here since the
- ;; arity of such filters is different.
- (let ((backend-name (org-export-backend-name backend)))
- (dolist (filter (plist-get info :filter-options))
- (let ((result (funcall filter info backend-name)))
- (when result (setq info result)))))
- ;; Parse buffer.
- (setq tree (org-element-parse-buffer nil visible-only))
- ;; Prune tree from non-exported elements and transform
- ;; uninterpreted elements or objects in both parse tree and
- ;; communication channel.
- (org-export--prune-tree tree info)
- (org-export--remove-uninterpreted-data tree info)
- ;; Call parse tree filters.
- (setq tree
- (org-export-filter-apply-functions
- (plist-get info :filter-parse-tree) tree info))
- ;; Now tree is complete, compute its properties and add them
- ;; to communication channel.
- (setq info (org-export--collect-tree-properties tree info))
- ;; Process citations and bibliography. Replace each citation
- ;; and "print_bibliography" keyword in the parse tree with
- ;; the output of the selected citation export processor.
- (org-cite-process-citations info)
- (org-cite-process-bibliography info)
- ;; Eventually transcode TREE. Wrap the resulting string into
- ;; a template.
- (let* ((body (org-element-normalize-string
- (or (org-export-data tree info) "")))
- (inner-template (cdr (assq 'inner-template
- (plist-get info :translate-alist))))
- (full-body (org-export-filter-apply-functions
- (plist-get info :filter-body)
- (if (not (functionp inner-template)) body
- (funcall inner-template body info))
- info))
- (template (cdr (assq 'template
- (plist-get info :translate-alist))))
- (output
- (if (or (not (functionp template)) body-only) full-body
- (funcall template full-body info))))
- ;; Call citation export finalizer.
- (setq output (org-cite-finalize-export output info))
- ;; Remove all text properties since they cannot be
- ;; retrieved from an external process. Finally call
- ;; final-output filter and return result.
- (org-no-properties
- (org-export-filter-apply-functions
- (plist-get info :filter-final-output)
- output info))))))))
+ (setq modified-tick (buffer-chars-modified-tick))
+ ;; Update communication channel with environment.
+ (setq info
+ (org-combine-plists
+ info (org-export-get-environment backend subtreep ext-plist)))
+ ;; Pre-process citations environment, i.e. install
+ ;; bibliography list, and citation processor in INFO.
+ (org-cite-store-bibliography info)
+ (org-cite-store-export-processor info)
+ ;; De-activate uninterpreted data from parsed keywords.
+ (dolist (entry (append (org-export-get-all-options backend)
+ org-export-options-alist))
+ (pcase entry
+ (`(,p ,_ ,_ ,_ parse)
+ (let ((value (plist-get info p)))
+ (plist-put info
+ p
+ (org-export--remove-uninterpreted-data value info))))
+ (_ nil)))
+ ;; Install user's and developer's filters.
+ (setq info (org-export-install-filters info))
+ ;; Call options filters and update export options. We do not
+ ;; use `org-export-filter-apply-functions' here since the
+ ;; arity of such filters is different.
+ (let ((backend-name (org-export-backend-name backend)))
+ (dolist (filter (plist-get info :filter-options))
+ (let ((result (funcall filter info backend-name)))
+ (when result (setq info result)))))
+ ;; Parse buffer.
+ (setq tree (org-element-parse-buffer nil visible-only))
+ ;; Prune tree from non-exported elements and transform
+ ;; uninterpreted elements or objects in both parse tree and
+ ;; communication channel.
+ (org-export--prune-tree tree info)
+ (org-export--remove-uninterpreted-data tree info)
+ ;; Call parse tree filters.
+ (setq tree
+ (org-export-filter-apply-functions
+ (plist-get info :filter-parse-tree) tree info))
+ ;; Now tree is complete, compute its properties and add them
+ ;; to communication channel.
+ (setq info (org-export--collect-tree-properties tree info))
+ ;; Process citations and bibliography. Replace each citation
+ ;; and "print_bibliography" keyword in the parse tree with
+ ;; the output of the selected citation export processor.
+ (org-cite-process-citations info)
+ (org-cite-process-bibliography info)
+ ;; Eventually transcode TREE. Wrap the resulting string into
+ ;; a template.
+ (let* ((body (org-element-normalize-string
+ (or (org-export-data tree info) "")))
+ (inner-template (cdr (assq 'inner-template
+ (plist-get info :translate-alist))))
+ (full-body (org-export-filter-apply-functions
+ (plist-get info :filter-body)
+ (if (not (functionp inner-template)) body
+ (funcall inner-template body info))
+ info))
+ (template (cdr (assq 'template
+ (plist-get info :translate-alist))))
+ (output
+ (if (or (not (functionp template)) body-only) full-body
+ (funcall template full-body info))))
+ ;; Call citation export finalizer.
+ (setq output (org-cite-finalize-export output info))
+ ;; Remove all text properties since they cannot be
+ ;; retrieved from an external process. Finally call
+ ;; final-output filter and return result.
+ (org-no-properties
+ (org-export-filter-apply-functions
+ (plist-get info :filter-final-output)
+ output info)))))))))
;;;###autoload
(defun org-export-string-as (string backend &optional body-only ext-plist)
@@ -3226,7 +3310,7 @@ storing and resolving footnotes. It is created automatically."
(beginning-of-line)
;; Extract arguments from keyword's value.
(let* ((value (org-element-property :value element))
- (ind (current-indentation))
+ (ind (org-current-text-indentation))
location
(coding-system-for-read
(or (and (string-match ":coding +\\(\\S-+\\)>" value)
@@ -3238,15 +3322,18 @@ storing and resolving footnotes. It is created automatically."
value)
(prog1
(save-match-data
- (let ((matched (match-string 1 value)))
+ (let ((matched (match-string 1 value))
+ stripped)
(when (string-match "\\(::\\(.*?\\)\\)\"?\\'"
matched)
(setq location (match-string 2 matched))
(setq matched
(replace-match "" nil nil matched 1)))
- (expand-file-name (org-strip-quotes matched)
- dir)))
- (setq value (replace-match "" nil nil value)))))
+ (setq stripped (org-strip-quotes matched))
+ (if (org-url-p stripped)
+ stripped
+ (expand-file-name stripped dir))))
+ (setq value (replace-match "" nil nil value)))))
(only-contents
(and (string-match ":only-contents *\\([^: \r\t\n]\\S-*\\)?"
value)
@@ -3282,7 +3369,7 @@ storing and resolving footnotes. It is created automatically."
(delete-region (point) (line-beginning-position 2))
(cond
((not file) nil)
- ((not (file-readable-p file))
+ ((and (not (org-url-p file)) (not (file-readable-p file)))
(error "Cannot include file %s" file))
;; Check if files has already been parsed. Look after
;; inclusion lines too, as different parts of the same
@@ -3328,8 +3415,9 @@ storing and resolving footnotes. It is created automatically."
includer-file)))
(org-export-expand-include-keyword
(cons (list file lines) included)
- (file-name-directory file)
- footnotes)
+ (unless (org-url-p file)
+ (file-name-directory file))
+ footnotes)
(buffer-string)))))
;; Expand footnotes after all files have been
;; included. Footnotes are stored at end of buffer.
@@ -3352,7 +3440,7 @@ Org-Element. If LINES is non-nil only those lines are included.
Return a string of lines to be included in the format expected by
`org-export--prepare-file-contents'."
(with-temp-buffer
- (insert-file-contents file)
+ (insert (org-file-contents file))
(unless (eq major-mode 'org-mode)
(let ((org-inhibit-startup t)) (org-mode)))
(condition-case err
@@ -3457,7 +3545,7 @@ the included document.
Optional argument INCLUDER is the file name where the inclusion
is to happen."
(with-temp-buffer
- (insert-file-contents file)
+ (insert (org-file-contents file))
(when lines
(let* ((lines (split-string lines "-"))
(lbeg (string-to-number (car lines)))
@@ -4109,7 +4197,7 @@ meant to be translated with `org-export-data' or alike."
((and fmt
(not (cdr date))
(eq (org-element-type (car date)) 'timestamp))
- (org-timestamp-format (car date) fmt))
+ (org-format-timestamp (car date) fmt))
(t date))))
@@ -4146,7 +4234,7 @@ meant to be translated with `org-export-data' or alike."
;; `org-export-data' for further processing, depending on
;; `org-export-with-broken-links' value.
-(org-define-error 'org-link-broken "Unable to resolve link; aborting")
+(define-error 'org-link-broken "Unable to resolve link; aborting")
(defun org-export-custom-protocol-maybe (link desc backend &optional info)
"Try exporting LINK object with a dedicated function.
@@ -4294,7 +4382,7 @@ A search cell follows the pattern (TYPE . SEARCH) where
- target's or radio-target's name as a list of strings if
TYPE is `target'.
- - NAME affiliated keyword if TYPE is `other'.
+ - NAME or RESULTS affiliated keyword if TYPE is `other'.
A search cell is the internal representation of a fuzzy link. It
ignores white spaces and statistics cookies, if applicable."
@@ -4312,7 +4400,8 @@ ignores white spaces and statistics cookies, if applicable."
(and custom-id (cons 'custom-id custom-id)))))))
(`target
(list (cons 'target (split-string (org-element-property :value datum)))))
- ((and (let name (org-element-property :name datum))
+ ((and (let name (or (org-element-property :name datum)
+ (car (org-element-property :results datum))))
(guard name))
(list (cons 'other (split-string name))))
(_ nil)))
@@ -4344,8 +4433,9 @@ Return value can be an object or an element:
- If LINK path matches a target object (i.e. <<path>>) return it.
-- If LINK path exactly matches the name affiliated keyword
- (i.e. #+NAME: path) of an element, return that element.
+- If LINK path exactly matches the name or results affiliated keyword
+ (i.e. #+NAME: path or #+RESULTS: name) of an element, return that
+ element.
- If LINK path exactly matches any headline name, return that
element.
@@ -4437,11 +4527,11 @@ INFO is a plist used as a communication channel.
Return value can be a radio-target object or nil. Assume LINK
has type \"radio\"."
- (let ((path (string-clean-whitespace (org-element-property :path link))))
+ (let ((path (org-string-clean-whitespace (org-element-property :path link))))
(org-element-map (plist-get info :parse-tree) 'radio-target
(lambda (radio)
- (and (string-equal-ignore-case
- (string-clean-whitespace (org-element-property :value radio))
+ (and (org-string-equal-ignore-case
+ (org-string-clean-whitespace (org-element-property :value radio))
path)
radio))
info 'first-match)))
@@ -4481,6 +4571,50 @@ Return value can be an object or an element:
(concat (if (string-prefix-p "/" fullname) "file://" "file:///")
fullname)))))
+(defun org-export-link-remote-p (link)
+ "Returns non-nil if the link refers to a remote resource."
+ (or (member (org-element-property :type link) '("http" "https" "ftp"))
+ (and (string= (org-element-property :type link) "file")
+ (file-remote-p (org-element-property :path link)))))
+
+(defun org-export-link--remote-local-copy (link)
+ "Download the remote resource specified by LINK, and return its local path."
+ ;; TODO work this into ol.el as a link parameter, say :download.
+ (let* ((location-type
+ (pcase (org-element-property :type link)
+ ((or "http" "https" "ftp") 'url)
+ ((and "file" (guard (file-remote-p
+ (org-element-property :path link))))
+ 'file)
+ (_ (error "Cannot copy %s:%s to a local file"
+ (org-element-property :type link)
+ (org-element-property :path link)))))
+ (path
+ (pcase location-type
+ ('url
+ (concat (org-element-property :type link)
+ ":" (org-element-property :path link)))
+ ('file
+ (org-element-property :path link)))))
+ (or (org-persist-read location-type path)
+ (org-persist-register location-type path
+ :write-immediately t))))
+
+(require 'subr-x) ;; FIXME: For `thread-first' in Emacs 26.
+(defun org-export-link-localise (link)
+ "Convert remote LINK to local link.
+If LINK refers to a remote resource, modify it to point to a local
+downloaded copy. Otherwise, return unchanged LINK."
+ (when (org-export-link-remote-p link)
+ (let* ((local-path (org-export-link--remote-local-copy link)))
+ (setcdr link
+ (thread-first (cadr link)
+ (plist-put :type "file")
+ (plist-put :path local-path)
+ (plist-put :raw-link (concat "file:" local-path))
+ list))))
+ link)
+
;;;; For References
;;
;; `org-export-get-reference' associate a unique reference for any
@@ -4616,10 +4750,22 @@ objects of the same type."
(org-element-map (plist-get info :parse-tree)
(or types (org-element-type element))
(lambda (el)
- (cond
- ((eq element el) (1+ counter))
- ((not predicate) (cl-incf counter) nil)
- ((funcall predicate el info) (cl-incf counter) nil)))
+ (let ((cached (org-element-property :org-export--counter el)))
+ (cond
+ ((eq element el) (1+ counter))
+ ;; Use cached result.
+ ((and cached (equal predicate (car cached)))
+ (cdr cached))
+ ((not predicate)
+ (cl-incf counter)
+ (org-element-put-property
+ el :org-export--counter (cons predicate counter))
+ nil)
+ ((funcall predicate el info)
+ (cl-incf counter)
+ (org-element-put-property
+ el :org-export--counter (cons predicate counter))
+ nil))))
info 'first-match)))))
;;;; For Raw objects
@@ -5505,6 +5651,18 @@ transcoding it."
(secondary-opening :utf-8 "“" :html "&ldquo;" :latex "``" :texinfo "``")
(secondary-closing :utf-8 "”" :html "&rdquo;" :latex "''" :texinfo "''")
(apostrophe :utf-8 "’" :html "&rsquo;"))
+ ("fa"
+ (primary-opening
+ :utf-8 "«" :html "&laquo;" :latex "\\guillemotleft{}"
+ :texinfo "@guillemetleft{}")
+ (primary-closing
+ :utf-8 "»" :html "&raquo;" :latex "\\guillemotright{}"
+ :texinfo "@guillemetright{}")
+ (secondary-opening :utf-8 "‹" :html "&lsaquo;" :latex "\\guilsinglleft{}"
+ :texinfo "@guilsinglleft{}")
+ (secondary-closing :utf-8 "›" :html "&rsaquo;" :latex "\\guilsinglright{}"
+ :texinfo "@guilsinglright{}")
+ (apostrophe :utf-8 "’" :html "&rsquo;"))
("fr"
(primary-opening
:utf-8 "« " :html "&laquo;&nbsp;" :latex "\\og "
@@ -5826,6 +5984,7 @@ them."
("eo" :html "A&#365;toro")
("es" :default "Autor")
("et" :default "Autor")
+ ("fa" :default "نویسنده")
("fi" :html "Tekij&auml;")
("fr" :default "Auteur")
("hu" :default "Szerz&otilde;")
@@ -5851,6 +6010,7 @@ them."
("cs" :default "Pokračování z předchozí strany")
("de" :default "Fortsetzung von vorheriger Seite")
("es" :html "Contin&uacute;a de la p&aacute;gina anterior" :ascii "Continua de la pagina anterior" :default "Continúa de la página anterior")
+ ("fa" :default "ادامه از صفحهٔ قبل")
("fr" :default "Suite de la page précédente")
("it" :default "Continua da pagina precedente")
("ja" :default "前ページからの続き")
@@ -5868,6 +6028,7 @@ them."
("cs" :default "Pokračuje na další stránce")
("de" :default "Fortsetzung nächste Seite")
("es" :html "Contin&uacute;a en la siguiente p&aacute;gina" :ascii "Continua en la siguiente pagina" :default "Continúa en la siguiente página")
+ ("fa" :default "ادامه در صفحهٔ بعد")
("fr" :default "Suite page suivante")
("it" :default "Continua alla pagina successiva")
("ja" :default "次ページに続く")
@@ -5882,6 +6043,7 @@ them."
("tr" :default "Devamı sonraki sayfada"))
("Created"
("cs" :default "Vytvořeno")
+ ("fa" :default "ساخته شده")
("nl" :default "Gemaakt op") ;; must be followed by a date or date+time
("pt_BR" :default "Criado em")
("ro" :default "Creat")
@@ -5896,6 +6058,7 @@ them."
("eo" :default "Dato")
("es" :default "Fecha")
("et" :html "Kuup&#228;ev" :utf-8 "Kuupäev")
+ ("fa" :default "تاریخ")
("fi" :html "P&auml;iv&auml;m&auml;&auml;r&auml;")
("hu" :html "D&aacute;tum")
("is" :default "Dagsetning")
@@ -5922,6 +6085,7 @@ them."
("de" :default "Gleichung")
("es" :ascii "Ecuacion" :html "Ecuaci&oacute;n" :default "Ecuación")
("et" :html "V&#245;rrand" :utf-8 "Võrrand")
+ ("fa" :default "معادله")
("fr" :ascii "Equation" :default "Équation")
("is" :default "Jafna")
("ja" :default "方程式")
@@ -5944,6 +6108,7 @@ them."
("de" :default "Abbildung")
("es" :default "Figura")
("et" :default "Joonis")
+ ("fa" :default "شکل")
("is" :default "Mynd")
("it" :default "Figura")
("ja" :default "図" :html "&#22259;")
@@ -5964,6 +6129,7 @@ them."
("de" :default "Abbildung %d:")
("es" :default "Figura %d:")
("et" :default "Joonis %d:")
+ ("fa" :default "شکل %d:")
("fr" :default "Figure %d :" :html "Figure&nbsp;%d&nbsp;:")
("is" :default "Mynd %d")
("it" :default "Figura %d:")
@@ -5988,6 +6154,7 @@ them."
("eo" :default "Piednotoj")
("es" :ascii "Notas al pie de pagina" :html "Notas al pie de p&aacute;gina" :default "Notas al pie de página")
("et" :html "Allm&#228;rkused" :utf-8 "Allmärkused")
+ ("fa" :default "پانوشت‌ها")
("fi" :default "Alaviitteet")
("fr" :default "Notes de bas de page")
("hu" :html "L&aacute;bjegyzet")
@@ -6016,6 +6183,7 @@ them."
("de" :default "Programmauflistungsverzeichnis")
("es" :ascii "Indice de Listados de programas" :html "&Iacute;ndice de Listados de programas" :default "Índice de Listados de programas")
("et" :default "Loendite nimekiri")
+ ("fa" :default "فهرست برنامه‌ریزی‌ها")
("fr" :default "Liste des programmes")
("ja" :default "ソースコード目次")
("nl" :default "Lijst van programma's")
@@ -6034,6 +6202,7 @@ them."
("de" :default "Tabellenverzeichnis")
("es" :ascii "Indice de tablas" :html "&Iacute;ndice de tablas" :default "Índice de tablas")
("et" :default "Tabelite nimekiri")
+ ("fa" :default "فهرست جدول‌ها")
("fr" :default "Liste des tableaux")
("is" :default "Töfluskrá" :html "T&ouml;fluskr&aacute;")
("it" :default "Indice delle tabelle")
@@ -6057,6 +6226,7 @@ them."
("de" :default "Programmlisting")
("es" :default "Listado de programa")
("et" :default "Loend")
+ ("fa" :default "برنامه‌ریزی")
("fr" :default "Programme" :html "Programme")
("it" :default "Listato")
("ja" :default "ソースコード")
@@ -6077,6 +6247,7 @@ them."
("de" :default "Programmlisting %d")
("es" :default "Listado de programa %d")
("et" :default "Loend %d")
+ ("fa" :default "برنامه‌ریزی %d:")
("fr" :default "Programme %d :" :html "Programme&nbsp;%d&nbsp;:")
("it" :default "Listato %d :")
("ja" :default "ソースコード%d:")
@@ -6095,6 +6266,7 @@ them."
("cs" :default "Reference")
("de" :default "Quellen")
("es" :default "Referencias")
+ ("fa" :default "منابع")
("fr" :ascii "References" :default "Références")
("it" :default "Riferimenti")
("nl" :default "Bronverwijzingen")
@@ -6104,6 +6276,7 @@ them."
("tr" :default "Referanslar"))
("See figure %s"
("cs" :default "Viz obrázek %s")
+ ("fa" :default "نمایش شکل %s")
("fr" :default "cf. figure %s"
:html "cf.&nbsp;figure&nbsp;%s" :latex "cf.~figure~%s")
("it" :default "Vedi figura %s")
@@ -6115,6 +6288,7 @@ them."
("tr" :default "bkz. şekil %s"))
("See listing %s"
("cs" :default "Viz program %s")
+ ("fa" :default "نمایش برنامه‌ریزی %s")
("fr" :default "cf. programme %s"
:html "cf.&nbsp;programme&nbsp;%s" :latex "cf.~programme~%s")
("nl" :default "Zie programma %s"
@@ -6130,6 +6304,7 @@ them."
("de" :default "siehe Abschnitt %s")
("es" :ascii "Vea seccion %s" :html "Vea secci&oacute;n %s" :default "Vea sección %s")
("et" :html "Vaata peat&#252;kki %s" :utf-8 "Vaata peatükki %s")
+ ("fa" :default "نمایش بخش %s")
("fr" :default "cf. section %s")
("it" :default "Vedi sezione %s")
("ja" :default "セクション %s を参照")
@@ -6145,6 +6320,7 @@ them."
("zh-CN" :html "&#21442;&#35265;&#31532;%s&#33410;" :utf-8 "参见第%s节"))
("See table %s"
("cs" :default "Viz tabulka %s")
+ ("fa" :default "نمایش جدول %s")
("fr" :default "cf. tableau %s"
:html "cf.&nbsp;tableau&nbsp;%s" :latex "cf.~tableau~%s")
("it" :default "Vedi tabella %s")
@@ -6160,6 +6336,7 @@ them."
("de" :default "Tabelle")
("es" :default "Tabla")
("et" :default "Tabel")
+ ("fa" :default "جدول")
("fr" :default "Tableau")
("is" :default "Tafla")
("it" :default "Tabella")
@@ -6178,6 +6355,7 @@ them."
("de" :default "Tabelle %d")
("es" :default "Tabla %d")
("et" :default "Tabel %d")
+ ("fa" :default "جدول %d")
("fr" :default "Tableau %d :")
("is" :default "Tafla %d")
("it" :default "Tabella %d:")
@@ -6203,6 +6381,7 @@ them."
("eo" :default "Enhavo")
("es" :ascii "Indice" :html "&Iacute;ndice" :default "Índice")
("et" :default "Sisukord")
+ ("fa" :default "فهرست")
("fi" :html "Sis&auml;llysluettelo")
("fr" :ascii "Sommaire" :default "Table des matières")
("hu" :html "Tartalomjegyz&eacute;k")
@@ -6230,6 +6409,7 @@ them."
("de" :default "Unbekannter Verweis")
("es" :default "Referencia desconocida")
("et" :default "Tundmatu viide")
+ ("fa" :default "منبع ناشناس")
("fr" :ascii "Destination inconnue" :default "Référence inconnue")
("it" :default "Riferimento sconosciuto")
("ja" :default "不明な参照先")
@@ -6489,8 +6669,7 @@ or FILE."
(declare (indent 2))
(if (not (file-writable-p file)) (error "Output file not writable")
(let ((ext-plist (org-combine-plists `(:output-file ,file) ext-plist))
- (encoding (or org-export-coding-system buffer-file-coding-system))
- auto-mode-alist)
+ (encoding (or org-export-coding-system buffer-file-coding-system)))
(if async
(org-export-async-start
(lambda (file)
@@ -6502,14 +6681,14 @@ or FILE."
(with-temp-buffer
(insert output)
(let ((coding-system-for-write ',encoding))
- (write-file ,file)))
+ (write-region (point-min) (point-max) ,file)))
(or (ignore-errors (funcall ',post-process ,file)) ,file)))
(let ((output (org-export-as
backend subtreep visible-only body-only ext-plist)))
(with-temp-buffer
(insert output)
(let ((coding-system-for-write encoding))
- (write-file file)))
+ (write-region (point-min) (point-max) file)))
(when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output))
(org-kill-new output))
;; Get proper return value.
@@ -6965,8 +7144,20 @@ back to standard interface."
(delete-other-windows)
(org-switch-to-buffer-other-window
(get-buffer-create "*Org Export Dispatcher*"))
- (setq cursor-type nil
- header-line-format "Use SPC, DEL, C-n or C-p to navigate.")
+ (setq cursor-type nil)
+ (setq header-line-format
+ (let ((propertize-help-key
+ (lambda (key)
+ ;; Add `face' *and* `font-lock-face' to "work
+ ;; reliably in any buffer", per a comment in
+ ;; `help--key-description-fontified'.
+ (propertize key
+ 'font-lock-face 'help-key-binding
+ 'face 'help-key-binding))))
+ (apply 'format
+ (cons "Use %s, %s, %s, or %s to navigate."
+ (mapcar propertize-help-key
+ (list "SPC" "DEL" "C-n" "C-p"))))))
;; Make sure that invisible cursor will not highlight square
;; brackets.
(set-syntax-table (copy-syntax-table))
diff --git a/lisp/outline.el b/lisp/outline.el
index 86ac19aa415..2c3f9798ec4 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -318,6 +318,12 @@ don't modify the buffer."
(defvar-local outline--use-rtl nil
"Non-nil when direction of clickable buttons is right-to-left.")
+(defvar-local outline--margin-width nil
+ "Current margin width.")
+
+(defvar-local outline-margin-width nil
+ "Default margin width.")
+
(define-icon outline-open nil
'((image "outline-open.svg" "outline-open.pbm" :height (0.8 . em))
(emoji "🔽")
@@ -344,24 +350,24 @@ don't modify the buffer."
"Right-to-left icon used for buttons in closed outline sections."
:version "29.1")
-(define-icon outline-open-in-margins outline-open
- '((image "outline-open.svg" "outline-open.pbm" :height 10)
+(define-icon outline-open-in-margins nil
+ '((image "outline-open.svg" "outline-open.pbm" :width font)
(emoji "🔽")
(symbol "▼")
(text "v"))
"Icon used for buttons for opened sections in margins."
:version "29.1")
-(define-icon outline-close-in-margins outline-close
- '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation -90)
+(define-icon outline-close-in-margins nil
+ '((image "outline-open.svg" "outline-open.pbm" :width font :rotation -90)
(emoji "▶️")
(symbol "▶")
(text ">"))
"Icon used for buttons for closed sections in margins."
:version "29.1")
-(define-icon outline-close-rtl-in-margins outline-close-rtl
- '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation 90)
+(define-icon outline-close-rtl-in-margins nil
+ '((image "outline-open.svg" "outline-open.pbm" :width font :rotation 90)
(emoji "◀️")
(symbol "◀")
(text "<"))
@@ -528,9 +534,22 @@ See the command `outline-mode' for more information on this mode."
(when (and (eq outline-minor-mode-use-buttons 'in-margins)
(> 1 (if outline--use-rtl right-margin-width
left-margin-width)))
+ (setq outline--margin-width
+ (or outline-margin-width
+ (ceiling
+ (/ (seq-max
+ (seq-map #'string-pixel-width
+ (seq-map #'icon-string
+ `(outline-open-in-margins
+ ,(if outline--use-rtl
+ 'outline-close-rtl-in-margins
+ 'outline-close-in-margins)))))
+ (* (default-font-width) 1.0)))))
(if outline--use-rtl
- (setq-local right-margin-width (1+ right-margin-width))
- (setq-local left-margin-width (1+ left-margin-width)))
+ (setq-local right-margin-width (+ right-margin-width
+ outline--margin-width))
+ (setq-local left-margin-width (+ left-margin-width
+ outline--margin-width)))
(setq-local fringes-outside-margins t)
;; Force display of margins
(when (eq (current-buffer) (window-buffer))
@@ -566,8 +585,10 @@ See the command `outline-mode' for more information on this mode."
(< 0 (if outline--use-rtl right-margin-width
left-margin-width)))
(if outline--use-rtl
- (setq-local right-margin-width (1- right-margin-width))
- (setq-local left-margin-width (1- left-margin-width)))
+ (setq-local right-margin-width (- right-margin-width
+ outline--margin-width))
+ (setq-local left-margin-width (- left-margin-width
+ outline--margin-width)))
(setq-local fringes-outside-margins nil)
;; Force removal of margins
(when (eq (current-buffer) (window-buffer))
diff --git a/lisp/paren.el b/lisp/paren.el
index 1d7fb1c4625..eeda95809a5 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -120,7 +120,7 @@ On non-graphical frames, the context is shown in the echo area."
(defcustom show-paren-predicate '(not (derived-mode . special-mode))
"Whether to use `show-paren-mode' in a buffer.
-The default is to enable the mode in all buffers that have don't
+The default is to enable the mode in all buffers that don't
derive from `special-mode', which means that it's on (by default)
in all editing buffers."
:type 'buffer-predicate
diff --git a/lisp/play/zone.el b/lisp/play/zone.el
index a470f23dfe4..6e27ba51653 100644
--- a/lisp/play/zone.el
+++ b/lisp/play/zone.el
@@ -320,7 +320,7 @@ run a specific program. The program must be a member of
(zone-pgm-jitter))
-;;;; putzing w/ case
+;;;; putzing with case
;; Faster than `zone-pgm-putz-with-case', but not as good: all
;; instances of the same letter have the same case, which produces a
diff --git a/lisp/proced.el b/lisp/proced.el
index ac44ae1513d..c7419288edf 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -114,41 +114,58 @@ the external command (usually \"kill\")."
(defcustom proced-grammar-alist
'( ;; attributes defined in `process-attributes'
(euid "EUID" "%d" right proced-< nil (euid pid) (nil t nil))
- (user "User" nil left proced-string-lessp nil (user pid) (nil t nil))
+ (user "User" proced-format-user left proced-string-lessp nil
+ (user pid) (nil t nil))
(egid "EGID" "%d" right proced-< nil (egid euid pid) (nil t nil))
- (group "Group" nil left proced-string-lessp nil (group user pid) (nil t nil))
+ (group "Group" nil left proced-string-lessp nil (group user pid)
+ (nil t nil))
(comm "Command" nil left proced-string-lessp nil (comm pid) (nil t nil))
- (state "Stat" nil left proced-string-lessp nil (state pid) (nil t nil))
- (ppid "PPID" "%d" right proced-< nil (ppid pid)
- ((lambda (ppid) (proced-filter-parents proced-process-alist ppid))
- "refine to process parents"))
- (pgrp "PGrp" "%d" right proced-< nil (pgrp euid pid) (nil t nil))
- (sess "Sess" "%d" right proced-< nil (sess pid) (nil t nil))
- (ttname "TTY" proced-format-ttname left proced-string-lessp nil (ttname pid) (nil t nil))
+ (state "Stat" proced-format-state left proced-string-lessp nil
+ (state pid) (nil t nil))
+ (ppid "PPID" proced-format-ppid right proced-< nil (ppid pid)
+ ((lambda (ppid)
+ (proced-filter-parents proced-process-alist ppid))
+ "refine to process parents"))
+ (pgrp "PGrp" proced-format-pgrp right proced-< nil (pgrp euid pid)
+ (nil t nil))
+ (sess "Sess" proced-format-sess right proced-< nil (sess pid)
+ (nil t nil))
+ (ttname "TTY" proced-format-ttname left proced-string-lessp nil
+ (ttname pid) (nil t nil))
(tpgid "TPGID" "%d" right proced-< nil (tpgid pid) (nil t nil))
(minflt "MinFlt" "%d" right proced-< nil (minflt pid) (nil t t))
(majflt "MajFlt" "%d" right proced-< nil (majflt pid) (nil t t))
(cminflt "CMinFlt" "%d" right proced-< nil (cminflt pid) (nil t t))
(cmajflt "CMajFlt" "%d" right proced-< nil (cmajflt pid) (nil t t))
- (utime "UTime" proced-format-time right proced-time-lessp t (utime pid) (nil t t))
- (stime "STime" proced-format-time right proced-time-lessp t (stime pid) (nil t t))
- (time "Time" proced-format-time right proced-time-lessp t (time pid) (nil t t))
- (cutime "CUTime" proced-format-time right proced-time-lessp t (cutime pid) (nil t t))
- (cstime "CSTime" proced-format-time right proced-time-lessp t (cstime pid) (nil t t))
- (ctime "CTime" proced-format-time right proced-time-lessp t (ctime pid) (nil t t))
+ (utime "UTime" proced-format-time right proced-time-lessp t (utime pid)
+ (nil t t))
+ (stime "STime" proced-format-time right proced-time-lessp t (stime pid)
+ (nil t t))
+ (time "Time" proced-format-time right proced-time-lessp t (time pid)
+ (nil t t))
+ (cutime "CUTime" proced-format-time right proced-time-lessp t (cutime pid)
+ (nil t t))
+ (cstime "CSTime" proced-format-time right proced-time-lessp t (cstime pid)
+ (nil t t))
+ (ctime "CTime" proced-format-time right proced-time-lessp t (ctime pid)
+ (nil t t))
(pri "Pr" "%d" right proced-< t (pri pid) (nil t t))
(nice "Ni" "%3d" 3 proced-< t (nice pid) (t t nil))
(thcount "THCount" "%d" right proced-< t (thcount pid) (nil t t))
- (start "Start" proced-format-start 6 proced-time-lessp nil (start pid) (t t nil))
- (vsize "VSize" proced-format-memory right proced-< t (vsize pid) (nil t t))
- (rss "RSS" proced-format-memory right proced-< t (rss pid) (nil t t))
- (etime "ETime" proced-format-time right proced-time-lessp t (etime pid) (nil t t))
- (pcpu "%CPU" "%.1f" right proced-< t (pcpu pid) (nil t t))
- (pmem "%Mem" "%.1f" right proced-< t (pmem pid) (nil t t))
- (args "Args" proced-format-args left proced-string-lessp nil (args pid) (nil t nil))
+ (start "Start" proced-format-start 6 proced-time-lessp nil (start pid)
+ (t t nil))
+ (vsize "VSize" proced-format-memory right proced-< t (vsize pid)
+ (nil t t))
+ (rss "RSS" proced-format-rss right proced-< t (rss pid) (nil t t))
+ (etime "ETime" proced-format-time right proced-time-lessp t (etime pid)
+ (nil t t))
+ (pcpu "%CPU" proced-format-cpu right proced-< t (pcpu pid) (nil t t))
+ (pmem "%Mem" proced-format-mem right proced-< t (pmem pid) (nil t t))
+ (args "Args" proced-format-args left proced-string-lessp nil
+ (args pid) (nil t nil))
;;
;; attributes defined by proced (see `proced-process-attributes')
- (pid "PID" "%d" right proced-< nil (pid)
+ (pid "PID" proced-format-pid right proced-< nil (pid)
((lambda (ppid) (proced-filter-children proced-process-alist ppid))
"refine to process children"))
;; process tree
@@ -367,6 +384,32 @@ May be used to revert the process listing."
:type 'hook
:options '(proced-revert))
+(defcustom proced-enable-color-flag nil
+ "Non-nil means Proced should display some process attributes with color."
+ :type 'boolean
+ :version "29.1")
+
+(defcustom proced-low-memory-usage-threshold 0.1
+ "The upper bound for low relative memory usage display in Proced.
+
+When `proced-enable-color-flag' is non-nil, RSS values denoting a
+proportion of memory, relative to total memory, that is lower
+than this value will be displayed using the `proced-memory-low-usage' face."
+ :type 'float
+ :version "29.1")
+
+(defcustom proced-medium-memory-usage-threshold 0.5
+ "The upper bound for medium relative memory usage display in Proced.
+
+When `proced-enable-color-flag' is non-nil, RSS values denoting a
+proportion of memory, relative to total memory, that is less than
+this value, but greater than `proced-low-memory-usage-threshold',
+will be displayed using the `proced-memory-medium-usage' face.
+RSS values denoting a greater proportion than this value will be
+displayed using the `proced-memory-high-usage' face."
+ :type 'float
+ :version "29.1")
+
;; Internal variables
(defvar proced-available t;(not (null (list-system-processes)))
@@ -403,6 +446,114 @@ It is a list of lists (KEY PREDICATE REVERSE).")
'((t (:inherit font-lock-keyword-face)))
"Face used for header of attribute used for sorting.")
+(defface proced-run-status-code
+ '((t (:foreground "green")))
+ "Face used in Proced buffers for running or runnable status code character \"R\"."
+ :version "29.1")
+
+(defface proced-interruptible-sleep-status-code
+ '((((class color) (min-colors 88)) (:foreground "DimGrey"))
+ (t (:italic t)))
+ "Face used in Proced buffers for interruptible sleep status code character \"S\"."
+ :version "29.1")
+
+(defface proced-uninterruptible-sleep-status-code
+ '((((class color)) (:foreground "red"))
+ (t (:bold t)))
+ "Face used in Proced buffers for uninterruptible sleep status code character \"D\"."
+ :version "29.1")
+
+(defface proced-executable
+ '((((class color) (min-colors 88) (background dark)) (:foreground "DeepSkyBlue"))
+ (((class color) (background dark)) (:foreground "cyan"))
+ (((class color) (background light)) (:foreground "blue"))
+ (t (:bold t)))
+ "Face used in Proced buffers for executable names.
+The first word in the process arguments attribute is assumed to
+be the executable that runs in the process."
+ :version "29.1")
+
+(defface proced-memory-high-usage
+ '((((class color) (min-colors 88) (background dark)) (:foreground "orange"))
+ (((class color) (min-colors 88) (background light)) (:foreground "OrangeRed"))
+ (((class color)) (:foreground "red"))
+ (t (:underline t)))
+ "Face used in Proced buffers for high memory usage."
+ :version "29.1")
+
+(defface proced-memory-medium-usage
+ '((((class color) (min-colors 88) (background dark)) (:foreground "yellow3"))
+ (((class color) (min-colors 88) (background light)) (:foreground "orange"))
+ (((class color)) (:foreground "yellow")))
+ "Face used in Proced buffers for medium memory usage."
+ :version "29.1")
+
+(defface proced-memory-low-usage
+ '((((class color) (min-colors 88) (background dark)) (:foreground "#8bcd50"))
+ (((class color)) (:foreground "green")))
+ "Face used in Proced buffers for low memory usage."
+ :version "29.1")
+
+(defface proced-emacs-pid
+ '((((class color) (min-colors 88)) (:foreground "purple"))
+ (((class color)) (:foreground "magenta")))
+ "Face used in Proced buffers for the process ID of the current Emacs process."
+ :version "29.1")
+
+(defface proced-pid
+ '((((class color) (min-colors 88)) (:foreground "#5085ef"))
+ (((class color)) (:foreground "blue")))
+ "Face used in Proced buffers for process IDs."
+ :version "29.1")
+
+(defface proced-session-leader-pid
+ '((((class color) (min-colors 88)) (:foreground "#5085ef" :underline t))
+ (((class color)) (:foreground "blue" :underline t))
+ (t (:underline t)))
+ "Face used in Proced buffers for process IDs which are session leaders."
+ :version "29.1")
+
+(defface proced-ppid
+ '((((class color) (min-colors 88)) (:foreground "#5085bf"))
+ (((class color)) (:foreground "blue")))
+ "Face used in Proced buffers for parent process IDs."
+ :version "29.1")
+
+(defface proced-pgrp
+ '((((class color) (min-colors 88)) (:foreground "#4785bf"))
+ (((class color)) (:foreground "blue")))
+ "Face used in Proced buffers for process group IDs."
+ :version "29.1")
+
+(defface proced-sess
+ '((((class color) (min-colors 88)) (:foreground "#41729f"))
+ (((class color)) (:foreground "MidnightBlue")))
+ "Face used in Proced buffers for process session IDs."
+ :version "29.1")
+
+(defface proced-cpu
+ '((((class color) (min-colors 88)) (:foreground "#6d5cc3" :bold t))
+ (t (:bold t)))
+ "Face used in Proced buffers for process CPU utilization."
+ :version "29.1")
+
+(defface proced-mem
+ '((((class color) (min-colors 88))
+ (:foreground "#6d5cc3")))
+ "Face used in Proced buffers for process memory utilization."
+ :version "29.1")
+
+(defface proced-user
+ '((t (:bold t)))
+ "Face used in Proced buffers for the user owning the process."
+ :version "29.1")
+
+(defface proced-time-colon
+ '((((class color) (min-colors 88)) (:foreground "DarkMagenta"))
+ (t (:bold t)))
+ "Face used in Proced buffers for the colon in time strings."
+ :version "29.1")
+
(defvar proced-re-mark "^[^ \n]"
"Regexp matching a marked line.
Important: the match ends just after the marker.")
@@ -1392,26 +1543,32 @@ Prefix ARG controls sort order, see `proced-sort-interactive'."
(hours (truncate ftime 3600))
(ftime (mod ftime 3600))
(minutes (truncate ftime 60))
- (seconds (mod ftime 60)))
+ (seconds (mod ftime 60))
+ (colon (if proced-enable-color-flag
+ (propertize ":" 'font-lock-face 'proced-time-colon)
+ ":")))
(cond ((< 0 days)
- (format "%d-%02d:%02d:%02d" days hours minutes seconds))
+ (format "%d-%02d%s%02d%s%02d" days hours colon minutes colon seconds))
((< 0 hours)
- (format "%02d:%02d:%02d" hours minutes seconds))
+ (format "%02d%s%02d%s%02d" hours colon minutes colon seconds))
(t
- (format "%02d:%02d" minutes seconds)))))
+ (format "%02d%s%02d" minutes colon seconds)))))
(defun proced-format-start (start)
"Format time START.
The return string is always 6 characters wide."
(let ((d-start (decode-time start))
- (d-current (decode-time)))
+ (d-current (decode-time))
+ (colon (if proced-enable-color-flag
+ (propertize ":" 'font-lock-face 'proced-time-colon)
+ ":")))
(cond (;; process started in previous years
(< (decoded-time-year d-start) (decoded-time-year d-current))
(format-time-string " %Y" start))
;; process started today
((and (= (decoded-time-day d-start) (decoded-time-day d-current))
(= (decoded-time-month d-start) (decoded-time-month d-current)))
- (format-time-string " %H:%M" start))
+ (string-replace ":" colon (format-time-string " %H:%M" start)))
(t ;; process started this year
(format-time-string "%b %e" start)))))
@@ -1429,12 +1586,97 @@ The return string is always 6 characters wide."
(defun proced-format-args (args)
"Format attribute ARGS.
Replace newline characters by \"^J\" (two characters)."
- (string-replace "\n" "^J" args))
+ (string-replace "\n" "^J"
+ (pcase-let* ((`(,exe . ,rest) (split-string args))
+ (exe-prop (if proced-enable-color-flag
+ (propertize exe 'font-lock-face 'proced-executable)
+ exe)))
+ (mapconcat #'identity (cons exe-prop rest) " "))))
(defun proced-format-memory (kilobytes)
"Format KILOBYTES in a human readable format."
(funcall byte-count-to-string-function (* 1024 kilobytes)))
+(defun proced-format-rss (kilobytes)
+ "Format RSS KILOBYTES in a human readable format."
+ (let ((formatted (proced-format-memory kilobytes)))
+ (if-let* ((proced-enable-color-flag)
+ (total (car (memory-info)))
+ (proportion (/ (float kilobytes) total)))
+ (cond ((< proportion proced-low-memory-usage-threshold)
+ (propertize formatted 'font-lock-face 'proced-memory-low-usage))
+ ((< proportion proced-medium-memory-usage-threshold)
+ (propertize formatted 'font-lock-face 'proced-memory-medium-usage))
+ (t (propertize formatted 'font-lock-face 'proced-memory-high-usage)))
+ formatted)))
+
+(defun proced-format-state (state)
+ "Format STATE."
+ (cond ((and proced-enable-color-flag (string= state "R"))
+ (propertize state 'font-lock-face 'proced-run-status-code))
+ ((and proced-enable-color-flag (string= state "S"))
+ (propertize state 'font-lock-face 'proced-interruptible-sleep-status-code))
+ ((and proced-enable-color-flag (string= state "D"))
+ (propertize state 'font-lock-face 'proced-uninterruptible-sleep-status-code))
+ (t state)))
+
+(defun proced-format-pid (pid)
+ "Format PID."
+ (let ((proc-info (process-attributes pid))
+ (pid-s (number-to-string pid)))
+ (cond ((and proced-enable-color-flag
+ (not (file-remote-p default-directory))
+ (equal pid (emacs-pid)))
+ (propertize pid-s 'font-lock-face 'proced-emacs-pid))
+ ((and proced-enable-color-flag (equal pid (alist-get 'sess proc-info)))
+ (propertize pid-s 'font-lock-face 'proced-session-leader-pid))
+ (proced-enable-color-flag
+ (propertize pid-s 'font-lock-face 'proced-pid))
+ (t pid-s))))
+
+(defun proced-format-ppid (ppid)
+ "Format PPID."
+ (let ((ppid-s (number-to-string ppid)))
+ (cond ((and proced-enable-color-flag
+ (not (file-remote-p default-directory))
+ (= ppid (emacs-pid)))
+ (propertize ppid-s 'font-lock-face 'proced-emacs-pid))
+ (proced-enable-color-flag
+ (propertize ppid-s 'font-lock-face 'proced-ppid))
+ (t ppid-s))))
+
+(defun proced-format-pgrp (pgrp)
+ "Format PGRP."
+ (if proced-enable-color-flag
+ (propertize (number-to-string pgrp) 'font-lock-face 'proced-pgrp)
+ (number-to-string pgrp)))
+
+(defun proced-format-sess (sess)
+ "Format SESS."
+ (if proced-enable-color-flag
+ (propertize (number-to-string sess) 'font-lock-face 'proced-sess)
+ (number-to-string sess)))
+
+(defun proced-format-cpu (cpu)
+ "Format CPU."
+ (let ((formatted (format "%.1f" cpu)))
+ (if proced-enable-color-flag
+ (propertize formatted 'font-lock-face 'proced-cpu)
+ formatted)))
+
+(defun proced-format-mem (mem)
+ "Format MEM."
+ (let ((formatted (format "%.1f" mem)))
+ (if proced-enable-color-flag
+ (propertize formatted 'font-lock-face 'proced-mem)
+ formatted)))
+
+(defun proced-format-user (user)
+ "Format USER."
+ (if proced-enable-color-flag
+ (propertize user 'font-lock-face 'proced-user)
+ user))
+
(defun proced-format (process-alist format)
"Display PROCESS-ALIST using FORMAT."
(if (symbolp format)
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index b722790334d..efee400681a 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -1777,7 +1777,7 @@ For AREA and OLD, see `antlr-insert-option-do'."
(skip-chars-forward " \t")
(if (looking-at "$\\|//")
- ;; just comment after point => skip (+ lines w/ same col comment)
+ ;; just comment after point => skip (+ lines with same col comment)
(let ((same (if (> (match-end 0) (match-beginning 0))
(current-column))))
(beginning-of-line 2)
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index aaf063b5174..2a63c100027 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -209,7 +209,7 @@ repeatedly until you are satisfied with the kind of comment."
(indent-according-to-mode)
(insert asm-comment-char asm-comment-char ?\ ))
- ;; Nonblank line w/o comment => start a comment at comment-column.
+ ;; Nonblank line without comment => start a comment at comment-column.
;; Also: point before the comment => jump inside.
((or (null comment) (< (point) comment))
(indent-for-comment))
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index fc35d9aedda..a8189a0f3da 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -29,7 +29,7 @@
;;; Code:
(require 'treesit)
-(require 'rx)
+(eval-when-compile (require 'rx))
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
@@ -168,7 +168,7 @@ MODE is either `c' or `cpp'."
(let ((c-keywords
'("break" "case" "const" "continue"
"default" "do" "else" "enum"
- "extern" "for" "goto" "if"
+ "extern" "for" "goto" "if" "inline"
"long" "register" "return" "short"
"signed" "sizeof" "static" "struct"
"switch" "typedef" "union" "unsigned"
@@ -179,7 +179,7 @@ MODE is either `c' or `cpp'."
"catch" "class" "co_await" "co_return"
"co_yield" "compl" "concept" "consteval"
"constexpr" "constinit" "decltype" "delete"
- "explicit" "final" "friend" "friend"
+ "explicit" "final" "friend"
"mutable" "namespace" "new" "noexcept"
"not" "not_eq" "operator" "or"
"or_eq" "override" "private" "protected"
@@ -505,15 +505,35 @@ the subtrees."
(when var-index `(("Variable" . ,var-index)))
(when func-index `(("Function" . ,func-index))))))
+(defun c-ts-mode--end-of-defun ()
+ "`end-of-defun-function' of `c-ts-mode'."
+ ;; A struct/enum/union_specifier node doesn't include the ; at the
+ ;; end, so we manually skip it.
+ (treesit-end-of-defun)
+ (when (looking-at (rx (* " ") ";"))
+ (goto-char (match-end 0))
+ ;; This part is copied from `end-of-defun'.
+ (unless (bolp)
+ (skip-chars-forward " \t")
+ (if (looking-at "\\s<\\|\n")
+ (forward-line 1)))))
+
;;;###autoload
-(define-derived-mode c-ts-mode--base-mode prog-mode "C"
+(define-derived-mode c-ts-base-mode prog-mode "C"
"Major mode for editing C, powered by tree-sitter."
:syntax-table c-ts-mode--syntax-table
;; Navigation.
(setq-local treesit-defun-type-regexp
- (rx (or "specifier"
- "definition")))
+ (regexp-opt '("function_definition"
+ "type_definition"
+ "struct_specifier"
+ "enum_specifier"
+ "union_specifier")))
+
+ ;; Nodes like struct/enum/union_specifier can appear in
+ ;; function_definitions, so we need to find the top-level node.
+ (setq-local treesit-defun-prefer-top-level t)
;; Indent.
(when (eq c-ts-mode-indent-style 'linux)
@@ -528,13 +548,13 @@ the subtrees."
(setq-local which-func-functions nil)
(setq-local treesit-font-lock-feature-list
- '(( comment constant keyword literal preprocessor string)
- ( assignment definition label property type)
- ( delimiter error escape-sequence function
- operator variable bracket))))
+ '(( comment definition)
+ ( keyword preprocessor string type)
+ ( assignment constant escape-sequence label literal property )
+ ( bracket delimiter error function operator variable))))
;;;###autoload
-(define-derived-mode c-ts-mode c-ts-mode--base-mode "C"
+(define-derived-mode c-ts-mode c-ts-base-mode "C"
"Major mode for editing C, powered by tree-sitter."
:group 'c
@@ -545,10 +565,14 @@ the subtrees."
;; Comments.
(setq-local comment-start "/* ")
- (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
(setq-local comment-end " */")
- (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
- (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
+ (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+ (seq "/" (+ "*")))
+ (* (syntax whitespace))))
+ (setq-local comment-end-skip
+ (rx (* (syntax whitespace))
+ (group (or (syntax comment-end)
+ (seq (+ "*") "/")))))
(setq-local treesit-simple-indent-rules
(c-ts-mode--set-indent-style 'c))
@@ -556,10 +580,14 @@ the subtrees."
;; Font-lock.
(setq-local treesit-font-lock-settings (c-ts-mode--font-lock-settings 'c))
- (treesit-major-mode-setup))
+ (treesit-major-mode-setup)
+
+ ;; Override default value of end-of-defun-function set by
+ ;; `treesit-major-mode-setup'.
+ (setq-local end-of-defun-function #'c-ts-mode--end-of-defun))
;;;###autoload
-(define-derived-mode c++-ts-mode c-ts-mode--base-mode "C++"
+(define-derived-mode c++-ts-mode c-ts-base-mode "C++"
"Major mode for editing C++, powered by tree-sitter."
:group 'c++
@@ -568,8 +596,14 @@ the subtrees."
;; Comments.
(setq-local comment-start "// ")
- (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
(setq-local comment-end "")
+ (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+ (seq "/" (+ "*")))
+ (* (syntax whitespace))))
+ (setq-local comment-end-skip
+ (rx (* (syntax whitespace))
+ (group (or (syntax comment-end)
+ (seq (+ "*") "/")))))
(treesit-parser-create 'cpp)
@@ -579,7 +613,11 @@ the subtrees."
;; Font-lock.
(setq-local treesit-font-lock-settings (c-ts-mode--font-lock-settings 'cpp))
- (treesit-major-mode-setup))
+ (treesit-major-mode-setup)
+
+ ;; Override default value of end-of-defun-function set by
+ ;; `treesit-major-mode-setup'.
+ (setq-local end-of-defun-function #'c-ts-mode--end-of-defun))
(provide 'c-ts-mode)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 11ddb39ed91..edb873f5a62 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -10678,6 +10678,8 @@ This function might do hidden buffer changes."
(c-forward-syntactic-ws))
(when (and (not got-identifier)
+ (or backup-at-type
+ (not (memq context '(arglist decl))))
(or (and new-style-auto
(looking-at c-auto-ops-re))
(and (or maybe-typeless backup-maybe-typeless)
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index e0f5a7ee021..60d568add56 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1044,6 +1044,8 @@ can always override the use of `c-default-style' by making calls to
(cons :format "%v"
(const :format "AWK " awk-mode) (string :format "%v"))
(cons :format "%v"
+ (const :format "C# " csharp-mode) (string :format "%v"))
+ (cons :format "%v"
(const :format "Other " other) (string :format "%v"))))
:group 'c)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 18c996e8997..e8ada9388e1 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2807,7 +2807,7 @@ This is the value of `next-error-function' in Compilation buffers."
(goto-char (point-min))
;; Treat file's found lines in forward order, 1 by 1.
(dolist (line (reverse (cddr (compilation--loc->file-struct loc))))
- (when (car line) ; else this is a filename w/o a line#
+ (when (car line) ; else this is a filename without a line#
(compilation-beginning-of-line (- (car line) last -1))
(setq last (car line)))
;; Treat line's found columns and store/update a marker for each.
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index a544a4b5cbd..054dabfed07 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -36,7 +36,8 @@
(require 'treesit)
(eval-when-compile
- (require 'cc-fonts))
+ (require 'cc-fonts)
+ (require 'rx))
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
@@ -319,12 +320,7 @@
(c-lang-defconst c-basic-matchers-before
csharp `(
;; Warning face on unclosed strings
- ,@(if (version< emacs-version "27.0")
- ;; Taken from 26.1 branch
- `(,(c-make-font-lock-search-function
- (concat ".\\(" c-string-limit-regexp "\\)")
- '((c-font-lock-invalid-string))))
- `(("\\s|" 0 font-lock-warning-face t nil)))
+ ("\\s|" 0 font-lock-warning-face t nil)
;; Invalid single quotes
c-font-lock-invalid-single-quotes
@@ -346,7 +342,6 @@
nil
(goto-char (match-end 0)))))
-
;; Negation character
(eval . (list "\\(!\\)[^=]" 1 c-negation-char-face-name))
@@ -375,8 +370,7 @@
(eval . (list (concat "\\<catch\\> *( *"
csharp--regex-type-name-matcher
" *) *")
- 1 font-lock-type-face))
- ))
+ 1 font-lock-type-face))))
(c-lang-defconst c-basic-matchers-after
csharp (append
@@ -505,70 +499,6 @@ compilation and evaluation time conflicts."
;;; End of new syntax constructs
-
-
-;;; Fix for strings on version 27.1
-
-(when (version= emacs-version "27.1")
- ;; See:
- ;; https://github.com/emacs-csharp/csharp-mode/issues/175
- ;; https://github.com/emacs-csharp/csharp-mode/issues/151
- ;; for the full story.
- (defun c-pps-to-string-delim (end)
- (let* ((start (point))
- (no-st-s `(0 nil nil ?\" nil nil 0 nil ,start nil nil))
- (st-s `(0 nil nil t nil nil 0 nil ,start nil nil))
- no-st-pos st-pos
- )
- (parse-partial-sexp start end nil nil no-st-s 'syntax-table)
- (setq no-st-pos (point))
- (goto-char start)
- (while (progn
- (parse-partial-sexp (point) end nil nil st-s 'syntax-table)
- (unless (bobp)
- (c-clear-syn-tab (1- (point))))
- (setq st-pos (point))
- (and (< (point) end)
- (not (eq (char-before) ?\")))))
- (goto-char (min no-st-pos st-pos))
- nil))
-
- (defun c-multiline-string-check-final-quote ()
- (let (pos-ll pos-lt)
- (save-excursion
- (goto-char (point-max))
- (skip-chars-backward "^\"")
- (while
- (and
- (not (bobp))
- (cond
- ((progn
- (setq pos-ll (c-literal-limits)
- pos-lt (c-literal-type pos-ll))
- (memq pos-lt '(c c++)))
- ;; In a comment.
- (goto-char (car pos-ll)))
- ((save-excursion
- (backward-char) ; over "
- (c-is-escaped (point)))
- ;; At an escaped string.
- (backward-char)
- t)
- (t
- ;; At a significant "
- (c-clear-syn-tab (1- (point)))
- (setq pos-ll (c-literal-limits)
- pos-lt (c-literal-type pos-ll))
- nil)))
- (skip-chars-backward "^\""))
- (cond
- ((bobp))
- ((eq pos-lt 'string)
- (c-put-syn-tab (1- (point)) '(15)))
- (t nil))))))
-
-;;; End of fix for strings on version 27.1
-
;; When invoked by MSBuild, csc’s errors look like this:
;; subfolder\file.cs(6,18): error CS1006: Name of constructor must
;; match name of class [c:\Users\user\project.csproj]
@@ -812,7 +742,9 @@ compilation and evaluation time conflicts."
(cast_expression (identifier) @font-lock-type-face)
["operator"] @font-lock-type-face
(type_parameter_constraints_clause
- target: (identifier) @font-lock-type-face))
+ target: (identifier) @font-lock-type-face)
+ (type_of_expression (identifier) @font-lock-type-face)
+ (object_creation_expression (identifier) @font-lock-type-face))
:language 'c-sharp
:feature 'definition
:override t
@@ -858,11 +790,20 @@ compilation and evaluation time conflicts."
(invocation_expression
(member_access_expression (identifier) @font-lock-function-name-face))
+ (catch_declaration
+ ((identifier) @font-lock-type-face))
+ (catch_declaration
+ ((identifier) @font-lock-type-face
+ (identifier) @font-lock-variable-name-face))
+
(variable_declaration (identifier) @font-lock-type-face)
(variable_declarator (identifier) @font-lock-variable-name-face)
(parameter type: (identifier) @font-lock-type-face)
- (parameter name: (identifier) @font-lock-variable-name-face))
+ (parameter name: (identifier) @font-lock-variable-name-face)
+
+ (binary_expression (identifier) @font-lock-variable-name-face)
+ (argument (identifier) @font-lock-variable-name-face))
:language 'c-sharp
:feature 'expression
'((conditional_expression (identifier) @font-lock-variable-name-face)
@@ -958,8 +899,14 @@ Key bindings:
;; Comments.
(setq-local comment-start "// ")
- (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
(setq-local comment-end "")
+ (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+ (seq "/" (+ "*")))
+ (* (syntax whitespace))))
+ (setq-local comment-end-skip
+ (rx (* (syntax whitespace))
+ (group (or (syntax comment-end)
+ (seq (+ "*") "/")))))
;; Indent.
(setq-local treesit-simple-indent-rules csharp-ts-mode--indent-rules)
@@ -974,9 +921,10 @@ Key bindings:
;; Font-lock.
(setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
- '((comment keyword constant string)
- (type definition expression literal attribute)
- (bracket delimiter)))
+ '(( comment definition)
+ ( keyword string type)
+ ( attribute constant expression literal)
+ ( bracket delimiter)))
;; Imenu.
(setq-local imenu-create-index-function #'csharp-ts-mode--imenu)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 120d4feb951..c266f6e18a3 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -166,7 +166,7 @@ chosen (interactively or automatically)."
(cond ((cdr available)
(cdr (assoc
(completing-read
- "[eglot] More than one server executable available:"
+ "[eglot] More than one server executable available: "
(mapcar #'car available)
nil t nil nil (car (car available)))
available #'equal)))
@@ -190,7 +190,7 @@ chosen (interactively or automatically)."
((js-json-mode json-mode json-ts-mode)
. ,(eglot-alternatives '(("vscode-json-language-server" "--stdio")
("json-languageserver" "--stdio"))))
- ((js-mode typescript-ts-mode typescript-mode)
+ ((js-mode js-ts-mode tsx-ts-mode typescript-ts-mode typescript-mode)
. ("typescript-language-server" "--stdio"))
((bash-ts-mode sh-mode) . ("bash-language-server" "start"))
((php-mode phps-mode)
@@ -1011,7 +1011,7 @@ be guessed."
(and base-prompt
(cond (current-prefix-arg base-prompt)
((null guess)
- (format "[eglot] Sorry, couldn't guess for `%s'!\n%s"
+ (format "[eglot] Couldn't guess LSP server for `%s'\n%s"
main-mode base-prompt))
((and program
(not (file-name-absolute-p program))
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index dff677e785f..e8d8f9104e4 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -177,7 +177,7 @@ May be manually changed by user with `gdb-select-frame'.")
"Number of selected line for main current thread.")
(defvar gdb-threads-list nil
- "Associative list of threads provided by \"-thread-info\" MI command.
+ "Association list of threads provided by \"-thread-info\" MI command.
Keys are thread numbers (in strings) and values are structures as
returned from -thread-info by `gdb-mi--partial-output'. Updated in
@@ -196,7 +196,7 @@ Updated in `gdb-thread-list-handler-custom'.")
See also `gdb-running-threads-count'.")
(defvar gdb-breakpoints-list nil
- "Associative list of breakpoints provided by \"-break-list\" MI command.
+ "Association list of breakpoints provided by \"-break-list\" MI command.
Keys are breakpoint numbers (in string) and values are structures
as returned from \"-break-list\" by `gdb-mi--partial-output'
@@ -3159,7 +3159,7 @@ See `def-gdb-auto-update-handler'."
(gdb-remove-breakpoint-icons (point-min) (point-max)))))
(dolist (breakpoint gdb-breakpoints-list)
(let* ((breakpoint (cdr breakpoint)) ; gdb-breakpoints-list is
- ; an associative list
+ ; an association list
(line (gdb-mi--field breakpoint 'line)))
(when line
(let ((file (gdb-mi--field breakpoint 'fullname))
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 9b7d7a05353..143fa8c6798 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -159,96 +159,146 @@ Used to gray out relevant toolbar icons.")
(t
(comint-interrupt-subjob)))))
-(defvar-keymap gud-mode-map
+(easy-mmode-defmap gud-menu-map
+ '(([help] "Info (debugger)" . gud-goto-info)
+ ([tooltips] menu-item "Show GUD tooltips" gud-tooltip-mode
+ :enable (and (not emacs-basic-display)
+ (display-graphic-p)
+ (fboundp 'x-show-tip))
+ :visible (memq gud-minor-mode
+ '(gdbmi guiler dbx sdb xdb pdb))
+ :button (:toggle . gud-tooltip-mode))
+ ([refresh] "Refresh" . gud-refresh)
+ ([run] menu-item "Run" gud-run
+ :enable (not gud-running)
+ :visible (or (memq gud-minor-mode '(gdb dbx jdb))
+ (and (eq gud-minor-mode 'gdbmi)
+ (or (not (gdb-show-run-p))
+ (bound-and-true-p
+ gdb-active-process)))))
+ ([go] . (menu-item (if (bound-and-true-p gdb-active-process)
+ "Continue" "Run")
+ gud-go
+ :visible (and (eq gud-minor-mode 'gdbmi)
+ (gdb-show-run-p))))
+ ([stop] menu-item "Stop" gud-stop-subjob
+ :visible (or (not (memq gud-minor-mode '(gdbmi pdb)))
+ (and (eq gud-minor-mode 'gdbmi)
+ (gdb-show-stop-p))))
+ ([until] menu-item "Continue to selection" gud-until
+ :enable (not gud-running)
+ :visible (and (memq gud-minor-mode '(gdbmi gdb perldb))
+ (gud-tool-bar-item-visible-no-fringe)))
+ ([remove] menu-item "Remove Breakpoint" gud-remove
+ :enable (not gud-running)
+ :visible (gud-tool-bar-item-visible-no-fringe))
+ ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdb sdb xdb)))
+ ([break] menu-item "Set Breakpoint" gud-break
+ :enable (not gud-running)
+ :visible (gud-tool-bar-item-visible-no-fringe))
+ ([up] menu-item "Up Stack" gud-up
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdb guiler dbx xdb jdb pdb)))
+ ([down] menu-item "Down Stack" gud-down
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdb guiler dbx xdb jdb pdb)))
+ ([pp] menu-item "Print S-expression" gud-pp
+ :enable (and (not gud-running)
+ (bound-and-true-p gdb-active-process))
+ :visible (and (string-equal
+ (buffer-local-value
+ 'gud-target-name gud-comint-buffer)
+ "emacs")
+ (eq gud-minor-mode 'gdbmi)))
+ ([print*] . (menu-item (if (eq gud-minor-mode 'jdb)
+ "Dump object"
+ "Print Dereference")
+ gud-pstar
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdb jdb))))
+ ([print] menu-item "Print Expression" gud-print
+ :enable (not gud-running))
+ ([watch] menu-item "Watch Expression" gud-watch
+ :enable (not gud-running)
+ :visible (eq gud-minor-mode 'gdbmi))
+ ([finish] menu-item "Finish Function" gud-finish
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdb guiler xdb jdb pdb)))
+ ([stepi] menu-item "Step Instruction" gud-stepi
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdb dbx)))
+ ([nexti] menu-item "Next Instruction" gud-nexti
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdb dbx)))
+ ([step] menu-item "Step Line" gud-step
+ :enable (not gud-running))
+ ([next] menu-item "Next Line" gud-next
+ :enable (not gud-running))
+ ([cont] menu-item "Continue" gud-cont
+ :enable (not gud-running)
+ :visible (not (eq gud-minor-mode 'gdbmi))))
+ "Menu for `gud-mode'."
+ :name "Gud")
+
+(easy-mmode-defmap gud-minor-mode-map
+ (append
+ `(([menu-bar debug] . ("Gud" . ,gud-menu-map)))
+ ;; Get tool bar like functionality from the menu bar on a text only
+ ;; terminal.
+ (unless window-system
+ `(([menu-bar down]
+ . (,(propertize "down" 'face 'font-lock-doc-face) . gud-down))
+ ([menu-bar up]
+ . (,(propertize "up" 'face 'font-lock-doc-face) . gud-up))
+ ([menu-bar finish]
+ . (,(propertize "finish" 'face 'font-lock-doc-face) . gud-finish))
+ ([menu-bar step]
+ . (,(propertize "step" 'face 'font-lock-doc-face) . gud-step))
+ ([menu-bar next]
+ . (,(propertize "next" 'face 'font-lock-doc-face) . gud-next))
+ ([menu-bar until] menu-item
+ ,(propertize "until" 'face 'font-lock-doc-face) gud-until
+ :visible (memq gud-minor-mode '(gdbmi gdb perldb)))
+ ([menu-bar cont] menu-item
+ ,(propertize "cont" 'face 'font-lock-doc-face) gud-cont
+ :visible (not (eq gud-minor-mode 'gdbmi)))
+ ([menu-bar run] menu-item
+ ,(propertize "run" 'face 'font-lock-doc-face) gud-run
+ :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
+ ([menu-bar go] menu-item
+ ,(propertize " go " 'face 'font-lock-doc-face) gud-go
+ :visible (and (eq gud-minor-mode 'gdbmi)
+ (gdb-show-run-p)))
+ ([menu-bar stop] menu-item
+ ,(propertize "stop" 'face 'font-lock-doc-face) gud-stop-subjob
+ :visible (or (and (eq gud-minor-mode 'gdbmi)
+ (gdb-show-stop-p))
+ (not (eq gud-minor-mode 'gdbmi))))
+ ([menu-bar print]
+ . (,(propertize "print" 'face 'font-lock-doc-face) . gud-print))
+ ([menu-bar tools] . undefined)
+ ([menu-bar buffer] . undefined)
+ ([menu-bar options] . undefined)
+ ([menu-bar edit] . undefined)
+ ([menu-bar file] . undefined))))
+ "Map used in visited files.")
+
+(setf (alist-get 'gud-minor-mode minor-mode-map-alist)
+ gud-minor-mode-map)
+
+(defvar gud-mode-map
;; Will inherit from comint-mode via define-derived-mode.
- :doc "`gud-mode' keymap.")
-
-(defvar-keymap gud-minor-mode-map
- :parent gud-mode-map)
+ (make-sparse-keymap)
+ "`gud-mode' keymap.")
-(easy-menu-define gud-menu-map gud-mode-map
- "Menu for `gud-mode'."
- '("Gud"
- ["Continue" gud-cont
- :enable (not gud-running)
- :visible (not (eq gud-minor-mode 'gdbmi))]
- ["Next Line" gud-next
- :enable (not gud-running)]
- ["Step Line" gud-step
- :enable (not gud-running)]
- ["Next Instruction" gud-nexti
- :enable (not gud-running)
- :visible (memq gud-minor-mode '(gdbmi gdb dbx))]
- ["Step Instruction" gud-stepi
- :enable (not gud-running)
- :visible (memq gud-minor-mode '(gdbmi gdb dbx))]
- ["Finish Function" gud-finish
- :enable (not gud-running)
- :visible (memq gud-minor-mode '(gdbmi gdb guiler xdb jdb pdb))]
- ["Watch Expression" gud-watch
- :enable (not gud-running)
- :visible (eq gud-minor-mode 'gdbmi)]
- ["Print Expression" gud-print
- :enable (not gud-running)]
- ["Dump object-Derefenrece" gud-pstar
- :label (if (eq gud-minor-mode 'jdb)
- "Dump object"
- "Print Dereference")
- :enable (not gud-running)
- :visible (memq gud-minor-mode '(gdbmi gdb jdb))]
- ["Print S-expression" gud-pp
- :enable (and (not gud-running)
- (bound-and-true-p gdb-active-process))
- :visible (and (string-equal
- (buffer-local-value
- 'gud-target-name gud-comint-buffer)
- "emacs")
- (eq gud-minor-mode 'gdbmi))]
- ["Down Stack" gud-down
- :enable (not gud-running)
- :visible (memq gud-minor-mode '(gdbmi gdb guiler dbx xdb jdb pdb))]
- ["Up Stack" gud-up
- :enable (not gud-running)
- :visible (memq gud-minor-mode
- '(gdbmi gdb guiler dbx xdb jdb pdb))]
- ["Set Breakpoint" gud-break
- :enable (not gud-running)
- :visible (gud-tool-bar-item-visible-no-fringe)]
- ["Temporary Breakpoint" gud-tbreak
- :enable (not gud-running)
- :visible (memq gud-minor-mode '(gdbmi gdb sdb xdb))]
- ["Remove Breakpoint" gud-remove
- :enable (not gud-running)
- :visible (gud-tool-bar-item-visible-no-fringe)]
- ["Continue to selection" gud-until
- :enable (not gud-running)
- :visible (and (memq gud-minor-mode '(gdbmi gdb perldb))
- (gud-tool-bar-item-visible-no-fringe))]
- ["Stop" gud-stop-subjob
- :visible (or (not (memq gud-minor-mode '(gdbmi pdb)))
- (and (eq gud-minor-mode 'gdbmi)
- (gdb-show-stop-p)))]
- ["Continue-Run" gud-go
- :label (if (bound-and-true-p gdb-active-process)
- "Continue" "Run")
- :visible (and (eq gud-minor-mode 'gdbmi)
- (gdb-show-run-p))]
- ["Run" gud-run
- :enable (not gud-running)
- :visible (or (memq gud-minor-mode '(gdb dbx jdb))
- (and (eq gud-minor-mode 'gdbmi)
- (or (not (gdb-show-run-p))
- (bound-and-true-p
- gdb-active-process))))]
- ["Refresh" gud-refresh]
- ["Show GUD tooltips" gud-tooltip-mode
- :enable (and (not emacs-basic-display)
- (display-graphic-p)
- (fboundp 'x-show-tip))
- :visible (memq gud-minor-mode
- '(gdbmi guiler dbx sdb xdb pdb))
- :button (:toggle . gud-tooltip-mode)]
- ["Info (debugger)" gud-goto-info]))
+(setf (alist-get 'gud-minor-mode minor-mode-map-alist)
+ gud-minor-mode-map)
(defvar gud-tool-bar-map
(let ((map (make-sparse-keymap)))
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index ee2934f53c6..2c42505ac94 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -29,6 +29,7 @@
;;; Code:
(require 'treesit)
+(eval-when-compile (require 'rx))
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
@@ -299,10 +300,14 @@ the subtrees."
;; Comments.
(setq-local comment-start "// ")
- (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
(setq-local comment-end "")
- (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
- (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
+ (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+ (seq "/" (+ "*")))
+ (* (syntax whitespace))))
+ (setq-local comment-end-skip
+ (rx (* (syntax whitespace))
+ (group (or (syntax comment-end)
+ (seq (+ "*") "/")))))
;; Indent.
(setq-local treesit-simple-indent-rules java-ts-mode--indent-rules)
@@ -317,9 +322,10 @@ the subtrees."
;; Font-lock.
(setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
- '((comment constant keyword string)
- (annotation definition expression literal type)
- (bracket delimiter operator)))
+ '(( comment definition )
+ ( constant keyword string type)
+ ( annotation expression literal)
+ ( bracket delimiter operator)))
;; Imenu.
(setq-local imenu-create-index-function #'java-ts-mode--imenu)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index da05b7b364a..389096147ac 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3848,11 +3848,15 @@ Currently there are `js-mode' and `js-ts-mode'."
(setq-local which-func-imenu-joiner-function #'js--which-func-joiner)
;; Comment.
(setq-local comment-start "// ")
- (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
(setq-local comment-end "")
+ (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+ (seq "/" (+ "*")))
+ (* (syntax whitespace))))
+ (setq-local comment-end-skip
+ (rx (* (syntax whitespace))
+ (group (or (syntax comment-end)
+ (seq (+ "*") "/")))))
(setq-local comment-multi-line t)
- (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
- (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
;; Electric-indent.
(setq-local electric-indent-chars
(append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*".
@@ -3873,9 +3877,10 @@ Currently there are `js-mode' and `js-ts-mode'."
(setq-local treesit-font-lock-settings js--treesit-font-lock-settings)
(setq-local treesit-font-lock-feature-list
'(( comment declaration)
- ( constant expression identifier keyword number string)
- ( bracket delimiter escape-sequence jsx operator
- pattern property)))
+ ( keyword string)
+ ( constant escape-sequence expression
+ identifier jsx number pattern property)
+ ( bracket delimiter operator)))
;; Imenu
(setq-local imenu-create-index-function
#'js--treesit-imenu)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 5b8648031fb..38d4fdad5fc 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1,7 +1,7 @@
;;; project.el --- Operations on the current project -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
-;; Version: 0.8.3
+;; Version: 0.9.2
;; Package-Requires: ((emacs "26.1") (xref "1.4.0"))
;; This is a GNU ELPA :core package. Avoid using functionality that
@@ -58,13 +58,30 @@
;;
;; This list can change in future versions.
;;
-;; VC project:
+;; Transient project:
+;;
+;; An instance of this type can be returned by `project-current' if no
+;; project was detected automatically, and the user had to pick a
+;; directory manually. The fileset it describes is the whole
+;; directory, with the exception of some standard ignored files and
+;; directories. This type has little purpose otherwise, as the only
+;; generic function it provides an override for is `project-root'.
+;;
+;; VC-aware project:
;;
;; Originally conceived as an example implementation, now it's a
;; relatively fast backend that delegates to 'git ls-files' or 'hg
;; status' to list the project's files. It honors the VC ignore
;; files, but supports additions to the list using the user option
-;; `project-vc-ignores' (usually through .dir-locals.el).
+;; `project-vc-ignores' (usually through .dir-locals.el). See the
+;; customization group `project-vc' for other options that control its
+;; behavior.
+;;
+;; If the repository is using any other VCS than Git or Hg, the file
+;; listing uses the default mechanism based on `find-program'.
+;;
+;; This project type can also be used for non-VCS controlled
+;; directories, see the variable `project-vc-extra-root-markers'.
;;
;; Utils:
;;
@@ -196,8 +213,8 @@ project instance.
The \"transient\" project instance is a special kind of value
which denotes a project rooted in that directory and includes all
-the files under the directory except for those that should be
-ignored (per `project-ignores').
+the files under the directory except for those that match entries
+in `vc-directory-exclusion-list' or `grep-find-ignored-files'.
See the doc string of `project-find-functions' for the general form
of the project instance object."
@@ -261,7 +278,7 @@ headers search path, load path, class path, and so on."
(cl-defgeneric project-name (project)
"A human-readable name for the project.
Nominally unique, but not enforced."
- (file-name-base (directory-file-name (project-root project))))
+ (file-name-nondirectory (directory-file-name (project-root project))))
(cl-defgeneric project-ignores (_project _dir)
"Return the list of glob patterns to ignore inside DIR.
@@ -377,7 +394,7 @@ the buffer's value of `default-directory'."
(nreverse bufs)))
(defgroup project-vc nil
- "Project implementation based on the VC package."
+ "VC-aware project implementation."
:version "25.1"
:group 'project)
@@ -397,20 +414,50 @@ you might have to restart Emacs to see the effect."
:safe #'booleanp)
(defcustom project-vc-include-untracked t
- "When non-nil, the VC project backend includes untracked files."
+ "When non-nil, the VC-aware project backend includes untracked files."
:type 'boolean
:version "29.1"
:safe #'booleanp)
(defcustom project-vc-name nil
- "When non-nil, the name of the current VC project.
+ "When non-nil, the name of the current VC-aware project.
-The best way to change the value a VC project reports as its
-name, is by setting this in .dir-locals.el."
- :type 'string
+The best way to change the value a VC-aware project reports as
+its name, is by setting this in .dir-locals.el."
+ :type '(choice (const :tag "Default to the base name" nil)
+ (string :tag "Custom name"))
:version "29.1"
+ :package-version '(project . "0.9.0")
:safe #'stringp)
+;; Not using regexps because these wouldn't work in Git pathspecs, in
+;; case we decide we need to be able to list nested projects.
+(defcustom project-vc-extra-root-markers nil
+ "List of additional markers to signal project roots.
+
+A marker is either a base file name or a glob pattern for such.
+
+A directory containing such a marker file or a file matching a
+marker pattern will be recognized as the root of a VC-aware
+project.
+
+Example values: \".dir-locals.el\", \"package.json\", \"pom.xml\",
+\"requirements.txt\", \"Gemfile\", \"*.gemspec\", \"autogen.sh\".
+
+These will be used in addition to regular directory markers such
+as \".git\", \".hg\", and so on, depending on the value of
+`vc-handled-backends'. It is most useful when a project has
+subdirectories inside it that need to be considered as separate
+projects. It can also be used for projects outside of VC
+repositories.
+
+In either case, their behavior will still obey the relevant
+variables, such as `project-vc-ignores' or `project-vc-name'."
+ :type '(repeat string)
+ :version "29.1"
+ :package-version '(project . "0.9.0")
+ :safe (lambda (val) (and (listp val) (cl-every #'stringp val))))
+
;; FIXME: Using the current approach, major modes are supposed to set
;; this variable to a buffer-local value. So we don't have access to
;; the "external roots" of language A from buffers of language B, which
@@ -419,7 +466,7 @@ name, is by setting this in .dir-locals.el."
;;
;; We could add a second argument to this function: a file extension,
;; or a language name. Some projects will know the set of languages
-;; used in them; for others, like VC-based projects, we'll need
+;; used in them; for others, like the VC-aware type, we'll need
;; auto-detection. I see two options:
;;
;; - That could be implemented as a separate second hook, with a
@@ -443,32 +490,55 @@ name, is by setting this in .dir-locals.el."
It should return a list of directory roots that contain source
files related to the current buffer.
-The directory names should be absolute. Used in the VC project
-backend implementation of `project-external-roots'.")
+The directory names should be absolute. Used in the VC-aware
+project backend implementation of `project-external-roots'.")
(defun project-try-vc (dir)
+ (defvar vc-svn-admin-directory)
+ (require 'vc-svn)
+ ;; FIXME: Learn to invalidate when the value of
+ ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers'
+ ;; changes.
(or (vc-file-getprop dir 'project-vc)
- (let* ((backend (ignore-errors (vc-responsible-backend dir)))
+ (let* ((backend-markers-alist `((Git . ".git")
+ (Hg . ".hg")
+ (Bzr . ".bzr")
+ (SVN . ,vc-svn-admin-directory)
+ (DARCS . "_darcs")
+ (Fossil . ".fslckout")))
+ (backend-markers
+ (delete
+ nil
+ (mapcar
+ (lambda (b) (assoc-default b backend-markers-alist))
+ vc-handled-backends)))
+ (marker-re
+ (mapconcat
+ (lambda (m) (format "\\(%s\\)" (wildcard-to-regexp m)))
+ (append backend-markers project-vc-extra-root-markers)
+ "\\|"))
+ (locate-dominating-stop-dir-regexp
+ (or vc-ignore-dir-regexp locate-dominating-stop-dir-regexp))
+ last-matches
(root
- (pcase backend
- ('Git
- ;; Don't stop at submodule boundary.
- (or (vc-file-getprop dir 'project-git-root)
- (let ((root (vc-call-backend backend 'root dir)))
- (vc-file-setprop
- dir 'project-git-root
- (if (and
- ;; FIXME: Invalidate the cache when the value
- ;; of this variable changes.
- project-vc-merge-submodules
- (project--submodule-p root))
- (let* ((parent (file-name-directory
- (directory-file-name root))))
- (vc-call-backend backend 'root parent))
- root)))))
- ('nil nil)
- (_ (ignore-errors (vc-call-backend backend 'root dir)))))
+ (locate-dominating-file
+ dir
+ (lambda (d)
+ ;; Maybe limit count to 100 when we can drop Emacs < 28.
+ (setq last-matches (directory-files d nil marker-re t)))))
+ (backend
+ (cl-find-if
+ (lambda (b)
+ (member (assoc-default b backend-markers-alist)
+ last-matches))
+ vc-handled-backends))
project)
+ (when (and
+ (eq backend 'Git)
+ project-vc-merge-submodules
+ (project--submodule-p root))
+ (let* ((parent (file-name-directory (directory-file-name root))))
+ (setq root (vc-call-backend 'Git 'root parent))))
(when root
(setq project (list 'vc backend root))
;; FIXME: Cache for a shorter time.
@@ -513,9 +583,10 @@ backend implementation of `project-external-roots'.")
(mapcan
(lambda (dir)
(let ((ignores project-vc-ignores)
- backend)
+ (backend (cadr project)))
+ (when backend
+ (require (intern (concat "vc-" (downcase (symbol-name backend))))))
(if (and (file-equal-p dir (nth 2 project))
- (setq backend (cadr project))
(cond
((eq backend 'Hg))
((and (eq backend 'Git)
@@ -626,7 +697,8 @@ backend implementation of `project-external-roots'.")
(let* ((root (nth 2 project))
backend)
(append
- (when (file-equal-p dir root)
+ (when (and backend
+ (file-equal-p dir root))
(setq backend (cadr project))
(delq
nil
@@ -954,7 +1026,7 @@ by the user at will."
hist mb-default)))
(absname (expand-file-name relname common-parent-directory)))
(when (and hist history-add-new-input)
- (add-to-history hist absname))
+ (add-to-history hist (abbreviate-file-name absname)))
absname))
(defun project--read-file-absolute (prompt
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 2a7e8a4081d..4fc5d24e2fb 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -454,7 +454,7 @@ This variant of `rx' supports common Python named REGEXPS."
(close-paren (or "}" "]" ")"))
(simple-operator (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))
(not-simple-operator (not (or simple-operator ?\n)))
- (operator (or "==" ">=" "is" "not"
+ (operator (or "==" ">="
"**" "//" "<<" ">>" "<=" "!="
"+" "-" "/" "&" "^" "~" "|" "*" "<" ">"
"=" "%"))
@@ -791,6 +791,7 @@ sign in chained assignment."
(? (or ")" "]") (* sp-bsnl))
(group assignment-operator)))
(1 font-lock-variable-name-face)
+ (2 'font-lock-operator-face)
(,(python-rx grouped-assignment-target)
(progn
(goto-char (match-end 1)) ; go back after the first symbol
@@ -806,8 +807,9 @@ sign in chained assignment."
(python-rx (or line-start ?\;) (* sp-bsnl)
grouped-assignment-target (* sp-bsnl)
(? ?: (* sp-bsnl) (+ not-simple-operator) (* sp-bsnl))
- assignment-operator))
- (1 font-lock-variable-name-face))
+ (group assignment-operator)))
+ (1 font-lock-variable-name-face)
+ (2 'font-lock-operator-face))
;; special cases
;; (a) = 5
;; [a] = 5,
@@ -817,8 +819,11 @@ sign in chained assignment."
(or "[" "(") (* sp-nl)
grouped-assignment-target (* sp-nl)
(or ")" "]") (* sp-bsnl)
- assignment-operator))
- (1 font-lock-variable-name-face))
+ (group assignment-operator)))
+ (1 font-lock-variable-name-face)
+ (2 'font-lock-operator-face))
+ ;; Operators.
+ (,(python-rx operator) . 'font-lock-operator-face)
;; escape sequences within bytes literals
;; "\\" "\'" "\a" "\b" "\f" "\n" "\r" "\t" "\v"
;; "\ooo" character with octal value ooo
@@ -962,9 +967,9 @@ It makes underscores and dots word constituent chars.")
;; merge with `python-font-lock-keywords-level-2'.
(defvar python--treesit-keywords
- '("as" "assert" "async" "await" "break" "class" "continue" "def"
+ '("as" "assert" "async" "await" "break" "case" "class" "continue" "def"
"del" "elif" "else" "except" "exec" "finally" "for" "from"
- "global" "if" "import" "lambda" "nonlocal" "pass" "print"
+ "global" "if" "import" "lambda" "match" "nonlocal" "pass" "print"
"raise" "return" "try" "while" "with" "yield"
;; These are technically operators, but we fontify them as
;; keywords.
@@ -6584,9 +6589,6 @@ implementations: `python-mode' and `python-ts-mode'."
(make-local-variable 'python-shell-internal-buffer)
- (when python-indent-guess-indent-offset
- (python-indent-guess-indent-offset))
-
(add-hook 'flymake-diagnostic-functions #'python-flymake nil t))
;;;###autoload
@@ -6598,12 +6600,18 @@ implementations: `python-mode' and `python-ts-mode'."
`(,python-font-lock-keywords
nil nil nil nil
(font-lock-syntactic-face-function
- . python-font-lock-syntactic-face-function)))
+ . python-font-lock-syntactic-face-function)
+ (font-lock-extend-after-change-region-function
+ . python-font-lock-extend-region)))
(setq-local syntax-propertize-function
python-syntax-propertize-function)
(setq-local imenu-create-index-function
#'python-imenu-create-index)
- (add-hook 'which-func-functions #'python-info-current-defun nil t))
+
+ (add-hook 'which-func-functions #'python-info-current-defun nil t)
+
+ (when python-indent-guess-indent-offset
+ (python-indent-guess-indent-offset)))
;;;###autoload
(define-derived-mode python-ts-mode python-base-mode "Python"
@@ -6613,17 +6621,20 @@ implementations: `python-mode' and `python-ts-mode'."
(when (treesit-ready-p 'python)
(treesit-parser-create 'python)
(setq-local treesit-font-lock-feature-list
- '(( comment string definition)
- ( keyword builtin constant type)
- ( assignment decorator escape-sequence
- string-interpolation number property
- operator bracket delimiter)))
+ '(( comment definition)
+ ( keyword string type)
+ ( assignment builtin constant decorator
+ escape-sequence number property string-interpolation )
+ ( bracket delimiter operator)))
(setq-local treesit-font-lock-settings python--treesit-settings)
(setq-local imenu-create-index-function
#'python-imenu-treesit-create-index)
(setq-local treesit-defun-type-regexp (rx (or "function" "class")
"_definition"))
- (treesit-major-mode-setup)))
+ (treesit-major-mode-setup)
+
+ (when python-indent-guess-indent-offset
+ (python-indent-guess-indent-offset))))
;;; Completion predicates for M-x
;; Commands that only make sense when editing Python code
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index e0453c3b2f4..8454f24356a 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -361,7 +361,7 @@ See `run-hooks'."
) t)
"\\>") 1)
;;
- ;; It wouldn't be Scheme w/o named-let.
+ ;; It wouldn't be Scheme without named-let.
'("(let\\s-+\\(\\sw+\\)"
(1 font-lock-function-name-face))
;;
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 067aef86692..e170d18afeb 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1468,6 +1468,25 @@ When the region is active, send the region instead."
(defvar sh-mode--treesit-settings)
+(defun sh--guess-shell ()
+ "Guess the shell used in the current buffer.
+Return the name of the shell suitable for `sh-set-shell'."
+ (cond ((save-excursion
+ (goto-char (point-min))
+ (looking-at auto-mode-interpreter-regexp))
+ (match-string 2))
+ ((not buffer-file-name) sh-shell-file)
+ ;; Checks that use `buffer-file-name' follow.
+ ((string-match "\\.m?spec\\'" buffer-file-name) "rpm")
+ ((string-match "[.]sh\\>" buffer-file-name) "sh")
+ ((string-match "[.]bash\\(rc\\)?\\>" buffer-file-name) "bash")
+ ((string-match "[.]ksh\\>" buffer-file-name) "ksh")
+ ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
+ ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
+ ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
+ ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
+ (t sh-shell-file)))
+
;;;###autoload
(define-derived-mode sh-base-mode prog-mode "Shell-script"
"Generic major mode for editing shell scripts.
@@ -1519,23 +1538,7 @@ implementations. Currently there are two: `sh-mode' and
"\\")))
;; Parse or insert magic number for exec, and set all variables depending
;; on the shell thus determined.
- (sh-set-shell
- (cond ((save-excursion
- (goto-char (point-min))
- (looking-at auto-mode-interpreter-regexp))
- (match-string 2))
- ((not buffer-file-name) sh-shell-file)
- ;; Checks that use `buffer-file-name' follow.
- ((string-match "\\.m?spec\\'" buffer-file-name) "rpm")
- ((string-match "[.]sh\\>" buffer-file-name) "sh")
- ((string-match "[.]bash\\(rc\\)?\\>" buffer-file-name) "bash")
- ((string-match "[.]ksh\\>" buffer-file-name) "ksh")
- ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
- ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
- ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
- ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
- (t sh-shell-file))
- nil nil)
+ (sh-set-shell (sh--guess-shell) nil nil)
(add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t)
(add-hook 'hack-local-variables-hook
#'sh-after-hack-local-variables nil t))
@@ -1605,17 +1608,36 @@ with your script for an edit-interpret-debug cycle."
;;;###autoload
(define-derived-mode bash-ts-mode sh-base-mode "Bash"
- "Major mode for editing Bash shell scripts."
+ "Major mode for editing Bash shell scripts.
+This mode automatically falls back to `sh-mode' if the buffer is
+not written in Bash or sh."
(when (treesit-ready-p 'bash)
(setq-local treesit-font-lock-feature-list
- '(( comment function heredoc string)
- ( command declaration-command keyword number variable)
- ( bracket builtin-variable constant delimiter
- misc-punctuation operator)))
+ '(( comment function)
+ ( command declaration-command keyword string)
+ ( builtin-variable constant heredoc number variable)
+ ( bracket delimiter misc-punctuation operator)))
(setq-local treesit-font-lock-settings
sh-mode--treesit-settings)
(treesit-major-mode-setup)))
+(advice-add 'bash-ts-mode :around #'sh--redirect-bash-ts-mode
+ ;; Give it lower precedence than normal advice, so other
+ ;; advices take precedence over it.
+ '((depth . 50)))
+
+(defvar sh--redirect-recursing nil)
+(defun sh--redirect-bash-ts-mode (oldfn)
+ "Redirect to `sh-mode' if the current file is not written in Bash or sh.
+OLDFN should be `bash-ts-mode'."
+ (let ((sh--redirect-recursing sh--redirect-recursing))
+ (funcall (if (or delay-mode-hooks sh--redirect-recursing)
+ oldfn
+ (setq sh--redirect-recursing t)
+ (if (member (file-name-base (sh--guess-shell)) '("bash" "sh"))
+ oldfn
+ #'sh-mode)))))
+
(defun sh-font-lock-keywords (&optional keywords)
"Function to get simple fontification based on `sh-font-lock-keywords'.
This adds rules for comments and assignments."
@@ -1666,19 +1688,17 @@ This adds rules for comments and assignments."
;; (defun sh--var-completion-table (string pred action)
;; (complete-with-action action (sh--vars-before-point) string pred))
-(defun sh--cmd-completion-table (string pred action)
- (let ((cmds
- (append (when (fboundp 'imenu--make-index-alist)
- (mapcar #'car
- (condition-case nil
- (imenu--make-index-alist)
- (imenu-unavailable nil))))
- (mapcar (lambda (v) (concat v "="))
- (sh--vars-before-point))
- (locate-file-completion-table
- exec-path exec-suffixes string pred t)
- sh--completion-keywords)))
- (complete-with-action action cmds string pred)))
+(defun sh--cmd-completion-table-gen (string)
+ (append (when (fboundp 'imenu--make-index-alist)
+ (mapcar #'car
+ (condition-case nil
+ (imenu--make-index-alist)
+ (imenu-unavailable nil))))
+ (mapcar (lambda (v) (concat v "="))
+ (sh--vars-before-point))
+ (locate-file-completion-table
+ exec-path exec-suffixes string nil t)
+ sh--completion-keywords))
(defun sh-completion-at-point-function ()
(save-excursion
@@ -1691,14 +1711,14 @@ This adds rules for comments and assignments."
(list start end (sh--vars-before-point)
:company-kind (lambda (_) 'variable)))
((sh-smie--keyword-p)
- (list start end #'sh--cmd-completion-table
+ (list start end
+ (completion-table-with-cache #'sh--cmd-completion-table-gen)
:company-kind
(lambda (s)
(cond
((member s sh--completion-keywords) 'keyword)
((string-suffix-p "=" s) 'variable)
- (t 'function)))
- ))))))
+ (t 'function)))))))))
;;; Indentation and navigation with SMIE.
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 763686bf660..48ac1169fe8 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -22,11 +22,15 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+
;;; Code:
(require 'treesit)
-(require 'rx)
(require 'js)
+(eval-when-compile (require 'rx))
(declare-function treesit-parser-create "treesit.c")
@@ -56,8 +60,10 @@
table)
"Syntax table for `typescript-ts-mode'.")
-(defvar typescript-ts-mode--indent-rules
- `((tsx
+(defun typescript-ts-mode--indent-rules (language)
+ "Rules used for indentation.
+Argument LANGUAGE is either `typescript' or `tsx'."
+ `((,language
((parent-is "program") parent-bol 0)
((node-is "}") parent-bol 0)
((node-is ")") parent-bol 0)
@@ -82,14 +88,13 @@
((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset)
((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset)
- ;; TSX
- ((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset)
- ((node-is "jsx_closing_element") parent 0)
- ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)
- ((node-is "/") parent 0)
- ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset)
- (no-node parent-bol 0)))
- "Tree-sitter indent rules.")
+ ,@(when (eq language 'tsx)
+ `(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset)
+ ((node-is "jsx_closing_element") parent 0)
+ ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)
+ ((node-is "/") parent 0)
+ ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset)))
+ (no-node parent-bol 0))))
(defvar typescript-ts-mode--keywords
'("!" "abstract" "as" "async" "await" "break"
@@ -110,14 +115,16 @@
"&&" "||" "!" "?.")
"TypeScript operators for tree-sitter font-locking.")
-(defvar typescript-ts-mode--font-lock-settings
+(defun typescript-ts-mode--font-lock-settings (language)
+ "Tree-sitter font-lock settings.
+Argument LANGUAGE is either `typescript' or `tsx'."
(treesit-font-lock-rules
- :language 'tsx
+ :language language
:override t
:feature 'comment
`((comment) @font-lock-comment-face)
- :language 'tsx
+ :language language
:override t
:feature 'constant
`(((identifier) @font-lock-constant-face
@@ -125,13 +132,13 @@
[(true) (false) (null)] @font-lock-constant-face)
- :language 'tsx
+ :language language
:override t
:feature 'keyword
`([,@typescript-ts-mode--keywords] @font-lock-keyword-face
[(this) (super)] @font-lock-keyword-face)
- :language 'tsx
+ :language language
:override t
:feature 'string
`((regex pattern: (regex_pattern)) @font-lock-string-face
@@ -139,7 +146,7 @@
(template_string) @js--fontify-template-string
(template_substitution ["${" "}"] @font-lock-builtin-face))
- :language 'tsx
+ :language language
:override t
:feature 'declaration
`((function
@@ -150,12 +157,20 @@
(method_definition
name: (property_identifier) @font-lock-function-name-face)
+ (required_parameter (identifier) @font-lock-variable-name-face)
+ (optional_parameter (identifier) @font-lock-variable-name-face)
(variable_declarator
name: (identifier) @font-lock-variable-name-face)
(enum_declaration (identifier) @font-lock-type-face)
+ (extends_clause value: (identifier) @font-lock-type-face)
+ ;; extends React.Component<T>
+ (extends_clause value: (member_expression
+ object: (identifier) @font-lock-type-face
+ property: (property_identifier) @font-lock-type-face))
+
(arrow_function
parameter: (identifier) @font-lock-variable-name-face)
@@ -169,7 +184,7 @@
(identifier) @font-lock-function-name-face)
value: (array (number) (function))))
- :language 'tsx
+ :language language
:override t
:feature 'identifier
`((nested_type_identifier
@@ -200,7 +215,7 @@
(_ (_ (identifier) @font-lock-variable-name-face))
(_ (_ (_ (identifier) @font-lock-variable-name-face)))]))
- :language 'tsx
+ :language language
:override t
:feature 'expression
'((assignment_expression
@@ -215,7 +230,7 @@
(member_expression
property: (property_identifier) @font-lock-function-name-face)]))
- :language 'tsx
+ :language language
:override t
:feature 'pattern
`((pair_pattern
@@ -223,7 +238,7 @@
(array_pattern (identifier) @font-lock-variable-name-face))
- :language 'tsx
+ :language language
:override t
:feature 'jsx
`((jsx_opening_element
@@ -240,101 +255,135 @@
(jsx_attribute (property_identifier) @font-lock-constant-face))
- :language 'tsx
+ :language language
:feature 'number
`((number) @font-lock-number-face
((identifier) @font-lock-number-face
(:match "^\\(:?NaN\\|Infinity\\)$" @font-lock-number-face)))
- :language 'tsx
+ :language language
:feature 'operator
`([,@typescript-ts-mode--operators] @font-lock-operator-face
(ternary_expression ["?" ":"] @font-lock-operator-face))
- :language 'tsx
+ :language language
:feature 'bracket
'((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
- :language 'tsx
+ :language language
:feature 'delimiter
'((["," "." ";" ":"]) @font-lock-delimiter-face)
- :language 'tsx
+ :language language
:feature 'escape-sequence
:override t
'((escape_sequence) @font-lock-escape-face)
- :language 'tsx
+ :language language
:override t
:feature 'property
- `(((property_identifier) @font-lock-property-face)
-
- (pair value: (identifier) @font-lock-variable-name-face)
+ `((pair value: (identifier) @font-lock-variable-name-face)
((shorthand_property_identifier) @font-lock-property-face)
((shorthand_property_identifier_pattern)
- @font-lock-property-face)))
- "Tree-sitter font-lock settings.")
+ @font-lock-property-face))))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode))
+(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
+
+;;;###autoload
+(define-derived-mode typescript-ts-base-mode prog-mode "TypeScript"
+ "Major mode for editing TypeScript."
+ :group 'typescript
+ :syntax-table typescript-ts-mode--syntax-table
+
+ ;; Comments.
+ (setq-local comment-start "// ")
+ (setq-local comment-end "")
+ (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
+ (setq-local comment-end-skip
+ (rx (* (syntax whitespace))
+ (group (or (syntax comment-end)
+ (seq (+ "*") "/")))))
+
+ ;; Electric
+ (setq-local electric-indent-chars
+ (append "{}():;," electric-indent-chars))
+
+ ;; Navigation.
+ (setq-local treesit-defun-type-regexp
+ (regexp-opt '("class_declaration"
+ "method_definition"
+ "function_declaration"
+ "lexical_declaration")))
+ ;; Imenu.
+ (setq-local imenu-create-index-function #'js--treesit-imenu)
+
+ ;; Which-func (use imenu).
+ (setq-local which-func-functions nil))
;;;###autoload
-(define-derived-mode typescript-ts-mode prog-mode "TypeScript"
+(define-derived-mode typescript-ts-mode typescript-ts-base-mode "TypeScript"
"Major mode for editing TypeScript."
:group 'typescript
:syntax-table typescript-ts-mode--syntax-table
- (cond
- ;; `typescript-ts-mode' requires tree-sitter to work, so we don't check if
- ;; user enables tree-sitter for it.
- ((treesit-ready-p 'tsx)
- ;; Tree-sitter.
+ (when (treesit-ready-p 'typescript)
+ (treesit-parser-create 'typescript)
+
+ ;; Indent.
+ (setq-local treesit-simple-indent-rules
+ (typescript-ts-mode--indent-rules 'typescript))
+
+ ;; Font-lock.
+ (setq-local treesit-font-lock-settings
+ (typescript-ts-mode--font-lock-settings 'typescript))
+ (setq-local treesit-font-lock-feature-list
+ '((comment declaration)
+ (keyword string)
+ (constant expression identifier number pattern property)
+ (bracket delimiter)))
+
+ (treesit-major-mode-setup)))
+
+;;;###autoload
+(define-derived-mode tsx-ts-mode typescript-ts-base-mode "TypeScript[TSX]"
+ "Major mode for editing TypeScript."
+ :group 'typescript
+ :syntax-table typescript-ts-mode--syntax-table
+
+ (when (treesit-ready-p 'tsx)
(treesit-parser-create 'tsx)
;; Comments.
(setq-local comment-start "// ")
- (setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
(setq-local comment-end "")
- (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
- (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
-
- ;; Electric
- (setq-local electric-indent-chars
- (append "{}():;," electric-indent-chars))
+ (setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
+ (seq "/" (+ "*")))
+ (* (syntax whitespace))))
+ (setq-local comment-end-skip
+ (rx (* (syntax whitespace))
+ (group (or (syntax comment-end)
+ (seq (+ "*") "/")))))
;; Indent.
- (setq-local treesit-simple-indent-rules typescript-ts-mode--indent-rules)
-
- ;; Navigation.
- (setq-local treesit-defun-type-regexp
- (rx (or "class_declaration"
- "method_definition"
- "function_declaration"
- "lexical_declaration")))
+ (setq-local treesit-simple-indent-rules
+ (typescript-ts-mode--indent-rules 'tsx))
;; Font-lock.
- (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings)
+ (setq-local treesit-font-lock-settings
+ (typescript-ts-mode--font-lock-settings 'tsx))
(setq-local treesit-font-lock-feature-list
'((comment declaration)
- (constant expression identifier keyword number string)
- (bracket delimiter jsx pattern property)))
- ;; Imenu.
- (setq-local imenu-create-index-function #'js--treesit-imenu)
-
- ;; Which-func (use imenu).
- (setq-local which-func-functions nil)
-
- (treesit-major-mode-setup))
+ (keyword string)
+ (constant expression identifier jsx number pattern property)
+ (bracket delimiter)))
- ;; Elisp.
- (t
- (js-mode)
- (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'"))))
+ (treesit-major-mode-setup)))
(provide 'typescript-ts-mode)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index c72041d70f9..1e4aa4eba52 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -692,8 +692,8 @@ and finally return the window."
(defun xref--show-location (location &optional select)
"Help `xref-show-xref' and `xref-goto-xref' do their job.
-Go to LOCATION and if SELECT is non-nil select its window. If
-SELECT is `quit', also quit the *xref* window."
+Go to LOCATION and if SELECT is non-nil select its window.
+If SELECT is `quit', also quit the *xref* window."
(condition-case err
(let* ((marker (xref-location-marker location))
(buf (marker-buffer marker))
@@ -885,7 +885,12 @@ some of the references to the identifiers."
(defun xref--outdated-p (item)
"Check that the match location at current position is up-to-date.
-ITEMS is an xref item which " ; FIXME: Expand documentation.
+
+ITEM is an xref item which is expected to be produced by a search
+command and have summary that matches buffer contents near point.
+Depending on whether it's the first of the matches on the line,
+the summary should either start from bol, or only match after
+point."
;; FIXME: The check should most likely be a generic function instead
;; of the assumption that all matches' summaries relate to the
;; buffer text in a particular way.
@@ -974,7 +979,8 @@ ITEMS is an xref item which " ; FIXME: Expand documentation.
(define-key map (kbd "M-,") #'xref-quit-and-pop-marker-stack)
map))
-(declare-function outline-search-text-property "outline" (property &optional value bound move backward looking-at))
+(declare-function outline-search-text-property "outline"
+ (property &optional value bound move backward looking-at))
(define-derived-mode xref--xref-buffer-mode special-mode "XREF"
"Mode for displaying cross-references."
@@ -985,6 +991,8 @@ ITEMS is an xref item which " ; FIXME: Expand documentation.
#'xref--imenu-prev-index-position)
(setq imenu-extract-index-name-function
#'xref--imenu-extract-index-name)
+ (setq-local add-log-current-defun-function
+ #'xref--add-log-current-defun)
(setq-local outline-minor-mode-cycle t
outline-minor-mode-use-buttons t
outline-search-function
@@ -1001,7 +1009,7 @@ ITEMS is an xref item which " ; FIXME: Expand documentation.
(define-derived-mode xref--transient-buffer-mode
xref--xref-buffer-mode
- "XREF Transient")
+ "XREF Transient.")
(defun xref--imenu-prev-index-position ()
"Move point to previous line in `xref' buffer.
@@ -1019,6 +1027,15 @@ beginning of the line."
(buffer-substring-no-properties (line-beginning-position)
(line-end-position)))
+(defun xref--add-log-current-defun ()
+ "Return the string used to group a set of locations.
+This function is used as a value for `add-log-current-defun-function'."
+ (xref--group-name-for-display
+ (if-let (item (xref--item-at-point))
+ (xref-location-group (xref-match-item-location item))
+ (xref--imenu-extract-index-name))
+ (xref--project-root (project-current))))
+
(defun xref--next-error-function (n reset?)
(when reset?
(goto-char (point-min)))
@@ -1165,7 +1182,7 @@ to that style. Otherwise it is returned unchanged."
(cl-ecase xref-file-name-display
(abs group)
(nondirectory
- (if (string-match-p "\\`~?/" group)
+ (if (file-name-absolute-p group)
(file-name-nondirectory group)
group))
(project-relative
@@ -1406,7 +1423,7 @@ FETCHER is a function of no arguments that returns a list of xref
values. It must not depend on the current buffer or selected
window.
-ALIST can include, but limited to, the following keys:
+ALIST can include, but is not limited to, the following keys:
WINDOW for the window that was selected before the current
command was called.
@@ -1807,7 +1824,7 @@ IGNORES is a list of glob patterns for files to ignore."
"xargs -0 rg <C> --null -nH --no-heading --no-messages -g '!*/' -e <R>"
)
(ugrep . "xargs -0 ugrep <C> --null -ns -e <R>"))
- "Associative list mapping program identifiers to command templates.
+ "Association list mapping program identifiers to command templates.
Program identifier should be a symbol, named after the search program.
diff --git a/lisp/server.el b/lisp/server.el
index 2102f8569b8..1b027f88ce6 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -619,20 +619,22 @@ If the key is not valid, signal an error."
(defun server-stop (&optional noframe)
"If this Emacs process has a server communication subprocess, stop it.
-If the server is running in some other Emacs process (see
+If this actually stopped the server, return non-nil. If the
+server is running in some other Emacs process (see
`server-running-p'), signal a `server-running-external' error.
If NOFRAME is non-nil, don't delete any existing frames
associated with a client process. This is useful, for example,
when killing Emacs, in which case the frames will get deleted
anyway."
- (let ((server-file (server--file-name)))
+ (let ((server-file (server--file-name))
+ stopped-p)
(when server-process
;; Kill it dead!
(ignore-errors (delete-process server-process))
- (unless noframe
- (server-log (message "Server stopped")))
- (setq server-process nil
+ (server-log "Stopped server")
+ (setq stopped-p t
+ server-process nil
server-mode nil
global-minor-modes (delq 'server-mode global-minor-modes)))
(unwind-protect
@@ -658,7 +660,8 @@ anyway."
server-name))))
;; If this Emacs already had a server, clear out associated status.
(while server-clients
- (server-delete-client (car server-clients) noframe)))))
+ (server-delete-client (car server-clients) noframe)))
+ stopped-p))
;;;###autoload
(defun server-start (&optional leave-dead inhibit-prompt)
@@ -702,7 +705,8 @@ the `server-process' variable."
(if (and internal--daemon-sockname
(not server--external-socket-initialized))
(setq server--external-socket-initialized t)
- (server-stop))
+ (when (server-stop)
+ (message (if leave-dead "Stopped server" "Restarting server"))))
(server-running-external
(display-warning
'server
@@ -717,8 +721,6 @@ the `server-process' variable."
(let ((server-file (server--file-name)))
;; Make sure there is a safe directory in which to place the socket.
(server-ensure-safe-dir (file-name-directory server-file))
- (when server-process
- (server-log (message "Restarting server")))
(with-file-modes ?\700
(add-hook 'suspend-tty-functions #'server-handle-suspend-tty)
(add-hook 'delete-frame-functions #'server-handle-delete-frame)
@@ -756,7 +758,7 @@ the `server-process' variable."
:service server-file
:plist '(:authenticated t)))))
(unless server-process (error "Could not start server process"))
- (server-log "Starting server")
+ (server-log "Started server")
(process-put server-process :server-file server-file)
(setq server-mode t)
(push 'server-mode global-minor-modes)
diff --git a/lisp/shell.el b/lisp/shell.el
index 7c3c925ab87..b396bc2b180 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -71,7 +71,7 @@
;; c-c c-o comint-delete-output Delete last batch of process output
;; c-c c-r comint-show-output Show last batch of process output
;; c-c c-l comint-dynamic-list-input-ring List input history
-;; comint-send-invisible Read line w/o echo & send to proc
+;; comint-send-invisible Read line without echo & send to proc
;; comint-continue-subjob Useful if you accidentally suspend
;; top-level job
;; comint-mode-hook is the comint mode hook.
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 515f7d5d750..7a279bdaa0e 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -349,7 +349,7 @@ determined automatically."
(defcustom speedbar-sort-tags nil
"If non-nil, sort tags in the speedbar display. *Obsolete*.
-Use `semantic-tag-hierarchy-method' instead."
+Use `speedbar-tag-hierarchy-method' instead."
:group 'speedbar
:type 'boolean)
diff --git a/lisp/startup.el b/lisp/startup.el
index 3745dac0c66..2b431591441 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1259,6 +1259,12 @@ please check its value")
(setq init-file-user nil))
((member argi '("-init-directory"))
(setq user-emacs-directory (or argval (pop args))
+ user-emacs-directory (if (stringp user-emacs-directory)
+ (file-name-as-directory
+ (expand-file-name
+ user-emacs-directory
+ command-line-default-directory))
+ user-emacs-directory)
argval nil))
((member argi '("-u" "-user"))
(setq init-file-user (or argval (pop args))
diff --git a/lisp/strokes.el b/lisp/strokes.el
index 0f84588a41b..e5719dfd5de 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -1151,7 +1151,7 @@ the stroke as a character in some language."
strokes-last-stroke)
31))))
(lift-flag t)
- (rainbow-chars (list ?R ?O ?Y ?G ?B ?P))) ; ROYGBIV w/o indigo
+ (rainbow-chars (list ?R ?O ?Y ?G ?B ?P))) ; ROYGBIV without indigo
(set-buffer buf)
(erase-buffer)
(insert strokes-xpm-header)
diff --git a/lisp/subr.el b/lisp/subr.el
index 4f671de918b..21f43092d42 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3936,6 +3936,31 @@ See also `locate-user-emacs-file'.")
"Return non-nil if the current buffer is narrowed."
(/= (- (point-max) (point-min)) (buffer-size)))
+(defmacro with-narrowing (start end &rest rest)
+ "Execute BODY with restrictions set to START and END.
+
+The current restrictions, if any, are restored upon return.
+
+With the optional :locked TAG argument, inside BODY,
+`narrow-to-region' and `widen' can be used only within the START
+and END limits, unless the restrictions are unlocked by calling
+`narrowing-unlock' with TAG. See `narrowing-lock' for a more
+detailed description.
+
+\(fn START END [:locked TAG] BODY)"
+ (if (eq (car rest) :locked)
+ `(internal--with-narrowing ,start ,end (lambda () ,@(cddr rest))
+ ,(cadr rest))
+ `(internal--with-narrowing ,start ,end (lambda () ,@rest))))
+
+(defun internal--with-narrowing (start end body &optional tag)
+ "Helper function for `with-narrowing', which see."
+ (save-restriction
+ (progn
+ (narrow-to-region start end)
+ (if tag (narrowing-lock tag))
+ (funcall body))))
+
(defun find-tag-default-bounds ()
"Determine the boundaries of the default tag, based on text at point.
Return a cons cell with the beginning and end of the found tag.
@@ -5410,9 +5435,11 @@ and replace a sub-expression, e.g.
(apply #'concat (nreverse matches)))))
(defsubst string-equal-ignore-case (string1 string2)
- "Like `string-equal', but case-insensitive.
+ "Compare STRING1 and STRING2 case-insensitively.
Upper-case and lower-case letters are treated as equal.
-Unibyte strings are converted to multibyte for comparison."
+Unibyte strings are converted to multibyte for comparison.
+
+See also `string-equal'."
(declare (pure t) (side-effect-free t))
(eq t (compare-strings string1 0 nil string2 0 nil t)))
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index eb4cec48619..dcda67e9c5b 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -189,7 +189,7 @@ For easier selection of tabs by their numbers, consider customizing
'(;; (emoji "🍔")
(symbol "☰")
(text "Menu" :face tab-bar-tab-inactive))
- "Icon for for the menu bar."
+ "Icon for the menu bar."
:version "29.1"
:help-echo "Menu bar"))
(setq tab-bar-menu-bar-button (icon-string 'tab-bar-menu-bar)))
@@ -936,7 +936,12 @@ when the tab is current. Return the result as a keymap."
(hpos (progn
(add-face-text-property 0 (length rest) 'tab-bar t rest)
(string-pixel-width rest)))
- (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
+ (str (propertize " " 'display
+ ;; The `right' spec doesn't work on TTY frames
+ ;; when windows are split horizontally (bug#59620)
+ (if window-system
+ `(space :align-to (- right (,hpos)))
+ `(space :align-to (,(- (frame-inner-width) hpos)))))))
`((align-right menu-item ,str ignore))))
(defun tab-bar-format-global ()
@@ -1083,7 +1088,7 @@ tab bar might wrap to the second line when it shouldn't.")
(setf (substring name ins-pos ins-pos) space)
(setq curr-width (string-pixel-width name))
(if (and (< curr-width width)
- (not (eq curr-width prev-width)))
+ (> curr-width prev-width))
(setq prev-width curr-width
prev-name name)
;; Set back a shorter name
@@ -1096,7 +1101,7 @@ tab bar might wrap to the second line when it shouldn't.")
(setf (substring name del-pos1 del-pos2) "")
(setq curr-width (string-pixel-width name))
(if (and (> curr-width width)
- (not (eq curr-width prev-width)))
+ (< curr-width prev-width))
(setq prev-width curr-width)
(setq continue nil)))
(let* ((len (length name))
@@ -1920,13 +1925,16 @@ function `tab-bar-tab-name-function'."
(when pos
(tab-bar-move-tab-to pos (1+ tab-index)))))
-(defcustom tab-bar-tab-post-change-group-functions nil
+(defcustom tab-bar-tab-post-change-group-functions '(tab-bar-move-tab-to-group)
"List of functions to call after changing a tab group.
-The current tab is supplied as an argument."
+This hook is run at the end of the function `tab-bar-change-tab-group'.
+The current tab is supplied as an argument. You can use any function,
+but by default it enables the function `tab-bar-move-tab-to-group'
+that moves the tab closer to its group."
:type 'hook
:options '(tab-bar-move-tab-to-group)
:group 'tab-bar
- :version "28.1")
+ :version "29.1")
(defun tab-bar-change-tab-group (group-name &optional tab-number)
"Add the tab specified by its absolute position TAB-NUMBER to GROUP-NAME.
@@ -1937,7 +1945,8 @@ TAB-NUMBER counts from 1.
If GROUP-NAME is the empty string, then remove the tab from any group.
While using this command, you might also want to replace
`tab-bar-format-tabs' with `tab-bar-format-tabs-groups' in
-`tab-bar-format' to group tabs on the tab bar."
+`tab-bar-format' to group tabs on the tab bar.
+Runs the hook `tab-bar-tab-post-change-group-functions' at the end."
(interactive
(let* ((tabs (funcall tab-bar-tabs-function))
(tab-number (or current-prefix-arg
diff --git a/lisp/term.el b/lisp/term.el
index 755c2202703..550aa781cc5 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -278,7 +278,7 @@
;; C-c C-h term-dynamic-list-input-ring List input history
;;
;; Not bound by default in term-mode
-;; term-send-invisible Read a line w/o echo, and send to proc
+;; term-send-invisible Read a line without echo, and send to proc
;; (These are bound in shell-mode)
;; term-dynamic-complete Complete filename at point.
;; term-dynamic-list-completions List completions in help buffer.
@@ -976,7 +976,7 @@ underlying shell."
'term-mode))
(buffer-list))))
(easy-menu-change
- '("Terminal")
+ nil
"Terminal Buffers"
(mapcar
(lambda (buffer)
@@ -986,7 +986,9 @@ underlying shell."
(lambda ()
(interactive)
(switch-to-buffer buffer))))
- buffer-list)))))
+ buffer-list)
+ nil
+ term-terminal-menu))))
(easy-menu-define term-signals-menu
(list term-mode-map term-raw-map term-pager-break-map)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 734252ee66f..b82886e3974 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1353,10 +1353,27 @@ for determining whether point is within a selector."
:language 'css
'((string_value) @font-lock-string-face)
+ :feature 'keyword
+ :language 'css
+ '(["@media"
+ "@import"
+ "@charset"
+ "@namespace"
+ "@keyframes"] @font-lock-builtin-face
+ ["and"
+ "or"
+ "not"
+ "only"
+ "selector"] @font-lock-keyword-face)
+
:feature 'variable
:language 'css
'((plain_value) @font-lock-variable-name-face)
+ :language 'css
+ :feature 'operator
+ `(["=" "~=" "^=" "|=" "*=" "$="] @font-lock-operator-face)
+
:feature 'selector
:language 'css
'((class_selector) @css-selector
@@ -1377,7 +1394,18 @@ for determining whether point is within a selector."
:language 'css
'((integer_value) @font-lock-number-face
(float_value) @font-lock-number-face
- (unit) @font-lock-constant-face)
+ (unit) @font-lock-constant-face
+ (important) @font-lock-builtin-face)
+
+ :feature 'query
+ :language 'css
+ '((keyword_query) @font-lock-property-face
+ (feature_name) @font-lock-property-face)
+
+
+ :feature 'bracket
+ :language 'css
+ '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
:feature 'error
:language 'css
@@ -1808,9 +1836,9 @@ can also be used to fill comments.
(setq-local treesit-defun-type-regexp "rule_set")
(setq-local treesit-font-lock-settings css--treesit-settings)
(setq-local treesit-font-lock-feature-list
- '((selector comment)
+ '((selector comment query keyword)
(property constant string)
- (error variable function)))
+ (error variable function operator bracket)))
;; Tree-sitter-css, for whatever reason, cannot reliably return
;; the captured nodes in a given range (it instead returns the
;; nodes preceding range). Before this is fixed in
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index e72576cdc74..f815419ea44 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -2053,7 +2053,8 @@ IGNORE-WORDS List of words which should be removed from the string."
(newname (concat "Fontify-me-" oldname)))
(unwind-protect
(progn
- ;; Rename buffer temporarily to start w/o space (because of font-lock)
+ ;; Rename buffer temporarily to start without space (because
+ ;; of font-lock)
(rename-buffer newname t)
;; Good: we have the indirection functions
(set (make-local-variable 'font-lock-fontify-region-function)
diff --git a/lisp/treesit.el b/lisp/treesit.el
index b7da38becc1..f3c03daf7e0 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -520,6 +520,25 @@ omitted, default END to BEG."
"Generic tree-sitter font-lock error"
'treesit-error)
+(defvar-local treesit-font-lock-level 3
+ "Decoration level to be used by tree-sitter fontifications.
+
+Major modes categorize their fontification features into levels,
+from 1 which is the absolute minimum, to 4 that yields the maximum
+fontifications.
+
+Level 1 usually contains only comments and definitions.
+Level 2 usually adds keywords, strings, constants, types, etc.
+Level 3 usually represents a full-blown fontification, including
+assignment, constants, numbers, properties, etc.
+Level 4 adds everything else that can be fontified: delimiters,
+operators, brackets, all functions and variables, etc.
+
+In addition to the decoration level, individual features can be
+turned on/off by calling `treesit-font-lock-recompute-features'.
+Changing the decoration level requires calling
+`treesit-font-lock-recompute-features' to have an effect.")
+
(defvar-local treesit--font-lock-query-expand-range (cons 0 0)
"The amount to expand the start and end of the region when fontifying.
This should be a cons cell (START . END). When fontifying a
@@ -537,11 +556,10 @@ temporarily fix.")
"A list of lists of feature symbols.
Use `treesit-font-lock-recompute-features' and
-`font-lock-maximum-decoration' to configure enabled features.
+`treesit-font-lock-level' to configure enabled features.
Each sublist represents a decoration level.
-`font-lock-maximum-decoration' controls which levels are
-activated.
+`treesit-font-lock-level' controls which levels are activated.
Inside each sublist are feature symbols, which correspond to the
:feature value of a query defined in `treesit-font-lock-rules'.
@@ -575,8 +593,8 @@ For SETTING to be activated for font-lock, ENABLE must be t. To
disable this SETTING, set ENABLE to nil.
FEATURE is the \"feature name\" of the query. Users can control
-which features are enabled with `font-lock-maximum-decoration'
-and `treesit-font-lock-feature-list'.
+which features are enabled with `treesit-font-lock-level' and
+`treesit-font-lock-feature-list'.
OVERRIDE is the override flag for this query. Its value can be
t, nil, append, prepend, keep. See more in
@@ -718,22 +736,19 @@ REMOVE-LIST.
If both ADD-LIST and REMOVE-LIST are omitted, recompute each
feature according to `treesit-font-lock-feature-list' and
-`font-lock-maximum-decoration'. Let N be the value of
-`font-lock-maximum-decoration', features in the first Nth sublist
-of `treesit-font-lock-feature-list' are enabled, and the rest
-features are disabled. If `font-lock-maximum-decoration' is t,
-all features in `treesit-font-lock-feature-list' are enabled, and
-the rest are disabled.
-
-ADD-LIST and REMOVE-LIST are each a list of feature symbols. The
+`treesit-font-lock-level'. If the value of `treesit-font-lock-level',
+is N, then the features in the first N sublists of
+`treesit-font-lock-feature-list' are enabled, and the rest of
+the features are disabled.
+
+ADD-LIST and REMOVE-LIST are lists of feature symbols. The
same feature symbol cannot appear in both lists; the function
signals the `treesit-font-lock-error' error if that happens."
(when-let ((intersection (cl-intersection add-list remove-list)))
(signal 'treesit-font-lock-error
(list "ADD-LIST and REMOVE-LIST contain the same feature"
intersection)))
- (let* ((level (font-lock-value-in-major-mode
- font-lock-maximum-decoration))
+ (let* ((level treesit-font-lock-level)
(base-features (cl-loop
for idx = 0 then (1+ idx)
for features in treesit-font-lock-feature-list
@@ -958,16 +973,6 @@ parser notifying of the change."
;;; Indent
-;; `comment-start' and `comment-end' assume there is only one type of
-;; comment, and that the comment spans only one line. So they are not
-;; sufficient for our purpose.
-
-(defvar-local treesit-comment-start nil
- "Regular expression matching an opening comment token.")
-
-(defvar-local treesit-comment-end nil
- "Regular expression matching a closing comment token.")
-
(define-error 'treesit-indent-error
"Generic tree-sitter indentation error"
'treesit-error)
@@ -1056,7 +1061,7 @@ See `treesit-simple-indent-presets'.")
(cons 'comment-end (lambda (_node _parent bol &rest _)
(save-excursion
(goto-char bol)
- (looking-at-p treesit-comment-end))))
+ (looking-at-p comment-end-skip))))
;; TODO: Document.
(cons 'catch-all (lambda (&rest _) t))
@@ -1082,14 +1087,14 @@ See `treesit-simple-indent-presets'.")
(lambda (_n parent &rest _)
(save-excursion
(goto-char (treesit-node-start parent))
- (re-search-forward treesit-comment-start)
+ (re-search-forward comment-start-skip)
+ (skip-syntax-backward "-")
(point))))
(cons 'comment-start-skip
(lambda (_n parent &rest _)
(save-excursion
(goto-char (treesit-node-start parent))
- (re-search-forward treesit-comment-start)
- (skip-syntax-forward "-")
+ (re-search-forward comment-start-skip)
(point))))
;; TODO: Document.
(cons 'grand-parent
@@ -1549,20 +1554,18 @@ For example, \"(function|class)_definition\".
This is used by `treesit-beginning-of-defun' and friends.")
(defvar-local treesit-defun-prefer-top-level nil
- "When non-nil, `treesit-beginning-of-defun' prefers top-level defun.
+ "When non-nil, Emacs prefers top-level defun.
-In some languages, a defun (function, class, struct) could be
-nested in another one. Normally `treesit-beginning-of-defun'
-just finds the first defun it encounter. If this variable's
-value is t, `treesit-beginning-of-defun' tries to find the
-top-level defun, and ignores nested ones.
+In some languages, a defun could be nested in another one.
+Normally Emacs stops at the first defun it encounters. If this
+variable's value is t, Emacs tries to find the top-level defun,
+and ignores nested ones.
-This variable can also be a list of tree-sitter node type
-regexps. Then, when `treesit-beginning-of-defun' finds a defun
-node and that node's type matches one in the list,
-`treesit-beginning-of-defun' finds the top-level node matching
-that particular regexp (as opposed to any node matched by
-`treesit-defun-type-regexp').")
+This variable can also be a list of cons cells of the
+form (FROM . TO), where FROM and TO are tree-sitter node type
+regexps. When Emacs finds a defun node whose type matches any of
+the FROM regexps in the list, it then tries to find a
+higher-level node matching the corresponding TO regexp.")
(defun treesit--defun-maybe-top-level (node)
"Maybe return the top-level equivalent of NODE.
@@ -1574,9 +1577,11 @@ For the detailed semantic see `treesit-defun-prefer-top-level'."
node))
((pred consp)
(cl-loop
- for re in treesit-defun-prefer-top-level
- if (string-match-p re (treesit-node-type node))
- return (or (treesit-node-top-level node re)
+ for con in treesit-defun-prefer-top-level
+ for from = (car con)
+ for to = (cdr con)
+ if (string-match-p from (treesit-node-type node))
+ return (or (treesit-node-top-level node to)
node)
finally return node))))
@@ -1609,7 +1614,12 @@ ARG is the same as in `beginning-of-defun'."
(let* ((node (treesit-search-forward
(treesit-node-at (point)) treesit-defun-type-regexp t t))
(top (treesit--defun-maybe-top-level node)))
- (goto-char (treesit-node-end top))))
+ ;; Technically `end-of-defun' should only call this function when
+ ;; point is at the beginning of a defun, so TOP should always be
+ ;; non-nil, but things happen, and we want to be safe, so check
+ ;; for TOP anyway.
+ (when top
+ (goto-char (treesit-node-end top)))))
;;; Activating tree-sitter
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index a1ff03144bc..38e9d5f9c91 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1325,7 +1325,7 @@ If LIMIT is a revision string, use it as an end-revision."
,(format "--pretty=tformat:%s"
(car vc-git-root-log-format))
"--abbrev-commit"))
- vc-git-log-switches
+ (ensure-list vc-git-log-switches)
(when (numberp limit)
(list "-n" (format "%s" limit)))
(when start-revision
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index c41835e19f2..bf1d847f1a4 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -683,11 +683,11 @@ Optional arg REVISION is a revision to annotate from."
;; *BEFORE* editing occurs) to start from, but line numbers
;; change as a result of edits. To DTRT, we apply edits in
;; order of descending buffer position so that edits further
- ;; down in the buffer occur first w/o corrupting specified
+ ;; down in the buffer occur first without corrupting specified
;; buffer positions of edits occurring towards the beginning of
;; the buffer. In this way we avoid using markers. A pleasant
;; property of this approach is ability to push instructions
- ;; onto `path' directly, w/o need to maintain rev boundaries.
+ ;; onto `path' directly, without need to maintain rev boundaries.
(dolist (insn (cdr (assq :insn meta)))
(goto-char (point-min))
(forward-line (1- (pop insn)))
diff --git a/lisp/window.el b/lisp/window.el
index dd23ab1d394..a11293d372a 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1958,7 +1958,7 @@ Optional argument PIXELWISE non-nil means return number of
pixels by which WINDOW can be enlarged."
(setq window (window-normalize-window window))
(if (and (not nodown) (window-size-fixed-p window horizontal ignore))
- ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed
+ ;; With IGNORE and NODOWN nil return zero if WINDOW has fixed
;; size.
0
;; WINDOW has no fixed size.
diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp
index ff6be8d0830..4abea2ec597 100644
--- a/msdos/sed2v2.inp
+++ b/msdos/sed2v2.inp
@@ -67,7 +67,7 @@
/^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/
/^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/
/^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/
-/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.0.50"/
+/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.0.60"/
/^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/
/^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/
/^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/
diff --git a/nt/README.W32 b/nt/README.W32
index cbb5b12551e..840da905dab 100644
--- a/nt/README.W32
+++ b/nt/README.W32
@@ -1,7 +1,7 @@
Copyright (C) 2001-2022 Free Software Foundation, Inc.
See the end of the file for license conditions.
- Emacs version 29.0.50 for MS-Windows
+ Emacs version 29.0.60 for MS-Windows
This README file describes how to set up and run a precompiled
distribution of the latest version of GNU Emacs for MS-Windows. You
diff --git a/src/.lldbinit b/src/.lldbinit
index 358cea5f8b6..5fdac34b786 100644
--- a/src/.lldbinit
+++ b/src/.lldbinit
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
#
-# Use 'lldb --local-init' or add to your ~/.lldbinit the line
+# Use 'lldb --local-lldbinit' or add to your ~/.lldbinit the line
#
# settings set target.load-cwd-lldbinit true
#
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index a00ca453ca4..77180262aca 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -14235,7 +14235,7 @@
ns_alternate_modifier. (Bug#1217)
* nsmenu.m (EmacsMenu-parseKeyEquiv:, addItemWithWidgetValue:):
- Display all shortcuts, including those w/o super modifier.
+ Display all shortcuts, including those without super modifier.
* nsfns.m (ns-read-file-name): Fix typo in assignment statement.
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index 4b3675eaa8f..d32e894fa53 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -14422,7 +14422,7 @@
* s-umips.h: Now include either s-usg5-2-2.h or s-bsd4-3.h
and then override as needed.
* m-mips.h: System dependence deleted.
- LD_SWITCH_MACHINE remains w/ options needed on all systems.
+ LD_SWITCH_MACHINE remains with options needed on all systems.
* m-pmax.h: A little of that (LIBS_DEBUG) moved here.
No need to undef LIBS_MACHINE.
diff --git a/src/alloc.c b/src/alloc.c
index 0653f2e0ccc..980085d3292 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -7435,9 +7435,17 @@ DEFUN ("memory-info", Fmemory_info, Smemory_info, 0, 0, 0,
doc: /* Return a list of (TOTAL-RAM FREE-RAM TOTAL-SWAP FREE-SWAP).
All values are in Kbytes. If there is no swap space,
last two values are zero. If the system is not supported
-or memory information can't be obtained, return nil. */)
+or memory information can't be obtained, return nil.
+If `default-directory’ is remote, return memory information of the
+respective remote host. */)
(void)
{
+ Lisp_Object handler
+ = Ffind_file_name_handler (BVAR (current_buffer, directory),
+ Qmemory_info);
+ if (!NILP (handler))
+ return call1 (handler, Qmemory_info);
+
#if defined HAVE_LINUX_SYSINFO
struct sysinfo si;
uintmax_t units;
@@ -7859,6 +7867,8 @@ do hash-consing of the objects allocated to pure space. */);
doc: /* Non-nil means Emacs cannot get much more Lisp memory. */);
Vmemory_full = Qnil;
+ DEFSYM (Qmemory_info, "memory-info");
+
DEFSYM (Qconses, "conses");
DEFSYM (Qsymbols, "symbols");
DEFSYM (Qstrings, "strings");
diff --git a/src/buffer.c b/src/buffer.c
index ac7f4f8e9d4..71be7ed9e13 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5898,7 +5898,42 @@ this threshold.
If nil, these display shortcuts will always remain disabled.
There is no reason to change that value except for debugging purposes. */);
- XSETFASTINT (Vlong_line_threshold, 10000);
+ XSETFASTINT (Vlong_line_threshold, 50000);
+
+ DEFVAR_INT ("long-line-locked-narrowing-region-size",
+ long_line_locked_narrowing_region_size,
+ doc: /* Region size for locked narrowing in buffers with long lines.
+
+This variable has effect only in buffers which contain one or more
+lines whose length is above `long-line-threshold', which see. For
+performance reasons, in such buffers, low-level hooks such as
+`fontification-functions' or `post-command-hook' are executed on a
+narrowed buffer, with a narrowing locked with `narrowing-lock'. This
+variable specifies the size of the narrowed region around point.
+
+To disable that narrowing, set this variable to 0.
+
+See also `long-line-locked-narrowing-bol-search-limit'.
+
+There is no reason to change that value except for debugging purposes. */);
+ long_line_locked_narrowing_region_size = 500000;
+
+ DEFVAR_INT ("long-line-locked-narrowing-bol-search-limit",
+ long_line_locked_narrowing_bol_search_limit,
+ doc: /* Limit for beginning of line search in buffers with long lines.
+
+This variable has effect only in buffers which contain one or more
+lines whose length is above `long-line-threshold', which see. For
+performance reasons, in such buffers, low-level hooks such as
+`fontification-functions' or `post-command-hook' are executed on a
+narrowed buffer, with a narrowing locked with `narrowing-lock'. The
+variable `long-line-locked-narrowing-region-size' specifies the size
+of the narrowed region around point. This variable, which should be a
+small integer, specifies the number of characters by which that region
+can be extended backwards to make it start at the beginning of a line.
+
+There is no reason to change that value except for debugging purposes. */);
+ long_line_locked_narrowing_bol_search_limit = 128;
DEFVAR_INT ("large-hscroll-threshold", large_hscroll_threshold,
doc: /* Horizontal scroll of truncated lines above which to use redisplay shortcuts.
diff --git a/src/dispextern.h b/src/dispextern.h
index 2afbdeabaab..df6134e68f0 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2342,6 +2342,14 @@ struct it
optimize display. */
ptrdiff_t narrowed_zv;
+ /* Begin position of the buffer for the locked narrowing around
+ low-level hooks. */
+ ptrdiff_t locked_narrowing_begv;
+
+ /* End position of the buffer for the locked narrowing around
+ low-level hooks. */
+ ptrdiff_t locked_narrowing_zv;
+
/* C string to iterate over. Non-null means get characters from
this string, otherwise characters are read from current_buffer
or it->string. */
@@ -3405,6 +3413,8 @@ void init_iterator (struct it *, struct window *, ptrdiff_t,
ptrdiff_t get_narrowed_begv (struct window *, ptrdiff_t);
ptrdiff_t get_narrowed_zv (struct window *, ptrdiff_t);
ptrdiff_t get_closer_narrowed_begv (struct window *, ptrdiff_t);
+ptrdiff_t get_locked_narrowing_begv (ptrdiff_t);
+ptrdiff_t get_locked_narrowing_zv (ptrdiff_t);
void init_iterator_to_row_start (struct it *, struct window *,
struct glyph_row *);
void start_display (struct it *, struct window *, struct text_pos);
diff --git a/src/editfns.c b/src/editfns.c
index 17dca4708ed..b364f441b53 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2653,88 +2653,216 @@ DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
return del_range_1 (XFIXNUM (start), XFIXNUM (end), 1, 1);
}
-DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
- doc: /* Remove restrictions (narrowing) from current buffer.
-This allows the buffer's full text to be seen and edited.
+/* Alist of buffers in which locked narrowing is used. The car of
+ each list element is a buffer, the cdr is a list of triplets (tag
+ begv-marker zv-marker). The last element of that list always uses
+ the (uninterned) Qoutermost_narrowing tag and records the narrowing
+ bounds that were set by the user and that are visible on display.
+ This alist is used internally by narrow-to-region, widen,
+ narrowing-lock, narrowing-unlock and save-restriction. */
+static Lisp_Object narrowing_locks;
+
+/* Add BUF with its LOCKS in the narrowing_locks alist. */
+static void
+narrowing_locks_add (Lisp_Object buf, Lisp_Object locks)
+{
+ narrowing_locks = nconc2 (list1 (list2 (buf, locks)), narrowing_locks);
+}
-Note that, when the current buffer contains one or more lines whose
-length is above `long-line-threshold', Emacs may decide to leave, for
-performance reasons, the accessible portion of the buffer unchanged
-after this function is called from low-level hooks, such as
-`jit-lock-functions' or `post-command-hook'. */)
- (void)
+/* Remove BUF and its locks from the narrowing_locks alist. Do
+ nothing if BUF is not present in narrowing_locks. */
+static void
+narrowing_locks_remove (Lisp_Object buf)
+{
+ narrowing_locks = Fdelq (Fassoc (buf, narrowing_locks, Qnil),
+ narrowing_locks);
+}
+
+/* Retrieve one of the BEGV/ZV bounds of a narrowing in BUF from the
+ narrowing_locks alist, as a pointer to a struct Lisp_Marker, or
+ NULL if BUF is not in narrowing_locks or is a killed buffer. When
+ OUTERMOST is true, the bounds that were set by the user and that
+ are visible on display are returned. Otherwise the innermost
+ locked narrowing bounds are returned. */
+static struct Lisp_Marker *
+narrowing_lock_get_bound (Lisp_Object buf, bool begv, bool outermost)
+{
+ if (NILP (Fbuffer_live_p (buf)))
+ return NULL;
+ Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+ if (NILP (buffer_locks))
+ return NULL;
+ buffer_locks = XCAR (XCDR (buffer_locks));
+ Lisp_Object bounds
+ = outermost
+ ? XCDR (assq_no_quit (Qoutermost_narrowing, buffer_locks))
+ : XCDR (XCAR (buffer_locks));
+ eassert (! NILP (bounds));
+ Lisp_Object marker = begv ? XCAR (bounds) : XCAR (XCDR (bounds));
+ eassert (EQ (Fmarker_buffer (marker), buf));
+ return XMARKER (marker);
+}
+
+/* Retrieve the tag of the innermost narrowing in BUF. Return nil if
+ BUF is not in narrowing_locks or is a killed buffer. */
+static Lisp_Object
+narrowing_lock_peek_tag (Lisp_Object buf)
{
- if (! NILP (Vrestrictions_locked))
+ if (NILP (Fbuffer_live_p (buf)))
return Qnil;
- if (BEG != BEGV || Z != ZV)
- current_buffer->clip_changed = 1;
- BEGV = BEG;
- BEGV_BYTE = BEG_BYTE;
- SET_BUF_ZV_BOTH (current_buffer, Z, Z_BYTE);
- /* Changing the buffer bounds invalidates any recorded current column. */
- invalidate_current_column ();
- return Qnil;
+ Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+ if (NILP (buffer_locks))
+ return Qnil;
+ Lisp_Object tag = XCAR (XCAR (XCAR (XCDR (buffer_locks))));
+ eassert (! NILP (tag));
+ return tag;
}
+/* Add a LOCK for BUF in the narrowing_locks alist. */
static void
-unwind_locked_begv (Lisp_Object point_min)
+narrowing_lock_push (Lisp_Object buf, Lisp_Object lock)
{
- SET_BUF_BEGV (current_buffer, XFIXNUM (point_min));
+ Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+ if (NILP (buffer_locks))
+ narrowing_locks_add (buf, list1 (lock));
+ else
+ XSETCDR (buffer_locks, list1 (nconc2 (list1 (lock),
+ XCAR (XCDR (buffer_locks)))));
}
+/* Remove the innermost lock in BUF from the narrowing_locks alist.
+ Do nothing if BUF is not present in narrowing_locks. */
static void
-unwind_locked_zv (Lisp_Object point_max)
+narrowing_lock_pop (Lisp_Object buf)
{
- SET_BUF_ZV (current_buffer, XFIXNUM (point_max));
+ Lisp_Object buffer_locks = assq_no_quit (buf, narrowing_locks);
+ if (NILP (buffer_locks))
+ return;
+ if (EQ (narrowing_lock_peek_tag (buf), Qoutermost_narrowing))
+ narrowing_locks_remove (buf);
+ else
+ XSETCDR (buffer_locks, list1 (XCDR (XCAR (XCDR (buffer_locks)))));
}
-/* Internal function for Fnarrow_to_region, meant to be used with a
- third argument 'true', in which case it should be followed by "specbind
- (Qrestrictions_locked, Qt)". */
-Lisp_Object
-narrow_to_region_internal (Lisp_Object start, Lisp_Object end, bool lock)
+static void
+unwind_reset_outermost_narrowing (Lisp_Object buf)
{
- EMACS_INT s = fix_position (start), e = fix_position (end);
-
- if (e < s)
+ struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, false);
+ struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, false);
+ if (begv != NULL && zv != NULL)
{
- EMACS_INT tem = s; s = e; e = tem;
+ SET_BUF_BEGV_BOTH (XBUFFER (buf), begv->charpos, begv->bytepos);
+ SET_BUF_ZV_BOTH (XBUFFER (buf), zv->charpos, zv->bytepos);
}
+ else
+ narrowing_locks_remove (buf);
+}
- if (lock)
+/* Restore the narrowing bounds that were set by the user, and restore
+ the bounds of the locked narrowing upon return.
+ In particular, this function is called when redisplay starts, so
+ that if a Lisp function executed during redisplay calls (redisplay)
+ while a locked narrowing is in effect, the locked narrowing will
+ not be visible on display. */
+void
+reset_outermost_narrowings (void)
+{
+ Lisp_Object val, buf;
+ for (val = narrowing_locks; CONSP (val); val = XCDR (val))
{
- if (!(BEGV <= s && s <= e && e <= ZV))
- args_out_of_range (start, end);
+ buf = XCAR (XCAR (val));
+ eassert (BUFFERP (buf));
+ struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, true);
+ struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, true);
+ if (begv != NULL && zv != NULL)
+ {
+ SET_BUF_BEGV_BOTH (XBUFFER (buf), begv->charpos, begv->bytepos);
+ SET_BUF_ZV_BOTH (XBUFFER (buf), zv->charpos, zv->bytepos);
+ record_unwind_protect (unwind_reset_outermost_narrowing, buf);
+ }
+ else
+ narrowing_locks_remove (buf);
+ }
+}
- if (BEGV != s || ZV != e)
- current_buffer->clip_changed = 1;
+/* Helper functions to save and restore the narrowing locks of the
+ current buffer in Fsave_restriction. */
+static Lisp_Object
+narrowing_locks_save (void)
+{
+ Lisp_Object buf = Fcurrent_buffer ();
+ Lisp_Object locks = assq_no_quit (buf, narrowing_locks);
+ if (NILP (locks))
+ return Qnil;
+ locks = XCAR (XCDR (locks));
+ return Fcons (buf, Fcopy_sequence (locks));
+}
- record_unwind_protect (restore_point_unwind, Fpoint_marker ());
- record_unwind_protect (unwind_locked_begv, Fpoint_min ());
- record_unwind_protect (unwind_locked_zv, Fpoint_max ());
+static void
+narrowing_locks_restore (Lisp_Object buf_and_saved_locks)
+{
+ if (NILP (buf_and_saved_locks))
+ return;
+ Lisp_Object buf = XCAR (buf_and_saved_locks);
+ Lisp_Object saved_locks = XCDR (buf_and_saved_locks);
+ narrowing_locks_remove (buf);
+ narrowing_locks_add (buf, saved_locks);
+}
- SET_BUF_BEGV (current_buffer, s);
- SET_BUF_ZV (current_buffer, e);
+static void
+unwind_narrow_to_region_locked (Lisp_Object tag)
+{
+ Fnarrowing_unlock (tag);
+ Fwiden ();
+}
+
+/* Narrow current_buffer to BEGV-ZV with a narrowing locked with TAG. */
+void
+narrow_to_region_locked (Lisp_Object begv, Lisp_Object zv, Lisp_Object tag)
+{
+ Fnarrow_to_region (begv, zv);
+ Fnarrowing_lock (tag);
+ record_unwind_protect (restore_point_unwind, Fpoint_marker ());
+ record_unwind_protect (unwind_narrow_to_region_locked, tag);
+}
+
+DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
+ doc: /* Remove restrictions (narrowing) from current buffer.
+
+This allows the buffer's full text to be seen and edited, unless
+restrictions have been locked with `narrowing-lock', which see, in
+which case the narrowing that was current when `narrowing-lock' was
+called is restored. */)
+ (void)
+{
+ Fset (Qoutermost_narrowing, Qnil);
+ Lisp_Object buf = Fcurrent_buffer ();
+ Lisp_Object tag = narrowing_lock_peek_tag (buf);
+
+ if (NILP (tag))
+ {
+ if (BEG != BEGV || Z != ZV)
+ current_buffer->clip_changed = 1;
+ BEGV = BEG;
+ BEGV_BYTE = BEG_BYTE;
+ SET_BUF_ZV_BOTH (current_buffer, Z, Z_BYTE);
}
else
{
- if (! NILP (Vrestrictions_locked))
- return Qnil;
-
- if (!(BEG <= s && s <= e && e <= Z))
- args_out_of_range (start, end);
-
- if (BEGV != s || ZV != e)
+ struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, false);
+ struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, false);
+ eassert (begv != NULL && zv != NULL);
+ if (begv->charpos != BEGV || zv->charpos != ZV)
current_buffer->clip_changed = 1;
-
- SET_BUF_BEGV (current_buffer, s);
- SET_BUF_ZV (current_buffer, e);
+ SET_BUF_BEGV_BOTH (current_buffer, begv->charpos, begv->bytepos);
+ SET_BUF_ZV_BOTH (current_buffer, zv->charpos, zv->bytepos);
+ /* If the only remaining bounds in narrowing_locks for
+ current_buffer are the bounds that were set by the user, no
+ locked narrowing is in effect in current_buffer anymore:
+ remove it from the narrowing_locks alist. */
+ if (EQ (tag, Qoutermost_narrowing))
+ narrowing_lock_pop (buf);
}
-
- if (PT < s)
- SET_PT (s);
- if (e < PT)
- SET_PT (e);
/* Changing the buffer bounds invalidates any recorded current column. */
invalidate_current_column ();
return Qnil;
@@ -2751,14 +2879,110 @@ When calling from Lisp, pass two arguments START and END:
positions (integers or markers) bounding the text that should
remain visible.
-Note that, when the current buffer contains one or more lines whose
-length is above `long-line-threshold', Emacs may decide to leave, for
-performance reasons, the accessible portion of the buffer unchanged
-after this function is called from low-level hooks, such as
-`jit-lock-functions' or `post-command-hook'. */)
+When restrictions have been locked with `narrowing-lock', which see,
+`narrow-to-region' can be used only within the limits of the
+restrictions that were current when `narrowing-lock' was called. If
+the START or END arguments are outside these limits, the corresponding
+limit of the locked restriction is used instead of the argument. */)
(Lisp_Object start, Lisp_Object end)
{
- return narrow_to_region_internal (start, end, false);
+ EMACS_INT s = fix_position (start), e = fix_position (end);
+
+ if (e < s)
+ {
+ EMACS_INT tem = s; s = e; e = tem;
+ }
+
+ if (!(BEG <= s && s <= e && e <= Z))
+ args_out_of_range (start, end);
+
+ Lisp_Object buf = Fcurrent_buffer ();
+ if (! NILP (narrowing_lock_peek_tag (buf)))
+ {
+ struct Lisp_Marker *begv = narrowing_lock_get_bound (buf, true, false);
+ struct Lisp_Marker *zv = narrowing_lock_get_bound (buf, false, false);
+ eassert (begv != NULL && zv != NULL);
+ /* Limit the start and end positions to those of the locked
+ narrowing. */
+ if (s < begv->charpos) s = begv->charpos;
+ if (s > zv->charpos) s = zv->charpos;
+ if (e < begv->charpos) e = begv->charpos;
+ if (e > zv->charpos) e = zv->charpos;
+ }
+
+ /* Record the accessible range of the buffer when narrow-to-region
+ is called, that is, before applying the narrowing. It is used
+ only by narrowing-lock. */
+ Fset (Qoutermost_narrowing, list3 (Qoutermost_narrowing,
+ Fpoint_min_marker (),
+ Fpoint_max_marker ()));
+
+ if (BEGV != s || ZV != e)
+ current_buffer->clip_changed = 1;
+
+ SET_BUF_BEGV (current_buffer, s);
+ SET_BUF_ZV (current_buffer, e);
+
+ if (PT < s)
+ SET_PT (s);
+ if (e < PT)
+ SET_PT (e);
+ /* Changing the buffer bounds invalidates any recorded current column. */
+ invalidate_current_column ();
+ return Qnil;
+}
+
+DEFUN ("narrowing-lock", Fnarrowing_lock, Snarrowing_lock, 1, 1, 0,
+ doc: /* Lock the current narrowing with TAG.
+
+When restrictions are locked, `narrow-to-region' and `widen' can be
+used only within the limits of the restrictions that were current when
+`narrowing-lock' was called, unless the lock is removed by calling
+`narrowing-unlock' with TAG.
+
+Locking restrictions should be used sparingly, after carefully
+considering the potential adverse effects on the code that will be
+executed within locked restrictions. It is typically meant to be used
+around portions of code that would become too slow, and make Emacs
+unresponsive, if they were executed in a large buffer. For example,
+restrictions are locked by Emacs around low-level hooks such as
+`fontification-functions' or `post-command-hook'.
+
+Locked restrictions are never visible on display, and can therefore
+not be used as a stronger variant of normal restrictions. */)
+ (Lisp_Object tag)
+{
+ Lisp_Object buf = Fcurrent_buffer ();
+ Lisp_Object outermost_narrowing
+ = buffer_local_value (Qoutermost_narrowing, buf);
+ /* If narrowing-lock is called without being preceded by
+ narrow-to-region, do nothing. */
+ if (NILP (outermost_narrowing))
+ return Qnil;
+ if (NILP (narrowing_lock_peek_tag (buf)))
+ narrowing_lock_push (buf, outermost_narrowing);
+ narrowing_lock_push (buf, list3 (tag,
+ Fpoint_min_marker (),
+ Fpoint_max_marker ()));
+ return Qnil;
+}
+
+DEFUN ("narrowing-unlock", Fnarrowing_unlock, Snarrowing_unlock, 1, 1, 0,
+ doc: /* Unlock a narrowing locked with (narrowing-lock TAG).
+
+Unlocking restrictions locked with `narrowing-lock' should be used
+sparingly, after carefully considering the reasons why restrictions
+were locked. Restrictions are typically locked around portions of
+code that would become too slow, and make Emacs unresponsive, if they
+were executed in a large buffer. For example, restrictions are locked
+by Emacs around low-level hooks such as `fontification-functions' or
+`post-command-hook'. */)
+ (Lisp_Object tag)
+{
+ Lisp_Object buf = Fcurrent_buffer ();
+ if (EQ (narrowing_lock_peek_tag (buf), tag))
+ narrowing_lock_pop (buf);
+ return Qnil;
}
Lisp_Object
@@ -2858,11 +3082,12 @@ DEFUN ("save-restriction", Fsave_restriction, Ssave_restriction, 0, UNEVALLED, 0
doc: /* Execute BODY, saving and restoring current buffer's restrictions.
The buffer's restrictions make parts of the beginning and end invisible.
\(They are set up with `narrow-to-region' and eliminated with `widen'.)
-This special form, `save-restriction', saves the current buffer's restrictions
-when it is entered, and restores them when it is exited.
+This special form, `save-restriction', saves the current buffer's
+restrictions, as well as their locks if they have been locked with
+`narrowing-lock', when it is entered, and restores them when it is exited.
So any `narrow-to-region' within BODY lasts only until the end of the form.
-The old restrictions settings are restored
-even in case of abnormal exit (throw or error).
+The old restrictions settings are restored even in case of abnormal exit
+\(throw or error).
The value returned is the value of the last form in BODY.
@@ -2877,6 +3102,7 @@ usage: (save-restriction &rest BODY) */)
specpdl_ref count = SPECPDL_INDEX ();
record_unwind_protect (save_restriction_restore, save_restriction_save ());
+ record_unwind_protect (narrowing_locks_restore, narrowing_locks_save ());
val = Fprogn (body);
return unbind_to (count, val);
}
@@ -4518,6 +4744,8 @@ syms_of_editfns (void)
DEFSYM (Qwall, "wall");
DEFSYM (Qpropertize, "propertize");
+ staticpro (&narrowing_locks);
+
DEFVAR_LISP ("inhibit-field-text-motion", Vinhibit_field_text_motion,
doc: /* Non-nil means text motion commands don't notice fields. */);
Vinhibit_field_text_motion = Qnil;
@@ -4577,11 +4805,12 @@ This variable is experimental; email 32252@debbugs.gnu.org if you need
it to be non-nil. */);
binary_as_unsigned = false;
- DEFSYM (Qrestrictions_locked, "restrictions-locked");
- DEFVAR_LISP ("restrictions-locked", Vrestrictions_locked,
- doc: /* If non-nil, restrictions are currently locked. */);
- Vrestrictions_locked = Qnil;
- Funintern (Qrestrictions_locked, Qnil);
+ DEFVAR_LISP ("outermost-narrowing", Voutermost_narrowing,
+ doc: /* Outermost narrowing bounds, if any. Internal use only. */);
+ Voutermost_narrowing = Qnil;
+ Fmake_variable_buffer_local (Qoutermost_narrowing);
+ DEFSYM (Qoutermost_narrowing, "outermost-narrowing");
+ Funintern (Qoutermost_narrowing, Qnil);
defsubr (&Spropertize);
defsubr (&Schar_equal);
@@ -4674,6 +4903,8 @@ it to be non-nil. */);
defsubr (&Sdelete_and_extract_region);
defsubr (&Swiden);
defsubr (&Snarrow_to_region);
+ defsubr (&Snarrowing_lock);
+ defsubr (&Snarrowing_unlock);
defsubr (&Ssave_restriction);
defsubr (&Stranspose_regions);
}
diff --git a/src/fns.c b/src/fns.c
index 7cc6d00afef..d8744c1a4de 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -334,7 +334,9 @@ Letter-case is significant, but text properties are ignored. */)
DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
doc: /* Return t if two strings have identical contents.
Case is significant, but text properties are ignored.
-Symbols are also allowed; their print names are used instead. */)
+Symbols are also allowed; their print names are used instead.
+
+See also `string-equal-ignore-case'. */)
(register Lisp_Object s1, Lisp_Object s2)
{
if (SYMBOLP (s1))
diff --git a/src/frame.c b/src/frame.c
index b57b296be54..05106a6c759 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2214,17 +2214,24 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
/* Since a similar behavior was observed on the Lucid and Motif
builds (see Bug#5802, Bug#21509, Bug#23499, Bug#27816), we now
don't delete the terminal for these builds either. */
- if (terminal->reference_count == 0 &&
- (terminal->type == output_x_window || terminal->type == output_pgtk))
+ if (terminal->reference_count == 0
+ && (terminal->type == output_x_window
+ || terminal->type == output_pgtk))
terminal->reference_count = 1;
#endif /* USE_X_TOOLKIT || USE_GTK */
+
if (terminal->reference_count == 0)
{
Lisp_Object tmp;
XSETTERMINAL (tmp, terminal);
kb = NULL;
- Fdelete_terminal (tmp, NILP (force) ? Qt : force);
+
+ /* If force is noelisp, the terminal is going away inside
+ x_delete_terminal, and a recursive call to Fdelete_terminal
+ is unsafe! */
+ if (!EQ (force, Qnoelisp))
+ Fdelete_terminal (tmp, NILP (force) ? Qt : force);
}
else
kb = terminal->kboard;
diff --git a/src/keyboard.c b/src/keyboard.c
index 811998823cc..d68b50428a9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1910,10 +1910,14 @@ safe_run_hooks_maybe_narrowed (Lisp_Object hook, struct window *w)
specbind (Qinhibit_quit, Qt);
- if (current_buffer->long_line_optimizations_p)
- narrow_to_region_internal (make_fixnum (get_narrowed_begv (w, PT)),
- make_fixnum (get_narrowed_zv (w, PT)),
- true);
+ if (current_buffer->long_line_optimizations_p
+ && long_line_locked_narrowing_region_size > 0)
+ {
+ ptrdiff_t begv = get_locked_narrowing_begv (PT);
+ ptrdiff_t zv = get_locked_narrowing_zv (PT);
+ if (begv != BEG || zv != Z)
+ narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv), hook);
+ }
run_hook_with_args (2, ((Lisp_Object []) {hook, hook}),
safe_run_hook_funcall);
@@ -12727,8 +12731,9 @@ the error might happen repeatedly and make Emacs nonfunctional.
Note that, when the current buffer contains one or more lines whose
length is above `long-line-threshold', these hook functions are called
-with the buffer narrowed to a small portion around point, and the
-narrowing is locked (see `narrow-to-region'), so that these hook
+with the buffer narrowed to a small portion around point (whose size
+is specified by `long-line-locked-narrowing-region-size'), and the
+narrowing is locked (see `narrowing-lock'), so that these hook
functions cannot use `widen' to gain access to other portions of
buffer text.
@@ -12748,8 +12753,9 @@ avoid making Emacs unresponsive while the user types.
Note that, when the current buffer contains one or more lines whose
length is above `long-line-threshold', these hook functions are called
-with the buffer narrowed to a small portion around point, and the
-narrowing is locked (see `narrow-to-region'), so that these hook
+with the buffer narrowed to a small portion around point (whose size
+is specified by `long-line-locked-narrowing-region-size'), and the
+narrowing is locked (see `narrowing-lock'), so that these hook
functions cannot use `widen' to gain access to other portions of
buffer text.
diff --git a/src/lisp.h b/src/lisp.h
index 6a24a538172..0f70f60d75c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4687,7 +4687,8 @@ extern void save_restriction_restore (Lisp_Object);
extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool);
extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
ptrdiff_t, bool);
-extern Lisp_Object narrow_to_region_internal (Lisp_Object, Lisp_Object, bool);
+extern void narrow_to_region_locked (Lisp_Object, Lisp_Object, Lisp_Object);
+extern void reset_outermost_narrowings (void);
extern void init_editfns (void);
extern void syms_of_editfns (void);
diff --git a/src/treesit.c b/src/treesit.c
index ad7e43fbc5c..4b150059fac 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -810,7 +810,10 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte,
with BUF_BEGV_BYTE and BUG_ZV_BYTE. When calling this function you
must make sure the current buffer's size in bytes is not larger than
UINT32_MAX. Basically, always call treesit_check_buffer_size before
- this function. */
+ this function.
+
+ If buffer range changed since last parse (visible_beg/end doesn't
+ match buffer visible beginning/end), set need_reparse to true. */
static void
treesit_sync_visible_region (Lisp_Object parser)
{
@@ -834,6 +837,12 @@ treesit_sync_visible_region (Lisp_Object parser)
eassert (BUF_BEGV_BYTE (buffer) <= UINT32_MAX);
eassert (BUF_ZV_BYTE (buffer) <= UINT32_MAX);
+ /* If buffer restriction changed and user requests for a node (hence
+ this function is called), we need to reparse. */
+ if (visible_beg != BUF_BEGV_BYTE (buffer)
+ || visible_end != BUF_ZV_BYTE (buffer))
+ XTS_PARSER (parser)->need_reparse = true;
+
/* Before we parse or set ranges, catch up with the narrowing
situation. We change visible_beg and visible_end to match
BUF_BEGV_BYTE and BUF_ZV_BYTE, and inform tree-sitter of the
@@ -879,6 +888,8 @@ treesit_sync_visible_region (Lisp_Object parser)
}
eassert (0 <= visible_beg);
eassert (visible_beg <= visible_end);
+ eassert (visible_beg == BUF_BEGV_BYTE (buffer));
+ eassert (visible_end == BUF_ZV_BYTE (buffer));
XTS_PARSER (parser)->visible_beg = visible_beg;
XTS_PARSER (parser)->visible_end = visible_end;
@@ -922,17 +933,20 @@ treesit_call_after_change_functions (TSTree *old_tree, TSTree *new_tree,
static void
treesit_ensure_parsed (Lisp_Object parser)
{
- if (!XTS_PARSER (parser)->need_reparse)
- return;
- TSParser *treesit_parser = XTS_PARSER (parser)->parser;
- TSTree *tree = XTS_PARSER (parser)->tree;
- TSInput input = XTS_PARSER (parser)->input;
struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
/* Before we parse, catch up with the narrowing situation. */
treesit_check_buffer_size (buffer);
+ /* This function has to run before we check for need_reparse flag,
+ because it might set the flag to true. */
treesit_sync_visible_region (parser);
+ if (!XTS_PARSER (parser)->need_reparse)
+ return;
+ TSParser *treesit_parser = XTS_PARSER (parser)->parser;
+ TSTree *tree = XTS_PARSER (parser)->tree;
+ TSInput input = XTS_PARSER (parser)->input;
+
TSTree *new_tree = ts_parser_parse (treesit_parser, tree, input);
/* This should be very rare (impossible, really): it only happens
when 1) language is not set (impossible in Emacs because the user
@@ -1524,8 +1538,8 @@ DEFUN ("treesit-parser-included-ranges",
Streesit_parser_included_ranges,
1, 1, 0,
doc: /* Return the ranges set for PARSER.
-See `treesit-parser-set-ranges'. If no ranges are set for PARSER,
-return nil. */)
+If no ranges are set for PARSER, return nil.
+See also `treesit-parser-set-included-ranges'. */)
(Lisp_Object parser)
{
treesit_check_parser (parser);
@@ -2644,19 +2658,18 @@ treesit_traverse_match_predicate (TSNode node, Lisp_Object pred,
return true. If no node satisfies PRED, return FALSE. PARSER is
the parser of ROOT.
- LIMIT is the number of levels we descend in the tree. If NO_LIMIT
- is true, LIMIT is ignored. FORWARD controls the direction in which
- we traverse the tree, true means forward, false backward. If NAMED
- is true, only traverse named nodes, if false, all nodes. If
- SKIP_ROOT is true, don't match ROOT. */
+ LIMIT is the number of levels we descend in the tree. FORWARD
+ controls the direction in which we traverse the tree, true means
+ forward, false backward. If NAMED is true, only traverse named
+ nodes, if false, all nodes. If SKIP_ROOT is true, don't match
+ ROOT. */
static bool
treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser,
- bool named, bool forward, ptrdiff_t limit, bool no_limit,
+ bool named, bool forward, ptrdiff_t limit,
bool skip_root)
{
/* TSTreeCursor doesn't allow us to move backward, so we can't use
- it. We could use limit == -1 to indicate no_limit == true, but
- separating them is safer. */
+ it. */
TSNode node = *root;
if (!skip_root && treesit_traverse_match_predicate (node, pred, parser))
@@ -2665,7 +2678,7 @@ treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser,
return true;
}
- if (!no_limit && limit <= 0)
+ if (limit <= 0)
return false;
else
{
@@ -2681,7 +2694,7 @@ treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser,
if (!ts_node_is_null (child)
&& treesit_search_dfs (&child, pred, parser, named,
- forward, limit - 1, no_limit, false))
+ forward, limit - 1, false))
{
*root = child;
return true;
@@ -2757,7 +2770,8 @@ node's type, or a function that takes a node and returns nil/non-nil.
By default, only traverse named nodes, but if ALL is non-nil, traverse
all nodes. If BACKWARD is non-nil, traverse backwards. If LIMIT is
-non-nil, only traverse nodes up to that number of levels down in the tree.
+non-nil, only traverse nodes up to that number of levels down in the
+tree. If LIMIT is nil, default to 1000.
Return the first matched node, or nil if none matches. */)
(Lisp_Object node, Lisp_Object predicate, Lisp_Object backward,
@@ -2769,11 +2783,10 @@ Return the first matched node, or nil if none matches. */)
CHECK_SYMBOL (all);
CHECK_SYMBOL (backward);
- ptrdiff_t the_limit = 0;
- bool no_limit = false;
- if (NILP (limit))
- no_limit = true;
- else
+ /* We use a default limit to 1000. See bug#59426 for the
+ discussion. */
+ ptrdiff_t the_limit = 1000;
+ if (!NILP (limit))
{
CHECK_FIXNUM (limit);
the_limit = XFIXNUM (limit);
@@ -2784,7 +2797,7 @@ Return the first matched node, or nil if none matches. */)
TSNode treesit_node = XTS_NODE (node)->node;
Lisp_Object parser = XTS_NODE (node)->parser;
if (treesit_search_dfs (&treesit_node, predicate, parser, NILP (all),
- NILP (backward), the_limit, no_limit, false))
+ NILP (backward), the_limit, false))
return make_treesit_node (parser, treesit_node);
else
return Qnil;
@@ -2847,7 +2860,7 @@ always traverse leaf nodes first, then upwards. */)
static void
treesit_build_sparse_tree (TSTreeCursor *cursor, Lisp_Object parent,
Lisp_Object pred, Lisp_Object process_fn,
- ptrdiff_t limit, bool no_limit, Lisp_Object parser)
+ ptrdiff_t limit, Lisp_Object parser)
{
TSNode node = ts_tree_cursor_current_node (cursor);
@@ -2866,8 +2879,7 @@ treesit_build_sparse_tree (TSTreeCursor *cursor, Lisp_Object parent,
parent = this;
}
/* Go through each child. */
- if ((no_limit || limit > 0)
- && ts_tree_cursor_goto_first_child (cursor))
+ if (limit > 0 && ts_tree_cursor_goto_first_child (cursor))
{
do
{
@@ -2875,7 +2887,7 @@ treesit_build_sparse_tree (TSTreeCursor *cursor, Lisp_Object parent,
Then C compilers should be smart enough not to copy NODE
to stack. */
treesit_build_sparse_tree (cursor, parent, pred, process_fn,
- limit - 1, no_limit, parser);
+ limit - 1, parser);
}
while (ts_tree_cursor_goto_next_sibling (cursor));
/* Don't forget to come back to this node. */
@@ -2916,7 +2928,8 @@ If PROCESS-FN is non-nil, it should be a function of one argument. In
that case, instead of returning the matched nodes, pass each node to
PROCESS-FN, and use its return value instead.
-If non-nil, LIMIT is the number of levels to go down the tree from ROOT.
+If non-nil, LIMIT is the number of levels to go down the tree from
+ROOT. If LIMIT is nil or omitted, it defaults to 1000.
Each node in the returned tree looks like (NODE . (CHILD ...)). The
root of this tree might be nil, if ROOT doesn't match PREDICATE.
@@ -2935,11 +2948,11 @@ a regexp. */)
if (!NILP (process_fn))
CHECK_TYPE (FUNCTIONP (process_fn), Qfunctionp, process_fn);
- ptrdiff_t the_limit = 0;
- bool no_limit = false;
- if (NILP (limit))
- no_limit = true;
- else
+
+ /* We use a default limit to 1000. See bug#59426 for the
+ discussion. */
+ ptrdiff_t the_limit = 1000;
+ if (!NILP (limit))
{
CHECK_FIXNUM (limit);
the_limit = XFIXNUM (limit);
@@ -2951,7 +2964,7 @@ a regexp. */)
Lisp_Object parser = XTS_NODE (root)->parser;
Lisp_Object parent = Fcons (Qnil, Qnil);
treesit_build_sparse_tree (&cursor, parent, predicate, process_fn,
- the_limit, no_limit, parser);
+ the_limit, parser);
Fsetcdr (parent, Fnreverse (Fcdr (parent)));
if (NILP (Fcdr (parent)))
return Qnil;
diff --git a/src/xdisp.c b/src/xdisp.c
index 5dcf21dc4ce..255851b9213 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3533,6 +3533,33 @@ get_closer_narrowed_begv (struct window *w, ptrdiff_t pos)
return max ((pos / len - 1) * len, BEGV);
}
+ptrdiff_t
+get_locked_narrowing_begv (ptrdiff_t pos)
+{
+ if (long_line_locked_narrowing_region_size <= 0)
+ return BEGV;
+ int len = long_line_locked_narrowing_region_size / 2;
+ int begv = max (pos - len, BEGV);
+ int limit = long_line_locked_narrowing_bol_search_limit;
+ while (limit > 0)
+ {
+ if (begv == BEGV || FETCH_BYTE (CHAR_TO_BYTE (begv) - 1) == '\n')
+ return begv;
+ begv--;
+ limit--;
+ }
+ return begv;
+}
+
+ptrdiff_t
+get_locked_narrowing_zv (ptrdiff_t pos)
+{
+ if (long_line_locked_narrowing_region_size <= 0)
+ return ZV;
+ int len = long_line_locked_narrowing_region_size / 2;
+ return min (pos + len, ZV);
+}
+
static void
unwind_narrowed_begv (Lisp_Object point_min)
{
@@ -4366,18 +4393,20 @@ handle_fontified_prop (struct it *it)
eassert (it->end_charpos == ZV);
- if (current_buffer->long_line_optimizations_p)
+ if (current_buffer->long_line_optimizations_p
+ && long_line_locked_narrowing_region_size > 0)
{
- ptrdiff_t begv = it->narrowed_begv;
- ptrdiff_t zv = it->narrowed_zv;
+ ptrdiff_t begv = it->locked_narrowing_begv;
+ ptrdiff_t zv = it->locked_narrowing_zv;
ptrdiff_t charpos = IT_CHARPOS (*it);
if (charpos < begv || charpos > zv)
{
- begv = get_narrowed_begv (it->w, charpos);
- zv = get_narrowed_zv (it->w, charpos);
+ begv = get_locked_narrowing_begv (charpos);
+ zv = get_locked_narrowing_zv (charpos);
}
- narrow_to_region_internal (make_fixnum (begv), make_fixnum (zv), true);
- specbind (Qrestrictions_locked, Qt);
+ if (begv != BEG || zv != Z)
+ narrow_to_region_locked (make_fixnum (begv), make_fixnum (zv),
+ Qfontification_functions);
}
/* Don't allow Lisp that runs from 'fontification-functions'
@@ -7435,12 +7464,20 @@ reseat (struct it *it, struct text_pos pos, bool force_p)
{
it->narrowed_begv = get_narrowed_begv (it->w, window_point (it->w));
it->narrowed_zv = get_narrowed_zv (it->w, window_point (it->w));
+ it->locked_narrowing_begv
+ = get_locked_narrowing_begv (window_point (it->w));
+ it->locked_narrowing_zv
+ = get_locked_narrowing_zv (window_point (it->w));
}
else if ((pos.charpos < it->narrowed_begv || pos.charpos > it->narrowed_zv)
&& (!redisplaying_p || it->line_wrap == TRUNCATE))
{
it->narrowed_begv = get_narrowed_begv (it->w, pos.charpos);
it->narrowed_zv = get_narrowed_zv (it->w, pos.charpos);
+ it->locked_narrowing_begv
+ = get_locked_narrowing_begv (window_point (it->w));
+ it->locked_narrowing_zv
+ = get_locked_narrowing_zv (window_point (it->w));
}
}
@@ -16266,7 +16303,6 @@ do { if (! polling_stopped_here) stop_polling (); \
do { if (polling_stopped_here) start_polling (); \
polling_stopped_here = false; } while (false)
-
/* Perhaps in the future avoid recentering windows if it
is not necessary; currently that causes some problems. */
@@ -16352,6 +16388,8 @@ redisplay_internal (void)
FOR_EACH_FRAME (tail, frame)
XFRAME (frame)->already_hscrolled_p = false;
+ reset_outermost_narrowings ();
+
retry:
/* Remember the currently selected window. */
sw = w;
@@ -19497,7 +19535,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
/* Check whether the buffer to be displayed contains long lines. */
if (!NILP (Vlong_line_threshold)
&& !current_buffer->long_line_optimizations_p
- && CHARS_MODIFF - CHARS_UNCHANGED_MODIFIED > 8)
+ && (CHARS_MODIFF - CHARS_UNCHANGED_MODIFIED > 8
+ || current_buffer->clip_changed))
{
ptrdiff_t cur, next, found, max = 0, threshold;
threshold = XFIXNUM (Vlong_line_threshold);
@@ -22578,7 +22617,8 @@ usage: (trace-to-stderr STRING &rest OBJECTS) */)
***********************************************************************/
/* Return a temporary glyph row holding the glyphs of an overlay arrow.
- Used for non-window-redisplay windows, and for windows w/o left fringe. */
+ Used for non-window-redisplay windows, and for windows without left
+ fringe. */
static struct glyph_row *
get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
@@ -36711,10 +36751,11 @@ fontify a region starting at POS in the current buffer, and give
fontified regions the property `fontified' with a non-nil value.
Note that, when the buffer contains one or more lines whose length is
-above `long-line-threshold', these functions are called with the buffer
-narrowed to a small portion around POS, and the narrowing is locked (see
-`narrow-to-region'), so that these functions cannot use `widen' to gain
-access to other portions of buffer text. */);
+above `long-line-threshold', these functions are called with the
+buffer narrowed to a small portion around POS (whose size is specified
+by `long-line-locked-narrowing-region-size'), and the narrowing is
+locked (see `narrowing-lock'), so that these functions cannot use
+`widen' to gain access to other portions of buffer text. */);
Vfontification_functions = Qnil;
Fmake_variable_buffer_local (Qfontification_functions);
diff --git a/src/xterm.c b/src/xterm.c
index ec605f5e914..44fad6e8d59 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6919,13 +6919,27 @@ x_sync_wait_for_frame_drawn_event (struct frame *f)
x_sync_is_frame_drawn_event, (XPointer) f,
make_timespec (1, 0)))
{
- /* TODO: display this warning in the echo area. */
- fprintf (stderr, "Warning: compositing manager spent more than 1 second "
- "drawing a frame. Frame synchronization has been disabled\n");
- FRAME_X_OUTPUT (f)->use_vsync_p = false;
+ /* The first time a draw hangs, treat it as a random fluctuation
+ on the part of the compositor. If the next draw continues to
+ hang, disable frame synchronization. */
+ if (FRAME_X_DRAW_JUST_HUNG (f))
+ {
+ fprintf (stderr, "Warning: compositing manager spent more than 1 "
+ "second drawing a frame. Frame synchronization has "
+ "been disabled\n");
+ FRAME_X_OUTPUT (f)->use_vsync_p = false;
- /* Also change the frame parameter to reflect the new state. */
- store_frame_param (f, Quse_frame_synchronization, Qnil);
+ /* Also change the frame parameter to reflect the new
+ state. */
+ store_frame_param (f, Quse_frame_synchronization, Qnil);
+ }
+ else
+ {
+ fprintf (stderr, "Warning: compositing manager spent more than 1 "
+ "second drawing a frame. Frame synchronization will be "
+ "disabled if this happens again\n");
+ FRAME_X_DRAW_JUST_HUNG (f) = true;
+ }
}
else
x_sync_note_frame_times (FRAME_DISPLAY_INFO (f), f, &event);
@@ -7128,8 +7142,26 @@ static void
x_sync_handle_frame_drawn (struct x_display_info *dpyinfo,
XEvent *message, struct frame *f)
{
+ XSyncValue value, counter;
+
if (FRAME_OUTER_WINDOW (f) == message->xclient.window)
- FRAME_X_WAITING_FOR_DRAW (f) = false;
+ {
+ counter = FRAME_X_COUNTER_VALUE (f);
+
+ /* Check that the counter in the message is the same as the
+ counter in the frame. */
+ XSyncIntsToValue (&value,
+ message->xclient.data.l[0] & 0xffffffff,
+ message->xclient.data.l[1] & 0xffffffff);
+
+ if (XSyncValueEqual (value, counter))
+ FRAME_X_WAITING_FOR_DRAW (f) = false;
+
+ /* As long as a _NET_WM_FRAME_DRAWN message arrives, we know
+ that the compositor is still sending events, so avoid timing
+ out. */
+ FRAME_X_DRAW_JUST_HUNG (f) = false;
+ }
x_sync_note_frame_times (dpyinfo, f, message);
}
@@ -26736,13 +26768,14 @@ x_wm_supports_1 (struct x_display_info *dpyinfo, Atom want_atom)
if (rc != Success || actual_type != XA_ATOM || x_had_errors_p (dpy))
{
- if (tmp_data) XFree (tmp_data);
+ if (tmp_data)
+ XFree (tmp_data);
x_uncatch_errors ();
unblock_input ();
return false;
}
- dpyinfo->net_supported_atoms = (Atom *)tmp_data;
+ dpyinfo->net_supported_atoms = (Atom *) tmp_data;
dpyinfo->nr_net_supported_atoms = actual_size;
dpyinfo->net_supported_window = wmcheck_window;
}
@@ -30598,6 +30631,9 @@ x_delete_display (struct x_display_info *dpyinfo)
}
}
+ if (dpyinfo->net_supported_atoms)
+ XFree (dpyinfo->net_supported_atoms);
+
xfree (dpyinfo->color_names);
xfree (dpyinfo->color_names_length);
xfree (dpyinfo->x_id_name);
@@ -30709,7 +30745,11 @@ static struct redisplay_interface x_redisplay_interface =
void
x_delete_terminal (struct terminal *terminal)
{
- struct x_display_info *dpyinfo = terminal->display_info.x;
+ struct x_display_info *dpyinfo;
+ struct frame *f;
+ Lisp_Object tail, frame;
+
+ dpyinfo = terminal->display_info.x;
/* Protect against recursive calls. delete_frame in
delete_terminal calls us back when it deletes our last frame. */
@@ -30717,6 +30757,19 @@ x_delete_terminal (struct terminal *terminal)
return;
block_input ();
+
+ /* Delete all remaining frames on the display that is going away.
+ Otherwise, font backends assume the display is still up, and
+ xftfont_end_for_frame crashes. */
+ FOR_EACH_FRAME (tail, frame)
+ {
+ f = XFRAME (frame);
+
+ if (FRAME_LIVE_P (f) && f->terminal == terminal)
+ /* Pass Qnoelisp rather than Qt. */
+ delete_frame (frame, Qnoelisp);
+ }
+
#ifdef HAVE_X_I18N
/* We must close our connection to the XIM server before closing the
X display. */
@@ -30730,6 +30783,10 @@ x_delete_terminal (struct terminal *terminal)
image_destroy_all_bitmaps (dpyinfo);
XSetCloseDownMode (dpyinfo->display, DestroyAll);
+ /* Delete the scratch cursor GC, should it exist. */
+ if (dpyinfo->scratch_cursor_gc)
+ XFreeGC (dpyinfo->display, dpyinfo->scratch_cursor_gc);
+
/* Get rid of any drag-and-drop operation that might be in
progress as well. */
if ((x_dnd_in_progress || x_dnd_waiting_for_finish)
diff --git a/src/xterm.h b/src/xterm.h
index c36920081d3..ee429e9c68d 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1179,6 +1179,10 @@ struct x_output
frame. */
bool_bf waiting_for_frame_p : 1;
+ /* Whether or not Emacs just skipped waiting for a frame due to a
+ timeout. */
+ bool_bf draw_just_hung_p : 1;
+
#if !defined USE_GTK && defined HAVE_CLOCK_GETTIME
/* Whether or not Emacs should wait for the compositing manager to
draw frames before starting a new frame. */
@@ -1392,6 +1396,8 @@ extern void x_mark_frame_dirty (struct frame *f);
FRAME_X_OUTPUT (f)->extended_frame_counter
#define FRAME_X_WAITING_FOR_DRAW(f) \
FRAME_X_OUTPUT (f)->waiting_for_frame_p
+#define FRAME_X_DRAW_JUST_HUNG(f) \
+ FRAME_X_OUTPUT (f)->draw_just_hung_p
#define FRAME_X_COUNTER_VALUE(f) \
FRAME_X_OUTPUT (f)->current_extended_counter_value
#endif
diff --git a/test/lisp/cedet/semantic-utest.el b/test/lisp/cedet/semantic-utest.el
index b577b198089..4aaa4c5e3c4 100644
--- a/test/lisp/cedet/semantic-utest.el
+++ b/test/lisp/cedet/semantic-utest.el
@@ -593,7 +593,7 @@ INSERTME is the text to be inserted after the deletion."
)
(ert-deftest semantic-utest-Scheme()
- (skip-unless nil) ;; There is a bug w/ scheme parser. Skip this for now.
+ (skip-unless nil) ;; There is a bug with scheme parser. Skip this for now.
(semantic-utest-generic (semantic-utest-fname "tst.scm") semantic-utest-Scheme-buffer-contents semantic-utest-Scheme-name-contents '("fun2") ";1" ";deleted line")
)
diff --git a/test/lisp/emacs-lisp/comp-tests.el b/test/lisp/emacs-lisp/comp-tests.el
index 082b641fe30..418c7296948 100644
--- a/test/lisp/emacs-lisp/comp-tests.el
+++ b/test/lisp/emacs-lisp/comp-tests.el
@@ -31,25 +31,30 @@
(defmacro with-test-native-compile-prune-cache (&rest body)
(declare (indent 0) (debug t))
`(ert-with-temp-directory testdir
- (setq testdir (expand-file-name "eln-cache" testdir))
- (make-directory testdir)
- (let* ((c1 (expand-file-name "29.0.50-cur" testdir))
- (c2 (expand-file-name "29.0.50-old" testdir))
- (native-comp-eln-load-path (list testdir))
- (comp-native-version-dir "29.0.50-cur"))
- (dolist (d (list c1 c2))
- (make-directory d)
- (with-temp-file (expand-file-name "some.eln" d) (insert "foo"))
- (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo")))
- ,@body)))
+ (let ((usr-cache (expand-file-name "eln-usr-cache" testdir))
+ (sys-cache (expand-file-name "eln-sys-cache" testdir)))
+ (make-directory usr-cache)
+ (make-directory sys-cache)
+ (let* ((c1 (expand-file-name "29.0.50-cur" usr-cache))
+ (c2 (expand-file-name "29.0.50-old" usr-cache))
+ (s1 (expand-file-name "29.0.50-cur" sys-cache))
+ (s2 (expand-file-name "preloaded" s1))
+ (native-comp-eln-load-path (list usr-cache sys-cache))
+ (comp-native-version-dir "29.0.50-cur"))
+ (dolist (d (list c1 c2 s1 s2))
+ (make-directory d)
+ (with-temp-file (expand-file-name "some.eln" d) (insert "foo"))
+ (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo")))
+ ,@body))))
(ert-deftest test-native-compile-prune-cache ()
(skip-unless (featurep 'native-compile))
(with-test-native-compile-prune-cache
(native-compile-prune-cache)
- (should (file-directory-p c1))
- (should (file-regular-p (expand-file-name "some.eln" c1)))
- (should (file-regular-p (expand-file-name "some.eln.tmp" c1)))
+ (dolist (d (list c1 s1 s2))
+ (should (file-directory-p d))
+ (should (file-regular-p (expand-file-name "some.eln" d)))
+ (should (file-regular-p (expand-file-name "some.eln.tmp" d))))
(should-not (file-directory-p c2))
(should-not (file-regular-p (expand-file-name "some.eln" c2)))
(should-not (file-regular-p (expand-file-name "some.eln.tmp" c2)))))
@@ -57,21 +62,23 @@
(ert-deftest test-native-compile-prune-cache/delete-only-eln ()
(skip-unless (featurep 'native-compile))
(with-test-native-compile-prune-cache
- (with-temp-file (expand-file-name "keep1.txt" c1) (insert "foo"))
- (with-temp-file (expand-file-name "keep2.txt" c2) (insert "foo"))
+ (dolist (d (list c1 c2 s1 s2))
+ (with-temp-file (expand-file-name "keep.txt" d) (insert "foo")))
(native-compile-prune-cache)
- (should (file-regular-p (expand-file-name "keep1.txt" c1)))
- (should (file-regular-p (expand-file-name "keep2.txt" c2)))))
+ (dolist (d (list c1 c2 s1 s2))
+ (should (file-regular-p (expand-file-name "keep.txt" d))))))
(ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache ()
(skip-unless (featurep 'native-compile))
(with-test-native-compile-prune-cache
- (let ((f1 (expand-file-name "../some.eln" testdir))
- (f2 (expand-file-name "some.eln" testdir)))
- (with-temp-file f1 (insert "foo"))
- (with-temp-file f2 (insert "foo"))
+ (let ((f1 (expand-file-name "../some.eln" usr-cache))
+ (f2 (expand-file-name "some.eln" usr-cache))
+ (f3 (expand-file-name "../some.eln" sys-cache))
+ (f4 (expand-file-name "some.eln" sys-cache)))
+ (dolist (f (list f1 f2 f3 f4))
+ (with-temp-file f (insert "foo")))
(native-compile-prune-cache)
- (should (file-regular-p f1))
- (should (file-regular-p f2)))))
+ (dolist (f (list f1 f2 f3 f4))
+ (should (file-regular-p f))))))
;;; comp-tests.el ends here
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
index af19c122b9f..05d24a8e35d 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
@@ -308,7 +308,7 @@
(setq eieio-test-method-order-list (nreverse eieio-test-method-order-list))
(eieio-test-match ans)))
-;;; Jan's methodinvoke order w/ multiple inheritance and :after methods.
+;;; Jan's methodinvoke order with multiple inheritance and :after methods.
;;
(defclass eitest-Ja ()
())
diff --git a/test/lisp/erc/erc-join-tests.el b/test/lisp/erc/erc-join-tests.el
index 8210defbfbd..89521ba4292 100644
--- a/test/lisp/erc/erc-join-tests.el
+++ b/test/lisp/erc/erc-join-tests.el
@@ -335,7 +335,7 @@
(start-process "true" (current-buffer) "true")
erc-server-current-nick "tester"
erc-server-announced-name "foo.gnu.chat"
- ;; Assume special case w/o known network
+ ;; Assume special case without known network
erc-networks--id (make-erc-networks--id))
(set-process-query-on-exit-flag erc-server-process nil)
(should-not calls)
diff --git a/test/lisp/erc/erc-sasl-tests.el b/test/lisp/erc/erc-sasl-tests.el
index 64593ca270c..0e5ea60e5f0 100644
--- a/test/lisp/erc/erc-sasl-tests.el
+++ b/test/lisp/erc/erc-sasl-tests.el
@@ -42,21 +42,23 @@
(erc-sasl--options '((password . :password))))
(should (string= (erc-sasl--read-password nil) "foo"))))
- (ert-info ("Fallback to prompt skip auth-source")
- (should-not erc-sasl-auth-source-function)
- (let ((erc-session-password "bar")
- (erc-networks--id (erc-networks--id-create nil)))
+ (ert-info ("Prompt when no authfn and :password resolves to nil")
+ (let ((erc-session-password nil)
+ (erc-sasl--options
+ '((password . :password) (user . :user) (authfn))))
(should (string= (ert-simulate-keys "bar\r"
(erc-sasl--read-password "?"))
"bar"))))
- (ert-info ("Prompt when auth-source fails and `erc-sasl-password' null")
- (let ((erc-sasl--options '((password)))
- (erc-sasl-auth-source-function #'ignore))
+ (ert-info ("Prompt when auth-source fails and `erc-session-password' null")
+ (should-not erc-session-password)
+ (let ((erc-sasl--options '((password) (authfn . ignore))))
(should (string= (ert-simulate-keys "baz\r"
(erc-sasl--read-password "pwd:"))
"baz")))))
+;; This mainly tests `erc-sasl-auth-source-password-as-host'.
+
(ert-deftest erc-sasl--read-password--auth-source ()
(ert-with-temp-file netrc-file
:text (string-join
@@ -70,40 +72,53 @@
(erc-session-server "irc.gnu.org")
(erc-session-port 6697)
(erc-networks--id (erc-networks--id-create nil))
- calls
- (erc-sasl-auth-source-function
- (lambda (&rest r)
- (push r calls)
- (apply #'erc--auth-source-search r)))
erc-server-announced-name ; too early
- auth-source-do-cache)
+ auth-source-do-cache
+ ;;
+ (fn #'erc-sasl-auth-source-password-as-host)
+ calls)
+
+ (advice-add 'erc-auth-source-search :before
+ (lambda (&rest r) (push r calls))
+ '((name . erc-sasl--read-password--auth-source)))
(ert-info ("Symbol as password specifies machine")
- (let ((erc-sasl--options '((user . "bob") (password . FSF.chat)))
- (erc-networks--id (make-erc-networks--id)))
+ (let ((erc-sasl--options
+ `((user . "bob") (password . FSF.chat) (authfn . ,fn))))
+ (should (string= (erc-sasl--read-password nil) "sesame"))
+ (should (equal (pop calls) '(:user "bob" :host "FSF.chat")))))
+
+ (ert-info (":password as password resolved to machine")
+ (let ((erc-session-password "FSF.chat")
+ (erc-sasl--options
+ `((user . "bob") (password . :password) (authfn . ,fn))))
(should (string= (erc-sasl--read-password nil) "sesame"))
(should (equal (pop calls) '(:user "bob" :host "FSF.chat")))))
- (ert-info ("ID for :host and `erc-session-username' for :user") ; *1
+ (ert-info (":user resolved to `erc-session-username'") ; *1
(let ((erc-session-username "bob")
- (erc-sasl--options '((user . :user) (password)))
+ (erc-sasl--options `((user . :user) (password) (authfn . ,fn)))
(erc-networks--id (erc-networks--id-create 'GNU/chat)))
(should (string= (erc-sasl--read-password nil) "spam"))
- (should (equal (pop calls) '(:user "bob" :host "GNU/chat")))))
+ (should (equal (pop calls) '(:user "bob")))))
- (ert-info ("ID for :host and current nick for :user") ; *1
+ (ert-info (":user resolved to current nick") ; *1
(let ((erc-server-current-nick "bob")
- (erc-sasl--options '((user . :nick) (password)))
+ (erc-sasl--options `((user . :nick) (password) (authfn . ,fn)))
(erc-networks--id (erc-networks--id-create 'GNU/chat)))
(should (string= (erc-sasl--read-password nil) "spam"))
- (should (equal (pop calls) '(:user "bob" :host "GNU/chat")))))
+ (should (equal (pop calls) '(:user "bob")))))
(ert-info ("Symbol as password, entry lacks user field")
(let ((erc-server-current-nick "fake")
- (erc-sasl--options '((user . :nick) (password . MyHost)))
+ (erc-sasl--options
+ `((user . :nick) (password . MyHost) (authfn . ,fn)))
(erc-networks--id (erc-networks--id-create 'GNU/chat)))
(should (string= (erc-sasl--read-password nil) "123"))
- (should (equal (pop calls) '(:user "fake" :host "MyHost"))))))))
+ (should (equal (pop calls) '(:user "fake" :host "MyHost")))))
+
+ (advice-remove 'erc-auth-source-search
+ 'erc-sasl--read-password--auth-source))))
(ert-deftest erc-sasl-create-client--plain ()
(let* ((erc-session-password "password123")
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index d82e2dae7aa..724cd63e222 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -1590,8 +1590,8 @@ the file watch."
(unwind-protect
(progn
(write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message)
- ;; Some systems, like MS Windows w/o sufficient privileges, do
- ;; not allow creation of symbolic links.
+ ;; Some systems, like MS Windows without sufficient
+ ;; privileges, do not allow creation of symbolic links.
(condition-case nil
(make-symbolic-link
file-notify--test-tmpfile1 file-notify--test-tmpfile)
diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el
index 9e359d5022f..8d7ac5eb8b1 100644
--- a/test/lisp/international/ucs-normalize-tests.el
+++ b/test/lisp/international/ucs-normalize-tests.el
@@ -59,7 +59,7 @@ And NORM is one of the symbols `NFC', `NFD', `NFKC', `NFKD' for brevity."
(NFD . ucs-normalize-NFD-region)
(NFKC . ucs-normalize-NFKC-region)
(NFKD . ucs-normalize-NFKD-region))))
- `(with-current-buffer ucs-normalize-tests--norm-buf
+ `(progn
(erase-buffer)
(insert ,str)
(,(cdr (assq norm norm-alist)) (point-min) (point-max))
@@ -74,7 +74,7 @@ And NORM is one of the symbols `NFC', `NFD', `NFKC', `NFKD' for brevity."
(NFD . ucs-normalize-NFD-region)
(NFKC . ucs-normalize-NFKC-region)
(NFKD . ucs-normalize-NFKD-region))))
- `(with-current-buffer ucs-normalize-tests--norm-buf
+ `(progn
(erase-buffer)
(insert ,char)
(,(cdr (assq norm norm-alist)) (point-min) (point-max))
@@ -90,36 +90,37 @@ The following invariants must be true for all conformant implementations..."
;; See `ucs-normalize-tests--rule2-holds-p'.
(aset ucs-normalize-tests--chars-part1
(aref source 0) 1))
- (and
- ;; c2 == toNFC(c1) == toNFC(c2) == toNFC(c3)
- (ucs-normalize-tests--normalization-equal-p NFC source nfc)
- (ucs-normalize-tests--normalization-equal-p NFC nfc nfc)
- (ucs-normalize-tests--normalization-equal-p NFC nfd nfc)
- ;; c4 == toNFC(c4) == toNFC(c5)
- (ucs-normalize-tests--normalization-equal-p NFC nfkc nfkc)
- (ucs-normalize-tests--normalization-equal-p NFC nfkd nfkc)
-
- ;; c3 == toNFD(c1) == toNFD(c2) == toNFD(c3)
- (ucs-normalize-tests--normalization-equal-p NFD source nfd)
- (ucs-normalize-tests--normalization-equal-p NFD nfc nfd)
- (ucs-normalize-tests--normalization-equal-p NFD nfd nfd)
- ;; c5 == toNFD(c4) == toNFD(c5)
- (ucs-normalize-tests--normalization-equal-p NFD nfkc nfkd)
- (ucs-normalize-tests--normalization-equal-p NFD nfkd nfkd)
-
- ;; c4 == toNFKC(c1) == toNFKC(c2) == toNFKC(c3) == toNFKC(c4) == toNFKC(c5)
- (ucs-normalize-tests--normalization-equal-p NFKC source nfkc)
- (ucs-normalize-tests--normalization-equal-p NFKC nfc nfkc)
- (ucs-normalize-tests--normalization-equal-p NFKC nfd nfkc)
- (ucs-normalize-tests--normalization-equal-p NFKC nfkc nfkc)
- (ucs-normalize-tests--normalization-equal-p NFKC nfkd nfkc)
-
- ;; c5 == toNFKD(c1) == toNFKD(c2) == toNFKD(c3) == toNFKD(c4) == toNFKD(c5)
- (ucs-normalize-tests--normalization-equal-p NFKD source nfkd)
- (ucs-normalize-tests--normalization-equal-p NFKD nfc nfkd)
- (ucs-normalize-tests--normalization-equal-p NFKD nfd nfkd)
- (ucs-normalize-tests--normalization-equal-p NFKD nfkc nfkd)
- (ucs-normalize-tests--normalization-equal-p NFKD nfkd nfkd)))
+ (with-current-buffer ucs-normalize-tests--norm-buf
+ (and
+ ;; c2 == toNFC(c1) == toNFC(c2) == toNFC(c3)
+ (ucs-normalize-tests--normalization-equal-p NFC source nfc)
+ (ucs-normalize-tests--normalization-equal-p NFC nfc nfc)
+ (ucs-normalize-tests--normalization-equal-p NFC nfd nfc)
+ ;; c4 == toNFC(c4) == toNFC(c5)
+ (ucs-normalize-tests--normalization-equal-p NFC nfkc nfkc)
+ (ucs-normalize-tests--normalization-equal-p NFC nfkd nfkc)
+
+ ;; c3 == toNFD(c1) == toNFD(c2) == toNFD(c3)
+ (ucs-normalize-tests--normalization-equal-p NFD source nfd)
+ (ucs-normalize-tests--normalization-equal-p NFD nfc nfd)
+ (ucs-normalize-tests--normalization-equal-p NFD nfd nfd)
+ ;; c5 == toNFD(c4) == toNFD(c5)
+ (ucs-normalize-tests--normalization-equal-p NFD nfkc nfkd)
+ (ucs-normalize-tests--normalization-equal-p NFD nfkd nfkd)
+
+ ;; c4 == toNFKC(c1) == toNFKC(c2) == toNFKC(c3) == toNFKC(c4) == toNFKC(c5)
+ (ucs-normalize-tests--normalization-equal-p NFKC source nfkc)
+ (ucs-normalize-tests--normalization-equal-p NFKC nfc nfkc)
+ (ucs-normalize-tests--normalization-equal-p NFKC nfd nfkc)
+ (ucs-normalize-tests--normalization-equal-p NFKC nfkc nfkc)
+ (ucs-normalize-tests--normalization-equal-p NFKC nfkd nfkc)
+
+ ;; c5 == toNFKD(c1) == toNFKD(c2) == toNFKD(c3) == toNFKD(c4) == toNFKD(c5)
+ (ucs-normalize-tests--normalization-equal-p NFKD source nfkd)
+ (ucs-normalize-tests--normalization-equal-p NFKD nfc nfkd)
+ (ucs-normalize-tests--normalization-equal-p NFKD nfd nfkd)
+ (ucs-normalize-tests--normalization-equal-p NFKD nfkc nfkd)
+ (ucs-normalize-tests--normalization-equal-p NFKD nfkd nfkd))))
(defsubst ucs-normalize-tests--rule2-holds-p (X)
"Check 2nd conformance rule.
@@ -127,7 +128,9 @@ For every code point X assigned in this version of Unicode that
is not specifically listed in Part 1, the following invariants
must be true for all conformant implementations:
- X == toNFC(X) == toNFD(X) == toNFKC(X) == toNFKD(X)"
+ X == toNFC(X) == toNFD(X) == toNFKC(X) == toNFKD(X)
+
+Must be called with `ucs-normalize-tests--norm-buf' as current buffer."
(and (ucs-normalize-tests--normalization-chareq-p NFC X X)
(ucs-normalize-tests--normalization-chareq-p NFD X X)
(ucs-normalize-tests--normalization-chareq-p NFKC X X)
@@ -230,20 +233,23 @@ must be true for all conformant implementations:
(defun ucs-normalize-tests--part1-rule2 (chars-part1)
(let ((reporter (make-progress-reporter "UCS Normalize Test Part1, rule 2"
- 0 (max-char)))
- (failed-chars nil))
- (map-char-table
- (lambda (char-range listed-in-part)
- (unless (eq listed-in-part 1)
- (if (characterp char-range)
- (progn (unless (ucs-normalize-tests--rule2-holds-p char-range)
- (push char-range failed-chars))
- (progress-reporter-update reporter char-range))
- (cl-loop for char from (car char-range) to (cdr char-range)
- unless (ucs-normalize-tests--rule2-holds-p char)
- do (push char failed-chars)
- do (progress-reporter-update reporter char)))))
- chars-part1)
+ 0 (max-char t)))
+ (failed-chars nil)
+ (unicode-max (max-char t)))
+ (with-current-buffer ucs-normalize-tests--norm-buf
+ (map-char-table
+ (lambda (char-range listed-in-part)
+ (unless (eq listed-in-part 1)
+ (if (characterp char-range)
+ (progn (unless (ucs-normalize-tests--rule2-holds-p char-range)
+ (push char-range failed-chars))
+ (progress-reporter-update reporter char-range))
+ (cl-loop for char from (car char-range) to (min (cdr char-range)
+ unicode-max)
+ unless (ucs-normalize-tests--rule2-holds-p char)
+ do (push char failed-chars)
+ do (progress-reporter-update reporter char)))))
+ chars-part1))
(progress-reporter-done reporter)
failed-chars))
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el
index f8a0aa03e32..d9eafc47ad7 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -123,7 +123,7 @@ the origin of the temporary TMPFILE, have no write permissions."
(defun tramp-archive--test-emacs27-p ()
"Check for Emacs version >= 27.1.
-Some semantics has been changed for there, w/o new functions or
+Some semantics has been changed for there, without new functions or
variables, so we check the Emacs version directly."
(>= emacs-major-version 27))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a79c47be723..79b2fc803d6 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5388,6 +5388,21 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
;; Cleanup.
(ignore-errors (delete-process proc)))))
+(ert-deftest tramp-test31-memory-info ()
+ "Check `memory-info'."
+ :tags '(:expensive-test)
+ (skip-unless (tramp--test-enabled))
+ (skip-unless (tramp--test-supports-processes-p))
+ ;; `memory-info' is supported since Emacs 29.1.
+ (skip-unless (tramp--test-emacs29-p))
+
+ (when-let ((default-directory ert-remote-temporary-file-directory)
+ (mi (memory-info)))
+ (should (consp mi))
+ (should (= (length mi) 4))
+ (dotimes (i (length mi))
+ (should (natnump (nth i mi))))))
+
(defun tramp--test-async-shell-command
(command output-buffer &optional error-buffer input)
"Like `async-shell-command', reading the output.
@@ -6582,20 +6597,20 @@ INPUT, if non-nil, is a string sent to the process."
(defun tramp--test-emacs27-p ()
"Check for Emacs version >= 27.1.
-Some semantics has been changed for there, w/o new functions or
-variables, so we check the Emacs version directly."
+Some semantics has been changed for there, without new functions
+or variables, so we check the Emacs version directly."
(>= emacs-major-version 27))
(defun tramp--test-emacs28-p ()
"Check for Emacs version >= 28.1.
-Some semantics has been changed for there, w/o new functions or
-variables, so we check the Emacs version directly."
+Some semantics has been changed for there, without new functions
+or variables, so we check the Emacs version directly."
(>= emacs-major-version 28))
(defun tramp--test-emacs29-p ()
"Check for Emacs version >= 29.1.
-Some semantics has been changed for there, w/o new functions or
-variables, so we check the Emacs version directly."
+Some semantics has been changed for there, without new functions
+or variables, so we check the Emacs version directly."
(>= emacs-major-version 29))
(defun tramp--test-adb-p ()
diff --git a/test/lisp/progmodes/project-tests.el b/test/lisp/progmodes/project-tests.el
index d4b6bca7e8f..c3b886873d3 100644
--- a/test/lisp/progmodes/project-tests.el
+++ b/test/lisp/progmodes/project-tests.el
@@ -110,4 +110,33 @@ When `project-ignores' includes a name matching project dir."
(list
(expand-file-name "some-file" dir)))))))
+(defvar project-tests--this-file (or (bound-and-true-p byte-compile-current-file)
+ (and load-in-progress load-file-name)
+ buffer-file-name))
+
+(ert-deftest project-vc-recognizes-git ()
+ "Check that Git repository is detected."
+ (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+ (let* ((vc-handled-backends '(Git))
+ (dir (file-name-directory project-tests--this-file))
+ (_ (vc-file-clearprops dir))
+ (project-vc-extra-root-markers nil)
+ (project (project-current nil dir)))
+ (should-not (null project))
+ (should (string-match-p
+ "\\`test/lisp/progmodes/project-tests\\.elc?"
+ (file-relative-name
+ project-tests--this-file
+ (project-root project))))))
+
+(ert-deftest project-vc-extra-root-markers-supports-wildcards ()
+ "Check that one can add wildcard entries."
+ (skip-unless (eq (vc-responsible-backend default-directory) 'Git))
+ (let* ((dir (file-name-directory project-tests--this-file))
+ (_ (vc-file-clearprops dir))
+ (project-vc-extra-root-markers '("files-x-tests.*"))
+ (project (project-current nil dir)))
+ (should-not (null project))
+ (should (string-match-p "/test/lisp/\\'" (project-root project)))))
+
;;; project-tests.el ends here
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index f871b7bc7d9..17d6d8aa706 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -280,28 +280,33 @@ aliqua."
"a, b, c = 1, 2, 3"
'((1 . font-lock-variable-name-face) (2)
(4 . font-lock-variable-name-face) (5)
- (7 . font-lock-variable-name-face) (8))))
+ (7 . font-lock-variable-name-face) (8)
+ (9 . font-lock-operator-face) (10))))
(ert-deftest python-font-lock-assignment-statement-2 ()
(python-tests-assert-faces
"a, *b, c = 1, 2, 3, 4, 5"
'((1 . font-lock-variable-name-face) (2)
+ (4 . font-lock-operator-face)
(5 . font-lock-variable-name-face) (6)
- (8 . font-lock-variable-name-face) (9))))
+ (8 . font-lock-variable-name-face) (9)
+ (10 . font-lock-operator-face) (11))))
(ert-deftest python-font-lock-assignment-statement-3 ()
(python-tests-assert-faces
"[a, b] = (1, 2)"
'((1)
(2 . font-lock-variable-name-face) (3)
- (5 . font-lock-variable-name-face) (6))))
+ (5 . font-lock-variable-name-face) (6)
+ (8 . font-lock-operator-face) (9))))
(ert-deftest python-font-lock-assignment-statement-4 ()
(python-tests-assert-faces
"(l[1], l[2]) = (10, 11)"
'((1)
(2 . font-lock-variable-name-face) (3)
- (8 . font-lock-variable-name-face) (9))))
+ (8 . font-lock-variable-name-face) (9)
+ (14 . font-lock-operator-face) (15))))
(ert-deftest python-font-lock-assignment-statement-5 ()
(python-tests-assert-faces
@@ -310,22 +315,29 @@ aliqua."
(2 . font-lock-variable-name-face) (3)
(5 . font-lock-variable-name-face) (6)
(8 . font-lock-variable-name-face) (9)
+ (11 . font-lock-operator-face)
(12 . font-lock-variable-name-face) (13)
+ (15 . font-lock-operator-face) (16)
+ (17 . font-lock-operator-face)
(18 . font-lock-variable-name-face) (19)
- (21 . font-lock-variable-name-face) (22))))
+ (21 . font-lock-variable-name-face) (22)
+ (23 . font-lock-operator-face) (24))))
(ert-deftest python-font-lock-assignment-statement-6 ()
(python-tests-assert-faces
"(a,) = 'foo',"
'((1)
(2 . font-lock-variable-name-face) (3)
+ (6 . font-lock-operator-face) (7)
(8 . font-lock-string-face) (13))))
(ert-deftest python-font-lock-assignment-statement-7 ()
(python-tests-assert-faces
"(*a,) = ['foo', 'bar', 'baz']"
'((1)
+ (2 . font-lock-operator-face)
(3 . font-lock-variable-name-face) (4)
+ (7 . font-lock-operator-face) (8)
(10 . font-lock-string-face) (15)
(17 . font-lock-string-face) (22)
(24 . font-lock-string-face) (29))))
@@ -334,6 +346,7 @@ aliqua."
(python-tests-assert-faces
"d = D('a', ['b'], 'c')"
'((1 . font-lock-variable-name-face) (2)
+ (3 . font-lock-operator-face) (4)
(7 . font-lock-string-face) (10)
(13 . font-lock-string-face) (16)
(19 . font-lock-string-face) (22))))
@@ -344,7 +357,9 @@ aliqua."
'((1)
(3 . font-lock-variable-name-face) (4)
(8 . font-lock-variable-name-face) (9)
+ (14 . font-lock-operator-face) (15)
(17 . font-lock-variable-name-face) (18)
+ (19 . font-lock-operator-face) (20)
(21 . font-lock-string-face) (24)
(26 . font-lock-string-face) (29)
(31 . font-lock-string-face) (34)
@@ -355,7 +370,8 @@ aliqua."
(python-tests-assert-faces
"a: int = 5"
'((1 . font-lock-variable-name-face) (2)
- (4 . font-lock-builtin-face) (7))))
+ (4 . font-lock-builtin-face) (7)
+ (8 . font-lock-operator-face) (9))))
(ert-deftest python-font-lock-assignment-statement-11 ()
(python-tests-assert-faces
@@ -364,13 +380,15 @@ aliqua."
(19 . font-lock-builtin-face) (22)
(40 . font-lock-builtin-face) (43)
(46 . font-lock-builtin-face) (49)
+ (52 . font-lock-operator-face) (53)
(55 . font-lock-constant-face) (59)
(61 . font-lock-string-face) (66))))
(ert-deftest python-font-lock-assignment-statement-12 ()
(python-tests-assert-faces
"c: Collection = {1, 2, 3}"
- '((1 . font-lock-variable-name-face) (2))))
+ '((1 . font-lock-variable-name-face) (2)
+ (15 . font-lock-operator-face) (16))))
(ert-deftest python-font-lock-assignment-statement-13 ()
(python-tests-assert-faces
@@ -378,6 +396,7 @@ aliqua."
'((1 . font-lock-variable-name-face) (2)
(12 . font-lock-builtin-face) (15)
(17 . font-lock-builtin-face) (20)
+ (22 . font-lock-operator-face) (23)
(28 . font-lock-string-face) (33)
(38 . font-lock-string-face) (43))))
@@ -386,28 +405,38 @@ aliqua."
"(a) = 5; (b) = 6"
'((1)
(2 . font-lock-variable-name-face) (3)
- (11 . font-lock-variable-name-face) (12))))
+ (5 . font-lock-operator-face) (6)
+ (11 . font-lock-variable-name-face) (12)
+ (14 . font-lock-operator-face) (15))))
(ert-deftest python-font-lock-assignment-statement-15 ()
(python-tests-assert-faces
"[a] = 5,; [b] = 6,"
'((1)
(2 . font-lock-variable-name-face) (3)
- (12 . font-lock-variable-name-face) (13))))
+ (5 . font-lock-operator-face) (6)
+ (12 . font-lock-variable-name-face) (13)
+ (15 . font-lock-operator-face) (16))))
(ert-deftest python-font-lock-assignment-statement-16 ()
(python-tests-assert-faces
"[*a] = 5, 6; [*b] = 7, 8"
'((1)
+ (2 . font-lock-operator-face)
(3 . font-lock-variable-name-face) (4)
- (16 . font-lock-variable-name-face) (17))))
+ (6 . font-lock-operator-face) (7)
+ (15 . font-lock-operator-face)
+ (16 . font-lock-variable-name-face) (17)
+ (19 . font-lock-operator-face) (20))))
(ert-deftest python-font-lock-assignment-statement-17 ()
(python-tests-assert-faces
"(a) = (b) = 1"
- `((1)
+ '((1)
(2 . font-lock-variable-name-face) (3)
- (8 . font-lock-variable-name-face) (9))))
+ (5 . font-lock-operator-face) (6)
+ (8 . font-lock-variable-name-face) (9)
+ (11 . font-lock-operator-face) (12))))
(ert-deftest python-font-lock-assignment-statement-18 ()
(python-tests-assert-faces
@@ -420,13 +449,21 @@ def f(x: CustomInt) -> CustomInt:
return res
"
'((1 . font-lock-variable-name-face) (10)
+ (11 . font-lock-operator-face) (12)
(13 . font-lock-builtin-face) (16)
(18 . font-lock-keyword-face) (21)
(22 . font-lock-function-name-face) (23)
+ (38 . font-lock-operator-face) (40)
(56 . font-lock-variable-name-face) (57)
+ (58 . font-lock-operator-face) (59)
+ (62 . font-lock-operator-face) (63)
(70 . font-lock-variable-name-face) (72)
+ (94 . font-lock-operator-face) (95)
+ (102 . font-lock-operator-face) (103)
(111 . font-lock-variable-name-face) (114)
+ (126 . font-lock-operator-face) (127)
(128 . font-lock-builtin-face) (131)
+ (136 . font-lock-operator-face) (137)
(144 . font-lock-keyword-face) (150))))
(ert-deftest python-font-lock-assignment-statement-multiline-1 ()
@@ -442,7 +479,8 @@ def f(x: CustomInt) -> CustomInt:
"
'((1)
(8 . font-lock-variable-name-face) (9)
- (15 . font-lock-variable-name-face) (16))
+ (15 . font-lock-variable-name-face) (16)
+ (19 . font-lock-operator-face) (20))
"#" "="))
(ert-deftest python-font-lock-assignment-statement-multiline-2 ()
@@ -453,7 +491,9 @@ def f(x: CustomInt) -> CustomInt:
] # 5, 6
"
'((1)
- (9 . font-lock-variable-name-face) (10))
+ (8 . font-lock-operator-face)
+ (9 . font-lock-variable-name-face) (10)
+ (13 . font-lock-operator-face) (14))
"#" "="))
(ert-deftest python-font-lock-assignment-statement-multiline-3 ()
@@ -471,7 +511,8 @@ def f(x: CustomInt) -> CustomInt:
3"
'((1 . font-lock-variable-name-face) (2)
(15 . font-lock-variable-name-face) (16)
- (29 . font-lock-variable-name-face) (30))
+ (29 . font-lock-variable-name-face) (30)
+ (36 . font-lock-operator-face) (37))
"#" "="))
(ert-deftest python-font-lock-assignment-statement-multiline-4 ()
@@ -482,7 +523,8 @@ def f(x: CustomInt) -> CustomInt:
#\\
5"
'((1 . font-lock-variable-name-face) (2)
- (15 . font-lock-builtin-face) (18))
+ (15 . font-lock-builtin-face) (18)
+ (24 . font-lock-operator-face) (25))
"#" "="))
(ert-deftest python-font-lock-assignment-statement-multiline-5 ()
@@ -500,7 +542,9 @@ def f(x: CustomInt) -> CustomInt:
6"
'((1)
(8 . font-lock-variable-name-face) (9)
- (46 . font-lock-variable-name-face) (47))
+ (18 . font-lock-operator-face) (19)
+ (46 . font-lock-variable-name-face) (47)
+ (60 . font-lock-operator-face) (61))
"#" "="))
(ert-deftest python-font-lock-assignment-statement-multiline-6 ()
@@ -518,9 +562,33 @@ def f(x: CustomInt) -> CustomInt:
6"
'((1)
(7 . font-lock-variable-name-face) (8)
- (43 . font-lock-variable-name-face) (44))
+ (16 . font-lock-operator-face) (17)
+ (43 . font-lock-variable-name-face) (44)
+ (56 . font-lock-operator-face) (57))
"#" "="))
+(ert-deftest python-font-lock-operator-1 ()
+ (python-tests-assert-faces
+ "1 << 2 ** 3 == +4%-5|~6&7^8%9"
+ '((1)
+ (3 . font-lock-operator-face) (5)
+ (8 . font-lock-operator-face) (10)
+ (13 . font-lock-operator-face) (15)
+ (16 . font-lock-operator-face) (17)
+ (18 . font-lock-operator-face) (20)
+ (21 . font-lock-operator-face) (23)
+ (24 . font-lock-operator-face) (25)
+ (26 . font-lock-operator-face) (27)
+ (28 . font-lock-operator-face) (29))))
+
+(ert-deftest python-font-lock-operator-2 ()
+ "Keyword operators are font-locked as keywords."
+ (python-tests-assert-faces
+ "is_ is None"
+ '((1)
+ (5 . font-lock-keyword-face) (7)
+ (8 . font-lock-constant-face))))
+
(ert-deftest python-font-lock-escape-sequence-string-newline ()
(python-tests-assert-faces
"'\\n'
@@ -603,12 +671,16 @@ u\"\\n\""
(196 . font-lock-constant-face)
(215 . font-lock-string-face) (218)
(221 . font-lock-string-face) (254)
+ (259 . font-lock-operator-face) (260)
(271 . font-lock-string-face) (274)
(277 . font-lock-string-face) (310)
+ (315 . font-lock-operator-face) (316)
(327 . font-lock-string-face) (330)
(333 . font-lock-string-face) (366)
+ (371 . font-lock-operator-face) (372)
(383 . font-lock-string-face) (386)
(389 . font-lock-string-face) (422)
+ (427 . font-lock-operator-face) (428)
(439 . font-lock-string-face) (442)
(444 . font-lock-string-face) (497)
(499 . font-lock-string-face) (552)
@@ -4566,6 +4638,11 @@ import abc
(ert-deftest python-ffap-module-path-1 ()
(skip-unless (executable-find python-tests-shell-interpreter))
+ ;; Skip the test on macOS, since the standard Python installation uses
+ ;; libedit rather than readline which confuses the running of an inferior
+ ;; interpreter in this case (see bug#59477 and bug#25753).
+ (skip-unless (not (eq system-type 'darwin)))
+ (trace-function 'python-shell-output-filter)
(python-tests-with-temp-buffer-with-shell
"
import abc
diff --git a/test/lisp/server-tests.el b/test/lisp/server-tests.el
index f8ecd046f2b..ebf84481c61 100644
--- a/test/lisp/server-tests.el
+++ b/test/lisp/server-tests.el
@@ -21,9 +21,11 @@
(require 'ert)
(require 'server)
+(require 'cl-lib)
(defconst server-tests/can-create-frames-p
- (not (memq system-type '(windows-nt ms-dos)))
+ (and (not (memq system-type '(windows-nt ms-dos)))
+ (not (member (getenv "TERM") '("dumb" "" nil))))
"Non-nil if we can create a new frame in the tests.
Some tests below need to create new frames for the emacsclient.
However, this doesn't work on all platforms. In particular,
@@ -188,8 +190,9 @@ tests that `server-force-stop' doesn't delete frames (and even
then, requires a few tricks to run as a regression test). So
long as this works, the problem in bug#58877 shouldn't occur."
(skip-unless server-tests/can-create-frames-p)
- (let ((starting-frame-count (length (frame-list)))
- terminal)
+ (let* ((starting-frames (frame-list))
+ (starting-frame-count (length starting-frames))
+ terminal)
(unwind-protect
(server-tests/with-server
(server-tests/with-client emacsclient '("-c") 'exit
@@ -214,6 +217,9 @@ long as this works, the problem in bug#58877 shouldn't occur."
(when (and terminal
(eq (terminal-live-p terminal) t)
(not (eq system-type 'windows-nt)))
- (delete-terminal terminal)))))
+ (delete-terminal terminal)))
+ ;; Delete the created frame.
+ (delete-frame (car (cl-set-difference (frame-list) starting-frames))
+ t)))
;;; server-tests.el ends here
diff --git a/test/manual/cedet/cedet-utests.el b/test/manual/cedet/cedet-utests.el
index b365908c639..2c5ba46855d 100644
--- a/test/manual/cedet/cedet-utests.el
+++ b/test/manual/cedet/cedet-utests.el
@@ -333,7 +333,8 @@ ERRORCONDITION is some error that may have occurred during testing."
"Add into the log that the last item is done.
Apply NOTES to the doneness of the log.
Apply ERR if there was an error in previous item.
-Optional argument PRECR indicates to prefix the done msg w/ a newline."
+Optional argument PRECR indicates to prefix the done message with
+a newline."
(if noninteractive
;; Non-interactive-mode - show a message.
(if notes
diff --git a/test/manual/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el
index dcdeb45b0a3..1d0e668d96f 100644
--- a/test/manual/cedet/semantic-tests.el
+++ b/test/manual/cedet/semantic-tests.el
@@ -87,7 +87,8 @@ run the test again")))
(defun semanticdb-test-gnu-global (searchfor &optional standardfile)
"Test the GNU Global semanticdb.
Argument SEARCHFOR is the text to search for.
-If optional arg STANDARDFILE is non-nil, use a standard file w/ global enabled."
+If optional arg STANDARDFILE is non-nil, use a standard file with
+global enabled."
(interactive "sSearch For Tag: \nP")
(require 'data-debug)
diff --git a/test/manual/cedet/tests/testpolymorph.cpp b/test/manual/cedet/tests/testpolymorph.cpp
index ba64e39a7a5..cfe44ecc4d3 100644
--- a/test/manual/cedet/tests/testpolymorph.cpp
+++ b/test/manual/cedet/tests/testpolymorph.cpp
@@ -22,7 +22,7 @@
#include <cmath>
-// Test 1 - Functions w/ prototypes
+// Test 1 - Functions with prototypes
namespace proto {
int pt_func1(int arg1);
@@ -32,7 +32,7 @@ namespace proto {
}
-// Test 2 - Functions w/ different arg lists.
+// Test 2 - Functions with different arg lists.
namespace fcn_poly {
int pm_func(void) {
@@ -50,7 +50,7 @@ namespace fcn_poly {
}
-// Test 3 - Methods w/ different arg lists.
+// Test 3 - Methods with different arg lists.
class meth_poly {
public:
int pm_meth(void) {
@@ -68,7 +68,7 @@ public:
};
-// Test 4 - Templates w/ partial specifiers.
+// Test 4 - Templates with partial specifiers.
namespace template_partial_spec {
template <typename T> class test
{
@@ -83,7 +83,7 @@ namespace template_partial_spec {
};
}
-// Test 5 - Templates w/ full specialization which may or may not share
+// Test 5 - Templates with full specialization which may or may not share
// common functions.
namespace template_full_spec {
template <typename T> class test
diff --git a/test/manual/cedet/tests/testsppreplace.c b/test/manual/cedet/tests/testsppreplace.c
index 54ae3f0323e..d255c202d35 100644
--- a/test/manual/cedet/tests/testsppreplace.c
+++ b/test/manual/cedet/tests/testsppreplace.c
@@ -66,7 +66,7 @@ int myFcn3 (int a, int b);
MULTI_ARGS(ma_struct, moose, penguin, emu);
-/* TEST: Macro w/ args, but no body. */
+/* TEST: Macro with args, but no body. */
#define NO_BODY(name)
NO_BODY(Moose);
@@ -78,7 +78,7 @@ int not_with_args_fcn NOT_WITH_ARGS
{
}
-/* TEST: macro w/ continuation. */
+/* TEST: macro with continuation. */
#define WITH_CONT \
continuation_symbol
diff --git a/test/manual/cedet/tests/testsppreplaced.c b/test/manual/cedet/tests/testsppreplaced.c
index c359fa7d690..c98349174e5 100644
--- a/test/manual/cedet/tests/testsppreplaced.c
+++ b/test/manual/cedet/tests/testsppreplaced.c
@@ -55,14 +55,14 @@ int myFcn3 (int a, int b);
/* TEST: Multiple args to a macro. */
struct ma_struct { int moose; int penguin; int emu; };
-/* TEST: Macro w/ args, but no body. */
+/* TEST: Macro with args, but no body. */
/* TEST: Not a macro with args, but close. */
int not_with_args_fcn (moose)
{
}
-/* TEST: macro w/ continuation. */
+/* TEST: macro with continuation. */
int continuation_symbol () { };
/* TEST: macros in a macro - tail processing */
diff --git a/test/manual/etags/CTAGS.good_crlf b/test/manual/etags/CTAGS.good_crlf
new file mode 100644
index 00000000000..3d64fa63c7a
--- /dev/null
+++ b/test/manual/etags/CTAGS.good_crlf
@@ -0,0 +1,4484 @@
+#a-defer-word forth-src/test-forth.fth /^defer #a-defer-word$/
+#some-storage forth-src/test-forth.fth /^2000 buffer: #some-storage$/
+$0x80 c-src/sysdep.h 32
+$SYS_##syscall_na c-src/sysdep.h 31
+$domain php-src/lce_functions.php 175
+$filename php-src/lce_functions.php 174
+$ignore_ws php-src/lce_functions.php 171
+$memassign php-src/ptest.php 9
+$memassign_space php-src/ptest.php 10
+$member php-src/ptest.php 8
+$msgid php-src/lce_functions.php 107
+$msgid php-src/lce_functions.php 165
+$msgid_lc php-src/lce_functions.php 113
+$msgstr php-src/lce_functions.php 108
+$msgstr php-src/lce_functions.php 166
+$msgstr_lc php-src/lce_functions.php 114
+$po_entries php-src/lce_functions.php 172
+$poe_num php-src/lce_functions.php 173
+$por_a php-src/lce_functions.php 500
+$prefix php-src/lce_functions.php 72
+$state php-src/lce_functions.php 170
+$sys_comment php-src/lce_functions.php 110
+$sys_comment php-src/lce_functions.php 168
+$sys_comment_lc php-src/lce_functions.php 116
+$test php-src/ptest.php 12
+$unk_comment php-src/lce_functions.php 111
+$unk_comment php-src/lce_functions.php 169
+$unk_comment_lc php-src/lce_functions.php 117
+$user_comment php-src/lce_functions.php 109
+$user_comment php-src/lce_functions.php 167
+$user_comment_lc php-src/lce_functions.php 115
+${CHECKOBJS} make-src/Makefile /^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/
+%cdiff make-src/Makefile /^%cdiff: CTAGS% CTAGS ${infiles}$/
+%ediff make-src/Makefile /^%ediff: ETAGS% ETAGS ${infiles}$/
+($_,$flag,$opt,$f,$r,@temp perl-src/yagrip.pl 8
+($prog,$_,@list perl-src/yagrip.pl 39
+($string,$flag,@string,@temp,@last perl-src/yagrip.pl 40
+(a-forth-constant forth-src/test-forth.fth /^constant (a-forth-constant$/
+(another-forth-word) forth-src/test-forth.fth /^: (another-forth-word) ( -- )$/
+(foo) forth-src/test-forth.fth /^: (foo) 1 ;$/
++ ruby-src/test.rb /^ def +(y)$/
++ tex-src/texinfo.tex /^\\def+{{\\tt \\char 43}}$/
+.PRECIOUS make-src/Makefile /^.PRECIOUS: ETAGS CTAGS ETAGS16 CTAGS16 ETAGS17 CTA/
+/.notdef ps-src/rfc1245.ps /^\/.notdef \/.notdef \/.notdef \/.notdef \/.notdef \/.not/
+/.notdef ps-src/rfc1245.ps /^\/.notdef \/.notdef \/.notdef \/.notdef \/space \/exclam/
+/A ps-src/rfc1245.ps /^\/A { $/
+/Acircumflex ps-src/rfc1245.ps /^\/Acircumflex \/Ecircumflex \/Aacute \/Edieresis \/Egra/
+/B ps-src/rfc1245.ps /^\/B { $/
+/BEGINBITMAP2BIT ps-src/rfc1245.ps /^\/BEGINBITMAP2BIT { $/
+/BEGINBITMAP2BITc ps-src/rfc1245.ps /^\/BEGINBITMAP2BITc { $/
+/BEGINBITMAPBW ps-src/rfc1245.ps /^\/BEGINBITMAPBW { $/
+/BEGINBITMAPBWc ps-src/rfc1245.ps /^\/BEGINBITMAPBWc { $/
+/BEGINBITMAPGRAY ps-src/rfc1245.ps /^\/BEGINBITMAPGRAY { $/
+/BEGINBITMAPGRAYc ps-src/rfc1245.ps /^\/BEGINBITMAPGRAYc { $/
+/BEGINPRINTCODE ps-src/rfc1245.ps /^\/BEGINPRINTCODE { $/
+/BF ps-src/rfc1245.ps /^\/BF { $/
+/BITMAPCOLOR ps-src/rfc1245.ps /^\/BITMAPCOLOR { $/
+/BITMAPCOLORc ps-src/rfc1245.ps /^\/BITMAPCOLORc { $/
+/BITMAPGRAY ps-src/rfc1245.ps /^\/BITMAPGRAY { $/
+/BITMAPGRAYc ps-src/rfc1245.ps /^\/BITMAPGRAYc { $/
+/C ps-src/rfc1245.ps /^\/C { $/
+/COMMONBITMAP ps-src/rfc1245.ps /^\/COMMONBITMAP { $/
+/COMMONBITMAPc ps-src/rfc1245.ps /^\/COMMONBITMAPc { $/
+/D ps-src/rfc1245.ps /^\/D {curveto} bind def$/
+/DiacriticEncoding ps-src/rfc1245.ps /^\/DiacriticEncoding [$/
+/E ps-src/rfc1245.ps /^\/E {lineto} bind def$/
+/ENDBITMAP ps-src/rfc1245.ps /^\/ENDBITMAP {$/
+/ENDPRINTCODE ps-src/rfc1245.ps /^\/ENDPRINTCODE {$/
+/F ps-src/rfc1245.ps /^\/F { $/
+/FMBEGINEPSF ps-src/rfc1245.ps /^\/FMBEGINEPSF { $/
+/FMBEGINPAGE ps-src/rfc1245.ps /^\/FMBEGINPAGE { $/
+/FMDEFINEFONT ps-src/rfc1245.ps /^\/FMDEFINEFONT { $/
+/FMDOCUMENT ps-src/rfc1245.ps /^\/FMDOCUMENT { $/
+/FMENDEPSF ps-src/rfc1245.ps /^\/FMENDEPSF {$/
+/FMENDPAGE ps-src/rfc1245.ps /^\/FMENDPAGE {$/
+/FMLOCAL ps-src/rfc1245.ps /^\/FMLOCAL {$/
+/FMNORMALIZEGRAPHICS ps-src/rfc1245.ps /^\/FMNORMALIZEGRAPHICS { $/
+/FMVERSION ps-src/rfc1245.ps /^\/FMVERSION {$/
+/FMversion ps-src/rfc1245.ps /^\/FMversion (2.0) def $/
+/Fmcc ps-src/rfc1245.ps /^\/Fmcc {$/
+/FrameDict ps-src/rfc1245.ps /^\/FrameDict 190 dict def $/
+/G ps-src/rfc1245.ps /^\/G { $/
+/H ps-src/rfc1245.ps /^\/H { $/
+/Icircumflex ps-src/rfc1245.ps /^\/Icircumflex \/Idieresis \/Igrave \/Oacute \/Ocircumfl/
+/L ps-src/rfc1245.ps /^\/L \/M \/N \/O \/P \/Q \/R \/S \/T \/U \/V \/W \/X \/Y \/Z \/brac/
+/L ps-src/rfc1245.ps /^\/L { $/
+/M ps-src/rfc1245.ps /^\/M {newpath moveto} bind def$/
+/N ps-src/rfc1245.ps /^\/N { $/
+/Ntilde ps-src/rfc1245.ps /^\/Ntilde \/Odieresis \/Udieresis \/aacute \/agrave \/aci/
+/O ps-src/rfc1245.ps /^\/O {closepath} bind def$/
+/Otilde ps-src/rfc1245.ps /^\/Otilde \/OE \/oe \/endash \/emdash \/quotedblleft \/quo/
+/P ps-src/rfc1245.ps /^\/P { $/
+/PF ps-src/rfc1245.ps /^\/PF { $/
+/R ps-src/rfc1245.ps /^\/R { $/
+/RF ps-src/rfc1245.ps /^\/RF { $/
+/RR ps-src/rfc1245.ps /^\/RR { $/
+/ReEncode ps-src/rfc1245.ps /^\/ReEncode { $/
+/S ps-src/rfc1245.ps /^\/S { $/
+/SF ps-src/rfc1245.ps /^\/SF { $/
+/T ps-src/rfc1245.ps /^\/T { $/
+/TF ps-src/rfc1245.ps /^\/TF { $/
+/U ps-src/rfc1245.ps /^\/U { $/
+/Uacute ps-src/rfc1245.ps /^\/Uacute \/Ucircumflex \/Ugrave \/dotlessi \/circumflex/
+/V ps-src/rfc1245.ps /^\/V { $/
+/W ps-src/rfc1245.ps /^\/W { $/
+/X ps-src/rfc1245.ps /^\/X { $/
+/Y ps-src/rfc1245.ps /^\/Y { $/
+/Z ps-src/rfc1245.ps /^\/Z {$/
+/atilde ps-src/rfc1245.ps /^\/atilde \/aring \/ccedilla \/eacute \/egrave \/ecircumf/
+/bl ps-src/rfc1245.ps /^\/bl { $/
+/braceright ps-src/rfc1245.ps /^\/braceright \/asciitilde \/.notdef \/Adieresis \/Aring/
+/bracketright ps-src/rfc1245.ps /^\/bracketright \/asciicircum \/underscore \/grave \/a \//
+/breve ps-src/rfc1245.ps /^\/breve \/dotaccent \/ring \/cedilla \/hungarumlaut \/og/
+/cfs ps-src/rfc1245.ps /^\/cfs { $/
+/colorsetup ps-src/rfc1245.ps /^\/colorsetup {$/
+/desperatepapersize ps-src/rfc1245.ps /^\/desperatepapersize {$/
+/dieresis ps-src/rfc1245.ps /^\/dieresis \/.notdef \/AE \/Oslash \/.notdef \/.notdef \//
+/dmatrix ps-src/rfc1245.ps /^\/dmatrix matrix def$/
+/dnormalize ps-src/rfc1245.ps /^\/dnormalize {$/
+/dpi ps-src/rfc1245.ps /^\/dpi 72 0 dmatrix defaultmatrix dtransform$/
+/exclamdown ps-src/rfc1245.ps /^\/exclamdown \/logicalnot \/.notdef \/florin \/.notdef /
+/fakecolorsetup ps-src/rfc1245.ps /^\/fakecolorsetup {$/
+/fillprocs ps-src/rfc1245.ps /^\/fillprocs 32 array def$/
+/fl ps-src/rfc1245.ps /^\/fl { $/
+/fraction ps-src/rfc1245.ps /^\/fraction \/currency \/guilsinglleft \/guilsinglright/
+/freq ps-src/rfc1245.ps /^\/freq dpi 18.75 div 8 div round dup 0 eq {pop 1} i/
+/gn ps-src/rfc1245.ps /^\/gn { $/
+/graymode ps-src/rfc1245.ps /^\/graymode true def$/
+/grayness ps-src/rfc1245.ps /^\/grayness {$/
+/guillemotleft ps-src/rfc1245.ps /^\/guillemotleft \/guillemotright \/ellipsis \/.notdef /
+/home/www/pub/etags.c.gz make-src/Makefile /^\/home\/www\/pub\/etags.c.gz: etags.c$/
+/home/www/pub/software/unix/etags.tar.gz make-src/Makefile /^\/home\/www\/pub\/software\/unix\/etags.tar.gz: Makefile/
+/hx ps-src/rfc1245.ps /^\/hx { $/
+/i ps-src/rfc1245.ps /^\/i \/j \/k \/l \/m \/n \/o \/p \/q \/r \/s \/t \/u \/v \/w \/x \/y/
+/iacute ps-src/rfc1245.ps /^\/iacute \/igrave \/icircumflex \/idieresis \/ntilde \/o/
+/ic ps-src/rfc1245.ps /^\/ic [ $/
+/inch ps-src/rfc1245.ps /^\/inch {72 mul} def$/
+/ip ps-src/rfc1245.ps /^\/ip { $/
+/less ps-src/rfc1245.ps /^\/less \/equal \/greater \/question \/at \/A \/B \/C \/D \/E/
+/lnormalize ps-src/rfc1245.ps /^\/lnormalize { $/
+/manualpapersize ps-src/rfc1245.ps /^\/manualpapersize {$/
+/max ps-src/rfc1245.ps /^\/max {2 copy lt {exch} if pop} bind def$/
+/min ps-src/rfc1245.ps /^\/min {2 copy gt {exch} if pop} bind def$/
+/ms ps-src/rfc1245.ps /^\/ms { $/
+/nbluet ps-src/rfc1245.ps /^\/nbluet 256 array def$/
+/ngrayt ps-src/rfc1245.ps /^\/ngrayt 256 array def$/
+/ngreent ps-src/rfc1245.ps /^\/ngreent 256 array def$/
+/normalize ps-src/rfc1245.ps /^\/normalize {$/
+/nredt ps-src/rfc1245.ps /^\/nredt 256 array def$/
+/numbersign ps-src/rfc1245.ps /^\/numbersign \/dollar \/percent \/ampersand \/quotesing/
+/ocircumflex ps-src/rfc1245.ps /^\/ocircumflex \/odieresis \/otilde \/uacute \/ugrave \/u/
+/ordfeminine ps-src/rfc1245.ps /^\/ordfeminine \/ordmasculine \/.notdef \/ae \/oslash \/q/
+/pagedimen ps-src/rfc1245.ps /^\/pagedimen { $/
+/papersize ps-src/rfc1245.ps /^\/papersize {$/
+/paragraph ps-src/rfc1245.ps /^\/paragraph \/germandbls \/registered \/copyright \/tra/
+/parenright ps-src/rfc1245.ps /^\/parenright \/asterisk \/plus \/comma \/hyphen \/period/
+/periodcentered ps-src/rfc1245.ps /^\/periodcentered \/quotesinglbase \/quotedblbase \/per/
+/quoteleft ps-src/rfc1245.ps /^\/quoteleft \/quoteright \/.notdef \/.notdef \/ydieresi/
+/restorematrix ps-src/rfc1245.ps /^\/restorematrix {$/
+/s1 ps-src/rfc1245.ps /^\/s1 1 string def$/
+/sangle ps-src/rfc1245.ps /^\/sangle 1 0 dmatrix defaultmatrix dtransform exch /
+/savematrix ps-src/rfc1245.ps /^\/savematrix {$/
+/setmanualfeed ps-src/rfc1245.ps /^\/setmanualfeed {$/
+/setpapername ps-src/rfc1245.ps /^\/setpapername { $/
+/setpattern ps-src/rfc1245.ps /^\/setpattern {$/
+/two ps-src/rfc1245.ps /^\/two \/three \/four \/five \/six \/seven \/eight \/nine \//
+/udieresis ps-src/rfc1245.ps /^\/udieresis \/dagger \/.notdef \/cent \/sterling \/secti/
+/wbytes ps-src/rfc1245.ps /^\/wbytes { $/
+/wh ps-src/rfc1245.ps /^\/wh { $/
+/yen ps-src/rfc1245.ps /^\/yen \/.notdef \/.notdef \/.notdef \/.notdef \/.notdef /
+2const forth-src/test-forth.fth /^3 4 2constant 2const$/
+2val forth-src/test-forth.fth /^2const 2value 2val$/
+2var forth-src/test-forth.fth /^2variable 2var$/
+:a-forth-dictionary-entry forth-src/test-forth.fth /^create :a-forth-dictionary-entry$/
+< tex-src/texinfo.tex /^\\def<{{\\tt \\less}}$/
+<< ruby-src/test.rb /^ def <<(y)$/
+<= ruby-src/test.rb /^ def <=(y)$/
+<=> ruby-src/test.rb /^ def <=>(y)$/
+= tex-src/texinfo.tex /^\\global\\def={{\\tt \\char 61}}}$/
+= tex-src/texinfo.tex /^\\global\\let\\section = \\appendixsec$/
+= tex-src/texinfo.tex /^\\global\\let\\section = \\numberedsec$/
+= tex-src/texinfo.tex /^\\global\\let\\section = \\unnumberedsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsection = \\appendixsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsection = \\numberedsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsection = \\unnumberedsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsubsection = \\appendixsubsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsubsection = \\numberedsubsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsubsection = \\unnumberedsubsubsec$/
+=/f ada-src/etags-test-for.ada /^ function "=" (L, R : System.Address) return Boo/
+== ruby-src/test.rb /^ def ==(y)$/
+=== ruby-src/test.rb /^ def ===(y)$/
+=\indexdummyfont tex-src/texinfo.tex /^\\let\\cite=\\indexdummyfont$/
+=\relax tex-src/texinfo.tex /^\\let\\appendix=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\chapter=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\section=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\subsection=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\subsubsection=\\relax$/
+=\smartitalic tex-src/texinfo.tex /^\\let\\cite=\\smartitalic$/
+=starts-with-equals! scm-src/test.scm /^(define =starts-with-equals! #t)$/
+> tex-src/texinfo.tex /^\\def>{{\\tt \\gtr}}$/
+>field1 forth-src/test-forth.fth /^ 9 field >field1$/
+>field2 forth-src/test-forth.fth /^ 5 field >field2$/
+A c.c 162
+A cp-src/c.C /^void A::A() {}$/
+A cp-src/c.C 117
+A cp-src/c.C 39
+A cp-src/c.C 56
+A cp-src/c.C 57
+A cp-src/c.C 73
+A cp-src/fail.C 23
+A cp-src/fail.C 7
+A ruby-src/test1.ru /^class A$/
+A ruby-src/test1.ru /^module A$/
+ABC ruby-src/test1.ru 11
+ADASRC make-src/Makefile /^ADASRC=etags-test-for.ada 2ataspri.adb 2ataspri.ad/
+ADDRESS c-src/emacs/src/gmalloc.c /^#define ADDRESS(B) ((void *) (((B) - 1) * BLOCKSIZ/
+ALIGNOF_STRUCT_LISP_VECTOR c-src/emacs/src/lisp.h 1378
+ALLOCATED_BEFORE_DUMPING c-src/emacs/src/gmalloc.c /^#define ALLOCATED_BEFORE_DUMPING(P) \\$/
+ALLOCATE_PSEUDOVECTOR c-src/emacs/src/lisp.h /^#define ALLOCATE_PSEUDOVECTOR(type, field, tag) /
+ALLOCATE_ZEROED_PSEUDOVECTOR c-src/emacs/src/lisp.h /^#define ALLOCATE_ZEROED_PSEUDOVECTOR(type, field, /
+AND y-src/cccp.c 11
+ANSIC c-src/h.h 84
+ANSIC c-src/h.h 85
+AREF c-src/emacs/src/lisp.h /^AREF (Lisp_Object array, ptrdiff_t idx)$/
+ARGS make-src/Makefile /^ARGS=- < srclist$/
+ARITH_EQUAL c-src/emacs/src/lisp.h 3498
+ARITH_GRTR c-src/emacs/src/lisp.h 3501
+ARITH_GRTR_OR_EQUAL c-src/emacs/src/lisp.h 3503
+ARITH_LESS c-src/emacs/src/lisp.h 3500
+ARITH_LESS_OR_EQUAL c-src/emacs/src/lisp.h 3502
+ARITH_NOTEQUAL c-src/emacs/src/lisp.h 3499
+ARRAYELTS c-src/emacs/src/lisp.h /^#define ARRAYELTS(arr) (sizeof (arr) \/ sizeof (arr/
+ARRAYP c-src/emacs/src/lisp.h /^ARRAYP (Lisp_Object x)$/
+ARRAY_MARK_FLAG c-src/emacs/src/lisp.h 768
+ASCII_CHAR_P c-src/emacs/src/lisp.h /^#define ASCII_CHAR_P(c) UNSIGNED_CMP (c, <, 0x80)$/
+ASET c-src/emacs/src/lisp.h /^ASET (Lisp_Object array, ptrdiff_t idx, Lisp_Objec/
+ASIZE c-src/emacs/src/lisp.h /^ASIZE (Lisp_Object array)$/
+ASRC make-src/Makefile /^ASRC=empty.zz empty.zz.gz$/
+AST_Array::AST_Array cp-src/c.C /^AST_Array::AST_Array(UTL_ScopedName *n, unsigned l/
+AST_ConcreteType::AST_ConcreteType cp-src/c.C /^AST_ConcreteType::AST_ConcreteType(AST_Decl::NodeT/
+AST_Root cp-src/c.C 92
+AT cp-src/c.C 52
+AU cp-src/c.C 53
+AUTOLOADP c-src/emacs/src/lisp.h /^AUTOLOADP (Lisp_Object x)$/
+AUTO_CONS c-src/emacs/src/lisp.h /^#define AUTO_CONS(name, a, b) Lisp_Object name = A/
+AUTO_CONS_EXPR c-src/emacs/src/lisp.h /^#define AUTO_CONS_EXPR(a, b) \\$/
+AUTO_LIST1 c-src/emacs/src/lisp.h /^#define AUTO_LIST1(name, a) \\$/
+AUTO_LIST2 c-src/emacs/src/lisp.h /^#define AUTO_LIST2(name, a, b) \\$/
+AUTO_LIST3 c-src/emacs/src/lisp.h /^#define AUTO_LIST3(name, a, b, c) \\$/
+AUTO_LIST4 c-src/emacs/src/lisp.h /^#define AUTO_LIST4(name, a, b, c, d) \\$/
+AUTO_STRING c-src/emacs/src/lisp.h /^#define AUTO_STRING(name, str) \\$/
+AVAIL_ALLOCA c-src/emacs/src/lisp.h /^#define AVAIL_ALLOCA(size) (sa_avail -= (size), al/
+Abort_Handler_Pointer/t ada-src/2ataspri.ads /^ type Abort_Handler_Pointer is access procedure /
+Abort_Task/p ada-src/2ataspri.adb /^ procedure Abort_Task (T : TCB_Ptr) is$/
+Abort_Task/p ada-src/2ataspri.ads /^ procedure Abort_Task (T : TCB_Ptr);$/
+Abort_Wrapper/p ada-src/2ataspri.adb /^ procedure Abort_Wrapper$/
+Ada_funcs c-src/etags.c /^Ada_funcs (FILE *inf)$/
+Ada_getit c-src/etags.c /^Ada_getit (FILE *inf, const char *name_qualifier)$/
+Ada_help c-src/etags.c 475
+Ada_suffixes c-src/etags.c 473
+AddNullToNmStr pas-src/common.pas /^function AddNullToNmStr; (*($/
+Address_To_Call_State/f ada-src/2ataspri.adb /^ function Address_To_Call_State is new$/
+Address_To_TCB_Ptr/f ada-src/2ataspri.ads /^ function Address_To_TCB_Ptr is new$/
+Advanced usage tex-src/gzip.texi /^@node Advanced usage, Environment, Invoking gzip, /
+Aligned_Cons c-src/emacs/src/lisp.h 4670
+Aligned_String c-src/emacs/src/lisp.h 4676
+AppendTextString pas-src/common.pas /^function AppendTextString;(*($/
+Arith_Comparison c-src/emacs/src/lisp.h 3497
+Asm_help c-src/etags.c 504
+Asm_labels c-src/etags.c /^Asm_labels (FILE *inf)$/
+Asm_suffixes c-src/etags.c 493
+B cp-src/c.C /^void B::B() {}$/
+B cp-src/c.C 122
+B cp-src/c.C 54
+B cp-src/c.C 56
+B cp-src/c.C 74
+B cp-src/fail.C 24
+B cp-src/fail.C 8
+B ruby-src/test1.ru /^ class B$/
+BE_Node cp-src/c.C /^void BE_Node::BE_Node() {}$/
+BE_Node cp-src/c.C 77
+BITS_PER_BITS_WORD c-src/emacs/src/lisp.h 125
+BITS_PER_BITS_WORD c-src/emacs/src/lisp.h 129
+BITS_PER_CHAR c-src/emacs/src/lisp.h 136
+BITS_PER_EMACS_INT c-src/emacs/src/lisp.h 139
+BITS_PER_LONG c-src/emacs/src/lisp.h 138
+BITS_PER_SHORT c-src/emacs/src/lisp.h 137
+BITS_WORD_MAX c-src/emacs/src/lisp.h 124
+BITS_WORD_MAX c-src/emacs/src/lisp.h 128
+BLACK cp-src/screen.hpp 12
+BLOCK c-src/emacs/src/gmalloc.c /^#define BLOCK(A) (((char *) (A) - _heapbase) \/ BLO/
+BLOCKIFY c-src/emacs/src/gmalloc.c /^#define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) \//
+BLOCKLOG c-src/emacs/src/gmalloc.c 125
+BLOCKSIZE c-src/emacs/src/gmalloc.c 126
+BLUE cp-src/screen.hpp 13
+BOOL_VECTOR_BITS_PER_CHAR c-src/emacs/src/lisp.h 114
+BOOL_VECTOR_BITS_PER_CHAR c-src/emacs/src/lisp.h 115
+BOOL_VECTOR_P c-src/emacs/src/lisp.h /^BOOL_VECTOR_P (Lisp_Object a)$/
+BROWN cp-src/screen.hpp 18
+BUFFERP c-src/emacs/src/lisp.h /^BUFFERP (Lisp_Object a)$/
+BUFFERSIZE objc-src/Subprocess.h 43
+BUFFER_OBJFWDP c-src/emacs/src/lisp.h /^BUFFER_OBJFWDP (union Lisp_Fwd *a)$/
+BYTE_MARK_STACK c-src/emacs/src/lisp.h 3181
+Bar lua-src/test.lua /^function Square.something:Bar ()$/
+Bar perl-src/kai-test.pl /^package Bar;$/
+Barrier_Function_Pointer/t ada-src/etags-test-for.ada /^ type Barrier_Function_Pointer is access$/
+Bidule/b ada-src/etags-test-for.ada /^ protected body Bidule is$/
+Bidule/b ada-src/waroquiers.ada /^ protected body Bidule is$/
+Bidule/t ada-src/etags-test-for.ada /^ protected Bidule is$/
+Bidule/t ada-src/waroquiers.ada /^ protected Bidule is$/
+Body_Required/f ada-src/etags-test-for.ada /^ function Body_Required$/
+Boo cp-src/c.C /^ Boo(int _i, int _a, int _b) : i(_i), a(_a), b(/
+Boo cp-src/c.C 129
+Boo::Boo cp-src/c.C /^Boo::Boo(Boo) :$/
+ButtonBar pyt-src/server.py /^def ButtonBar(frame, legend, ref, alternatives, co/
+C cp-src/fail.C /^ C(int i) {x = i;}$/
+C cp-src/fail.C 25
+C cp-src/fail.C 9
+CALLMANY c-src/emacs/src/lisp.h /^#define CALLMANY(f, array) (f) (ARRAYELTS (array),/
+CALLN c-src/emacs/src/lisp.h /^#define CALLN(f, ...) CALLMANY (f, ((Lisp_Object [/
+CAR c-src/emacs/src/lisp.h /^CAR (Lisp_Object c)$/
+CAR_SAFE c-src/emacs/src/lisp.h /^CAR_SAFE (Lisp_Object c)$/
+CATCHER c-src/emacs/src/lisp.h 3021
+CDR c-src/emacs/src/lisp.h /^CDR (Lisp_Object c)$/
+CDR_SAFE c-src/emacs/src/lisp.h /^CDR_SAFE (Lisp_Object c)$/
+CFLAGS make-src/Makefile /^CFLAGS=${WARNINGS} -ansi -g3 # -pg -O$/
+CHAR c-src/etags.c /^#define CHAR(x) ((unsigned int)(x) & (CHARS - 1))/
+CHAR y-src/cccp.c 7
+CHARACTERBITS c-src/emacs/src/lisp.h 2457
+CHARS c-src/etags.c 157
+CHARTAB_SIZE_BITS c-src/emacs/src/lisp.h 1565
+CHARTAB_SIZE_BITS_0 c-src/emacs/src/lisp.h 1567
+CHARTAB_SIZE_BITS_1 c-src/emacs/src/lisp.h 1568
+CHARTAB_SIZE_BITS_2 c-src/emacs/src/lisp.h 1569
+CHARTAB_SIZE_BITS_3 c-src/emacs/src/lisp.h 1570
+CHAR_ALT c-src/emacs/src/lisp.h 2445
+CHAR_BIT c-src/emacs/src/lisp.h 2957
+CHAR_BIT c-src/emacs/src/lisp.h 2959
+CHAR_BIT c-src/emacs/src/lisp.h 2964
+CHAR_BIT c-src/emacs/src/lisp.h 2969
+CHAR_BIT c-src/emacs/src/lisp.h 2974
+CHAR_BIT c-src/emacs/src/lisp.h 2978
+CHAR_BIT c-src/emacs/src/lisp.h 2983
+CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 593
+CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 597
+CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 605
+CHAR_CTL c-src/emacs/src/lisp.h 2449
+CHAR_HYPER c-src/emacs/src/lisp.h 2447
+CHAR_META c-src/emacs/src/lisp.h 2450
+CHAR_MODIFIER_MASK c-src/emacs/src/lisp.h 2452
+CHAR_SHIFT c-src/emacs/src/lisp.h 2448
+CHAR_SUPER c-src/emacs/src/lisp.h 2446
+CHAR_TABLE_EXTRA_SLOTS c-src/emacs/src/lisp.h /^CHAR_TABLE_EXTRA_SLOTS (struct Lisp_Char_Table *ct/
+CHAR_TABLE_P c-src/emacs/src/lisp.h /^CHAR_TABLE_P (Lisp_Object a)$/
+CHAR_TABLE_REF c-src/emacs/src/lisp.h /^CHAR_TABLE_REF (Lisp_Object ct, int idx)$/
+CHAR_TABLE_REF_ASCII c-src/emacs/src/lisp.h /^CHAR_TABLE_REF_ASCII (Lisp_Object ct, ptrdiff_t id/
+CHAR_TABLE_SET c-src/emacs/src/lisp.h /^CHAR_TABLE_SET (Lisp_Object ct, int idx, Lisp_Obje/
+CHAR_TABLE_STANDARD_SLOTS c-src/emacs/src/lisp.h 1697
+CHAR_TYPE_SIZE y-src/cccp.y 87
+CHECKFLAGS make-src/Makefile /^CHECKFLAGS=-DDEBUG -Wno-unused-function$/
+CHECKOBJS make-src/Makefile /^CHECKOBJS=chkmalloc.o chkxm.o$/
+CHECK_ARRAY c-src/emacs/src/lisp.h /^CHECK_ARRAY (Lisp_Object x, Lisp_Object predicate)/
+CHECK_BOOL_VECTOR c-src/emacs/src/lisp.h /^CHECK_BOOL_VECTOR (Lisp_Object x)$/
+CHECK_BUFFER c-src/emacs/src/lisp.h /^CHECK_BUFFER (Lisp_Object x)$/
+CHECK_CONS c-src/emacs/src/lisp.h /^CHECK_CONS (Lisp_Object x)$/
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h 571
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h 572
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h 579
+CHECK_LIST c-src/emacs/src/lisp.h /^CHECK_LIST (Lisp_Object x)$/
+CHECK_LIST_CONS c-src/emacs/src/lisp.h /^# define CHECK_LIST_CONS(x, y) lisp_h_CHECK_LIST_C/
+CHECK_NATNUM c-src/emacs/src/lisp.h /^CHECK_NATNUM (Lisp_Object x)$/
+CHECK_NUMBER c-src/emacs/src/lisp.h /^# define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x)$/
+CHECK_NUMBER_CAR c-src/emacs/src/lisp.h /^CHECK_NUMBER_CAR (Lisp_Object x)$/
+CHECK_NUMBER_CDR c-src/emacs/src/lisp.h /^CHECK_NUMBER_CDR (Lisp_Object x)$/
+CHECK_NUMBER_COERCE_MARKER c-src/emacs/src/lisp.h /^#define CHECK_NUMBER_COERCE_MARKER(x) \\$/
+CHECK_NUMBER_OR_FLOAT c-src/emacs/src/lisp.h /^CHECK_NUMBER_OR_FLOAT (Lisp_Object x)$/
+CHECK_NUMBER_OR_FLOAT_COERCE_MARKER c-src/emacs/src/lisp.h /^#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) /
+CHECK_PROCESS c-src/emacs/src/lisp.h /^CHECK_PROCESS (Lisp_Object x)$/
+CHECK_RANGED_INTEGER c-src/emacs/src/lisp.h /^#define CHECK_RANGED_INTEGER(x, lo, hi) \\$/
+CHECK_STRING_CAR c-src/emacs/src/lisp.h /^CHECK_STRING_CAR (Lisp_Object x)$/
+CHECK_SYMBOL c-src/emacs/src/lisp.h /^# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x)$/
+CHECK_TYPE c-src/emacs/src/lisp.h /^# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK/
+CHECK_TYPE_RANGED_INTEGER c-src/emacs/src/lisp.h /^#define CHECK_TYPE_RANGED_INTEGER(type, x) \\$/
+CHECK_VECTOR c-src/emacs/src/lisp.h /^CHECK_VECTOR (Lisp_Object x)$/
+CHECK_VECTOR_OR_STRING c-src/emacs/src/lisp.h /^CHECK_VECTOR_OR_STRING (Lisp_Object x)$/
+CHECK_WINDOW c-src/emacs/src/lisp.h /^CHECK_WINDOW (Lisp_Object x)$/
+CK_ABS_C y-src/parse.y /^#define CK_ABS_C(x) if((x)<MIN_COL || (x)>MAX_COL)/
+CK_ABS_R y-src/parse.y /^#define CK_ABS_R(x) if((x)<MIN_ROW || (x)>MAX_ROW)/
+CK_REL_C y-src/parse.y /^#define CK_REL_C(x) if( ((x)>0 && MAX_COL-(x)<cu/
+CK_REL_R y-src/parse.y /^#define CK_REL_R(x) if( ((x)>0 && MAX_ROW-(x)<cu/
+CMultiChannelCSC19_3D cp-src/c.C 2
+CNL c-src/etags.c /^#define CNL() \\$/
+CNL_SAVE_DEFINEDEF c-src/etags.c /^#define CNL_SAVE_DEFINEDEF() \\$/
+COBOLFLAGS make-src/Makefile /^COBOLFLAGS=--language=none --regex='\/.......[a-zA-/
+COLORS cp-src/screen.hpp 11
+COMPILEDP c-src/emacs/src/lisp.h /^COMPILEDP (Lisp_Object a)$/
+COMPILED_ARGLIST c-src/emacs/src/lisp.h 2431
+COMPILED_BYTECODE c-src/emacs/src/lisp.h 2432
+COMPILED_CONSTANTS c-src/emacs/src/lisp.h 2433
+COMPILED_DOC_STRING c-src/emacs/src/lisp.h 2435
+COMPILED_INTERACTIVE c-src/emacs/src/lisp.h 2436
+COMPILED_STACK_DEPTH c-src/emacs/src/lisp.h 2434
+CONDITION_CASE c-src/emacs/src/lisp.h 3021
+CONSP c-src/emacs/src/lisp.h /^# define CONSP(x) lisp_h_CONSP (x)$/
+CONSTYPE_HEAP c-src/emacs/src/lisp.h 3739
+CONSTYPE_PURE c-src/emacs/src/lisp.h 3739
+CONS_TO_INTEGER c-src/emacs/src/lisp.h /^#define CONS_TO_INTEGER(cons, type, var) \\$/
+CONVERT_CHARSTRING_TO_VALUE pas-src/common.pas /^procedure CONVERT_CHARSTRING_TO_VALUE;(*($/
+CPPFLAGS make-src/Makefile /^CPPFLAGS=${CHECKFLAGS} -DSTDC_HEADERS -DHAVE_GETCW/
+CPSRC make-src/Makefile /^CPSRC=c.C abstract.C abstract.H cfront.H burton.cp/
+CSRC make-src/Makefile /^CSRC=abbrev.c ..\/etags\/h.h .\/\/c.c torture.c getopt/
+CTAGS c-src/etags.c 146
+CTAGS c-src/etags.c 147
+CTAGS c-src/etags.c 149
+CTAGS make-src/Makefile /^CTAGS: ctags ${infiles}$/
+CTAGS% make-src/Makefile /^CTAGS%: ctags% ${infiles}$/
+CTAGS13 CTAGS14 CTAGS15 make-src/Makefile /^CTAGS13 CTAGS14 CTAGS15: ctags% ${infiles}$/
+CYAN cp-src/screen.hpp 15
+C_AUTO c-src/etags.c 2198
+C_EXT c-src/etags.c 2193
+C_JAVA c-src/etags.c 2197
+C_PLAIN c-src/etags.c 2194
+C_PLPL c-src/etags.c 2195
+C_STAR c-src/etags.c 2196
+C_entries c-src/etags.c /^C_entries (int c_ext, FILE *inf)$/
+C_stab_entry c-src/etags.c 2271
+C_symtype c-src/etags.c /^C_symtype (char *str, int len, int c_ext)$/
+ChangeFileType pas-src/common.pas /^function ChangeFileType; (*(FileName : NameString;/
+Circle.getPos lua-src/test.lua /^function Circle.getPos ()$/
+Cjava_entries c-src/etags.c /^Cjava_entries (FILE *inf)$/
+Cjava_help c-src/etags.c 551
+Cjava_suffixes c-src/etags.c 549
+ClassExample ruby-src/test.rb /^ class ClassExample$/
+Clear/p ada-src/2ataspri.adb /^ procedure Clear (Cell : in out TAS_Cell) is$/
+Clear/p ada-src/2ataspri.ads /^ procedure Clear (Cell : in out TAS_Cell)/
+Cobol_help c-src/etags.c 558
+Cobol_paragraphs c-src/etags.c /^Cobol_paragraphs (FILE *inf)$/
+Cobol_suffixes c-src/etags.c 556
+CommentAD php-src/lce_functions.php /^ function CommentAD($/
+CommentAD php-src/lce_functions.php 70
+ConcatT pas-src/common.pas /^function ConcatT;(*($/
+Concept Index tex-src/gzip.texi /^@node Concept Index, , Problems, Top$/
+Cond_Signal/p ada-src/2ataspri.adb /^ procedure Cond_Signal (Cond : in out Condition_/
+Cond_Signal/p ada-src/2ataspri.ads /^ procedure Cond_Signal (Cond : in out Condition_/
+Cond_Timed_Wait/p ada-src/2ataspri.adb /^ procedure Cond_Timed_Wait$/
+Cond_Timed_Wait/p ada-src/2ataspri.ads /^ procedure Cond_Timed_Wait$/
+Cond_Wait/p ada-src/2ataspri.adb /^ procedure Cond_Wait (Cond : in out Condition_Va/
+Cond_Wait/p ada-src/2ataspri.ads /^ procedure Cond_Wait (Cond : in out Condition_Va/
+Condition_Variable/t ada-src/2ataspri.ads /^ type Condition_Variable is private;$/
+Condition_Variable/t ada-src/2ataspri.ads /^ type Condition_Variable is$/
+Configure pyt-src/server.py /^class Configure(Frame, ControlEdit):$/
+ConfirmQuit pyt-src/server.py /^def ConfirmQuit(frame, context):$/
+Constant ruby-src/test1.ru 42
+ControlEdit pyt-src/server.py /^class ControlEdit(Frame):$/
+Controls pyt-src/server.py /^class Controls:$/
+CopyTextString pas-src/common.pas /^function CopyTextString;(*($/
+Copying tex-src/gzip.texi /^@node Copying, Overview, , Top$/
+Cplusplus_entries c-src/etags.c /^Cplusplus_entries (FILE *inf)$/
+Cplusplus_help c-src/etags.c 540
+Cplusplus_suffixes c-src/etags.c 535
+Create_LL_Task/p ada-src/2ataspri.adb /^ procedure Create_LL_Task$/
+Create_LL_Task/p ada-src/2ataspri.ads /^ procedure Create_LL_Task$/
+Cstar_entries c-src/etags.c /^Cstar_entries (FILE *inf)$/
+Cstar_suffixes c-src/etags.c 562
+Cube.data.getFoo lua-src/test.lua /^function Cube.data.getFoo ()$/
+D cp-src/fail.C /^ D() : ::A::T2::T(97), x(1066) {}$/
+D cp-src/fail.C 41
+DAEMON_RUNNING c-src/emacs/src/lisp.h 4258
+DAEMON_RUNNING c-src/emacs/src/lisp.h 4262
+DARKGRAY cp-src/screen.hpp 20
+DEAFUN c.c /^DEAFUN ("expand-file-name", Fexpand_file_name, Sex/
+DEBUG c-src/etags.c 84
+DEBUG c-src/etags.c 85
+DEBUG c-src/etags.c 87
+DEBUG objc-src/PackInsp.m 37
+DECLARE_GDB_SYM c-src/emacs/src/lisp.h /^#define DECLARE_GDB_SYM(type, id) type const id EX/
+DEFAULT_HASH_SIZE c-src/emacs/src/lisp.h 1940
+DEFAULT_REHASH_SIZE c-src/emacs/src/lisp.h 1950
+DEFAULT_REHASH_THRESHOLD c-src/emacs/src/lisp.h 1946
+DEFINE_GDB_SYMBOL_BEGIN c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_BEGIN(type, id) DECLARE/
+DEFINE_GDB_SYMBOL_BEGIN c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_BEGIN(type, id) extern /
+DEFINE_GDB_SYMBOL_END c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_END(id) = id;$/
+DEFINE_GDB_SYMBOL_END c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_END(val) ;$/
+DEFINE_LISP_SYMBOL c-src/emacs/src/lisp.h /^#define DEFINE_LISP_SYMBOL(name) \\$/
+DEFINE_NON_NIL_Q_SYMBOL_MACROS c-src/emacs/src/lisp.h 755
+DEFSYM c-src/emacs/src/lisp.h /^#define DEFSYM(sym, name) \/* empty *\/$/
+DEFSYM c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (SYMBOL_CONSTANT_P, int, (Lisp_Ob/
+DEFUN c-src/emacs/src/lisp.h /^#define DEFUN(lname, fnname, sname, minargs, maxar/
+DEFUN_ARGS_0 c-src/emacs/src/lisp.h 714
+DEFUN_ARGS_1 c-src/emacs/src/lisp.h 715
+DEFUN_ARGS_2 c-src/emacs/src/lisp.h 716
+DEFUN_ARGS_3 c-src/emacs/src/lisp.h 717
+DEFUN_ARGS_4 c-src/emacs/src/lisp.h 718
+DEFUN_ARGS_5 c-src/emacs/src/lisp.h 719
+DEFUN_ARGS_6 c-src/emacs/src/lisp.h 721
+DEFUN_ARGS_7 c-src/emacs/src/lisp.h 723
+DEFUN_ARGS_8 c-src/emacs/src/lisp.h 725
+DEFUN_ARGS_MANY c-src/emacs/src/lisp.h 712
+DEFUN_ARGS_UNEVALLED c-src/emacs/src/lisp.h 713
+DEFUN_func2 c.c /^DEFUN_func2()$/
+DEFVAR_BOOL c-src/emacs/src/lisp.h /^#define DEFVAR_BOOL(lname, vname, doc) \\$/
+DEFVAR_BUFFER_DEFAULTS c-src/emacs/src/lisp.h /^#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) /
+DEFVAR_INT c-src/emacs/src/lisp.h /^#define DEFVAR_INT(lname, vname, doc) \\$/
+DEFVAR_KBOARD c-src/emacs/src/lisp.h /^#define DEFVAR_KBOARD(lname, vname, doc) \\$/
+DEFVAR_LISP c-src/emacs/src/lisp.h /^#define DEFVAR_LISP(lname, vname, doc) \\$/
+DEFVAR_LISP_NOPRO c-src/emacs/src/lisp.h /^#define DEFVAR_LISP_NOPRO(lname, vname, doc) \\$/
+DEVICE_LAST c-src/h.h 24
+DEVICE_SWP c-src/h.h 23
+DOS_NT c-src/etags.c 117
+DOS_NT c-src/etags.c 118
+DUMPED c-src/emacs/src/gmalloc.c 80
+Debug cp-src/functions.cpp /^void Debug ( int lineno, int level, char* func , c/
+Def_ ruby-src/test1.ru 12
+DisposeANameList pas-src/common.pas /^procedure DisposeANameList( $/
+DisposeNameList pas-src/common.pas /^procedure DisposeNameList;$/
+ELEM_I c-src/h.h 3
+ELSRC make-src/Makefile /^ELSRC=TAGTEST.EL emacs\/lisp\/progmodes\/etags.el$/
+EMACS_INT c-src/emacs/src/lisp.h 103
+EMACS_INT c-src/emacs/src/lisp.h 91
+EMACS_INT c-src/emacs/src/lisp.h 96
+EMACS_INT_MAX c-src/emacs/src/lisp.h 105
+EMACS_INT_MAX c-src/emacs/src/lisp.h 93
+EMACS_INT_MAX c-src/emacs/src/lisp.h 98
+EMACS_LISP_H c-src/emacs/src/lisp.h 22
+EMACS_NAME c-src/etags.c 786
+EMACS_UINT c-src/emacs/src/lisp.h 104
+EMACS_UINT c-src/emacs/src/lisp.h 92
+EMACS_UINT c-src/emacs/src/lisp.h 97
+ENTRY c-src/sysdep.h /^#define ENTRY(name) \\$/
+ENUM_BF c-src/emacs/src/lisp.h /^#define ENUM_BF(TYPE) enum TYPE$/
+ENUM_BF c-src/emacs/src/lisp.h /^#define ENUM_BF(TYPE) unsigned int$/
+EQ c-src/emacs/src/lisp.h /^# define EQ(x, y) lisp_h_EQ (x, y)$/
+EQUAL y-src/cccp.c 12
+ERLSRC make-src/Makefile /^ERLSRC=gs_dialog.erl lines.erl lists.erl$/
+ERROR y-src/cccp.c 9
+ERROR y-src/parse.y 304
+ETAGS make-src/Makefile /^ETAGS: FRC etags ${infiles}$/
+ETAGS% make-src/Makefile /^ETAGS%: FRC etags% ${infiles}$/
+ETAGS12 make-src/Makefile /^ETAGS12: etags12 ${infiles}$/
+ETAGS13 ETAGS14 ETAGS15 make-src/Makefile /^ETAGS13 ETAGS14 ETAGS15: etags% ${infiles}$/
+EXFUN c-src/emacs/src/lisp.h /^#define EXFUN(fnname, maxargs) \\$/
+EXTAGS make-src/Makefile /^EXTAGS: extags ${infiles} Makefile$/
+EXTERNALLY_VISIBLE c-src/emacs/src/keyboard.c 3497
+EXTERNALLY_VISIBLE c-src/emacs/src/keyboard.c 4372
+EmptyNmStr pas-src/common.pas /^function EmptyNmStr(* : NameString*);$/
+Environment tex-src/gzip.texi /^@node Environment, Tapes, Advanced usage, Top$/
+Erlang_functions c-src/etags.c /^Erlang_functions (FILE *inf)$/
+Erlang_help c-src/etags.c 567
+Erlang_suffixes c-src/etags.c 565
+ErrStrToNmStr pas-src/common.pas /^function ErrStrToNmStr;(*($/
+Error_Information/t ada-src/2ataspri.ads /^ type Error_Information is new Interfaces.C.POSI/
+Exit_LL_Task/p ada-src/2ataspri.adb /^ procedure Exit_LL_Task is$/
+Exit_LL_Task/p ada-src/2ataspri.ads /^ procedure Exit_LL_Task;$/
+ExtractCommentInfo pas-src/common.pas /^procedure ExtractCommentInfo; (*($/
+FASTCFLAGS make-src/Makefile /^FASTCFLAGS=-O3 -finline-functions -ffast-math -fun/
+FASTCFLAGSWARN make-src/Makefile /^FASTCFLAGSWARN=${WARNINGS} -Werror ${FASTCFLAGS}$/
+FILTER make-src/Makefile /^FILTER=grep -v '\\.[Cchefy][lor]*,[1-9][0-9]*' || t/
+FINALIZERP c-src/emacs/src/lisp.h /^FINALIZERP (Lisp_Object x)$/
+FINAL_FREE_BLOCKS c-src/emacs/src/gmalloc.c 135
+FIXNUM_BITS c-src/emacs/src/lisp.h 252
+FIXNUM_OVERFLOW_P c-src/emacs/src/lisp.h /^#define FIXNUM_OVERFLOW_P(i) \\$/
+FIXNUM_OVERFLOW_P c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (EQ, bool, (Lisp_Object x, Lisp_O/
+FLOATP c-src/emacs/src/lisp.h /^# define FLOATP(x) lisp_h_FLOATP (x)$/
+FLOAT_TO_STRING_BUFSIZE c-src/emacs/src/lisp.h 3927
+FORTHSRC make-src/Makefile /^FORTHSRC=test-forth.fth$/
+FOR_EACH_ALIST_VALUE c-src/emacs/src/lisp.h /^#define FOR_EACH_ALIST_VALUE(head_var, list_var, v/
+FOR_EACH_TAIL c-src/emacs/src/lisp.h /^#define FOR_EACH_TAIL(hare, list, tortoise, n) \\$/
+FRAMEP c-src/emacs/src/lisp.h /^FRAMEP (Lisp_Object a)$/
+FRC make-src/Makefile /^FRC:;$/
+FREEFLOOD c-src/emacs/src/gmalloc.c 1858
+FSRC make-src/Makefile /^FSRC=entry.for entry.strange_suffix entry.strange$/
+FUN0 y-src/parse.y /^yylex FUN0()$/
+FUN1 y-src/parse.y /^str_to_col FUN1(char **,str)$/
+FUN1 y-src/parse.y /^yyerror FUN1(char *, s)$/
+FUN2 y-src/parse.y /^make_list FUN2(YYSTYPE, car, YYSTYPE, cdr)$/
+FUN2 y-src/parse.y /^parse_cell_or_range FUN2(char **,ptr, struct rng */
+FUNCTIONP c-src/emacs/src/lisp.h /^FUNCTIONP (Lisp_Object obj)$/
+FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 4766
+FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 5061
+F_getit c-src/etags.c /^F_getit (FILE *inf)$/
+F_takeprec c-src/etags.c /^F_takeprec (void)$/
+Fabbrev_expansion c-src/abbrev.c /^DEFUN ("abbrev-expansion", Fabbrev_expansion, Sabb/
+Fabbrev_symbol c-src/abbrev.c /^DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_sy/
+Fabort_recursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("abort-recursive-edit", Fabort_recursive_ed/
+Fails_t c-src/h.h 5
+Fclear_abbrev_table c-src/abbrev.c /^DEFUN ("clear-abbrev-table", Fclear_abbrev_table, /
+Fclear_this_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("clear-this-command-keys", Fclear_this_comm/
+Fcommand_error_default_function c-src/emacs/src/keyboard.c /^DEFUN ("command-error-default-function", Fcommand_/
+Fcurrent_idle_time c-src/emacs/src/keyboard.c /^DEFUN ("current-idle-time", Fcurrent_idle_time, Sc/
+Fcurrent_input_mode c-src/emacs/src/keyboard.c /^DEFUN ("current-input-mode", Fcurrent_input_mode, /
+Fdefine_abbrev c-src/abbrev.c /^DEFUN ("define-abbrev", Fdefine_abbrev, Sdefine_ab/
+Fdefine_abbrev_table c-src/abbrev.c /^DEFUN ("define-abbrev-table", Fdefine_abbrev_table/
+Fdefine_global_abbrev c-src/abbrev.c /^DEFUN ("define-global-abbrev", Fdefine_global_abbr/
+Fdefine_mode_abbrev c-src/abbrev.c /^DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, /
+Fdiscard_input c-src/emacs/src/keyboard.c /^DEFUN ("discard-input", Fdiscard_input, Sdiscard_i/
+Fevent_convert_list c-src/emacs/src/keyboard.c /^DEFUN ("event-convert-list", Fevent_convert_list, /
+Fevent_symbol_parse_modifiers c-src/emacs/src/keyboard.c /^DEFUN ("internal-event-symbol-parse-modifiers", Fe/
+Fexit_recursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("exit-recursive-edit", Fexit_recursive_edit/
+Fexpand_abbrev c-src/abbrev.c /^DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_ab/
+Finalize_Cond/p ada-src/2ataspri.adb /^ procedure Finalize_Cond (Cond : in out Conditio/
+Finalize_Cond/p ada-src/2ataspri.ads /^ procedure Finalize_Cond (Cond : in out Conditio/
+Finalize_Lock/p ada-src/2ataspri.adb /^ procedure Finalize_Lock (L : in out Lock) is$/
+Finalize_Lock/p ada-src/2ataspri.ads /^ procedure Finalize_Lock (L : in out Lock);$/
+Finalize_TAS_Cell/p ada-src/2ataspri.adb /^ procedure Finalize_TAS_Cell (Cell : in out TAS_/
+Finalize_TAS_Cell/p ada-src/2ataspri.ads /^ procedure Finalize_TAS_Cell (Cell : in out TA/
+Finput_pending_p c-src/emacs/src/keyboard.c /^DEFUN ("input-pending-p", Finput_pending_p, Sinput/
+Finsert_abbrev_table_description c-src/abbrev.c /^DEFUN ("insert-abbrev-table-description", Finsert_/
+First100Chars pas-src/common.pas /^procedure First100Chars; (*($/
+Fmake_abbrev_table c-src/abbrev.c /^DEFUN ("make-abbrev-table", Fmake_abbrev_table, Sm/
+Foo perl-src/kai-test.pl /^package Foo;$/
+Foo::Bar perl-src/kai-test.pl /^package Foo::Bar;$/
+Fopen_dribble_file c-src/emacs/src/keyboard.c /^DEFUN ("open-dribble-file", Fopen_dribble_file, So/
+Forth_help c-src/etags.c 573
+Forth_suffixes c-src/etags.c 571
+Forth_words c-src/etags.c /^Forth_words (FILE *inf)$/
+Fortran_functions c-src/etags.c /^Fortran_functions (FILE *inf)$/
+Fortran_help c-src/etags.c 579
+Fortran_suffixes c-src/etags.c 577
+Fposn_at_point c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_p/
+Fposn_at_x_y c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, /
+Fread_key_sequence c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence", Fread_key_sequence, Sr/
+Fread_key_sequence_vector c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence-vector", Fread_key_seque/
+Frecent_keys c-src/emacs/src/keyboard.c /^DEFUN ("recent-keys", Frecent_keys, Srecent_keys, /
+Frecursion_depth c-src/emacs/src/keyboard.c /^DEFUN ("recursion-depth", Frecursion_depth, Srecur/
+Frecursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("recursive-edit", Frecursive_edit, Srecursi/
+Freset_this_command_lengths c-src/emacs/src/keyboard.c /^DEFUN ("reset-this-command-lengths", Freset_this_c/
+Fset_input_interrupt_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-interrupt-mode", Fset_input_inte/
+Fset_input_meta_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-meta-mode", Fset_input_meta_mode/
+Fset_input_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-mode", Fset_input_mode, Sset_inp/
+Fset_output_flow_control c-src/emacs/src/keyboard.c /^DEFUN ("set-output-flow-control", Fset_output_flow/
+Fset_quit_char c-src/emacs/src/keyboard.c /^DEFUN ("set-quit-char", Fset_quit_char, Sset_quit_/
+Fsuspend_emacs c-src/emacs/src/keyboard.c /^DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_e/
+Fthis_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys", Fthis_command_keys, St/
+Fthis_command_keys_vector c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys-vector", Fthis_command_k/
+Fthis_single_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-keys", Fthis_single_co/
+Fthis_single_command_raw_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-raw-keys", Fthis_singl/
+Ftop_level c-src/emacs/src/keyboard.c /^DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, /
+Ftrack_mouse c-src/emacs/src/keyboard.c /^DEFUN ("internal--track-mouse", Ftrack_mouse, Stra/
+Funexpand_abbrev c-src/abbrev.c /^DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexp/
+Fx_get_selection_internal c.c /^ Fx_get_selection_internal, Sx_get_selection/
+Fx_get_selection_internal c.c /^DEFUN ("x-get-selection-internal", Fx_get_selectio/
+Fy_get_selection_internal c.c /^ Fy_get_selection_internal, Sy_get_selection_/
+GCALIGNED c-src/emacs/src/lisp.h 288
+GCALIGNED c-src/emacs/src/lisp.h 290
+GCALIGNMENT c-src/emacs/src/lisp.h 243
+GCPRO1 c-src/emacs/src/lisp.h /^#define GCPRO1(a) \\$/
+GCPRO1 c-src/emacs/src/lisp.h /^#define GCPRO1(varname) ((void) gcpro1)$/
+GCPRO2 c-src/emacs/src/lisp.h /^#define GCPRO2(a, b) \\$/
+GCPRO2 c-src/emacs/src/lisp.h /^#define GCPRO2(varname1, varname2) ((void) gcpro2,/
+GCPRO3 c-src/emacs/src/lisp.h /^#define GCPRO3(a, b, c) \\$/
+GCPRO3 c-src/emacs/src/lisp.h /^#define GCPRO3(varname1, varname2, varname3) \\$/
+GCPRO4 c-src/emacs/src/lisp.h /^#define GCPRO4(a, b, c, d) \\$/
+GCPRO4 c-src/emacs/src/lisp.h /^#define GCPRO4(varname1, varname2, varname3, varna/
+GCPRO5 c-src/emacs/src/lisp.h /^#define GCPRO5(a, b, c, d, e) \\$/
+GCPRO5 c-src/emacs/src/lisp.h /^#define GCPRO5(varname1, varname2, varname3, varna/
+GCPRO6 c-src/emacs/src/lisp.h /^#define GCPRO6(a, b, c, d, e, f) \\$/
+GCPRO6 c-src/emacs/src/lisp.h /^#define GCPRO6(varname1, varname2, varname3, varna/
+GCPRO7 c-src/emacs/src/lisp.h /^#define GCPRO7(a, b, c, d, e, f, g) \\$/
+GCPRO7 c-src/emacs/src/lisp.h /^#define GCPRO7(a, b, c, d, e, f, g) (GCPRO6 (a, b,/
+GCTYPEBITS c-src/emacs/src/lisp.h /^DEFINE_GDB_SYMBOL_BEGIN (int, GCTYPEBITS)$/
+GCTYPEBITS c-src/emacs/src/lisp.h 67
+GC_MAKE_GCPROS_NOOPS c-src/emacs/src/lisp.h 3172
+GC_MARK_STACK c-src/emacs/src/lisp.h 3177
+GC_MARK_STACK_CHECK_GCPROS c-src/emacs/src/lisp.h 3173
+GC_USE_GCPROS_AS_BEFORE c-src/emacs/src/lisp.h 3171
+GC_USE_GCPROS_CHECK_ZOMBIES c-src/emacs/src/lisp.h 3174
+GE y-src/parse.c 8
+GENERIC_PTR y-src/cccp.y 56
+GENERIC_PTR y-src/cccp.y 58
+GEQ y-src/cccp.c 15
+GETOPTOBJS make-src/Makefile /^GETOPTOBJS= #getopt.o getopt1.o$/
+GREEN cp-src/screen.hpp 14
+GROW_RAW_KEYBUF c-src/emacs/src/keyboard.c 119
+GatherControls pyt-src/server.py /^ def GatherControls(self):$/
+GetLayerByName lua-src/allegro.lua /^function GetLayerByName (name)$/
+GetNameList pas-src/common.pas /^function GetNameList; (* : BinNodePointer;*)$/
+GetNewNameListNode pas-src/common.pas /^function GetNewNameListNode;(*($/
+GetTextRef pas-src/common.pas /^function GetTextRef;(*($/
+GetUniqueLayerName lua-src/allegro.lua /^function GetUniqueLayerName ()$/
+Get_Own_Priority/f ada-src/2ataspri.adb /^ function Get_Own_Priority return System.Any_Pri/
+Get_Own_Priority/f ada-src/2ataspri.ads /^ function Get_Own_Priority return System.Any_Pri/
+Get_Priority/f ada-src/2ataspri.adb /^ function Get_Priority (T : TCB_Ptr) return Syst/
+Get_Priority/f ada-src/2ataspri.ads /^ function Get_Priority (T : TCB_Ptr) return Syst/
+HASH_HASH c-src/emacs/src/lisp.h /^HASH_HASH (struct Lisp_Hash_Table *h, ptrdiff_t id/
+HASH_INDEX c-src/emacs/src/lisp.h /^HASH_INDEX (struct Lisp_Hash_Table *h, ptrdiff_t i/
+HASH_KEY c-src/emacs/src/lisp.h /^HASH_KEY (struct Lisp_Hash_Table *h, ptrdiff_t idx/
+HASH_NEXT c-src/emacs/src/lisp.h /^HASH_NEXT (struct Lisp_Hash_Table *h, ptrdiff_t id/
+HASH_TABLE_P c-src/emacs/src/lisp.h /^HASH_TABLE_P (Lisp_Object a)$/
+HASH_TABLE_SIZE c-src/emacs/src/lisp.h /^HASH_TABLE_SIZE (struct Lisp_Hash_Table *h)$/
+HASH_VALUE c-src/emacs/src/lisp.h /^HASH_VALUE (struct Lisp_Hash_Table *h, ptrdiff_t i/
+HAVE_NTGUI c-src/etags.c 116
+HEAP c-src/emacs/src/gmalloc.c 131
+HTMLSRC make-src/Makefile /^HTMLSRC=softwarelibero.html index.shtml algrthms.h/
+HTML_help c-src/etags.c 584
+HTML_labels c-src/etags.c /^HTML_labels (FILE *inf)$/
+HTML_suffixes c-src/etags.c 582
+IEEE_FLOATING_POINT c-src/emacs/src/lisp.h 2415
+IMAGEP c-src/emacs/src/lisp.h /^IMAGEP (Lisp_Object x)$/
+INPUT_EVENT_POS_MAX c-src/emacs/src/keyboard.c 3698
+INPUT_EVENT_POS_MIN c-src/emacs/src/keyboard.c 3701
+INSERT_TREE_NODE pas-src/common.pas /^procedure INSERT_TREE_NODE;(*( $/
+INSTANTIATE_MDIAGARRAY_FRIENDS cp-src/MDiagArray2.h /^#define INSTANTIATE_MDIAGARRAY_FRIENDS(T) \\$/
+INT c-src/h.h 32
+INT y-src/cccp.c 6
+INTEGERP c-src/emacs/src/lisp.h /^# define INTEGERP(x) lisp_h_INTEGERP (x)$/
+INTEGER_TO_CONS c-src/emacs/src/lisp.h /^#define INTEGER_TO_CONS(i) \\$/
+INTERVAL c-src/emacs/src/lisp.h 1149
+INTMASK c-src/emacs/src/lisp.h 437
+INTTYPEBITS c-src/emacs/src/lisp.h 249
+INT_BIT c-src/emacs/src/gmalloc.c 124
+INT_TYPE_SIZE y-src/cccp.y 91
+ISALNUM c-src/etags.c /^#define ISALNUM(c) isalnum (CHAR (c))$/
+ISALPHA c-src/etags.c /^#define ISALPHA(c) isalpha (CHAR (c))$/
+ISDIGIT c-src/etags.c /^#define ISDIGIT(c) isdigit (CHAR (c))$/
+ISLOWER c-src/etags.c /^#define ISLOWER(c) islower (CHAR (c))$/
+ISO_FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 5149
+ISUPPER c-src/etags.c /^# define ISUPPER(c) isupper (CHAR (c))$/
+IS_DAEMON c-src/emacs/src/lisp.h 4257
+IS_DAEMON c-src/emacs/src/lisp.h 4261
+InitNameList pas-src/common.pas /^procedure InitNameList;$/
+InitNameStringPool pas-src/common.pas /^procedure InitNameStringPool;$/
+InitializeStringPackage pas-src/common.pas /^procedure InitializeStringPackage;$/
+Initialize_Cond/p ada-src/2ataspri.adb /^ procedure Initialize_Cond (Cond : in out Condit/
+Initialize_Cond/p ada-src/2ataspri.ads /^ procedure Initialize_Cond (Cond : in out Condit/
+Initialize_LL_Tasks/p ada-src/2ataspri.adb /^ procedure Initialize_LL_Tasks (T : TCB_Ptr) is$/
+Initialize_LL_Tasks/p ada-src/2ataspri.ads /^ procedure Initialize_LL_Tasks (T : TCB_Ptr);$/
+Initialize_Lock/p ada-src/2ataspri.adb /^ procedure Initialize_Lock$/
+Initialize_Lock/p ada-src/2ataspri.ads /^ procedure Initialize_Lock (Prio : System.Any_Pr/
+Initialize_TAS_Cell/p ada-src/2ataspri.adb /^ procedure Initialize_TAS_Cell (Cell : out TAS_C/
+Initialize_TAS_Cell/p ada-src/2ataspri.ads /^ procedure Initialize_TAS_Cell (Cell : out TA/
+Inner1/b ada-src/etags-test-for.ada /^ package body Inner1 is$/
+Inner1/b ada-src/waroquiers.ada /^ package body Inner1 is$/
+Inner1/s ada-src/etags-test-for.ada /^ package Inner1 is$/
+Inner1/s ada-src/waroquiers.ada /^ package Inner1 is$/
+Inner2/b ada-src/etags-test-for.ada /^ package body Inner2 is$/
+Inner2/b ada-src/waroquiers.ada /^ package body Inner2 is$/
+Inner2/s ada-src/etags-test-for.ada /^ package Inner2 is$/
+Inner2/s ada-src/waroquiers.ada /^ package Inner2 is$/
+Install_Abort_Handler/p ada-src/2ataspri.adb /^ procedure Install_Abort_Handler (Handler : Abor/
+Install_Abort_Handler/p ada-src/2ataspri.ads /^ procedure Install_Abort_Handler (Handler : Abor/
+Install_Error_Handler/p ada-src/2ataspri.adb /^ procedure Install_Error_Handler (Handler : Syst/
+Install_Error_Handler/p ada-src/2ataspri.ads /^ procedure Install_Error_Handler (Handler : Syst/
+Invoking gzip tex-src/gzip.texi /^@node Invoking gzip, Advanced usage, Sample, Top$/
+IpAddrKind rs-src/test.rs 3
+IsControlChar pas-src/common.pas /^function IsControlChar; (*($/
+IsControlCharName pas-src/common.pas /^function IsControlCharName($/
+Is_Set/f ada-src/2ataspri.adb /^ function Is_Set (Cell : in TAS_Cell) return Bo/
+Is_Set/f ada-src/2ataspri.ads /^ function Is_Set (Cell : in TAS_Cell)/
+JAVASRC make-src/Makefile /^JAVASRC=AWTEMul.java KeyEve.java SMan.java SysCol./
+KBD_BUFFER_SIZE c-src/emacs/src/keyboard.c 82
+KBYTES objc-src/PackInsp.m 58
+KEY_TO_CHAR c-src/emacs/src/keyboard.c /^#define KEY_TO_CHAR(k) (XINT (k) & ((1 << CHARACTE/
+LATEST make-src/Makefile /^LATEST=17$/
+LCE_COMMENT php-src/lce_functions.php 13
+LCE_COMMENT_TOOL php-src/lce_functions.php 17
+LCE_COMMENT_USER php-src/lce_functions.php 15
+LCE_FUNCTIONS php-src/lce_functions.php 4
+LCE_MSGID php-src/lce_functions.php 19
+LCE_MSGSTR php-src/lce_functions.php 21
+LCE_TEXT php-src/lce_functions.php 23
+LCE_UNKNOWN php-src/lce_functions.php 9
+LCE_WS php-src/lce_functions.php 11
+LDFLAGS make-src/Makefile /^LDFLAGS=#-static -lc_p$/
+LE y-src/parse.c 7
+LEQ y-src/cccp.c 14
+LIGHTBLUE cp-src/screen.hpp 21
+LIGHTCYAN cp-src/screen.hpp 23
+LIGHTGRAY cp-src/screen.hpp 19
+LIGHTGREEN cp-src/screen.hpp 22
+LIGHTMAGENTA cp-src/screen.hpp 25
+LIGHTRED cp-src/screen.hpp 24
+LISP_INITIALLY c-src/emacs/src/lisp.h /^#define LISP_INITIALLY(i) (i)$/
+LISP_INITIALLY c-src/emacs/src/lisp.h /^#define LISP_INITIALLY(i) {i}$/
+LISP_INITIALLY_ZERO c-src/emacs/src/lisp.h 582
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^#define LISP_MACRO_DEFUN(name, type, argdecls, arg/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (CONSP, bool, (Lisp_Object x), (x/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (NILP, bool, (Lisp_Object x), (x)/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (SYMBOL_VAL, Lisp_Object, (struct/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XCAR, Lisp_Object, (Lisp_Object /
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XCONS, struct Lisp_Cons *, (Lisp/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XHASH, EMACS_INT, (Lisp_Object a/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XLI, EMACS_INT, (Lisp_Object o),/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XPNTR, void *, (Lisp_Object a), /
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^#define LISP_MACRO_DEFUN_VOID(name, argdecls, args/
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN_VOID (CHECK_LIST_CONS, (Lisp_Obje/
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN_VOID (CHECK_TYPE,$/
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN_VOID (SET_SYMBOL_VAL,$/
+LISTCONTENTS objc-src/PackInsp.m 39
+LISTCONTENTSBUTTON objc-src/PackInsp.m 48
+LISTDESCRIPTIONBUTTON objc-src/PackInsp.m 49
+LL_Assert/p ada-src/2ataspri.adb /^ procedure LL_Assert (B : Boolean; M : String) i/
+LL_Assert/p ada-src/2ataspri.ads /^ procedure LL_Assert (B : Boolean; M : String);$/
+LL_Task_Procedure_Access/t ada-src/2ataspri.ads /^ type LL_Task_Procedure_Access is access procedu/
+LL_Task_Procedure_Access/t ada-src/etags-test-for.ada /^ type LL_Task_Procedure_Access is access procedu/
+LL_Wrapper/p ada-src/2ataspri.adb /^ procedure LL_Wrapper (T : TCB_Ptr) is$/
+LL_Wrapper/p ada-src/2ataspri.adb /^ procedure LL_Wrapper (T : TCB_Ptr);$/
+LL_Wrapper/p ada-src/etags-test-for.ada /^ procedure LL_Wrapper (T : TCB_Ptr);$/
+LOCALIZE objc-src/PackInsp.m /^#define LOCALIZE(s) NXLoadLocalizedStringFromTabl/
+LOCALIZE_ARCH objc-src/PackInsp.m /^#define LOCALIZE_ARCH(s) NXLoadLocalizedStringFrom/
+LOCK c-src/emacs/src/gmalloc.c /^#define LOCK() \\$/
+LOCK c-src/emacs/src/gmalloc.c /^#define LOCK()$/
+LOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define LOCK_ALIGNED_BLOCKS() \\$/
+LOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define LOCK_ALIGNED_BLOCKS()$/
+LONG_TYPE_SIZE y-src/cccp.y 95
+LOOKING_AT c-src/etags.c /^#define LOOKING_AT(cp, kw) \/* kw is the keyword, /
+LOOKING_AT_NOCASE c-src/etags.c /^#define LOOKING_AT_NOCASE(cp, kw) \/* the keyword i/
+LOOKUP objc-src/PackInsp.m /^#define LOOKUP(key, notfound) ([table isKey:key] ?/
+LOOKUP objc-src/PackInsp.m 176
+LOOP_ON_INPUT_LINES c-src/etags.c /^#define LOOP_ON_INPUT_LINES(file_pointer, line_buf/
+LSH y-src/cccp.c 16
+LTGT cp-src/MDiagArray2.h 144
+LTGT cp-src/MDiagArray2.h 35
+LTGT cp-src/MDiagArray2.h 39
+LTGT cp-src/MDiagArray2.h 42
+LUASRC make-src/Makefile /^LUASRC=allegro.lua$/
+L_CELL y-src/parse.c 10
+L_CONST y-src/parse.c 13
+L_FN0 y-src/parse.c 14
+L_FN1 y-src/parse.c 15
+L_FN1R y-src/parse.c 20
+L_FN2 y-src/parse.c 16
+L_FN2R y-src/parse.c 21
+L_FN3 y-src/parse.c 17
+L_FN3R y-src/parse.c 22
+L_FN4 y-src/parse.c 18
+L_FN4R y-src/parse.c 23
+L_FNN y-src/parse.c 19
+L_FNNR y-src/parse.c 24
+L_GE y-src/parse.c 27
+L_LE y-src/parse.c 25
+L_NE y-src/parse.c 26
+L_RANGE y-src/parse.c 11
+L_VAR y-src/parse.c 12
+L_getit c-src/etags.c /^L_getit (void)$/
+LabeledEntry pyt-src/server.py /^class LabeledEntry(Frame):$/
+Lang_function c-src/etags.c 182
+Lang_function c-src/h.h 6
+Lisp_Bits c-src/emacs/src/lisp.h 239
+Lisp_Bool_Vector c-src/emacs/src/lisp.h 1384
+Lisp_Boolfwd c-src/emacs/src/lisp.h 2284
+Lisp_Buffer_Local_Value c-src/emacs/src/lisp.h 2334
+Lisp_Buffer_Objfwd c-src/emacs/src/lisp.h 2302
+Lisp_Char_Table c-src/emacs/src/lisp.h 1575
+Lisp_Compiled c-src/emacs/src/lisp.h 2429
+Lisp_Cons c-src/emacs/src/lisp.h 475
+Lisp_Finalizer c-src/emacs/src/lisp.h 2186
+Lisp_Float c-src/emacs/src/lisp.h 2391
+Lisp_Float c-src/emacs/src/lisp.h 477
+Lisp_Free c-src/emacs/src/lisp.h 2201
+Lisp_Fwd c-src/emacs/src/lisp.h 2368
+Lisp_Fwd_Bool c-src/emacs/src/lisp.h 505
+Lisp_Fwd_Buffer_Obj c-src/emacs/src/lisp.h 507
+Lisp_Fwd_Int c-src/emacs/src/lisp.h 504
+Lisp_Fwd_Kboard_Obj c-src/emacs/src/lisp.h 508
+Lisp_Fwd_Obj c-src/emacs/src/lisp.h 506
+Lisp_Fwd_Type c-src/emacs/src/lisp.h 502
+Lisp_Hash_Table c-src/emacs/src/lisp.h 1823
+Lisp_Int0 c-src/emacs/src/lisp.h 461
+Lisp_Int1 c-src/emacs/src/lisp.h 462
+Lisp_Intfwd c-src/emacs/src/lisp.h 2274
+Lisp_Kboard_Objfwd c-src/emacs/src/lisp.h 2362
+Lisp_Marker c-src/emacs/src/lisp.h 1978
+Lisp_Misc c-src/emacs/src/lisp.h 2212
+Lisp_Misc c-src/emacs/src/lisp.h 458
+Lisp_Misc_Any c-src/emacs/src/lisp.h 1971
+Lisp_Misc_Finalizer c-src/emacs/src/lisp.h 491
+Lisp_Misc_Float c-src/emacs/src/lisp.h 494
+Lisp_Misc_Free c-src/emacs/src/lisp.h 487
+Lisp_Misc_Limit c-src/emacs/src/lisp.h 496
+Lisp_Misc_Marker c-src/emacs/src/lisp.h 488
+Lisp_Misc_Overlay c-src/emacs/src/lisp.h 489
+Lisp_Misc_Save_Value c-src/emacs/src/lisp.h 490
+Lisp_Misc_Type c-src/emacs/src/lisp.h 485
+Lisp_Object c-src/emacs/src/lisp.h 567
+Lisp_Object c-src/emacs/src/lisp.h 577
+Lisp_Objfwd c-src/emacs/src/lisp.h 2294
+Lisp_Overlay c-src/emacs/src/lisp.h 2021
+Lisp_Save_Type c-src/emacs/src/lisp.h 2064
+Lisp_Save_Value c-src/emacs/src/lisp.h 2110
+Lisp_String c-src/emacs/src/lisp.h 466
+Lisp_Sub_Char_Table c-src/emacs/src/lisp.h 1606
+Lisp_Subr c-src/emacs/src/lisp.h 1670
+Lisp_Symbol c-src/emacs/src/lisp.h 454
+Lisp_Symbol c-src/emacs/src/lisp.h 654
+Lisp_Type c-src/emacs/src/lisp.h 451
+Lisp_Vector c-src/emacs/src/lisp.h 1369
+Lisp_Vectorlike c-src/emacs/src/lisp.h 472
+Lisp_functions c-src/etags.c /^Lisp_functions (FILE *inf)$/
+Lisp_help c-src/etags.c 591
+Lisp_suffixes c-src/etags.c 589
+ListEdit pyt-src/server.py /^class ListEdit(Frame):$/
+Locate pas-src/common.pas /^function Locate; (*($/
+Lock/t ada-src/2ataspri.ads /^ type Lock is private;$/
+Lock/t ada-src/2ataspri.ads /^ type Lock is$/
+LowerCaseNmStr pas-src/common.pas /^function LowerCaseNmStr; (*($/
+Lua_functions c-src/etags.c /^Lua_functions (FILE *inf)$/
+Lua_help c-src/etags.c 600
+Lua_suffixes c-src/etags.c 598
+MAGENTA cp-src/screen.hpp 17
+MAGICBYTE c-src/emacs/src/gmalloc.c 1856
+MAGICFREE c-src/emacs/src/gmalloc.c 1855
+MAGICWORD c-src/emacs/src/gmalloc.c 1854
+MAKE make-src/Makefile /^MAKE:=$(MAKE) --no-print-directory$/
+MAKESRC make-src/Makefile /^MAKESRC=Makefile$/
+MALLOCFLOOD c-src/emacs/src/gmalloc.c 1857
+MANY c-src/emacs/src/lisp.h 2833
+MARKERP c-src/emacs/src/lisp.h /^# define MARKERP(x) lisp_h_MARKERP (x)$/
+MAXPATHLEN c-src/etags.c 115
+MAX_ALLOCA c-src/emacs/src/lisp.h 4556
+MAX_ENCODED_BYTES c-src/emacs/src/keyboard.c 2254
+MAX_HASH_VALUE c-src/etags.c 2329
+MAX_WORD_LENGTH c-src/etags.c 2327
+MAYBEREL y-src/parse.y /^#define MAYBEREL(p) (*(p)=='[' && (isdigit((p)[1])/
+MBYTES objc-src/PackInsp.m 59
+MCHECK_DISABLED c-src/emacs/src/gmalloc.c 285
+MCHECK_FREE c-src/emacs/src/gmalloc.c 287
+MCHECK_HEAD c-src/emacs/src/gmalloc.c 288
+MCHECK_OK c-src/emacs/src/gmalloc.c 286
+MCHECK_TAIL c-src/emacs/src/gmalloc.c 289
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (T *d, int r, int c) : DiagArray2<T>/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (const Array<T>& a) : DiagArray2<T> /
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (const DiagArray2<T>& a) : DiagArray/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (const MDiagArray2<T>& a) : DiagArra/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (int r, int c) : DiagArray2<T> (r, c/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (int r, int c, const T& val) : DiagA/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (void) : DiagArray2<T> () { }$/
+MDiagArray2 cp-src/MDiagArray2.h 78
+MIN_HASH_VALUE c-src/etags.c 2328
+MIN_WORD_LENGTH c-src/etags.c 2326
+MISCP c-src/emacs/src/lisp.h /^# define MISCP(x) lisp_h_MISCP (x)$/
+MOST_NEGATIVE_FIXNUM c-src/emacs/src/lisp.h 835
+MOST_POSITIVE_FIXNUM c-src/emacs/src/lisp.h 834
+MOVE c-src/sysdep.h /^#define MOVE(x,y) movl x, y$/
+MSDOS c-src/etags.c 100
+MSDOS c-src/etags.c 106
+MSDOS c-src/etags.c 107
+MSDOS c-src/etags.c 110
+MSGSEL f-src/entry.for /^ ENTRY MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange /^ ENTRY MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange_suffix /^ ENTRY MSGSEL ( TYPE )$/
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c /^#define MULTI_LETTER_MOD(BIT, NAME, LEN) \\$/
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c /^#define MULTI_LETTER_MOD(BIT, NAME, LEN) \\$/
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c 6231
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c 6764
+Machin_T/b ada-src/waroquiers.ada /^ protected body Machin_T is$/
+Machin_T/t ada-src/etags-test-for.ada /^ protected Machin_T is$/
+Machin_T/t ada-src/etags-test-for.ada /^ protected type Machin_T is$/
+Machin_T/t ada-src/waroquiers.ada /^ protected type Machin_T is$/
+Machine_Exceptions/t ada-src/2ataspri.ads /^ type Machine_Exceptions is new Interfaces.C.POS/
+MakeDispose pyt-src/server.py /^ def MakeDispose(self):$/
+MakeSitelist pyt-src/server.py /^ def MakeSitelist(self, master):$/
+Makefile_filenames c-src/etags.c 603
+Makefile_help c-src/etags.c 605
+Makefile_targets c-src/etags.c /^Makefile_targets (FILE *inf)$/
+Mc cp-src/c.C /^int main (void) { my_function0(0); my_function1(1)/
+Mcccp y-src/cccp.y /^main ()$/
+Mconway.cpp cp-src/conway.cpp /^void main(void)$/
+Metags c-src/etags.c /^main (int argc, char **argv)$/
+Mfail cp-src/fail.C /^main()$/
+Mkai-test.pl perl-src/kai-test.pl /^package main;$/
+ModuleExample ruby-src/test.rb /^module ModuleExample$/
+More_Lisp_Bits c-src/emacs/src/lisp.h 801
+MoveLayerAfter lua-src/allegro.lua /^function MoveLayerAfter (this_one)$/
+MoveLayerBefore lua-src/allegro.lua /^function MoveLayerBefore (this_one)$/
+MoveLayerBottom lua-src/allegro.lua /^function MoveLayerBottom ()$/
+MoveLayerTop lua-src/allegro.lua /^function MoveLayerTop ()$/
+Mtest.go go-src/test.go /^func main() {$/
+Mtest.go go-src/test.go 1
+Mtest.rs rs-src/test.rs /^fn main() {$/
+Mtest1.go go-src/test1.go /^func main() {$/
+Mtest1.go go-src/test1.go 1
+Mx.cc cp-src/x.cc /^main(int argc, char *argv[])$/
+NAME y-src/cccp.c 8
+NATNUMP c-src/emacs/src/lisp.h /^NATNUMP (Lisp_Object x)$/
+NDEBUG c-src/etags.c 88
+NE y-src/parse.c 6
+NEG y-src/parse.c 9
+NEXT_ALMOST_PRIME_LIMIT c-src/emacs/src/lisp.h 3573
+NILP c-src/emacs/src/lisp.h /^# define NILP(x) lisp_h_NILP (x)$/
+NIL_IS_ZERO c-src/emacs/src/lisp.h 1515
+NONPOINTER_BITS c-src/emacs/src/lisp.h 78
+NONPOINTER_BITS c-src/emacs/src/lisp.h 80
+NONSRCS make-src/Makefile /^NONSRCS=entry.strange lists.erl clheir.hpp.gz$/
+NOTEQUAL y-src/cccp.c 13
+NULL y-src/cccp.y 51
+NULL_PTR y-src/cccp.y 63
+NUMSTATS objc-src/PackInsp.h 36
+NUM_MOD_NAMES c-src/emacs/src/keyboard.c 6325
+NUM_RECENT_KEYS c-src/emacs/src/keyboard.c 91
+NameHasChar pas-src/common.pas /^function NameHasChar; (* (TheName : NameString; Th/
+NameStringLess pas-src/common.pas /^function NameStringLess;(*(var Name1,Name2 : NameS/
+NewLayer lua-src/allegro.lua /^function NewLayer (name, x, y, w, h)$/
+NewLayerSet lua-src/allegro.lua /^function NewLayerSet (name)$/
+NewNameString pas-src/common.pas /^procedure NewNameString; (* (var NSP: NameStringPo/
+NmStrToErrStr pas-src/common.pas /^function NmStrToErrStr;(*($/
+NmStrToInteger pas-src/common.pas /^function NmStrToInteger; (* (Str : NameString) : i/
+OBJCPPSRC make-src/Makefile /^OBJCPPSRC=SimpleCalc.H SimpleCalc.M$/
+OBJCSRC make-src/Makefile /^OBJCSRC=Subprocess.h Subprocess.m PackInsp.h PackI/
+OBJS make-src/Makefile /^OBJS=${GETOPTOBJS} ${REGEXOBJS} ${CHECKOBJS}$/
+OPENBUTTON objc-src/PackInsp.m 47
+OPTIONS make-src/Makefile /^OPTIONS=--members --declarations --regex=@regexfil/
+OR y-src/cccp.c 10
+OTAGS make-src/Makefile /^OTAGS: oetags ${SRCS} srclist$/
+OVERLAYP c-src/emacs/src/lisp.h /^OVERLAYP (Lisp_Object x)$/
+Objc_help c-src/etags.c 613
+Objc_suffixes c-src/etags.c 609
+OperatorFun c-src/h.h 88
+Overview tex-src/gzip.texi /^@node Overview, Sample, Copying, Top$/
+PASSRC make-src/Makefile /^PASSRC=common.pas$/
+PDT c-src/h.h /^ Date 04 May 87 235311 PDT (Mon)$/
+PERLSRC make-src/Makefile /^PERLSRC=htlmify-cystic yagrip.pl kai-test.pl mirro/
+PHPSRC make-src/Makefile /^PHPSRC=lce_functions.php ptest.php sendmail.php$/
+PHP_functions c-src/etags.c /^PHP_functions (FILE *inf)$/
+PHP_help c-src/etags.c 639
+PHP_suffixes c-src/etags.c 637
+POEntry php-src/lce_functions.php /^ function POEntry()$/
+POEntry php-src/lce_functions.php 105
+POEntryAD php-src/lce_functions.php 29
+PORManager php-src/lce_functions.php /^ function PORManager()$/
+PORManager php-src/lce_functions.php 498
+POReader php-src/lce_functions.php /^ function POReader($domain, $filename)$/
+POReader php-src/lce_functions.php 163
+POSTSCRIPTFLAGS make-src/Makefile /^POSTSCRIPTFLAGS=--language=none --regex='#\/[^ \\t{]/
+PRINT_UNDOCUMENTED_OPTIONS_HELP c-src/etags.c 804
+PROCESSP c-src/emacs/src/lisp.h /^PROCESSP (Lisp_Object a)$/
+PROLSRC make-src/Makefile /^PROLSRC=ordsets.prolog natded.prolog$/
+PROP c-src/emacs/src/keyboard.c /^#define PROP(IDX) AREF (tool_bar_item_properties, /
+PROP c-src/emacs/src/keyboard.c 8379
+PROTECT_MALLOC_STATE c-src/emacs/src/gmalloc.c /^#define PROTECT_MALLOC_STATE(PROT) \/* empty *\/$/
+PROTECT_MALLOC_STATE c-src/emacs/src/gmalloc.c /^#define PROTECT_MALLOC_STATE(PROT) protect_malloc_/
+PRTPKG f-src/entry.for /^ LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PRTPKG f-src/entry.strange /^ LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PRTPKG f-src/entry.strange_suffix /^ LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PSEUDO c-src/sysdep.h /^#define PSEUDO(name, syscall_name, args) /
+PSEUDOVECSIZE c-src/emacs/src/lisp.h /^#define PSEUDOVECSIZE(type, nonlispfield) \\$/
+PSEUDOVECTORP c-src/emacs/src/lisp.h /^PSEUDOVECTORP (Lisp_Object a, int code)$/
+PSEUDOVECTOR_AREA_BITS c-src/emacs/src/lisp.h 818
+PSEUDOVECTOR_FLAG c-src/emacs/src/lisp.h 774
+PSEUDOVECTOR_REST_BITS c-src/emacs/src/lisp.h 813
+PSEUDOVECTOR_REST_MASK c-src/emacs/src/lisp.h 814
+PSEUDOVECTOR_SIZE_BITS c-src/emacs/src/lisp.h 808
+PSEUDOVECTOR_SIZE_MASK c-src/emacs/src/lisp.h 809
+PSEUDOVECTOR_TYPEP c-src/emacs/src/lisp.h /^PSEUDOVECTOR_TYPEP (struct vectorlike_header *a, i/
+PSSRC make-src/Makefile /^PSSRC=rfc1245.ps$/
+PS_functions c-src/etags.c /^PS_functions (FILE *inf)$/
+PS_help c-src/etags.c 649
+PS_suffixes c-src/etags.c 647
+PTY_LENGTH objc-src/Subprocess.m 21
+PTY_TEMPLATE objc-src/Subprocess.m 20
+PUSH_C_STR c-src/emacs/src/keyboard.c /^#define PUSH_C_STR(str, listvar) \\$/
+PUSH_HANDLER c-src/emacs/src/lisp.h /^#define PUSH_HANDLER(c, tag_ch_val, handlertype) \\/
+PVEC_BOOL_VECTOR c-src/emacs/src/lisp.h 787
+PVEC_BUFFER c-src/emacs/src/lisp.h 788
+PVEC_CHAR_TABLE c-src/emacs/src/lisp.h 796
+PVEC_COMPILED c-src/emacs/src/lisp.h 795
+PVEC_FONT c-src/emacs/src/lisp.h 798
+PVEC_FRAME c-src/emacs/src/lisp.h 785
+PVEC_FREE c-src/emacs/src/lisp.h 783
+PVEC_HASH_TABLE c-src/emacs/src/lisp.h 789
+PVEC_NORMAL_VECTOR c-src/emacs/src/lisp.h 782
+PVEC_OTHER c-src/emacs/src/lisp.h 793
+PVEC_PROCESS c-src/emacs/src/lisp.h 784
+PVEC_SUBR c-src/emacs/src/lisp.h 792
+PVEC_SUB_CHAR_TABLE c-src/emacs/src/lisp.h 797
+PVEC_TERMINAL c-src/emacs/src/lisp.h 790
+PVEC_TYPE_MASK c-src/emacs/src/lisp.h 819
+PVEC_WINDOW c-src/emacs/src/lisp.h 786
+PVEC_WINDOW_CONFIGURATION c-src/emacs/src/lisp.h 791
+PYTSRC make-src/Makefile /^PYTSRC=server.py$/
+PackageInspector objc-src/PackInsp.h /^@interface PackageInspector:WMInspector$/
+Pascal_functions c-src/etags.c /^Pascal_functions (FILE *inf)$/
+Pascal_help c-src/etags.c 621
+Pascal_suffixes c-src/etags.c 619
+Perl_functions c-src/etags.c /^Perl_functions (FILE *inf)$/
+Perl_help c-src/etags.c 630
+Perl_interpreters c-src/etags.c 628
+Perl_suffixes c-src/etags.c 626
+Pkg1/b ada-src/etags-test-for.ada /^package body Pkg1 is$/
+Pkg1/b ada-src/waroquiers.ada /^package body Pkg1 is$/
+Pkg1/s ada-src/etags-test-for.ada /^package Pkg1 is$/
+Pkg1/s ada-src/waroquiers.ada /^package Pkg1 is$/
+Pkg1_Func1/f ada-src/etags-test-for.ada /^ function Pkg1_Func1 return Boolean is separate;$/
+Pkg1_Func1/f ada-src/etags-test-for.ada /^ function Pkg1_Func1 return Boolean;$/
+Pkg1_Func1/f ada-src/etags-test-for.ada /^function Pkg1_Func1 return Boolean is$/
+Pkg1_Func1/f ada-src/waroquiers.ada /^ function Pkg1_Func1 return Boolean is separate;$/
+Pkg1_Func1/f ada-src/waroquiers.ada /^ function Pkg1_Func1 return Boolean;$/
+Pkg1_Func1/f ada-src/waroquiers.ada /^function Pkg1_Func1 return Boolean is$/
+Pkg1_Func2/f ada-src/etags-test-for.ada /^ function Pkg1_Func2 (Ijk : Integer; Z : Integer)/
+Pkg1_Func2/f ada-src/waroquiers.ada /^ function Pkg1_Func2 (Ijk : Integer; Z : Integer)/
+Pkg1_Pkg1/b ada-src/etags-test-for.ada /^ package body Pkg1_Pkg1 is separate;$/
+Pkg1_Pkg1/b ada-src/etags-test-for.ada /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/b ada-src/waroquiers.ada /^ package body Pkg1_Pkg1 is separate;$/
+Pkg1_Pkg1/b ada-src/waroquiers.ada /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s ada-src/etags-test-for.ada /^ package Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s ada-src/waroquiers.ada /^ package Pkg1_Pkg1 is$/
+Pkg1_Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Pkg1_Proc1 is$/
+Pkg1_Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Pkg1_Proc1 is$/
+Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc1;$/
+Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc1;$/
+Pkg1_Proc2/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc2 (I : Integer) is$/
+Pkg1_Proc2/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc2 (I : Integer);$/
+Pkg1_Proc2/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc2 (I : Integer) is$/
+Pkg1_Proc2/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc2 (I : Integer);$/
+PostControls pyt-src/server.py /^ def PostControls(self):$/
+Pre_Call_State/t ada-src/2ataspri.ads /^ type Pre_Call_State is new System.Address;$/
+PrintAdd go-src/test1.go /^func (n intNumber) PrintAdd() {$/
+PrintAdd go-src/test1.go /^func (s str) PrintAdd() {$/
+Private objc-src/Subprocess.m /^@interface Subprocess(Private)$/
+Private_T/b ada-src/etags-test-for.ada /^ task body Private_T is$/
+Private_T/b ada-src/waroquiers.ada /^ task body Private_T is$/
+Private_T/k ada-src/etags-test-for.ada /^ task Private_T;$/
+Private_T/k ada-src/waroquiers.ada /^ task Private_T;$/
+Private_T/p ada-src/etags-test-for.ada /^ procedure Private_T is$/
+Private_T/p ada-src/etags-test-for.ada /^ procedure Private_T;$/
+Private_T/p ada-src/waroquiers.ada /^ procedure Private_T is$/
+Private_T/p ada-src/waroquiers.ada /^ procedure Private_T;$/
+Private_T/t ada-src/etags-test-for.ada /^ type Private_T is private;$/
+Private_T/t ada-src/etags-test-for.ada /^ type Private_T is$/
+Private_T/t ada-src/waroquiers.ada /^ type Private_T is private;$/
+Private_T/t ada-src/waroquiers.ada /^ type Private_T is$/
+Problems tex-src/gzip.texi /^@node Problems, Concept Index, Tapes, Top$/
+Proc/t ada-src/2ataspri.ads /^ type Proc is access procedure (Addr : System.Ad/
+Prolog_functions c-src/etags.c /^Prolog_functions (FILE *inf)$/
+Prolog_help c-src/etags.c 654
+Prolog_suffixes c-src/etags.c 652
+Public_T/t ada-src/etags-test-for.ada /^ type Public_T is$/
+Public_T/t ada-src/waroquiers.ada /^ type Public_T is$/
+Python_functions c-src/etags.c /^Python_functions (FILE *inf)$/
+Python_help c-src/etags.c 660
+Python_suffixes c-src/etags.c 658
+QUIT c-src/emacs/src/lisp.h 3101
+QUITP c-src/emacs/src/lisp.h 3112
+RANGED_INTEGERP c-src/emacs/src/lisp.h /^RANGED_INTEGERP (intmax_t lo, Lisp_Object x, intma/
+RCSid objc-src/PackInsp.m 30
+READABLE_EVENTS_DO_TIMERS_NOW c-src/emacs/src/keyboard.c 346
+READABLE_EVENTS_FILTER_EVENTS c-src/emacs/src/keyboard.c 347
+READABLE_EVENTS_IGNORE_SQUEEZABLES c-src/emacs/src/keyboard.c 348
+RECC_ALNUM c-src/emacs/src/regex.h 610
+RECC_ALPHA c-src/emacs/src/regex.h 610
+RECC_ASCII c-src/emacs/src/regex.h 617
+RECC_BLANK c-src/emacs/src/regex.h 615
+RECC_CNTRL c-src/emacs/src/regex.h 613
+RECC_DIGIT c-src/emacs/src/regex.h 614
+RECC_ERROR c-src/emacs/src/regex.h 609
+RECC_GRAPH c-src/emacs/src/regex.h 611
+RECC_LOWER c-src/emacs/src/regex.h 612
+RECC_MULTIBYTE c-src/emacs/src/regex.h 616
+RECC_NONASCII c-src/emacs/src/regex.h 616
+RECC_PRINT c-src/emacs/src/regex.h 611
+RECC_PUNCT c-src/emacs/src/regex.h 613
+RECC_SPACE c-src/emacs/src/regex.h 615
+RECC_UNIBYTE c-src/emacs/src/regex.h 617
+RECC_UPPER c-src/emacs/src/regex.h 612
+RECC_WORD c-src/emacs/src/regex.h 610
+RECC_XDIGIT c-src/emacs/src/regex.h 614
+RED cp-src/screen.hpp 16
+REGEX make-src/Makefile /^REGEX=\/[ \\t]*DEFVAR_[A-Z_ \\t\\n(]+"\\([^"]+\\)"\/$/
+REGEXOBJS make-src/Makefile /^REGEXOBJS=regex.o$/
+REGS_FIXED c-src/emacs/src/regex.h 378
+REGS_REALLOCATE c-src/emacs/src/regex.h 377
+REGS_UNALLOCATED c-src/emacs/src/regex.h 376
+REG_BADBR c-src/emacs/src/regex.h 313
+REG_BADPAT c-src/emacs/src/regex.h 305
+REG_BADRPT c-src/emacs/src/regex.h 316
+REG_EBRACE c-src/emacs/src/regex.h 312
+REG_EBRACK c-src/emacs/src/regex.h 310
+REG_ECOLLATE c-src/emacs/src/regex.h 306
+REG_ECTYPE c-src/emacs/src/regex.h 307
+REG_EEND c-src/emacs/src/regex.h 319
+REG_EESCAPE c-src/emacs/src/regex.h 308
+REG_ENOSYS c-src/emacs/src/regex.h 297
+REG_ENOSYS c.c 279
+REG_EPAREN c-src/emacs/src/regex.h 311
+REG_ERANGE c-src/emacs/src/regex.h 314
+REG_ERANGEX c-src/emacs/src/regex.h 322
+REG_ERPAREN c-src/emacs/src/regex.h 321
+REG_ESIZE c-src/emacs/src/regex.h 320
+REG_ESPACE c-src/emacs/src/regex.h 315
+REG_ESUBREG c-src/emacs/src/regex.h 309
+REG_EXTENDED c-src/emacs/src/regex.h 263
+REG_ICASE c-src/emacs/src/regex.h 267
+REG_NEWLINE c-src/emacs/src/regex.h 272
+REG_NOERROR c-src/emacs/src/regex.h 300
+REG_NOMATCH c-src/emacs/src/regex.h 301
+REG_NOSUB c-src/emacs/src/regex.h 276
+REG_NOTBOL c-src/emacs/src/regex.h 286
+REG_NOTEOL c-src/emacs/src/regex.h 289
+RELEASELIST make-src/Makefile /^RELEASELIST=pot@gnu.org xemacs-review@xemacs.org j/
+RESUME_POLLING c-src/emacs/src/keyboard.c 2170
+RETURN_UNGCPRO c-src/emacs/src/lisp.h /^#define RETURN_UNGCPRO(expr) \\$/
+RE_BACKSLASH_ESCAPE_IN_LISTS c-src/emacs/src/regex.h 47
+RE_BK_PLUS_QM c-src/emacs/src/regex.h 52
+RE_CHAR_CLASSES c-src/emacs/src/regex.h 58
+RE_CONTEXT_INDEP_ANCHORS c-src/emacs/src/regex.h 72
+RE_CONTEXT_INDEP_OPS c-src/emacs/src/regex.h 80
+RE_CONTEXT_INVALID_OPS c-src/emacs/src/regex.h 84
+RE_DEBUG c-src/emacs/src/regex.h 161
+RE_DOT_NEWLINE c-src/emacs/src/regex.h 88
+RE_DOT_NOT_NULL c-src/emacs/src/regex.h 92
+RE_DUP_MAX c-src/emacs/src/regex.h 253
+RE_DUP_MAX c-src/emacs/src/regex.h 256
+RE_FRUGAL c-src/emacs/src/regex.h 147
+RE_HAT_LISTS_NOT_NEWLINE c-src/emacs/src/regex.h 96
+RE_INTERVALS c-src/emacs/src/regex.h 101
+RE_LIMITED_OPS c-src/emacs/src/regex.h 105
+RE_NEWLINE_ALT c-src/emacs/src/regex.h 109
+RE_NO_BK_BRACES c-src/emacs/src/regex.h 114
+RE_NO_BK_PARENS c-src/emacs/src/regex.h 118
+RE_NO_BK_REFS c-src/emacs/src/regex.h 122
+RE_NO_BK_VBAR c-src/emacs/src/regex.h 126
+RE_NO_EMPTY_RANGES c-src/emacs/src/regex.h 132
+RE_NO_GNU_OPS c-src/emacs/src/regex.h 144
+RE_NO_NEWLINE_ANCHOR c-src/emacs/src/regex.h 153
+RE_NO_POSIX_BACKTRACKING c-src/emacs/src/regex.h 140
+RE_NREGS c-src/emacs/src/regex.h 440
+RE_SHY_GROUPS c-src/emacs/src/regex.h 150
+RE_SYNTAX_AWK c-src/emacs/src/regex.h 186
+RE_SYNTAX_ED c-src/emacs/src/regex.h 216
+RE_SYNTAX_EGREP c-src/emacs/src/regex.h 206
+RE_SYNTAX_EMACS c-src/emacs/src/regex.h 183
+RE_SYNTAX_GNU_AWK c-src/emacs/src/regex.h 193
+RE_SYNTAX_GREP c-src/emacs/src/regex.h 201
+RE_SYNTAX_POSIX_AWK c-src/emacs/src/regex.h 197
+RE_SYNTAX_POSIX_BASIC c-src/emacs/src/regex.h 225
+RE_SYNTAX_POSIX_EGREP c-src/emacs/src/regex.h 212
+RE_SYNTAX_POSIX_EXTENDED c-src/emacs/src/regex.h 234
+RE_SYNTAX_POSIX_MINIMAL_BASIC c-src/emacs/src/regex.h 231
+RE_SYNTAX_POSIX_MINIMAL_EXTENDED c-src/emacs/src/regex.h 242
+RE_SYNTAX_SED c-src/emacs/src/regex.h 218
+RE_TRANSLATE_TYPE c-src/emacs/src/regex.h 332
+RE_UNMATCHED_RIGHT_PAREN_ORD c-src/emacs/src/regex.h 136
+RSH y-src/cccp.c 17
+RTE/s ada-src/2ataspri.adb /^ package RTE renames Interfaces.C.POSIX_RTE;$/
+RUN make-src/Makefile /^RUN=$/
+RUN make-src/Makefile /^RUN=time --quiet --format '%U + %S: %E'$/
+RXINCLUDE make-src/Makefile /^RXINCLUDE=-Iemacs\/src$/
+Range cp-src/Range.h /^ Range (const Range& r)$/
+Range cp-src/Range.h /^ Range (double b, double l)$/
+Range cp-src/Range.h /^ Range (double b, double l, double i)$/
+Range cp-src/Range.h /^ Range (void)$/
+Range cp-src/Range.h 35
+ReadVacation cp-src/functions.cpp /^void ReadVacation ( char *filename ) {$/
+Read_Lock/p ada-src/2ataspri.adb /^ procedure Read_Lock (L : in out Lock; Ceiling_V/
+Read_Lock/p ada-src/2ataspri.ads /^ procedure Read_Lock (L : in out Lock; Ceiling_V/
+Rectangle.getPos lua-src/test.lua /^function Rectangle.getPos ()$/
+ReleaseNameString pas-src/common.pas /^procedure ReleaseNameString; (* (var NSP: NameStri/
+RemoveLayer lua-src/allegro.lua /^function RemoveLayer ()$/
+RemoveUnderlineControl pas-src/common.pas /^function RemoveUnderlineControl; (*($/
+ReprOfChar pas-src/common.pas /^function ReprOfChar; (*( ch : char) : NameString;*/
+S c.c 156
+SAFE_ALLOCA c-src/emacs/src/lisp.h /^#define SAFE_ALLOCA(size) ((size) <= sa_avail \\/
+SAFE_ALLOCA_LISP c-src/emacs/src/lisp.h /^#define SAFE_ALLOCA_LISP(buf, nelt) \\$/
+SAFE_ALLOCA_STRING c-src/emacs/src/lisp.h /^#define SAFE_ALLOCA_STRING(ptr, string) \\$/
+SAFE_FREE c-src/emacs/src/lisp.h /^#define SAFE_FREE() \\$/
+SAFE_NALLOCA c-src/emacs/src/lisp.h /^#define SAFE_NALLOCA(buf, multiplier, nitems) \\/
+SAVE_FUNCPOINTER c-src/emacs/src/lisp.h 2049
+SAVE_INTEGER c-src/emacs/src/lisp.h 2048
+SAVE_OBJECT c-src/emacs/src/lisp.h 2051
+SAVE_POINTER c-src/emacs/src/lisp.h 2050
+SAVE_SLOT_BITS c-src/emacs/src/lisp.h 2055
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2062
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2114
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2123
+SAVE_TYPE_FUNCPTR_PTR_OBJ c-src/emacs/src/lisp.h 2076
+SAVE_TYPE_INT_INT c-src/emacs/src/lisp.h 2066
+SAVE_TYPE_INT_INT_INT c-src/emacs/src/lisp.h 2067
+SAVE_TYPE_MEMORY c-src/emacs/src/lisp.h 2080
+SAVE_TYPE_OBJ_OBJ c-src/emacs/src/lisp.h 2069
+SAVE_TYPE_OBJ_OBJ_OBJ c-src/emacs/src/lisp.h 2070
+SAVE_TYPE_OBJ_OBJ_OBJ_OBJ c-src/emacs/src/lisp.h 2071
+SAVE_TYPE_PTR_INT c-src/emacs/src/lisp.h 2073
+SAVE_TYPE_PTR_OBJ c-src/emacs/src/lisp.h 2074
+SAVE_TYPE_PTR_PTR c-src/emacs/src/lisp.h 2075
+SAVE_UNUSED c-src/emacs/src/lisp.h 2047
+SAVE_VALUEP c-src/emacs/src/lisp.h /^SAVE_VALUEP (Lisp_Object x)$/
+SAVE_VALUE_SLOTS c-src/emacs/src/lisp.h 2058
+SBYTES c-src/emacs/src/lisp.h /^SBYTES (Lisp_Object string)$/
+SCHARS c-src/emacs/src/lisp.h /^SCHARS (Lisp_Object string)$/
+SCREEN_FP cp-src/screen.hpp /^#define SCREEN_FP(x,y) \\$/
+SCREEN_START cp-src/screen.hpp 33
+SDATA c-src/emacs/src/lisp.h /^SDATA (Lisp_Object string)$/
+SDTrefGetInteger pas-src/common.pas /^function SDTrefGetInteger : integer;$/
+SDTrefIsEnd pas-src/common.pas /^function SDTrefIsEnd : Boolean;$/
+SDTrefRecToString pas-src/common.pas /^procedure SDTrefRecToString (* ($/
+SDTrefSkipSpaces pas-src/common.pas /^procedure SDTrefSkipSpaces;$/
+SDTrefStringToRec pas-src/common.pas /^procedure SDTrefStringToRec (* ($/
+SETPRT f-src/entry.for /^ ENTRY SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SETPRT f-src/entry.strange /^ ENTRY SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SETPRT f-src/entry.strange_suffix /^ ENTRY SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SET_SYMBOL_BLV c-src/emacs/src/lisp.h /^SET_SYMBOL_BLV (struct Lisp_Symbol *sym, struct Li/
+SET_SYMBOL_FWD c-src/emacs/src/lisp.h /^SET_SYMBOL_FWD (struct Lisp_Symbol *sym, union Lis/
+SET_SYMBOL_VAL c-src/emacs/src/lisp.h /^# define SET_SYMBOL_VAL(sym, v) lisp_h_SET_SYMBOL_/
+SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c /^#define SINGLE_LETTER_MOD(BIT) \\$/
+SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c 6212
+SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c 6763
+SIZEFORMAT objc-src/PackInsp.m 57
+SPECPDL_BACKTRACE c-src/emacs/src/lisp.h 2948
+SPECPDL_INDEX c-src/emacs/src/lisp.h /^SPECPDL_INDEX (void)$/
+SPECPDL_LET c-src/emacs/src/lisp.h 2949
+SPECPDL_LET_DEFAULT c-src/emacs/src/lisp.h 2952
+SPECPDL_LET_LOCAL c-src/emacs/src/lisp.h 2951
+SPECPDL_UNWIND c-src/emacs/src/lisp.h 2944
+SPECPDL_UNWIND_INT c-src/emacs/src/lisp.h 2946
+SPECPDL_UNWIND_PTR c-src/emacs/src/lisp.h 2945
+SPECPDL_UNWIND_VOID c-src/emacs/src/lisp.h 2947
+SRCS make-src/Makefile /^SRCS=Makefile ${ADASRC} ${ASRC} ${CSRC} ${CPSRC} $/
+SREF c-src/emacs/src/lisp.h /^SREF (Lisp_Object string, ptrdiff_t index)$/
+SSDATA c-src/emacs/src/lisp.h /^SSDATA (Lisp_Object string)$/
+SSET c-src/emacs/src/lisp.h /^SSET (Lisp_Object string, ptrdiff_t index, unsigne/
+STACK_CONS c-src/emacs/src/lisp.h /^#define STACK_CONS(a, b) \\$/
+STATE_ABORT php-src/lce_functions.php 25
+STATE_COMPRESSD objc-src/PackInsp.m 54
+STATE_INSTALLED objc-src/PackInsp.m 53
+STATE_LOOP php-src/lce_functions.php 27
+STATE_OK php-src/lce_functions.php 26
+STATE_UNINSTALLED objc-src/PackInsp.m 52
+STAT_EQ objc-src/PackInsp.m /^#define STAT_EQ(s1, s2) ((s1)->st_ino == (s2)->st_/
+STDIN c-src/etags.c 408
+STDIN c-src/etags.c 411
+STOP_POLLING c-src/emacs/src/keyboard.c 2166
+STRING_BYTES c-src/emacs/src/lisp.h /^STRING_BYTES (struct Lisp_String *s)$/
+STRING_BYTES_BOUND c-src/emacs/src/lisp.h 1261
+STRING_MULTIBYTE c-src/emacs/src/lisp.h /^STRING_MULTIBYTE (Lisp_Object str)$/
+STRING_SET_CHARS c-src/emacs/src/lisp.h /^STRING_SET_CHARS (Lisp_Object string, ptrdiff_t ne/
+STRING_SET_MULTIBYTE c-src/emacs/src/lisp.h /^#define STRING_SET_MULTIBYTE(STR) \\$/
+STRING_SET_UNIBYTE c-src/emacs/src/lisp.h /^#define STRING_SET_UNIBYTE(STR) \\$/
+SUBRP c-src/emacs/src/lisp.h /^SUBRP (Lisp_Object a)$/
+SUB_CHAR_TABLE_OFFSET c-src/emacs/src/lisp.h 1701
+SUB_CHAR_TABLE_P c-src/emacs/src/lisp.h /^SUB_CHAR_TABLE_P (Lisp_Object a)$/
+SXHASH_REDUCE c-src/emacs/src/lisp.h /^SXHASH_REDUCE (EMACS_UINT x)$/
+SYMBOLP c-src/emacs/src/lisp.h /^# define SYMBOLP(x) lisp_h_SYMBOLP (x)$/
+SYMBOL_BLV c-src/emacs/src/lisp.h /^SYMBOL_BLV (struct Lisp_Symbol *sym)$/
+SYMBOL_CONSTANT_P c-src/emacs/src/lisp.h /^# define SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONS/
+SYMBOL_FORWARDED c-src/emacs/src/lisp.h 651
+SYMBOL_FWD c-src/emacs/src/lisp.h /^SYMBOL_FWD (struct Lisp_Symbol *sym)$/
+SYMBOL_INDEX c-src/emacs/src/lisp.h /^#define SYMBOL_INDEX(sym) i##sym$/
+SYMBOL_INTERNED c-src/emacs/src/lisp.h 642
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY c-src/emacs/src/lisp.h 643
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P c-src/emacs/src/lisp.h /^SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object /
+SYMBOL_INTERNED_P c-src/emacs/src/lisp.h /^SYMBOL_INTERNED_P (Lisp_Object sym)$/
+SYMBOL_LOCALIZED c-src/emacs/src/lisp.h 650
+SYMBOL_NAME c-src/emacs/src/lisp.h /^SYMBOL_NAME (Lisp_Object sym)$/
+SYMBOL_PLAINVAL c-src/emacs/src/lisp.h 648
+SYMBOL_UNINTERNED c-src/emacs/src/lisp.h 641
+SYMBOL_VAL c-src/emacs/src/lisp.h /^# define SYMBOL_VAL(sym) lisp_h_SYMBOL_VAL (sym)$/
+SYMBOL_VARALIAS c-src/emacs/src/lisp.h 649
+SYSCALL c-src/machsyscalls.c /^#define SYSCALL(name, number, type, args, typed_ar/
+Sample tex-src/gzip.texi /^@node Sample, Invoking gzip, Overview, Top$/
+Scheme_functions c-src/etags.c /^Scheme_functions (FILE *inf)$/
+Scheme_help c-src/etags.c 667
+Scheme_suffixes c-src/etags.c 665
+SelectLayer lua-src/allegro.lua /^function SelectLayer (layer)$/
+Self/f ada-src/2ataspri.adb /^ function Self return TCB_Ptr is$/
+Self/f ada-src/2ataspri.ads /^ function Self return TCB_Ptr;$/
+Server pyt-src/server.py /^class Server:$/
+ServerEdit pyt-src/server.py /^class ServerEdit(Frame):$/
+Set_Own_Priority/p ada-src/2ataspri.adb /^ procedure Set_Own_Priority (Prio : System.Any_P/
+Set_Own_Priority/p ada-src/2ataspri.ads /^ procedure Set_Own_Priority (Prio : System.Any_P/
+Set_Priority/p ada-src/2ataspri.adb /^ procedure Set_Priority$/
+Set_Priority/p ada-src/2ataspri.ads /^ procedure Set_Priority (T : TCB_Ptr; Prio : Sys/
+SimpleCalc objcpp-src/SimpleCalc.H /^@interface SimpleCalc:Object$/
+SkipBlanks pas-src/common.pas /^function SkipBlanks; (*($/
+SkipChars pas-src/common.pas /^function SkipChars; (*($/
+SkipSpaces pas-src/common.pas /^procedure SkipSpaces; (* (Str : NameString; var I /
+Square.something:Bar lua-src/test.lua /^function Square.something:Bar ()$/
+StartDay cp-src/functions.cpp /^Date StartDay(Date a,int days){\/\/Function to calcu/
+StripPath pas-src/common.pas /^function StripPath; (*($/
+SubString pas-src/common.pas /^function SubString; (*($/
+Subprocess objc-src/Subprocess.h /^@interface Subprocess:Object$/
+Subprocess objc-src/Subprocess.h 41
+System.Task_Primitives/b ada-src/2ataspri.adb /^package body System.Task_Primitives is$/
+System.Task_Primitives/s ada-src/2ataspri.ads /^package System.Task_Primitives is$/
+T cp-src/fail.C 14
+T2 cp-src/fail.C 16
+T3 c.c 163
+TAGS make-src/Makefile /^TAGS: etags.c$/
+TAG_PTR c-src/emacs/src/lisp.h /^#define TAG_PTR(tag, ptr) \\$/
+TAG_SYMOFFSET c-src/emacs/src/lisp.h /^#define TAG_SYMOFFSET(offset) \\$/
+TAS_Cell/t ada-src/2ataspri.ads /^ type TAS_Cell is private;$/
+TAS_Cell/t ada-src/2ataspri.ads /^ type TAS_Cell is$/
+TCB_Ptr/t ada-src/2ataspri.ads /^ type TCB_Ptr is access all Task_Control_Block;$/
+TCLFLAGS make-src/Makefile /^TCLFLAGS=--lang=none --regex='\/proc[ \\t]+\\([^ \\t]+/
+TERMINALP c-src/emacs/src/lisp.h /^TERMINALP (Lisp_Object a)$/
+TEST php-src/ptest.php 1
+TEXSRC make-src/Makefile /^TEXSRC=testenv.tex gzip.texi texinfo.tex nonewline/
+TEX_LESC c-src/etags.c 4986
+TEX_SESC c-src/etags.c 4987
+TEX_clgrp c-src/etags.c 4922
+TEX_decode_env c-src/etags.c /^TEX_decode_env (const char *evarname, const char */
+TEX_defenv c-src/etags.c 4912
+TEX_esc c-src/etags.c 4920
+TEX_mode c-src/etags.c /^TEX_mode (FILE *inf)$/
+TEX_opgrp c-src/etags.c 4921
+TEX_toktab c-src/etags.c 4908
+TOTAL_KEYWORDS c-src/etags.c 2325
+TSL/s ada-src/2ataspri.adb /^ package TSL renames System.Tasking_Soft_Links;$/
+TYPESTOSTAT objc-src/PackInsp.h 37
+TYPE_RANGED_INTEGERP c-src/emacs/src/lisp.h /^#define TYPE_RANGED_INTEGERP(type, x) \\$/
+Tapes tex-src/gzip.texi /^@node Tapes, Problems, Environment, Top$/
+Task_Control_Block/t ada-src/2ataspri.ads /^ type Task_Control_Block is record$/
+Task_Storage_Size/t ada-src/2ataspri.ads /^ type Task_Storage_Size is new Interfaces.C.size/
+Task_Type/b ada-src/etags-test-for.ada /^ task body Task_Type is$/
+Task_Type/b ada-src/waroquiers.ada /^ task body Task_Type is$/
+Task_Type/k ada-src/etags-test-for.ada /^ task type Task_Type is$/
+Task_Type/k ada-src/waroquiers.ada /^ task type Task_Type is$/
+TeX_commands c-src/etags.c /^TeX_commands (FILE *inf)$/
+TeX_help c-src/etags.c 674
+TeX_suffixes c-src/etags.c 672
+Test_Abort/p ada-src/2ataspri.adb /^ procedure Test_Abort is$/
+Test_Abort/p ada-src/2ataspri.ads /^ procedure Test_Abort;$/
+Test_And_Set/p ada-src/2ataspri.adb /^ procedure Test_And_Set (Cell : in out TAS_Cell;/
+Test_And_Set/p ada-src/2ataspri.ads /^ procedure Test_And_Set (Cell : in out TAS_Cell;/
+Texinfo_help c-src/etags.c 688
+Texinfo_nodes c-src/etags.c /^Texinfo_nodes (FILE *inf)$/
+Texinfo_suffixes c-src/etags.c 686
+Time_to_position c-src/emacs/src/keyboard.c /^Time_to_position (Time encoded_pos)$/
+To_Lower pas-src/common.pas /^function To_Lower;(*(ch:char) : char;*)$/
+To_Start_Addr/f ada-src/2ataspri.adb /^ function To_Start_Addr is new$/
+To_TCB_Ptr/f ada-src/2ataspri.adb /^ function To_TCB_Ptr is new$/
+To_Upper pas-src/common.pas /^function To_Upper;(*(ch:char) : char;*)$/
+To_void_ptr/f ada-src/2ataspri.adb /^ function To_void_ptr is new$/
+Top tex-src/gzip.texi /^@node Top, , , (dir)$/
+Truc.Bidule/b ada-src/etags-test-for.ada /^package body Truc.Bidule is$/
+Truc.Bidule/b ada-src/waroquiers.ada /^package body Truc.Bidule is$/
+Truc.Bidule/s ada-src/etags-test-for.ada /^package Truc.Bidule is$/
+Truc.Bidule/s ada-src/waroquiers.ada /^package Truc.Bidule is$/
+Truc/s ada-src/etags-test-for.ada /^package Truc is$/
+Truc/s ada-src/waroquiers.ada /^package Truc is$/
+Type_Specific_Data/t ada-src/etags-test-for.ada /^ type Type_Specific_Data is record$/
+UCHAR c-src/emacs/src/lisp.h 2424
+UNARY y-src/cccp.c 18
+UNDEFINED c-src/h.h 118
+UNEVALLED c-src/emacs/src/lisp.h 2834
+UNGCPRO c-src/emacs/src/lisp.h 3202
+UNGCPRO c-src/emacs/src/lisp.h 3257
+UNGCPRO c-src/emacs/src/lisp.h 3353
+UNLOCK c-src/emacs/src/gmalloc.c /^#define UNLOCK() \\$/
+UNLOCK c-src/emacs/src/gmalloc.c /^#define UNLOCK()$/
+UNLOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define UNLOCK_ALIGNED_BLOCKS() \\$/
+UNLOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define UNLOCK_ALIGNED_BLOCKS()$/
+UNSIGNED_CMP c-src/emacs/src/lisp.h /^#define UNSIGNED_CMP(a, op, b) \\$/
+USE_LSB_TAG c-src/emacs/src/lisp.h /^DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG)$/
+USE_LSB_TAG c-src/emacs/src/lisp.h 271
+USE_PTHREAD c-src/emacs/src/gmalloc.c 25
+USE_SAFE_ALLOCA c-src/emacs/src/lisp.h 4560
+USE_STACK_CONS c-src/emacs/src/lisp.h 4689
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4652
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4658
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4659
+USE_STACK_STRING c-src/emacs/src/lisp.h 4691
+U_CHAR y-src/cccp.y 38
+Unlock/p ada-src/2ataspri.adb /^ procedure Unlock (L : in out Lock) is$/
+Unlock/p ada-src/2ataspri.ads /^ procedure Unlock (L : in out Lock);$/
+User pyt-src/server.py /^class User:$/
+UserEdit pyt-src/server.py /^class UserEdit(Frame):$/
+VALBITS c-src/emacs/src/lisp.h 246
+VALMASK c-src/emacs/src/lisp.h /^DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK)$/
+VALMASK c-src/emacs/src/lisp.h 829
+VAL_MAX c-src/emacs/src/lisp.h 263
+VECSIZE c-src/emacs/src/lisp.h /^#define VECSIZE(type) \\$/
+VECTORLIKEP c-src/emacs/src/lisp.h /^# define VECTORLIKEP(x) lisp_h_VECTORLIKEP (x)$/
+VECTORP c-src/emacs/src/lisp.h /^VECTORP (Lisp_Object x)$/
+VERSION c-src/etags.c 789
+VERSION erl-src/gs_dialog.erl /^-define(VERSION, '2001.1101').$/
+VERSION objc-src/PackInsp.m 34
+VHDLFLAGS make-src/Makefile /^VHDLFLAGS=--language=none --regex='\/[ \\t]*\\(ARCHIT/
+Vabbrev_start_location c-src/abbrev.c 63
+Vabbrev_start_location_buffer c-src/abbrev.c 66
+Vabbrev_table_name_list c-src/abbrev.c 43
+ValToNmStr pas-src/common.pas /^function ValToNmStr; (*($/
+Vfundamental_mode_abbrev_table c-src/abbrev.c 52
+Vglobal_abbrev_table c-src/abbrev.c 48
+Vlast_abbrev c-src/abbrev.c 70
+Vlast_abbrev_text c-src/abbrev.c 75
+Vlispy_mouse_stem c-src/emacs/src/keyboard.c 5172
+WAIT_READING_MAX c-src/emacs/src/lisp.h 4281
+WAIT_READING_MAX c-src/emacs/src/lisp.h 4283
+WARNINGS make-src/Makefile /^WARNINGS=-pedantic -Wall -Wpointer-arith -Winline /
+WCHAR_TYPE_SIZE y-src/cccp.y 99
+WHITE cp-src/screen.hpp 27
+WINDOWP c-src/emacs/src/lisp.h /^WINDOWP (Lisp_Object a)$/
+WINDOWSNT c-src/etags.c 101
+WINDOWSNT c-src/etags.c 102
+WINDOW_CONFIGURATIONP c-src/emacs/src/lisp.h /^WINDOW_CONFIGURATIONP (Lisp_Object a)$/
+WORKING objc-src/PackInsp.m 368
+WorkingDays cp-src/functions.cpp /^int WorkingDays(Date a, Date b){$/
+Write_Lock/p ada-src/2ataspri.adb /^ procedure Write_Lock (L : in out Lock; Ceiling_/
+Write_Lock/p ada-src/2ataspri.ads /^ procedure Write_Lock (L : in out Lock; Ceiling_/
+X c-src/h.h 100
+XBOOL_VECTOR c-src/emacs/src/lisp.h /^XBOOL_VECTOR (Lisp_Object a)$/
+XBUFFER c-src/emacs/src/lisp.h /^XBUFFER (Lisp_Object a)$/
+XBUFFER_OBJFWD c-src/emacs/src/lisp.h /^XBUFFER_OBJFWD (union Lisp_Fwd *a)$/
+XCAR c-src/emacs/src/lisp.h /^# define XCAR(c) lisp_h_XCAR (c)$/
+XCDR c-src/emacs/src/lisp.h /^# define XCDR(c) lisp_h_XCDR (c)$/
+XCHAR_TABLE c-src/emacs/src/lisp.h /^XCHAR_TABLE (Lisp_Object a)$/
+XCHG_0 c-src/sysdep.h 47
+XCHG_1 c-src/sysdep.h 48
+XCHG_2 c-src/sysdep.h 49
+XCHG_3 c-src/sysdep.h 50
+XCHG_4 c-src/sysdep.h 51
+XCHG_5 c-src/sysdep.h 52
+XCONS c-src/emacs/src/lisp.h /^# define XCONS(a) lisp_h_XCONS (a)$/
+XDEFUN c.c /^XDEFUN ("x-get-selection-internal", Fx_get_selecti/
+XFASTINT c-src/emacs/src/lisp.h /^# define XFASTINT(a) lisp_h_XFASTINT (a)$/
+XFASTINT c-src/emacs/src/lisp.h /^XFASTINT (Lisp_Object a)$/
+XFINALIZER c-src/emacs/src/lisp.h /^XFINALIZER (Lisp_Object a)$/
+XFLOAT c-src/emacs/src/lisp.h /^XFLOAT (Lisp_Object a)$/
+XFLOATINT c-src/emacs/src/lisp.h /^XFLOATINT (Lisp_Object n)$/
+XFLOAT_DATA c-src/emacs/src/lisp.h /^XFLOAT_DATA (Lisp_Object f)$/
+XFWDTYPE c-src/emacs/src/lisp.h /^XFWDTYPE (union Lisp_Fwd *a)$/
+XHASH c-src/emacs/src/lisp.h /^# define XHASH(a) lisp_h_XHASH (a)$/
+XHASH_TABLE c-src/emacs/src/lisp.h /^XHASH_TABLE (Lisp_Object a)$/
+XIL c-src/emacs/src/lisp.h /^# define XIL(i) lisp_h_XIL (i)$/
+XINT c-src/emacs/src/lisp.h /^# define XINT(a) lisp_h_XINT (a)$/
+XINT c-src/emacs/src/lisp.h /^XINT (Lisp_Object a)$/
+XINTPTR c-src/emacs/src/lisp.h /^XINTPTR (Lisp_Object a)$/
+XLI c-src/emacs/src/lisp.h /^# define XLI(o) lisp_h_XLI (o)$/
+XLI_BUILTIN_LISPSYM c-src/emacs/src/lisp.h /^#define XLI_BUILTIN_LISPSYM(iname) TAG_SYMOFFSET (/
+XMARKER c-src/emacs/src/lisp.h /^XMARKER (Lisp_Object a)$/
+XMISC c-src/emacs/src/lisp.h /^XMISC (Lisp_Object a)$/
+XMISCANY c-src/emacs/src/lisp.h /^XMISCANY (Lisp_Object a)$/
+XMISCTYPE c-src/emacs/src/lisp.h /^XMISCTYPE (Lisp_Object a)$/
+XOVERLAY c-src/emacs/src/lisp.h /^XOVERLAY (Lisp_Object a)$/
+XPNTR c-src/emacs/src/lisp.h /^# define XPNTR(a) lisp_h_XPNTR (a)$/
+XPROCESS c-src/emacs/src/lisp.h /^XPROCESS (Lisp_Object a)$/
+XSAVE_FUNCPOINTER c-src/emacs/src/lisp.h /^XSAVE_FUNCPOINTER (Lisp_Object obj, int n)$/
+XSAVE_INTEGER c-src/emacs/src/lisp.h /^XSAVE_INTEGER (Lisp_Object obj, int n)$/
+XSAVE_OBJECT c-src/emacs/src/lisp.h /^XSAVE_OBJECT (Lisp_Object obj, int n)$/
+XSAVE_POINTER c-src/emacs/src/lisp.h /^XSAVE_POINTER (Lisp_Object obj, int n)$/
+XSAVE_VALUE c-src/emacs/src/lisp.h /^XSAVE_VALUE (Lisp_Object a)$/
+XSETBOOL_VECTOR c-src/emacs/src/lisp.h /^#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a/
+XSETBUFFER c-src/emacs/src/lisp.h /^#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, /
+XSETCDR c-src/emacs/src/lisp.h /^XSETCDR (Lisp_Object c, Lisp_Object n)$/
+XSETCHAR_TABLE c-src/emacs/src/lisp.h /^#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a,/
+XSETCOMPILED c-src/emacs/src/lisp.h /^#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b/
+XSETCONS c-src/emacs/src/lisp.h /^#define XSETCONS(a, b) ((a) = make_lisp_ptr (b, Li/
+XSETFASTINT c-src/emacs/src/lisp.h /^#define XSETFASTINT(a, b) ((a) = make_natnum (b))$/
+XSETFLOAT c-src/emacs/src/lisp.h /^#define XSETFLOAT(a, b) ((a) = make_lisp_ptr (b, L/
+XSETINT c-src/emacs/src/lisp.h /^#define XSETINT(a, b) ((a) = make_number (b))$/
+XSETMISC c-src/emacs/src/lisp.h /^#define XSETMISC(a, b) ((a) = make_lisp_ptr (b, Li/
+XSETPROCESS c-src/emacs/src/lisp.h /^#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b,/
+XSETPSEUDOVECTOR c-src/emacs/src/lisp.h /^#define XSETPSEUDOVECTOR(a, b, code) \\$/
+XSETPVECTYPE c-src/emacs/src/lisp.h /^#define XSETPVECTYPE(v, code) \\$/
+XSETPVECTYPESIZE c-src/emacs/src/lisp.h /^#define XSETPVECTYPESIZE(v, code, lispsize, restsi/
+XSETSTRING c-src/emacs/src/lisp.h /^#define XSETSTRING(a, b) ((a) = make_lisp_ptr (b, /
+XSETSUBR c-src/emacs/src/lisp.h /^#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PV/
+XSETSUB_CHAR_TABLE c-src/emacs/src/lisp.h /^#define XSETSUB_CHAR_TABLE(a, b) (XSETPSEUDOVECTOR/
+XSETSYMBOL c-src/emacs/src/lisp.h /^#define XSETSYMBOL(a, b) ((a) = make_lisp_symbol (/
+XSETTERMINAL c-src/emacs/src/lisp.h /^#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b/
+XSETTYPED_PSEUDOVECTOR c-src/emacs/src/lisp.h /^#define XSETTYPED_PSEUDOVECTOR(a, b, size, code) /
+XSETVECTOR c-src/emacs/src/lisp.h /^#define XSETVECTOR(a, b) ((a) = make_lisp_ptr (b, /
+XSETWINDOW c-src/emacs/src/lisp.h /^#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, /
+XSETWINDOW_CONFIGURATION c-src/emacs/src/lisp.h /^#define XSETWINDOW_CONFIGURATION(a, b) \\$/
+XSET_HASH_TABLE c-src/emacs/src/lisp.h /^#define XSET_HASH_TABLE(VAR, PTR) \\$/
+XSTRING c-src/emacs/src/lisp.h /^XSTRING (Lisp_Object a)$/
+XSUBR c-src/emacs/src/lisp.h /^XSUBR (Lisp_Object a)$/
+XSUB_CHAR_TABLE c-src/emacs/src/lisp.h /^XSUB_CHAR_TABLE (Lisp_Object a)$/
+XSYMBOL c-src/emacs/src/lisp.h /^# define XSYMBOL(a) lisp_h_XSYMBOL (a)$/
+XSYMBOL c-src/emacs/src/lisp.h /^XSYMBOL (Lisp_Object a)$/
+XTERMINAL c-src/emacs/src/lisp.h /^XTERMINAL (Lisp_Object a)$/
+XTYPE c-src/emacs/src/lisp.h /^# define XTYPE(a) lisp_h_XTYPE (a)$/
+XTYPE c-src/emacs/src/lisp.h /^XTYPE (Lisp_Object a)$/
+XUNTAG c-src/emacs/src/lisp.h /^# define XUNTAG(a, type) lisp_h_XUNTAG (a, type)$/
+XUNTAG c-src/emacs/src/lisp.h /^XUNTAG (Lisp_Object a, int type)$/
+XWINDOW c-src/emacs/src/lisp.h /^XWINDOW (Lisp_Object a)$/
+XX cp-src/x.cc 1
+Xyzzy ruby-src/test1.ru 13
+Y c-src/h.h 100
+YACC c-src/etags.c 2199
+YELLOW cp-src/screen.hpp 26
+YSRC make-src/Makefile /^YSRC=parse.y parse.c atest.y cccp.c cccp.y$/
+YYABORT /usr/share/bison/bison.simple 153
+YYABORT /usr/share/bison/bison.simple 154
+YYACCEPT /usr/share/bison/bison.simple 152
+YYACCEPT /usr/share/bison/bison.simple 153
+YYBACKUP /usr/share/bison/bison.simple /^#define YYBACKUP(Token, Value) \\$/
+YYBISON y-src/cccp.c 4
+YYBISON y-src/parse.c 4
+YYDPRINTF /usr/share/bison/bison.simple /^# define YYDPRINTF(Args) \\$/
+YYDPRINTF /usr/share/bison/bison.simple /^# define YYDPRINTF(Args)$/
+YYEMPTY /usr/share/bison/bison.simple 150
+YYEMPTY /usr/share/bison/bison.simple 151
+YYEOF /usr/share/bison/bison.simple 151
+YYEOF /usr/share/bison/bison.simple 152
+YYERRCODE /usr/share/bison/bison.simple 178
+YYERRCODE /usr/share/bison/bison.simple 179
+YYERROR /usr/share/bison/bison.simple 154
+YYERROR /usr/share/bison/bison.simple 155
+YYFAIL /usr/share/bison/bison.simple 158
+YYFAIL /usr/share/bison/bison.simple 159
+YYFPRINTF /usr/share/bison/bison.simple 225
+YYFPRINTF /usr/share/bison/bison.simple 226
+YYINITDEPTH /usr/share/bison/bison.simple 244
+YYINITDEPTH /usr/share/bison/bison.simple 245
+YYLEX /usr/share/bison/bison.simple 200
+YYLEX /usr/share/bison/bison.simple 201
+YYLEX /usr/share/bison/bison.simple 202
+YYLEX /usr/share/bison/bison.simple 203
+YYLEX /usr/share/bison/bison.simple 206
+YYLEX /usr/share/bison/bison.simple 207
+YYLEX /usr/share/bison/bison.simple 208
+YYLEX /usr/share/bison/bison.simple 209
+YYLEX /usr/share/bison/bison.simple 212
+YYLEX /usr/share/bison/bison.simple 213
+YYLLOC_DEFAULT /usr/share/bison/bison.simple /^# define YYLLOC_DEFAULT(Current, Rhs, N) \\$/
+YYMAXDEPTH /usr/share/bison/bison.simple 255
+YYMAXDEPTH /usr/share/bison/bison.simple 256
+YYMAXDEPTH /usr/share/bison/bison.simple 259
+YYMAXDEPTH /usr/share/bison/bison.simple 260
+YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 351
+YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 354
+YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 358
+YYPARSE_PARAM_DECL /usr/share/bison/bison.simple 352
+YYPARSE_PARAM_DECL /usr/share/bison/bison.simple 355
+YYPARSE_PARAM_DECL /usr/share/bison/bison.simple 359
+YYPOPSTACK /usr/share/bison/bison.simple 445
+YYPOPSTACK /usr/share/bison/bison.simple 447
+YYRECOVERING /usr/share/bison/bison.simple /^#define YYRECOVERING() (!!yyerrstatus)$/
+YYSIZE_T /usr/share/bison/bison.simple 128
+YYSIZE_T /usr/share/bison/bison.simple 129
+YYSIZE_T /usr/share/bison/bison.simple 131
+YYSIZE_T /usr/share/bison/bison.simple 132
+YYSIZE_T /usr/share/bison/bison.simple 136
+YYSIZE_T /usr/share/bison/bison.simple 137
+YYSIZE_T /usr/share/bison/bison.simple 140
+YYSIZE_T /usr/share/bison/bison.simple 141
+YYSIZE_T /usr/share/bison/bison.simple 145
+YYSIZE_T /usr/share/bison/bison.simple 146
+YYSIZE_T /usr/share/bison/bison.simple 51
+YYSIZE_T /usr/share/bison/bison.simple 52
+YYSIZE_T /usr/share/bison/bison.simple 56
+YYSIZE_T /usr/share/bison/bison.simple 57
+YYSIZE_T /usr/share/bison/bison.simple 71
+YYSIZE_T /usr/share/bison/bison.simple 72
+YYSIZE_T /usr/share/bison/bison.simple 75
+YYSIZE_T /usr/share/bison/bison.simple 76
+YYSTACK_ALLOC /usr/share/bison/bison.simple 50
+YYSTACK_ALLOC /usr/share/bison/bison.simple 51
+YYSTACK_ALLOC /usr/share/bison/bison.simple 55
+YYSTACK_ALLOC /usr/share/bison/bison.simple 56
+YYSTACK_ALLOC /usr/share/bison/bison.simple 59
+YYSTACK_ALLOC /usr/share/bison/bison.simple 60
+YYSTACK_ALLOC /usr/share/bison/bison.simple 78
+YYSTACK_ALLOC /usr/share/bison/bison.simple 79
+YYSTACK_BYTES /usr/share/bison/bison.simple /^# define YYSTACK_BYTES(N) \\$/
+YYSTACK_FREE /usr/share/bison/bison.simple /^# define YYSTACK_FREE(Ptr) do { \/* empty *\/; } wh/
+YYSTACK_FREE /usr/share/bison/bison.simple 79
+YYSTACK_FREE /usr/share/bison/bison.simple 80
+YYSTACK_GAP_MAX /usr/share/bison/bison.simple 93
+YYSTACK_GAP_MAX /usr/share/bison/bison.simple 94
+YYSTACK_RELOCATE /usr/share/bison/bison.simple /^# define YYSTACK_RELOCATE(Type, Stack) \\$/
+YYSTACK_RELOCATE /usr/share/bison/bison.simple 548
+YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) std::x$/
+YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) x$/
+YYSTYPE y-src/parse.y 72
+YYSTYPE y-src/parse.y 73
+YYTERROR /usr/share/bison/bison.simple 177
+YYTERROR /usr/share/bison/bison.simple 178
+YY_DECL_NON_LSP_VARIABLES /usr/share/bison/bison.simple 374
+YY_DECL_VARIABLES /usr/share/bison/bison.simple 385
+YY_DECL_VARIABLES /usr/share/bison/bison.simple 391
+Yacc_entries c-src/etags.c /^Yacc_entries (FILE *inf)$/
+Yacc_help c-src/etags.c 693
+Yacc_suffixes c-src/etags.c 691
+Z c-src/h.h 100
+[] ruby-src/test.rb /^ def [](y)$/
+[]= ruby-src/test.rb /^ def []=(y, val)$/
+\ tex-src/texinfo.tex /^\\def\\ {{\\fontdimen2\\font=\\tclosesave{} }}%$/
+\ tex-src/texinfo.tex /^\\gdef\\sepspaces{\\def {\\ }}}$/
+\' tex-src/texinfo.tex /^\\def\\'{{'}}$/
+\* tex-src/texinfo.tex /^\\def\\*{\\hfil\\break\\hbox{}\\ignorespaces}$/
+\. tex-src/texinfo.tex /^\\def\\.{.\\spacefactor=3000 }$/
+\: tex-src/texinfo.tex /^\\def\\:{\\spacefactor=1000 }$/
+\@ tex-src/texinfo.tex /^\\def\\@{@}%$/
+\@ tex-src/texinfo.tex /^\\def\\@{{\\tt \\char '100}}$/
+\CHAPFopen tex-src/texinfo.tex /^\\def\\CHAPFopen{$/
+\CHAPFplain tex-src/texinfo.tex /^\\def\\CHAPFplain{$/
+\CHAPPAGodd tex-src/texinfo.tex /^\\def\\CHAPPAGodd{$/
+\CHAPPAGoff tex-src/texinfo.tex /^\\def\\CHAPPAGoff{$/
+\CHAPPAGon tex-src/texinfo.tex /^\\def\\CHAPPAGon{$/
+\ENVcheck tex-src/texinfo.tex /^\\def\\ENVcheck{%$/
+\Ealphaenumerate tex-src/texinfo.tex /^\\def\\Ealphaenumerate{\\Eenumerate}$/
+\Ecapsenumerate tex-src/texinfo.tex /^\\def\\Ecapsenumerate{\\Eenumerate}$/
+\Ecartouche tex-src/texinfo.tex /^\\def\\Ecartouche{%$/
+\Edescription tex-src/texinfo.tex /^\\def\\Edescription{\\Etable}% Necessary kludge.$/
+\Edisplay tex-src/texinfo.tex /^\\def\\Edisplay{\\endgroup\\afterenvbreak}%$/
+\Eexample tex-src/texinfo.tex /^\\def\\Eexample{\\Elisp}$/
+\Eflushleft tex-src/texinfo.tex /^\\def\\Eflushleft{\\endgroup\\afterenvbreak}%$/
+\Eflushright tex-src/texinfo.tex /^\\def\\Eflushright{\\endgroup\\afterenvbreak}%$/
+\Eformat tex-src/texinfo.tex /^\\def\\Eformat{\\endgroup\\afterenvbreak}$/
+\Eftable tex-src/texinfo.tex /^\\def\\Eftable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Egroup tex-src/texinfo.tex /^ \\def\\Egroup{\\egroup\\endgroup}%$/
+\Eifclear tex-src/texinfo.tex /^\\def\\Eifclear{}$/
+\Eifset tex-src/texinfo.tex /^\\def\\Eifset{}$/
+\Eiftex tex-src/texinfo.tex /^\\def\\Eiftex{}$/
+\Elisp tex-src/texinfo.tex /^\\def\\Elisp{\\endgroup\\afterenvbreak}%$/
+\Equotation tex-src/texinfo.tex /^\\def\\Equotation{\\par\\endgroup\\afterenvbreak}%$/
+\Esmallexample tex-src/texinfo.tex /^\\def\\Esmallexample{\\Elisp}$/
+\Esmallexample tex-src/texinfo.tex /^\\global\\def\\Esmallexample{\\Esmalllisp}$/
+\Esmalllisp tex-src/texinfo.tex /^\\def\\Esmalllisp{\\endgroup\\afterenvbreak}%$/
+\Etable tex-src/texinfo.tex /^\\def\\Etable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Etitlepage tex-src/texinfo.tex /^\\def\\Etitlepage{%$/
+\Evtable tex-src/texinfo.tex /^\\def\\Evtable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\HEADINGSafter tex-src/texinfo.tex /^\\def\\HEADINGSafter{\\let\\HEADINGShook=\\HEADINGSdoub/
+\HEADINGSdouble tex-src/texinfo.tex /^\\def\\HEADINGSdouble{$/
+\HEADINGSdoublex tex-src/texinfo.tex /^\\def\\HEADINGSdoublex{%$/
+\HEADINGSoff tex-src/texinfo.tex /^\\def\\HEADINGSoff{$/
+\HEADINGSon tex-src/texinfo.tex /^\\def\\HEADINGSon{\\HEADINGSdouble}$/
+\HEADINGSon tex-src/texinfo.tex /^\\global\\def\\HEADINGSon{\\HEADINGSdouble}}$/
+\HEADINGSon tex-src/texinfo.tex /^\\global\\def\\HEADINGSon{\\HEADINGSsingle}}$/
+\HEADINGSsingle tex-src/texinfo.tex /^\\def\\HEADINGSsingle{$/
+\HEADINGSsingleafter tex-src/texinfo.tex /^\\def\\HEADINGSsingleafter{\\let\\HEADINGShook=\\HEADIN/
+\HEADINGSsinglex tex-src/texinfo.tex /^\\def\\HEADINGSsinglex{%$/
+\TeX tex-src/texinfo.tex /^\\def\\TeX{\\realbackslash TeX}$/
+\TeX tex-src/texinfo.tex /^\\def\\TeX{\\realbackslash TeX}%$/
+\Yappendixletterandtype tex-src/texinfo.tex /^\\def\\Yappendixletterandtype{%$/
+\Ynothing tex-src/texinfo.tex /^\\def\\Ynothing{}$/
+\Ypagenumber tex-src/texinfo.tex /^\\def\\Ypagenumber{\\folio}$/
+\Ysectionnumberandtype tex-src/texinfo.tex /^\\def\\Ysectionnumberandtype{%$/
+\Ytitle tex-src/texinfo.tex /^\\def\\Ytitle{\\thischapter}$/
+\_ tex-src/texinfo.tex /^\\def\\_{\\lvvmode \\kern.06em \\vbox{\\hrule width.3em /
+\_ tex-src/texinfo.tex /^\\def\\_{{\\realbackslash _}}%$/
+\` tex-src/texinfo.tex /^\\def\\`{{`}}$/
+\aboveenvbreak tex-src/texinfo.tex /^\\def\\aboveenvbreak{{\\advance\\aboveenvskipamount by/
+\activedoublequote tex-src/texinfo.tex /^\\def\\activedoublequote{{\\tt \\char '042}}$/
+\activeparens tex-src/texinfo.tex /^\\def\\activeparens{%$/
+\afourpaper tex-src/texinfo.tex /^\\def\\afourpaper{$/
+\afterenvbreak tex-src/texinfo.tex /^\\def\\afterenvbreak{\\endgraf \\ifdim\\lastskip<\\above/
+\alphaenumerate tex-src/texinfo.tex /^\\def\\alphaenumerate{\\enumerate{a}}$/
+\appendix tex-src/texinfo.tex /^\\outer\\def\\appendix{\\parsearg\\appendixzzz}$/
+\appendixletter tex-src/texinfo.tex /^\\def\\appendixletter{\\char\\the\\appendixno}$/
+\appendixnoderef tex-src/texinfo.tex /^\\def\\appendixnoderef{\\ifx\\lastnode\\relax\\else$/
+\appendixsec tex-src/texinfo.tex /^\\outer\\def\\appendixsec{\\parsearg\\appendixsectionzz/
+\appendixsection tex-src/texinfo.tex /^\\outer\\def\\appendixsection{\\parsearg\\appendixsecti/
+\appendixsectionzzz tex-src/texinfo.tex /^\\def\\appendixsectionzzz #1{\\seccheck{appendixsecti/
+\appendixsetref tex-src/texinfo.tex /^\\def\\appendixsetref#1{%$/
+\appendixsubsec tex-src/texinfo.tex /^\\outer\\def\\appendixsubsec{\\parsearg\\appendixsubsec/
+\appendixsubseczzz tex-src/texinfo.tex /^\\def\\appendixsubseczzz #1{\\seccheck{appendixsubsec/
+\appendixsubsubsec tex-src/texinfo.tex /^\\outer\\def\\appendixsubsubsec{\\parsearg\\appendixsub/
+\appendixsubsubseczzz tex-src/texinfo.tex /^\\def\\appendixsubsubseczzz #1{\\seccheck{appendixsub/
+\appendixzzz tex-src/texinfo.tex /^\\def\\appendixzzz #1{\\seccheck{appendix}%$/
+\asis tex-src/texinfo.tex /^\\def\\asis#1{#1}$/
+\author tex-src/texinfo.tex /^ \\def\\author{\\parsearg\\authorzzz}%$/
+\authorfont tex-src/texinfo.tex /^ \\def\\authorfont{\\authorrm \\normalbaselineskip =/
+\authorzzz tex-src/texinfo.tex /^ \\def\\authorzzz##1{\\ifseenauthor\\else\\vskip 0pt /
+\b tex-src/texinfo.tex /^\\def\\b##1{\\realbackslash b {##1}}$/
+\b tex-src/texinfo.tex /^\\def\\b##1{\\realbackslash b {##1}}%$/
+\b tex-src/texinfo.tex /^\\def\\b#1{{\\bf #1}}$/
+\balancecolumns tex-src/texinfo.tex /^\\def\\balancecolumns{%$/
+\begin tex-src/texinfo.tex /^\\outer\\def\\begin{\\parsearg\\beginxxx}$/
+\begindoublecolumns tex-src/texinfo.tex /^\\def\\begindoublecolumns{\\begingroup$/
+\beginxxx tex-src/texinfo.tex /^\\def\\beginxxx #1{%$/
+\bf tex-src/texinfo.tex /^\\def\\bf{\\realbackslash bf }$/
+\bf tex-src/texinfo.tex /^\\def\\bf{\\realbackslash bf }%$/
+\bullet tex-src/texinfo.tex /^\\def\\bullet{$\\ptexbullet$}$/
+\bye tex-src/texinfo.tex /^\\outer\\def\\bye{\\pagealignmacro\\tracingstats=1\\ptex/
+\capsenumerate tex-src/texinfo.tex /^\\def\\capsenumerate{\\enumerate{A}}$/
+\cartbot tex-src/texinfo.tex /^\\def\\cartbot{\\hbox to \\cartouter{\\hskip\\lskip$/
+\cartouche tex-src/texinfo.tex /^\\long\\def\\cartouche{%$/
+\carttop tex-src/texinfo.tex /^\\def\\carttop{\\hbox to \\cartouter{\\hskip\\lskip$/
+\cbl tex-src/texinfo.tex /^\\def\\cbl{{\\circle\\char'012\\hskip -6pt}}$/
+\cbr tex-src/texinfo.tex /^\\def\\cbr{{\\hskip 6pt\\circle\\char'011}}$/
+\center tex-src/texinfo.tex /^\\def\\center{\\parsearg\\centerzzz}$/
+\centerzzz tex-src/texinfo.tex /^\\def\\centerzzz #1{{\\advance\\hsize by -\\leftskip$/
+\chapbreak tex-src/texinfo.tex /^\\def\\chapbreak{\\dobreak \\chapheadingskip {-4000}}$/
+\chapentry tex-src/texinfo.tex /^\\def\\chapentry#1#2#3{\\dochapentry{#2\\labelspace#1}/
+\chapentryfonts tex-src/texinfo.tex /^\\def\\chapentryfonts{\\secfonts \\rm}$/
+\chapfonts tex-src/texinfo.tex /^\\def\\chapfonts{%$/
+\chapheading tex-src/texinfo.tex /^\\def\\chapheading{\\parsearg\\chapheadingzzz}$/
+\chapheadingzzz tex-src/texinfo.tex /^\\def\\chapheadingzzz #1{\\chapbreak %$/
+\chapoddpage tex-src/texinfo.tex /^\\def\\chapoddpage{\\chappager \\ifodd\\pageno \\else \\h/
+\chappager tex-src/texinfo.tex /^\\def\\chappager{\\par\\vfill\\supereject}$/
+\chapter tex-src/texinfo.tex /^\\outer\\def\\chapter{\\parsearg\\chapterzzz}$/
+\chapternofonts tex-src/texinfo.tex /^\\def\\chapternofonts{%$/
+\chapterzzz tex-src/texinfo.tex /^\\def\\chapterzzz #1{\\seccheck{chapter}%$/
+\char tex-src/texinfo.tex /^\\def\\char{\\realbackslash char}$/
+\char tex-src/texinfo.tex /^\\def\\char{\\realbackslash char}%$/
+\chfopen tex-src/texinfo.tex /^\\def\\chfopen #1#2{\\chapoddpage {\\chapfonts$/
+\chfplain tex-src/texinfo.tex /^\\def\\chfplain #1#2{%$/
+\cindex tex-src/texinfo.tex /^\\def\\cindex {\\cpindex}$/
+\cindexsub tex-src/texinfo.tex /^\\def\\cindexsub {\\begingroup\\obeylines\\cindexsub}$/
+\cite tex-src/texinfo.tex /^\\def\\cite##1{\\realbackslash cite {##1}}$/
+\cite tex-src/texinfo.tex /^\\def\\cite##1{\\realbackslash cite {##1}}%$/
+\clear tex-src/texinfo.tex /^\\def\\clear{\\parsearg\\clearxxx}$/
+\clearxxx tex-src/texinfo.tex /^\\def\\clearxxx #1{$/
+\code tex-src/texinfo.tex /^\\def\\code##1{\\realbackslash code {##1}}$/
+\code tex-src/texinfo.tex /^\\def\\code##1{\\realbackslash code {##1}}%$/
+\comment tex-src/texinfo.tex /^\\def\\comment{\\catcode 64=\\other \\catcode 123=\\othe/
+\commentxxx tex-src/texinfo.tex /^\\def\\commentxxx #1{\\catcode 64=0 \\catcode 123=1 \\c/
+\contents tex-src/texinfo.tex /^\\outer\\def\\contents{%$/
+\copyright tex-src/texinfo.tex /^\\def\\copyright{\\realbackslash copyright }%$/
+\copyright tex-src/texinfo.tex /^\\def\\copyright{\\realbackslash copyright}$/
+\cropmarks tex-src/texinfo.tex /^\\def\\cropmarks{\\let\\onepageout=\\croppageout }$/
+\croppageout tex-src/texinfo.tex /^\\def\\croppageout#1{\\hoffset=0pt % make sure this d/
+\ctl tex-src/texinfo.tex /^\\def\\ctl{{\\circle\\char'013\\hskip -6pt}}% 6pt from /
+\ctr tex-src/texinfo.tex /^\\def\\ctr{{\\hskip 6pt\\circle\\char'010}}$/
+\ctrl tex-src/texinfo.tex /^\\def\\ctrl #1{{\\tt \\rawbackslash \\hat}#1}$/
+\defcodeindex tex-src/texinfo.tex /^\\def\\defcodeindex{\\parsearg\\newcodeindex}$/
+\defcv tex-src/texinfo.tex /^\\def\\defcv #1 {\\def\\defcvtype{#1}%$/
+\defcvarheader tex-src/texinfo.tex /^\\def\\defcvarheader #1#2#3{%$/
+\defcvx tex-src/texinfo.tex /^\\def\\defcvx #1 {\\errmessage{@defcvx in invalid con/
+\deffn tex-src/texinfo.tex /^\\def\\deffn{\\defmethparsebody\\Edeffn\\deffnx\\deffnhe/
+\deffnheader tex-src/texinfo.tex /^\\def\\deffnheader #1#2#3{\\doind {fn}{\\code{#2}}%$/
+\deffnx tex-src/texinfo.tex /^\\def\\deffnx #1 {\\errmessage{@deffnx in invalid con/
+\defindex tex-src/texinfo.tex /^\\def\\defindex{\\parsearg\\newindex}$/
+\defivar tex-src/texinfo.tex /^\\def\\defivar{\\defvrparsebody\\Edefivar\\defivarx\\def/
+\defivarheader tex-src/texinfo.tex /^\\def\\defivarheader #1#2#3{%$/
+\defivarx tex-src/texinfo.tex /^\\def\\defivarx #1 {\\errmessage{@defivarx in invalid/
+\defmac tex-src/texinfo.tex /^\\def\\defmac{\\defparsebody\\Edefmac\\defmacx\\defmache/
+\defmacheader tex-src/texinfo.tex /^\\def\\defmacheader #1#2{\\doind {fn}{\\code{#1}}% Mak/
+\defmacx tex-src/texinfo.tex /^\\def\\defmacx #1 {\\errmessage{@defmacx in invalid c/
+\defmethod tex-src/texinfo.tex /^\\def\\defmethod{\\defmethparsebody\\Edefmethod\\defmet/
+\defmethodheader tex-src/texinfo.tex /^\\def\\defmethodheader #1#2#3{%$/
+\defmethodx tex-src/texinfo.tex /^\\def\\defmethodx #1 {\\errmessage{@defmethodx in inv/
+\defmethparsebody tex-src/texinfo.tex /^\\def\\defmethparsebody #1#2#3#4 {\\begingroup\\inENV /
+\defname tex-src/texinfo.tex /^\\def\\defname #1#2{%$/
+\defop tex-src/texinfo.tex /^\\def\\defop #1 {\\def\\defoptype{#1}%$/
+\defopheader tex-src/texinfo.tex /^\\def\\defopheader #1#2#3{%$/
+\defopparsebody tex-src/texinfo.tex /^\\def\\defopparsebody #1#2#3#4#5 {\\begingroup\\inENV /
+\defopt tex-src/texinfo.tex /^\\def\\defopt{\\defvarparsebody\\Edefopt\\defoptx\\defop/
+\defoptheader tex-src/texinfo.tex /^\\def\\defoptheader #1#2{\\doind {vr}{\\code{#1}}% Mak/
+\defoptx tex-src/texinfo.tex /^\\def\\defoptx #1 {\\errmessage{@defoptx in invalid c/
+\defopvarparsebody tex-src/texinfo.tex /^\\def\\defopvarparsebody #1#2#3#4#5 {\\begingroup\\inE/
+\defopx tex-src/texinfo.tex /^\\def\\defopx #1 {\\errmessage{@defopx in invalid con/
+\defparsebody tex-src/texinfo.tex /^\\def\\defparsebody #1#2#3{\\begingroup\\inENV% Enviro/
+\defspec tex-src/texinfo.tex /^\\def\\defspec{\\defparsebody\\Edefspec\\defspecx\\defsp/
+\defspecheader tex-src/texinfo.tex /^\\def\\defspecheader #1#2{\\doind {fn}{\\code{#1}}% Ma/
+\defspecx tex-src/texinfo.tex /^\\def\\defspecx #1 {\\errmessage{@defspecx in invalid/
+\deftp tex-src/texinfo.tex /^\\def\\deftp{\\defvrparsebody\\Edeftp\\deftpx\\deftphead/
+\deftpargs tex-src/texinfo.tex /^\\def\\deftpargs #1{\\bf \\defvarargs{#1}}$/
+\deftpheader tex-src/texinfo.tex /^\\def\\deftpheader #1#2#3{\\doind {tp}{\\code{#2}}%$/
+\deftpx tex-src/texinfo.tex /^\\def\\deftpx #1 {\\errmessage{@deftpx in invalid con/
+\deftypefn tex-src/texinfo.tex /^\\def\\deftypefn{\\defmethparsebody\\Edeftypefn\\deftyp/
+\deftypefnheader tex-src/texinfo.tex /^\\def\\deftypefnheader #1#2#3{\\deftypefnheaderx{#1}{/
+\deftypefnheaderx tex-src/texinfo.tex /^\\def\\deftypefnheaderx #1#2#3 #4\\relax{%$/
+\deftypefnx tex-src/texinfo.tex /^\\def\\deftypefnx #1 {\\errmessage{@deftypefnx in inv/
+\deftypefun tex-src/texinfo.tex /^\\def\\deftypefun{\\defparsebody\\Edeftypefun\\deftypef/
+\deftypefunargs tex-src/texinfo.tex /^\\def\\deftypefunargs #1{%$/
+\deftypefunheader tex-src/texinfo.tex /^\\def\\deftypefunheader #1#2{\\deftypefunheaderx{#1}#/
+\deftypefunheaderx tex-src/texinfo.tex /^\\def\\deftypefunheaderx #1#2 #3\\relax{%$/
+\deftypeunx tex-src/texinfo.tex /^\\def\\deftypeunx #1 {\\errmessage{@deftypeunx in inv/
+\deftypevar tex-src/texinfo.tex /^\\def\\deftypevar{\\defvarparsebody\\Edeftypevar\\defty/
+\deftypevarheader tex-src/texinfo.tex /^\\def\\deftypevarheader #1#2{%$/
+\deftypevarx tex-src/texinfo.tex /^\\def\\deftypevarx #1 {\\errmessage{@deftypevarx in i/
+\deftypevr tex-src/texinfo.tex /^\\def\\deftypevr{\\defvrparsebody\\Edeftypevr\\deftypev/
+\deftypevrheader tex-src/texinfo.tex /^\\def\\deftypevrheader #1#2#3{\\doind {vr}{\\code{#3}}/
+\deftypevrx tex-src/texinfo.tex /^\\def\\deftypevrx #1 {\\errmessage{@deftypevrx in inv/
+\defun tex-src/texinfo.tex /^\\def\\defun{\\defparsebody\\Edefun\\defunx\\defunheader/
+\defunargs tex-src/texinfo.tex /^\\def\\defunargs #1{\\functionparens \\sl$/
+\defunheader tex-src/texinfo.tex /^\\def\\defunheader #1#2{\\doind {fn}{\\code{#1}}% Make/
+\defunx tex-src/texinfo.tex /^\\def\\defunx #1 {\\errmessage{@defunx in invalid con/
+\defvar tex-src/texinfo.tex /^\\def\\defvar{\\defvarparsebody\\Edefvar\\defvarx\\defva/
+\defvarargs tex-src/texinfo.tex /^\\def\\defvarargs #1{\\normalparens #1%$/
+\defvarheader tex-src/texinfo.tex /^\\def\\defvarheader #1#2{\\doind {vr}{\\code{#1}}% Mak/
+\defvarparsebody tex-src/texinfo.tex /^\\def\\defvarparsebody #1#2#3{\\begingroup\\inENV% Env/
+\defvarx tex-src/texinfo.tex /^\\def\\defvarx #1 {\\errmessage{@defvarx in invalid c/
+\defvr tex-src/texinfo.tex /^\\def\\defvr{\\defvrparsebody\\Edefvr\\defvrx\\defvrhead/
+\defvrheader tex-src/texinfo.tex /^\\def\\defvrheader #1#2#3{\\doind {vr}{\\code{#2}}%$/
+\defvrparsebody tex-src/texinfo.tex /^\\def\\defvrparsebody #1#2#3#4 {\\begingroup\\inENV %$/
+\defvrx tex-src/texinfo.tex /^\\def\\defvrx #1 {\\errmessage{@defvrx in invalid con/
+\description tex-src/texinfo.tex /^\\def\\description{\\tablez{\\dontindex}{1}{}{}{}{}}$/
+\df tex-src/texinfo.tex /^\\def\\df{\\let\\tentt=\\deftt \\let\\tenbf = \\defbf \\bf}/
+\dfn tex-src/texinfo.tex /^\\def\\dfn##1{\\realbackslash dfn {##1}}$/
+\direntry tex-src/texinfo.tex /^\\def\\direntry{\\begingroup\\direntryxxx}$/
+\direntryxxx tex-src/texinfo.tex /^\\long\\def\\direntryxxx #1\\end direntry{\\endgroup\\ig/
+\display tex-src/texinfo.tex /^\\def\\display{\\begingroup\\inENV %This group ends at/
+\dmn tex-src/texinfo.tex /^\\def\\dmn#1{\\thinspace #1}$/
+\dobreak tex-src/texinfo.tex /^\\def\\dobreak#1#2{\\par\\ifdim\\lastskip<#1\\removelast/
+\dochapentry tex-src/texinfo.tex /^\\def\\dochapentry#1#2{%$/
+\docodeindex tex-src/texinfo.tex /^\\def\\docodeindex#1{\\edef\\indexname{#1}\\parsearg\\si/
+\doind tex-src/texinfo.tex /^\\def\\doind #1#2{%$/
+\doindex tex-src/texinfo.tex /^\\def\\doindex#1{\\edef\\indexname{#1}\\parsearg\\single/
+\donoderef tex-src/texinfo.tex /^\\def\\donoderef{\\ifx\\lastnode\\relax\\else$/
+\dontindex tex-src/texinfo.tex /^\\def\\dontindex #1{}$/
+\dopageno tex-src/texinfo.tex /^\\def\\dopageno#1{{\\rm #1}}$/
+\doprintindex tex-src/texinfo.tex /^\\def\\doprintindex#1{%$/
+\dosecentry tex-src/texinfo.tex /^\\def\\dosecentry#1#2{%$/
+\dosetq tex-src/texinfo.tex /^\\def\\dosetq #1#2{{\\let\\folio=0 \\turnoffactive%$/
+\doshortpageno tex-src/texinfo.tex /^\\def\\doshortpageno#1{{\\rm #1}}$/
+\dosubind tex-src/texinfo.tex /^\\def\\dosubind #1#2#3{%$/
+\dosubsecentry tex-src/texinfo.tex /^\\def\\dosubsecentry#1#2{%$/
+\dosubsubsecentry tex-src/texinfo.tex /^\\def\\dosubsubsecentry#1#2{%$/
+\dots tex-src/texinfo.tex /^\\def\\dots{$\\ldots$}$/
+\dots tex-src/texinfo.tex /^\\def\\dots{\\realbackslash dots }%$/
+\dots tex-src/texinfo.tex /^\\def\\dots{\\realbackslash dots}$/
+\doublecolumnout tex-src/texinfo.tex /^\\def\\doublecolumnout{\\splittopskip=\\topskip \\split/
+\emph tex-src/texinfo.tex /^\\def\\emph##1{\\realbackslash emph {##1}}$/
+\end tex-src/texinfo.tex /^\\def\\end{\\parsearg\\endxxx}$/
+\enddoublecolumns tex-src/texinfo.tex /^\\def\\enddoublecolumns{\\output={\\balancecolumns}\\ej/
+\endxxx tex-src/texinfo.tex /^\\def\\endxxx #1{%$/
+\entry tex-src/texinfo.tex /^\\def\\entry #1#2{\\begingroup$/
+\enumerate tex-src/texinfo.tex /^\\def\\enumerate{\\parsearg\\enumeratezzz}$/
+\enumeratey tex-src/texinfo.tex /^\\def\\enumeratey #1 #2\\endenumeratey{%$/
+\enumeratezzz tex-src/texinfo.tex /^\\def\\enumeratezzz #1{\\enumeratey #1 \\endenumerate/
+\equiv tex-src/texinfo.tex /^\\def\\equiv{\\leavevmode\\lower.1ex\\hbox to 1em{\\hfil/
+\equiv tex-src/texinfo.tex /^\\def\\equiv{\\realbackslash equiv}$/
+\error tex-src/texinfo.tex /^\\def\\error{\\leavevmode\\lower.7ex\\copy\\errorbox}$/
+\errorE tex-src/texinfo.tex /^\\def\\errorE#1{$/
+\evenfooting tex-src/texinfo.tex /^\\def\\evenfooting{\\parsearg\\evenfootingxxx}$/
+\evenheading tex-src/texinfo.tex /^\\def\\evenheading{\\parsearg\\evenheadingxxx}$/
+\everyfooting tex-src/texinfo.tex /^\\def\\everyfooting{\\parsearg\\everyfootingxxx}$/
+\everyheading tex-src/texinfo.tex /^\\def\\everyheading{\\parsearg\\everyheadingxxx}$/
+\ewbot tex-src/texinfo.tex /^\\def\\ewbot{\\vrule height0pt depth\\cornerthick widt/
+\ewtop tex-src/texinfo.tex /^\\def\\ewtop{\\vrule height\\cornerthick depth0pt widt/
+\exdent tex-src/texinfo.tex /^\\def\\exdent{\\parsearg\\exdentyyy}$/
+\exdentyyy tex-src/texinfo.tex /^\\def\\exdentyyy #1{{\\hfil\\break\\hbox{\\kern -\\exdent/
+\expansion tex-src/texinfo.tex /^\\def\\expansion{\\leavevmode\\raise.1ex\\hbox to 1em{\\/
+\expansion tex-src/texinfo.tex /^\\def\\expansion{\\realbackslash expansion}$/
+\file tex-src/texinfo.tex /^\\def\\file##1{\\realbackslash file {##1}}$/
+\file tex-src/texinfo.tex /^\\def\\file##1{\\realbackslash file {##1}}%$/
+\finalout tex-src/texinfo.tex /^\\def\\finalout{\\overfullrule=0pt}$/
+\findex tex-src/texinfo.tex /^\\def\\findex {\\fnindex}$/
+\finishtitlepage tex-src/texinfo.tex /^\\def\\finishtitlepage{%$/
+\flushcr tex-src/texinfo.tex /^\\def\\flushcr{\\ifx\\par\\lisppar \\def\\next##1{}\\else /
+\flushleft tex-src/texinfo.tex /^\\def\\flushleft{%$/
+\flushright tex-src/texinfo.tex /^\\def\\flushright{%$/
+\fnitemindex tex-src/texinfo.tex /^\\def\\fnitemindex #1{\\doind {fn}{\\code{#1}}}%$/
+\format tex-src/texinfo.tex /^\\def\\format{\\begingroup\\inENV %This group ends at /
+\frenchspacing tex-src/texinfo.tex /^\\def\\frenchspacing{\\sfcode46=1000 \\sfcode63=1000 \\/
+\ftable tex-src/texinfo.tex /^\\def\\ftable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\gloggingall tex-src/texinfo.tex /^\\def\\gloggingall{\\begingroup \\globaldefs = 1 \\logg/
+\group tex-src/texinfo.tex /^\\def\\group{\\begingroup$/
+\gtr tex-src/texinfo.tex /^\\def\\gtr{\\realbackslash gtr}$/
+\gtr tex-src/texinfo.tex /^\\def\\gtr{\\realbackslash gtr}%$/
+\hat tex-src/texinfo.tex /^\\def\\hat{\\realbackslash hat}$/
+\hat tex-src/texinfo.tex /^\\def\\hat{\\realbackslash hat}%$/
+\heading tex-src/texinfo.tex /^\\def\\heading{\\parsearg\\secheadingi}$/
+\headings tex-src/texinfo.tex /^\\def\\headings #1 {\\csname HEADINGS#1\\endcsname}$/
+\i tex-src/texinfo.tex /^\\def\\i##1{\\realbackslash i {##1}}$/
+\i tex-src/texinfo.tex /^\\def\\i##1{\\realbackslash i {##1}}%$/
+\ifclear tex-src/texinfo.tex /^\\def\\ifclear{\\begingroup\\ignoresections\\parsearg\\i/
+\ifclearfail tex-src/texinfo.tex /^\\def\\ifclearfail{\\begingroup\\ignoresections\\ifclea/
+\ifclearfailxxx tex-src/texinfo.tex /^\\long\\def\\ifclearfailxxx #1\\end ifclear{\\endgroup\\/
+\ifclearxxx tex-src/texinfo.tex /^\\def\\ifclearxxx #1{\\endgroup$/
+\ifinfo tex-src/texinfo.tex /^\\def\\ifinfo{\\begingroup\\ignoresections\\ifinfoxxx}$/
+\ifinfoxxx tex-src/texinfo.tex /^\\long\\def\\ifinfoxxx #1\\end ifinfo{\\endgroup\\ignore/
+\ifset tex-src/texinfo.tex /^\\def\\ifset{\\begingroup\\ignoresections\\parsearg\\ifs/
+\ifsetfail tex-src/texinfo.tex /^\\def\\ifsetfail{\\begingroup\\ignoresections\\ifsetfai/
+\ifsetfailxxx tex-src/texinfo.tex /^\\long\\def\\ifsetfailxxx #1\\end ifset{\\endgroup\\igno/
+\ifsetxxx tex-src/texinfo.tex /^\\def\\ifsetxxx #1{\\endgroup$/
+\iftex tex-src/texinfo.tex /^\\def\\iftex{}$/
+\ifusingtt tex-src/texinfo.tex /^\\def\\ifusingtt#1#2{\\ifdim \\fontdimen3\\the\\font=0pt/
+\ignore tex-src/texinfo.tex /^\\def\\ignore{\\begingroup\\ignoresections$/
+\ignoresections tex-src/texinfo.tex /^\\def\\ignoresections{%$/
+\ignorexxx tex-src/texinfo.tex /^\\long\\def\\ignorexxx #1\\end ignore{\\endgroup\\ignore/
+\ii tex-src/texinfo.tex /^\\def\\ii#1{{\\it #1}} % italic font$/
+\inENV tex-src/texinfo.tex /^\\newif\\ifENV \\ENVfalse \\def\\inENV{\\ifENV\\relax\\els/
+\include tex-src/texinfo.tex /^\\def\\include{\\parsearg\\includezzz}$/
+\includezzz tex-src/texinfo.tex /^\\def\\includezzz #1{{\\def\\thisfile{#1}\\input #1$/
+\indexbackslash tex-src/texinfo.tex /^ \\def\\indexbackslash{\\rawbackslashxx}$/
+\indexdotfill tex-src/texinfo.tex /^\\def\\indexdotfill{\\cleaders$/
+\indexdummies tex-src/texinfo.tex /^\\def\\indexdummies{%$/
+\indexdummydots tex-src/texinfo.tex /^\\def\\indexdummydots{...}$/
+\indexdummyfont tex-src/texinfo.tex /^\\def\\indexdummyfont#1{#1}$/
+\indexdummytex tex-src/texinfo.tex /^\\def\\indexdummytex{TeX}$/
+\indexfonts tex-src/texinfo.tex /^\\def\\indexfonts{%$/
+\indexnofonts tex-src/texinfo.tex /^\\def\\indexnofonts{%$/
+\infoappendix tex-src/texinfo.tex /^\\def\\infoappendix{\\parsearg\\appendixzzz}$/
+\infoappendixsec tex-src/texinfo.tex /^\\def\\infoappendixsec{\\parsearg\\appendixseczzz}$/
+\infoappendixsubsec tex-src/texinfo.tex /^\\def\\infoappendixsubsec{\\parsearg\\appendixsubseczz/
+\infoappendixsubsubsec tex-src/texinfo.tex /^\\def\\infoappendixsubsubsec{\\parsearg\\appendixsubsu/
+\infochapter tex-src/texinfo.tex /^\\def\\infochapter{\\parsearg\\chapterzzz}$/
+\inforef tex-src/texinfo.tex /^\\def\\inforef #1{\\inforefzzz #1,,,,**}$/
+\inforefzzz tex-src/texinfo.tex /^\\def\\inforefzzz #1,#2,#3,#4**{See Info file \\file{/
+\infosection tex-src/texinfo.tex /^\\def\\infosection{\\parsearg\\sectionzzz}$/
+\infosubsection tex-src/texinfo.tex /^\\def\\infosubsection{\\parsearg\\subsectionzzz}$/
+\infosubsubsection tex-src/texinfo.tex /^\\def\\infosubsubsection{\\parsearg\\subsubsectionzzz}/
+\infotop tex-src/texinfo.tex /^\\def\\infotop{\\parsearg\\unnumberedzzz}$/
+\infounnumbered tex-src/texinfo.tex /^\\def\\infounnumbered{\\parsearg\\unnumberedzzz}$/
+\infounnumberedsec tex-src/texinfo.tex /^\\def\\infounnumberedsec{\\parsearg\\unnumberedseczzz}/
+\infounnumberedsubsec tex-src/texinfo.tex /^\\def\\infounnumberedsubsec{\\parsearg\\unnumberedsubs/
+\infounnumberedsubsubsec tex-src/texinfo.tex /^\\def\\infounnumberedsubsubsec{\\parsearg\\unnumbereds/
+\initial tex-src/texinfo.tex /^\\def\\initial #1{%$/
+\internalBitem tex-src/texinfo.tex /^\\def\\internalBitem{\\smallbreak \\parsearg\\itemzzz}$/
+\internalBitemx tex-src/texinfo.tex /^\\def\\internalBitemx{\\par \\parsearg\\itemzzz}$/
+\internalBkitem tex-src/texinfo.tex /^\\def\\internalBkitem{\\smallbreak \\parsearg\\kitemzzz/
+\internalBkitemx tex-src/texinfo.tex /^\\def\\internalBkitemx{\\par \\parsearg\\kitemzzz}$/
+\internalBxitem tex-src/texinfo.tex /^\\def\\internalBxitem "#1"{\\def\\xitemsubtopix{#1} \\s/
+\internalBxitemx tex-src/texinfo.tex /^\\def\\internalBxitemx "#1"{\\def\\xitemsubtopix{#1} \\/
+\internalsetq tex-src/texinfo.tex /^\\def\\internalsetq #1#2{'xrdef {#1}{\\csname #2\\endc/
+\item tex-src/texinfo.tex /^\\def\\item{\\errmessage{@item while not in a table}}/
+\itemcontents tex-src/texinfo.tex /^\\def\\itemcontents{#1}%$/
+\itemfont tex-src/texinfo.tex /^\\def\\itemfont{#2}%$/
+\itemize tex-src/texinfo.tex /^\\def\\itemize{\\parsearg\\itemizezzz}$/
+\itemizeitem tex-src/texinfo.tex /^\\def\\itemizeitem{%$/
+\itemizey tex-src/texinfo.tex /^\\def\\itemizey #1#2{%$/
+\itemizezzz tex-src/texinfo.tex /^\\def\\itemizezzz #1{%$/
+\itemx tex-src/texinfo.tex /^\\def\\itemx{\\errmessage{@itemx while not in a table/
+\itemzzz tex-src/texinfo.tex /^\\def\\itemzzz #1{\\begingroup %$/
+\kbd tex-src/texinfo.tex /^\\def\\kbd##1{\\realbackslash kbd {##1}}$/
+\kbd tex-src/texinfo.tex /^\\def\\kbd##1{\\realbackslash kbd {##1}}%$/
+\kbd tex-src/texinfo.tex /^\\def\\kbd#1{\\def\\look{#1}\\expandafter\\kbdfoo\\look??/
+\kbdfoo tex-src/texinfo.tex /^\\def\\kbdfoo#1#2#3\\par{\\def\\one{#1}\\def\\three{#3}\\d/
+\key tex-src/texinfo.tex /^\\def\\key #1{{\\tt \\exhyphenpenalty=10000\\uppercase{/
+\key tex-src/texinfo.tex /^\\def\\key##1{\\realbackslash key {##1}}$/
+\key tex-src/texinfo.tex /^\\def\\key##1{\\realbackslash key {##1}}%$/
+\kindex tex-src/texinfo.tex /^\\def\\kindex {\\kyindex}$/
+\kitem tex-src/texinfo.tex /^\\def\\kitem{\\errmessage{@kitem while not in a table/
+\kitemx tex-src/texinfo.tex /^\\def\\kitemx{\\errmessage{@kitemx while not in a tab/
+\kitemzzz tex-src/texinfo.tex /^\\def\\kitemzzz #1{\\dosubind {kw}{\\code{#1}}{for {\\b/
+\l tex-src/texinfo.tex /^\\def\\l#1{{\\li #1}\\null} % $/
+\labelspace tex-src/texinfo.tex /^\\def\\labelspace{\\hskip1em \\relax}$/
+\lbrb tex-src/texinfo.tex /^\\def\\lbrb{{\\bf\\char`\\[}} \\def\\rbrb{{\\bf\\char`\\]}}$/
+\less tex-src/texinfo.tex /^\\def\\less{\\realbackslash less}$/
+\less tex-src/texinfo.tex /^\\def\\less{\\realbackslash less}%$/
+\linenumber tex-src/texinfo.tex /^ \\def\\linenumber{\\the\\inputlineno:\\space}$/
+\lisp tex-src/texinfo.tex /^\\def\\lisp{\\aboveenvbreak$/
+\loggingall tex-src/texinfo.tex /^\\def\\loggingall{\\tracingcommands2 \\tracingstats2 $/
+\losespace tex-src/texinfo.tex /^\\def\\losespace #1{#1}$/
+\lowercaseenumerate tex-src/texinfo.tex /^\\def\\lowercaseenumerate{%$/
+\lvvmode tex-src/texinfo.tex /^\\def\\lvvmode{\\vbox to 0pt{}}$/
+\majorheading tex-src/texinfo.tex /^\\def\\majorheading{\\parsearg\\majorheadingzzz}$/
+\majorheadingzzz tex-src/texinfo.tex /^\\def\\majorheadingzzz #1{%$/
+\math tex-src/texinfo.tex /^\\def\\math#1{\\implicitmath #1\\implicitmath}$/
+\menu tex-src/texinfo.tex /^\\long\\def\\menu #1\\end menu{}$/
+\minus tex-src/texinfo.tex /^\\def\\minus{$-$}$/
+\mylbrace tex-src/texinfo.tex /^\\def\\mylbrace {{\\tt \\char '173}}$/
+\myrbrace tex-src/texinfo.tex /^\\def\\myrbrace {{\\tt \\char '175}}$/
+\need tex-src/texinfo.tex /^\\def\\need{\\parsearg\\needx}$/
+\needx tex-src/texinfo.tex /^\\def\\needx#1{%$/
+\newcodeindex tex-src/texinfo.tex /^\\def\\newcodeindex #1{$/
+\newindex tex-src/texinfo.tex /^\\def\\newindex #1{$/
+\next tex-src/texinfo.tex /^\\def\\next##1{}\\next}$/
+\nm tex-src/testenv.tex /^\\newcommand{\\nm}[2]{\\nomenclature{#1}{#2}}$/
+\node tex-src/texinfo.tex /^\\def\\node{\\ENVcheck\\parsearg\\nodezzz}$/
+\nodexxx[ tex-src/texinfo.tex /^\\def\\nodexxx[#1,#2]{\\gdef\\lastnode{#1}}$/
+\nodezzz tex-src/texinfo.tex /^\\def\\nodezzz#1{\\nodexxx [#1,]}$/
+\nofillexdent tex-src/texinfo.tex /^\\def\\nofillexdent{\\parsearg\\nofillexdentyyy}$/
+\nofillexdentyyy tex-src/texinfo.tex /^\\def\\nofillexdentyyy #1{{\\advance \\leftskip by -\\e/
+\normalbackslash tex-src/texinfo.tex /^\\def\\normalbackslash{{\\tt\\rawbackslashxx}}$/
+\normalcaret tex-src/texinfo.tex /^\\def\\normalcaret{^}$/
+\normaldoublequote tex-src/texinfo.tex /^\\def\\normaldoublequote{"}$/
+\normalgreater tex-src/texinfo.tex /^\\def\\normalgreater{>}$/
+\normalless tex-src/texinfo.tex /^\\def\\normalless{<}$/
+\normalplus tex-src/texinfo.tex /^\\def\\normalplus{+}$/
+\normaltilde tex-src/texinfo.tex /^\\def\\normaltilde{~}$/
+\normalunderscore tex-src/texinfo.tex /^\\def\\normalunderscore{_}$/
+\normalverticalbar tex-src/texinfo.tex /^\\def\\normalverticalbar{|}$/
+\nsbot tex-src/texinfo.tex /^\\def\\nsbot{\\vbox$/
+\nstop tex-src/texinfo.tex /^\\def\\nstop{\\vbox$/
+\numberedsec tex-src/texinfo.tex /^\\outer\\def\\numberedsec{\\parsearg\\seczzz}$/
+\numberedsubsec tex-src/texinfo.tex /^\\outer\\def\\numberedsubsec{\\parsearg\\numberedsubsec/
+\numberedsubseczzz tex-src/texinfo.tex /^\\def\\numberedsubseczzz #1{\\seccheck{subsection}%$/
+\numberedsubsubsec tex-src/texinfo.tex /^\\outer\\def\\numberedsubsubsec{\\parsearg\\numberedsub/
+\numberedsubsubseczzz tex-src/texinfo.tex /^\\def\\numberedsubsubseczzz #1{\\seccheck{subsubsecti/
+\numericenumerate tex-src/texinfo.tex /^\\def\\numericenumerate{%$/
+\oddfooting tex-src/texinfo.tex /^\\def\\oddfooting{\\parsearg\\oddfootingxxx}$/
+\oddheading tex-src/texinfo.tex /^\\def\\oddheading{\\parsearg\\oddheadingxxx}$/
+\onepageout tex-src/texinfo.tex /^\\def\\onepageout#1{\\hoffset=\\normaloffset$/
+\opencontents tex-src/texinfo.tex /^\\def\\opencontents{\\openout \\contentsfile = \\jobnam/
+\openindices tex-src/texinfo.tex /^\\def\\openindices{%$/
+\opnr tex-src/texinfo.tex /^\\def\\opnr{{\\sf\\char`\\(}} \\def\\clnr{{\\sf\\char`\\)}} /
+\page tex-src/texinfo.tex /^ \\def\\page{%$/
+\page tex-src/texinfo.tex /^\\def\\page{\\par\\vfill\\supereject}$/
+\pagebody tex-src/texinfo.tex /^\\def\\pagebody#1{\\vbox to\\pageheight{\\boxmaxdepth=\\/
+\pagesofar tex-src/texinfo.tex /^\\def\\pagesofar{\\unvbox\\partialpage %$/
+\parsearg tex-src/texinfo.tex /^\\def\\parsearg #1{\\let\\next=#1\\begingroup\\obeylines/
+\parseargline tex-src/texinfo.tex /^\\def\\parseargline{\\begingroup \\obeylines \\parsearg/
+\parseargx tex-src/texinfo.tex /^\\def\\parseargx{%$/
+\pindex tex-src/texinfo.tex /^\\def\\pindex {\\pgindex}$/
+\plainsecheading tex-src/texinfo.tex /^\\def\\plainsecheading #1{\\secheadingi {#1}}$/
+\point tex-src/texinfo.tex /^\\def\\point{$\\star$}$/
+\primary tex-src/texinfo.tex /^\\def\\primary #1{\\line{#1\\hfil}}$/
+\print tex-src/texinfo.tex /^\\def\\print{\\leavevmode\\lower.1ex\\hbox to 1em{\\hfil/
+\print tex-src/texinfo.tex /^\\def\\print{\\realbackslash print}$/
+\printedmanual tex-src/texinfo.tex /^\\def\\printedmanual{\\ignorespaces #5}%$/
+\printedmanual tex-src/texinfo.tex /^section ``\\printednodename'' in \\cite{\\printedmanu/
+\printednodename tex-src/texinfo.tex /^\\def\\printednodename{\\ignorespaces #1}%$/
+\printednodename tex-src/texinfo.tex /^\\def\\printednodename{\\ignorespaces #3}%$/
+\printindex tex-src/texinfo.tex /^\\def\\printindex{\\parsearg\\doprintindex}$/
+\pxref tex-src/texinfo.tex /^\\def\\pxref#1{see \\xrefX[#1,,,,,,,]}$/
+\quotation tex-src/texinfo.tex /^\\def\\quotation{%$/
+\r tex-src/texinfo.tex /^\\def\\r##1{\\realbackslash r {##1}}$/
+\r tex-src/texinfo.tex /^\\def\\r##1{\\realbackslash r {##1}}%$/
+\r tex-src/texinfo.tex /^\\def\\r#1{{\\rm #1}} % roman font$/
+\rawbackslashxx tex-src/texinfo.tex /^\\def\\rawbackslashxx{\\indexbackslash}% \\indexbacksl/
+\rawbackslashxx tex-src/texinfo.tex /^\\def\\rawbackslashxx{\\indexbackslash}%$/
+\readauxfile tex-src/texinfo.tex /^\\def\\readauxfile{%$/
+\ref tex-src/texinfo.tex /^\\def\\ref#1{\\xrefX[#1,,,,,,,]}$/
+\refx tex-src/texinfo.tex /^\\def\\refx#1#2{%$/
+\resetmathfonts tex-src/texinfo.tex /^\\def\\resetmathfonts{%$/
+\result tex-src/texinfo.tex /^\\def\\result{\\leavevmode\\raise.15ex\\hbox to 1em{\\hf/
+\result tex-src/texinfo.tex /^\\def\\result{\\realbackslash result}$/
+\rm tex-src/texinfo.tex /^\\def\\rm{\\realbackslash rm }%$/
+\samp tex-src/texinfo.tex /^\\def\\samp #1{`\\tclose{#1}'\\null}$/
+\samp tex-src/texinfo.tex /^\\def\\samp##1{\\realbackslash samp {##1}}$/
+\samp tex-src/texinfo.tex /^\\def\\samp##1{\\realbackslash samp {##1}}%$/
+\sc tex-src/texinfo.tex /^\\def\\sc#1{{\\smallcaps#1}} % smallcaps font$/
+\seccheck tex-src/texinfo.tex /^\\def\\seccheck#1{\\if \\pageno<0 %$/
+\secentry tex-src/texinfo.tex /^ \\def\\secentry ##1##2##3##4{}$/
+\secentry tex-src/texinfo.tex /^\\def\\secentry#1#2#3#4{\\dosecentry{#2.#3\\labelspace/
+\secentryfonts tex-src/texinfo.tex /^\\def\\secentryfonts{\\textfonts}$/
+\secfonts tex-src/texinfo.tex /^\\def\\secfonts{%$/
+\secheading tex-src/texinfo.tex /^\\def\\secheading #1#2#3{\\secheadingi {#2.#3\\enspace/
+\secheadingbreak tex-src/texinfo.tex /^\\def\\secheadingbreak{\\dobreak \\secheadingskip {-10/
+\secheadingi tex-src/texinfo.tex /^\\def\\secheadingi #1{{\\advance \\secheadingskip by \\/
+\secondary tex-src/texinfo.tex /^\\def\\secondary #1#2{$/
+\seczzz tex-src/texinfo.tex /^\\def\\seczzz #1{\\seccheck{section}%$/
+\set tex-src/texinfo.tex /^\\def\\set{\\parsearg\\setxxx}$/
+\setchapternewpage tex-src/texinfo.tex /^\\def\\setchapternewpage #1 {\\csname CHAPPAG#1\\endcs/
+\setchapterstyle tex-src/texinfo.tex /^\\def\\setchapterstyle #1 {\\csname CHAPF#1\\endcsname/
+\setdeffont tex-src/texinfo.tex /^\\def\\setdeffont #1 {\\csname DEF#1\\endcsname}$/
+\setfilename tex-src/texinfo.tex /^\\def\\setfilename{%$/
+\setref tex-src/texinfo.tex /^\\def\\setref#1{%$/
+\settitle tex-src/texinfo.tex /^\\def\\settitle{\\parsearg\\settitlezzz}$/
+\settitlezzz tex-src/texinfo.tex /^\\def\\settitlezzz #1{\\gdef\\thistitle{#1}}$/
+\setxxx tex-src/texinfo.tex /^\\def\\setxxx #1{$/
+\sf tex-src/texinfo.tex /^\\def\\sf{\\fam=\\sffam \\tensf}$/
+\sf tex-src/texinfo.tex /^\\def\\sf{\\realbackslash sf}%$/
+\shortchapentry tex-src/texinfo.tex /^\\def\\shortchapentry#1#2#3{%$/
+\shortunnumberedentry tex-src/texinfo.tex /^\\def\\shortunnumberedentry#1#2{%$/
+\singlecodeindexer tex-src/texinfo.tex /^\\def\\singlecodeindexer #1{\\doind{\\indexname}{\\code/
+\singleindexer tex-src/texinfo.tex /^\\def\\singleindexer #1{\\doind{\\indexname}{#1}}$/
+\singlespace tex-src/texinfo.tex /^\\def\\singlespace{%$/
+\sl tex-src/texinfo.tex /^\\def\\sl{\\realbackslash sl }%$/
+\smallbook tex-src/texinfo.tex /^\\def\\smallbook{$/
+\smalllispx tex-src/texinfo.tex /^\\def\\smalllispx{\\aboveenvbreak\\begingroup\\inENV$/
+\smartitalic tex-src/texinfo.tex /^\\def\\smartitalic#1{{\\sl #1}\\futurelet\\next\\smartit/
+\smartitalicx tex-src/texinfo.tex /^\\def\\smartitalicx{\\ifx\\next,\\else\\ifx\\next-\\else\\i/
+\sp tex-src/texinfo.tex /^\\def\\sp{\\parsearg\\spxxx}$/
+\splitoff tex-src/texinfo.tex /^\\def\\splitoff#1#2\\endmark{\\def\\first{#1}\\def\\rest{/
+\spxxx tex-src/texinfo.tex /^\\def\\spxxx #1{\\par \\vskip #1\\baselineskip}$/
+\startcontents tex-src/texinfo.tex /^\\def\\startcontents#1{%$/
+\startenumeration tex-src/texinfo.tex /^\\def\\startenumeration#1{%$/
+\subheading tex-src/texinfo.tex /^\\def\\subheading{\\parsearg\\subsecheadingi}$/
+\subsecentry tex-src/texinfo.tex /^ \\def\\subsecentry ##1##2##3##4##5{}$/
+\subsecentry tex-src/texinfo.tex /^\\def\\subsecentry#1#2#3#4#5{\\dosubsecentry{#2.#3.#4/
+\subsecfonts tex-src/texinfo.tex /^\\def\\subsecfonts{%$/
+\subsecheading tex-src/texinfo.tex /^\\def\\subsecheading #1#2#3#4{\\subsecheadingi {#2.#3/
+\subsecheadingbreak tex-src/texinfo.tex /^\\def\\subsecheadingbreak{\\dobreak \\subsecheadingski/
+\subsecheadingi tex-src/texinfo.tex /^\\def\\subsecheadingi #1{{\\advance \\subsecheadingski/
+\subsubheading tex-src/texinfo.tex /^\\def\\subsubheading{\\parsearg\\subsubsecheadingi}$/
+\subsubsecentry tex-src/texinfo.tex /^ \\def\\subsubsecentry ##1##2##3##4##5##6{}$/
+\subsubsecentry tex-src/texinfo.tex /^\\def\\subsubsecentry#1#2#3#4#5#6{%$/
+\subsubsecfonts tex-src/texinfo.tex /^\\def\\subsubsecfonts{\\subsecfonts} % Maybe this sho/
+\subsubsecheading tex-src/texinfo.tex /^\\def\\subsubsecheading #1#2#3#4#5{\\subsubsecheading/
+\subsubsecheadingi tex-src/texinfo.tex /^\\def\\subsubsecheadingi #1{{\\advance \\subsecheading/
+\subtitle tex-src/texinfo.tex /^ \\def\\subtitle{\\parsearg\\subtitlezzz}%$/
+\subtitlefont tex-src/texinfo.tex /^ \\def\\subtitlefont{\\subtitlerm \\normalbaselinesk/
+\subtitlezzz tex-src/texinfo.tex /^ \\def\\subtitlezzz##1{{\\subtitlefont \\rightline{#/
+\summarycontents tex-src/texinfo.tex /^\\outer\\def\\summarycontents{%$/
+\supereject tex-src/texinfo.tex /^\\def\\supereject{\\par\\penalty -20000\\footnoteno =0 /
+\syncodeindex tex-src/texinfo.tex /^\\def\\syncodeindex #1 #2 {%$/
+\synindex tex-src/texinfo.tex /^\\def\\synindex #1 #2 {%$/
+\t tex-src/texinfo.tex /^\\def\\t##1{\\realbackslash r {##1}}%$/
+\t tex-src/texinfo.tex /^\\def\\t#1{{\\tt \\exhyphenpenalty=10000\\rawbackslash /
+\table tex-src/texinfo.tex /^\\def\\table{\\begingroup\\inENV\\obeylines\\obeyspaces\\/
+\tablez tex-src/texinfo.tex /^\\def\\tablez #1#2#3#4#5#6{%$/
+\tclose tex-src/texinfo.tex /^\\def\\tclose##1{\\realbackslash tclose {##1}}$/
+\tclose tex-src/texinfo.tex /^\\def\\tclose##1{\\realbackslash tclose {##1}}%$/
+\tclose tex-src/texinfo.tex /^\\def\\tclose#1{{\\rm \\tcloserm=\\fontdimen2\\font \\tt /
+\tex tex-src/texinfo.tex /^\\def\\tex{\\begingroup$/
+\texinfoversion tex-src/texinfo.tex /^\\def\\texinfoversion{2.73}$/
+\textfonts tex-src/texinfo.tex /^\\def\\textfonts{%$/
+\thearg tex-src/texinfo.tex /^ \\def\\thearg{#1}%$/
+\thearg tex-src/texinfo.tex /^ \\ifx\\thearg\\empty \\def\\thearg{1}\\fi$/
+\thischapter tex-src/texinfo.tex /^ \\unnumbchapmacro{#1}\\def\\thischapter{}%$/
+\thischapter tex-src/texinfo.tex /^\\def\\thischapter{} \\def\\thissection{}$/
+\thischaptername tex-src/texinfo.tex /^\\def\\thischaptername{No Chapter Title}$/
+\thisfile tex-src/texinfo.tex /^\\def\\thisfile{}$/
+\thistitle tex-src/texinfo.tex /^\\def\\thistitle{No Title}$/
+\tie tex-src/texinfo.tex /^\\def\\tie{\\penalty 10000\\ } % Save plain tex de/
+\tindex tex-src/texinfo.tex /^\\def\\tindex {\\tpindex}$/
+\title tex-src/texinfo.tex /^ \\def\\title{\\parsearg\\titlezzz}%$/
+\titlefont tex-src/texinfo.tex /^\\def\\titlefont#1{{\\titlerm #1}}$/
+\titlepage tex-src/texinfo.tex /^\\def\\titlepage{\\begingroup \\parindent=0pt \\textfon/
+\titlezzz tex-src/texinfo.tex /^ \\def\\titlezzz##1{\\leftline{\\titlefont{##1}}$/
+\today tex-src/texinfo.tex /^\\def\\today{\\number\\day\\space$/
+\top tex-src/texinfo.tex /^\\outer\\def\\top{\\parsearg\\unnumberedzzz}$/
+\tt tex-src/texinfo.tex /^\\def\\tt{\\realbackslash tt}$/
+\tt tex-src/texinfo.tex /^\\def\\tt{\\realbackslash tt}%$/
+\turnoffactive tex-src/texinfo.tex /^\\def\\turnoffactive{\\let"=\\normaldoublequote$/
+\unnchfopen tex-src/texinfo.tex /^\\def\\unnchfopen #1{%$/
+\unnchfplain tex-src/texinfo.tex /^\\def\\unnchfplain #1{%$/
+\unnumbchapentry tex-src/texinfo.tex /^\\def\\unnumbchapentry#1#2{\\dochapentry{#1}{#2}}$/
+\unnumbered tex-src/texinfo.tex /^\\outer\\def\\unnumbered{\\parsearg\\unnumberedzzz}$/
+\unnumberedsec tex-src/texinfo.tex /^\\outer\\def\\unnumberedsec{\\parsearg\\unnumberedseczz/
+\unnumberedseczzz tex-src/texinfo.tex /^\\def\\unnumberedseczzz #1{\\seccheck{unnumberedsec}%/
+\unnumberedsubsec tex-src/texinfo.tex /^\\outer\\def\\unnumberedsubsec{\\parsearg\\unnumberedsu/
+\unnumberedsubseczzz tex-src/texinfo.tex /^\\def\\unnumberedsubseczzz #1{\\seccheck{unnumberedsu/
+\unnumberedsubsubsec tex-src/texinfo.tex /^\\outer\\def\\unnumberedsubsubsec{\\parsearg\\unnumbere/
+\unnumberedsubsubseczzz tex-src/texinfo.tex /^\\def\\unnumberedsubsubseczzz #1{\\seccheck{unnumbere/
+\unnumberedzzz tex-src/texinfo.tex /^\\def\\unnumberedzzz #1{\\seccheck{unnumbered}%$/
+\unnumbnoderef tex-src/texinfo.tex /^\\def\\unnumbnoderef{\\ifx\\lastnode\\relax\\else$/
+\unnumbsecentry tex-src/texinfo.tex /^ \\def\\unnumbsecentry ##1##2{}$/
+\unnumbsecentry tex-src/texinfo.tex /^\\def\\unnumbsecentry#1#2{\\dosecentry{#1}{#2}}$/
+\unnumbsetref tex-src/texinfo.tex /^\\def\\unnumbsetref#1{%$/
+\unnumbsubsecentry tex-src/texinfo.tex /^ \\def\\unnumbsubsecentry ##1##2{}$/
+\unnumbsubsecentry tex-src/texinfo.tex /^\\def\\unnumbsubsecentry#1#2{\\dosubsecentry{#1}{#2}}/
+\unnumbsubsubsecentry tex-src/texinfo.tex /^ \\def\\unnumbsubsubsecentry ##1##2{}$/
+\unnumbsubsubsecentry tex-src/texinfo.tex /^\\def\\unnumbsubsubsecentry#1#2{\\dosubsubsecentry{#1/
+\uppercaseenumerate tex-src/texinfo.tex /^\\def\\uppercaseenumerate{%$/
+\var tex-src/texinfo.tex /^\\def\\var##1{\\realbackslash var {##1}}$/
+\var tex-src/texinfo.tex /^\\def\\var##1{\\realbackslash var {##1}}%$/
+\vindex tex-src/texinfo.tex /^\\def\\vindex {\\vrindex}$/
+\vritemindex tex-src/texinfo.tex /^\\def\\vritemindex #1{\\doind {vr}{\\code{#1}}}%$/
+\vtable tex-src/texinfo.tex /^\\def\\vtable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\w tex-src/texinfo.tex /^\\def\\w#1{\\leavevmode\\hbox{#1}}$/
+\w tex-src/texinfo.tex /^\\def\\w{\\realbackslash w }%$/
+\w tex-src/texinfo.tex /^\\def\\w{\\realbackslash w}$/
+\xitem tex-src/texinfo.tex /^\\def\\xitem{\\errmessage{@xitem while not in a table/
+\xitemx tex-src/texinfo.tex /^\\def\\xitemx{\\errmessage{@xitemx while not in a tab/
+\xitemzzz tex-src/texinfo.tex /^\\def\\xitemzzz #1{\\dosubind {kw}{\\code{#1}}{for {\\b/
+\xkey tex-src/texinfo.tex /^\\def\\xkey{\\key}$/
+\xrdef tex-src/texinfo.tex /^\\def\\xrdef #1#2{$/
+\xref tex-src/texinfo.tex /^\\def\\xref#1{See \\xrefX[#1,,,,,,,]}$/
+\xrefX[ tex-src/texinfo.tex /^\\def\\xrefX[#1,#2,#3,#4,#5,#6]{\\begingroup%$/
+^ tex-src/texinfo.tex /^\\def^{{\\tt \\hat}}$/
+_ tex-src/texinfo.tex /^\\def_{\\ifusingtt\\normalunderscore\\_}$/
+_GETOPT_H c-src/getopt.h 19
+_GNU_SOURCE c-src/etags.c 94
+_REGEX_H c-src/emacs/src/regex.h 21
+_RE_SYNTAX_POSIX_COMMON c-src/emacs/src/regex.h 221
+_Restrict_ c-src/emacs/src/regex.h 540
+_Restrict_ c-src/emacs/src/regex.h 542
+_Restrict_ c-src/emacs/src/regex.h 544
+_Restrict_arr_ c-src/emacs/src/regex.h 555
+_Restrict_arr_ c-src/emacs/src/regex.h 557
+_UCHAR_T c-src/emacs/src/lisp.h 2423
+__COLORS cp-src/screen.hpp 9
+__default_morecore c-src/emacs/src/gmalloc.c /^__default_morecore (ptrdiff_t increment)$/
+__init__ pyt-src/server.py /^ def __init__(self):$/
+__init__ pyt-src/server.py /^ def __init__(self, Master, text, textvar, widt/
+__init__ pyt-src/server.py /^ def __init__(self, host, sitelist, master=None/
+__init__ pyt-src/server.py /^ def __init__(self, master=None):$/
+__init__ pyt-src/server.py /^ def __init__(self, newlegend, list, editor, ma/
+__init__ pyt-src/server.py /^ def __init__(self, user, userlist, master=None/
+__ip c.c 159
+__libc_atexit c-src/exit.c 30
+__libc_atexit c-src/exit.strange_suffix 30
+__malloc_extra_blocks c-src/emacs/src/gmalloc.c 381
+__malloc_initialize c-src/emacs/src/gmalloc.c /^__malloc_initialize (void)$/
+__malloc_initialized c-src/emacs/src/gmalloc.c 379
+__repr__ pyt-src/server.py /^ def __repr__(self):$/
+__sbrk c-src/emacs/src/gmalloc.c 1513
+__str__ pyt-src/server.py /^ def __str__(self):$/
+__up c.c 160
+_aligned_blocks c-src/emacs/src/gmalloc.c 1004
+_aligned_blocks_mutex c-src/emacs/src/gmalloc.c 518
+_bar? ruby-src/test1.ru /^ def self._bar?(abc)$/
+_bytes_free c-src/emacs/src/gmalloc.c 376
+_bytes_used c-src/emacs/src/gmalloc.c 374
+_chunks_free c-src/emacs/src/gmalloc.c 375
+_chunks_used c-src/emacs/src/gmalloc.c 373
+_fraghead c-src/emacs/src/gmalloc.c 370
+_free c-src/emacs/src/gmalloc.c /^_free (void *ptr)$/
+_free_internal c-src/emacs/src/gmalloc.c /^_free_internal (void *ptr)$/
+_free_internal_nolock c-src/emacs/src/gmalloc.c /^_free_internal_nolock (void *ptr)$/
+_heapbase c-src/emacs/src/gmalloc.c 355
+_heapindex c-src/emacs/src/gmalloc.c 364
+_heapinfo c-src/emacs/src/gmalloc.c 358
+_heaplimit c-src/emacs/src/gmalloc.c 367
+_malloc c-src/emacs/src/gmalloc.c /^_malloc (size_t size)$/
+_malloc_internal c-src/emacs/src/gmalloc.c /^_malloc_internal (size_t size)$/
+_malloc_internal_nolock c-src/emacs/src/gmalloc.c /^_malloc_internal_nolock (size_t size)$/
+_malloc_mutex c-src/emacs/src/gmalloc.c 517
+_malloc_thread_enabled_p c-src/emacs/src/gmalloc.c 519
+_realloc c-src/emacs/src/gmalloc.c /^_realloc (void *ptr, size_t size)$/
+_realloc_internal c-src/emacs/src/gmalloc.c /^_realloc_internal (void *ptr, size_t size)$/
+_realloc_internal_nolock c-src/emacs/src/gmalloc.c /^_realloc_internal_nolock (void *ptr, size_t size)$/
+` ruby-src/test.rb /^ def `(command)$/
+a c-src/h.h 103
+a c-src/h.h 40
+a c.c /^a ()$/
+a c.c /^a()$/
+a c.c 152
+a c.c 180
+a cp-src/c.C 132
+a ruby-src/test1.ru /^ def a()$/
+a-forth-constant! forth-src/test-forth.fth /^99 constant a-forth-constant!$/
+a-forth-value? forth-src/test-forth.fth /^55 value a-forth-value?$/
+a-forth-word forth-src/test-forth.fth /^: a-forth-word ( a b c -- )$/
+a-forth-word forth-src/test-forth.fth /^: a-forth-word ( a b c -- a*b+c ) + * ;$/
+a0 c-src/emacs/src/lisp.h /^ Lisp_Object (*a0) (void);$/
+a1 c-src/emacs/src/lisp.h /^ Lisp_Object (*a1) (Lisp_Object);$/
+a2 c-src/emacs/src/lisp.h /^ Lisp_Object (*a2) (Lisp_Object, Lisp_Object)/
+a3 c-src/emacs/src/lisp.h /^ Lisp_Object (*a3) (Lisp_Object, Lisp_Object,/
+a4 c-src/emacs/src/lisp.h /^ Lisp_Object (*a4) (Lisp_Object, Lisp_Object,/
+a5 c-src/emacs/src/lisp.h /^ Lisp_Object (*a5) (Lisp_Object, Lisp_Object,/
+a6 c-src/emacs/src/lisp.h /^ Lisp_Object (*a6) (Lisp_Object, Lisp_Object,/
+a7 c-src/emacs/src/lisp.h /^ Lisp_Object (*a7) (Lisp_Object, Lisp_Object,/
+a8 c-src/emacs/src/lisp.h /^ Lisp_Object (*a8) (Lisp_Object, Lisp_Object,/
+aMANY c-src/emacs/src/lisp.h /^ Lisp_Object (*aMANY) (ptrdiff_t, Lisp_Object/
+aUNEVALLED c-src/emacs/src/lisp.h /^ Lisp_Object (*aUNEVALLED) (Lisp_Object args)/
+aa c.c 269
+aa c.c 279
+aaa c.c 249
+aaa c.c 269
+aaaaaa c-src/h.h 111
+abbrev-expansion c-src/abbrev.c /^DEFUN ("abbrev-expansion", Fabbrev_expansion, Sabb/
+abbrev-symbol c-src/abbrev.c /^DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_sy/
+abbrev_all_caps c-src/abbrev.c 58
+abbrevs_changed c-src/abbrev.c 56
+abc c-src/h.h 33
+abc c-src/h.h 37
+abort-recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("abort-recursive-edit", Fabort_recursive_ed/
+abs/f ada-src/etags-test-for.ada /^ function "abs" (Right : Complex) return Real'/
+absolute_dirname c-src/etags.c /^absolute_dirname (char *file, char *dir)$/
+absolute_filename c-src/etags.c /^absolute_filename (char *file, char *dir)$/
+abt cp-src/c.C 55
+acc_pred_info merc-src/accumulator.m /^:- pred acc_pred_info(list(mer_type)::in, list(pro/
+acc_proc_info merc-src/accumulator.m /^:- pred acc_proc_info(list(prog_var)::in, prog_var/
+acc_unification merc-src/accumulator.m /^:- pred acc_unification(pair(prog_var)::in, hlds_g/
+acc_var_subst_init merc-src/accumulator.m /^:- pred acc_var_subst_init(list(prog_var)::in,$/
+accent_key_syms c-src/emacs/src/keyboard.c 4625
+access_keymap_keyremap c-src/emacs/src/keyboard.c /^access_keymap_keyremap (Lisp_Object map, Lisp_Obje/
+accu_assoc merc-src/accumulator.m /^:- pred accu_assoc(module_info::in, vartypes::in, /
+accu_assoc merc-src/accumulator.m /^:- type accu_assoc$/
+accu_base merc-src/accumulator.m /^:- type accu_base$/
+accu_before merc-src/accumulator.m /^:- pred accu_before(module_info::in, vartypes::in,/
+accu_case merc-src/accumulator.m /^:- type accu_case$/
+accu_construct merc-src/accumulator.m /^:- pred accu_construct(module_info::in, vartypes::/
+accu_construct_assoc merc-src/accumulator.m /^:- pred accu_construct_assoc(module_info::in, vart/
+accu_create_goal merc-src/accumulator.m /^:- pred accu_create_goal(accu_goal_id::in, list(pr/
+accu_divide_base_case merc-src/accumulator.m /^:- pred accu_divide_base_case(module_info::in, var/
+accu_goal_id merc-src/accumulator.m /^:- type accu_goal_id$/
+accu_goal_list merc-src/accumulator.m /^:- func accu_goal_list(list(accu_goal_id), accu_go/
+accu_goal_store merc-src/accumulator.m /^:- type accu_goal_store == goal_store(accu_goal_id/
+accu_has_heuristic merc-src/accumulator.m /^:- pred accu_has_heuristic(module_name::in, string/
+accu_heuristic merc-src/accumulator.m /^:- pred accu_heuristic(module_name::in, string::in/
+accu_is_associative merc-src/accumulator.m /^:- pred accu_is_associative(module_info::in, pred_/
+accu_is_update merc-src/accumulator.m /^:- pred accu_is_update(module_info::in, pred_id::i/
+accu_process_assoc_set merc-src/accumulator.m /^:- pred accu_process_assoc_set(module_info::in, ac/
+accu_process_update_set merc-src/accumulator.m /^:- pred accu_process_update_set(module_info::in, a/
+accu_related merc-src/accumulator.m /^:- pred accu_related(module_info::in, vartypes::in/
+accu_rename merc-src/accumulator.m /^:- func accu_rename(list(accu_goal_id), accu_subst/
+accu_sets merc-src/accumulator.m /^:- type accu_sets$/
+accu_sets_init merc-src/accumulator.m /^:- pred accu_sets_init(accu_sets::out) is det.$/
+accu_stage1 merc-src/accumulator.m /^:- pred accu_stage1(module_info::in, vartypes::in,/
+accu_stage1_2 merc-src/accumulator.m /^:- pred accu_stage1_2(module_info::in, vartypes::i/
+accu_stage2 merc-src/accumulator.m /^:- pred accu_stage2(module_info::in, proc_info::in/
+accu_stage3 merc-src/accumulator.m /^:- pred accu_stage3(accu_goal_id::in, list(prog_va/
+accu_standardize merc-src/accumulator.m /^:- pred accu_standardize(hlds_goal::in, hlds_goal:/
+accu_store merc-src/accumulator.m /^:- pred accu_store(accu_case::in, hlds_goal::in,$/
+accu_subst merc-src/accumulator.m /^:- type accu_subst == map(prog_var, prog_var).$/
+accu_substs merc-src/accumulator.m /^:- type accu_substs$/
+accu_substs_init merc-src/accumulator.m /^:- pred accu_substs_init(list(prog_var)::in, prog_/
+accu_top_level merc-src/accumulator.m /^:- pred accu_top_level(top_level::in, hlds_goal::i/
+accu_transform_proc merc-src/accumulator.m /^:- pred accu_transform_proc(pred_proc_id::in, pred/
+accu_update merc-src/accumulator.m /^:- pred accu_update(module_info::in, vartypes::in,/
+accu_warning merc-src/accumulator.m /^:- type accu_warning$/
+act prol-src/natded.prolog /^act(OutForm,OutSyn,Ws):-$/
+action prol-src/natded.prolog /^action(KeyVals):-$/
+active_maps c-src/emacs/src/keyboard.c /^active_maps (Lisp_Object first_event)$/
+actout prol-src/natded.prolog /^actout('Text',Trees):-$/
+addArchs objc-src/PackInsp.m /^-(void)addArchs:(const char *)string$/
+addPOReader php-src/lce_functions.php /^ function addPOReader($d_name, &$por)$/
+add_active prol-src/natded.prolog /^add_active([],Cat,Goal):-$/
+add_command_key c-src/emacs/src/keyboard.c /^add_command_key (Lisp_Object key)$/
+add_edge prol-src/natded.prolog /^add_edge(Left,Right,Cat):-$/
+add_node c-src/etags.c /^add_node (node *np, node **cur_node_p)$/
+add_regex c-src/etags.c /^add_regex (char *regexp_pattern, language *lang)$/
+add_user_signal c-src/emacs/src/keyboard.c /^add_user_signal (int sig, const char *name)$/
+addnoise html-src/algrthms.html /^Adding Noise to the$/
+address y-src/cccp.y 113
+adjust_point_for_property c-src/emacs/src/keyboard.c /^adjust_point_for_property (ptrdiff_t last_pt, bool/
+agent cp-src/clheir.hpp 75
+algorithms html-src/algrthms.html /^Description$/
+alias c-src/emacs/src/lisp.h 688
+align c-src/emacs/src/gmalloc.c /^align (size_t size)$/
+alignas c-src/emacs/src/lisp.h /^# define alignas(alignment) \/* empty *\/$/
+aligned c-src/emacs/src/gmalloc.c 199
+aligned_alloc c-src/emacs/src/gmalloc.c /^aligned_alloc (size_t alignment, size_t size)$/
+aligned_alloc c-src/emacs/src/gmalloc.c 1718
+aligned_alloc c-src/emacs/src/gmalloc.c 71
+alignlist c-src/emacs/src/gmalloc.c 196
+alive cp-src/conway.hpp 7
+all_kboards c-src/emacs/src/keyboard.c 86
+allocate_kboard c-src/emacs/src/keyboard.c /^allocate_kboard (Lisp_Object type)$/
+allocated c-src/emacs/src/regex.h 344
+an_extern_linkage c-src/h.h 44
+an_extern_linkage c-src/h.h 56
+an_extern_linkage_ptr c-src/h.h 43
+analyze_regex c-src/etags.c /^analyze_regex (char *regex_arg)$/
+andkeyvalseq prol-src/natded.prolog /^andkeyvalseq(KeyVals) --> ['&'], keyvalseq(KeyVals/
+animals c-src/h.h 81
+animals cp-src/c.C 126
+animals cp-src/c.C 130
+any_kboard_state c-src/emacs/src/keyboard.c /^any_kboard_state ()$/
+appDidInit objcpp-src/SimpleCalc.M /^- appDidInit:sender$/
+append prol-src/natded.prolog /^append([],Xs,Xs).$/
+appendToDisplay objcpp-src/SimpleCalc.M /^- appendToDisplay:(const char *)theDigit$/
+append_list prol-src/natded.prolog /^append_list([],[]).$/
+append_string pas-src/common.pas /^procedure append_string;(*($/
+append_tool_bar_item c-src/emacs/src/keyboard.c /^append_tool_bar_item (void)$/
+appendix perl-src/htlmify-cystic 24
+appendix_name perl-src/htlmify-cystic 13
+appendix_toc perl-src/htlmify-cystic 16
+apply_modifiers c-src/emacs/src/keyboard.c /^apply_modifiers (int modifiers, Lisp_Object base)$/
+apply_modifiers_uncached c-src/emacs/src/keyboard.c /^apply_modifiers_uncached (int modifiers, char *bas/
+aref_addr c-src/emacs/src/lisp.h /^aref_addr (Lisp_Object array, ptrdiff_t idx)$/
+arg c-src/emacs/src/lisp.h 2961
+arg c-src/emacs/src/lisp.h 2966
+arg c-src/emacs/src/lisp.h 2971
+arg c-src/h.h 13
+arg_type c-src/etags.c 250
+arglist y-src/cccp.y 41
+argno y-src/cccp.y 45
+args c-src/emacs/src/lisp.h 2986
+args c-src/h.h 30
+argsindent tex-src/texinfo.tex /^\\dimen1=\\hsize \\advance \\dimen1 by -\\defargsindent/
+argsindent tex-src/texinfo.tex /^\\newskip\\defargsindent \\defargsindent=50pt$/
+argsindent tex-src/texinfo.tex /^\\parshape 2 0in \\dimen0 \\defargsindent \\dimen1 /
+argument c-src/etags.c 253
+argvals prol-src/natded.prolog /^argvals([]) --> [].$/
+array c.c 190
+ascii c-src/emacs/src/lisp.h 1598
+asort cp-src/functions.cpp /^void asort(int *a, int num){$/
+assemby-code-word forth-src/test-forth.fth /^code assemby-code-word ( dunno what it does )$/
+assert c-src/etags.c /^# define assert(x) ((void) 0)$/
+assert c-src/etags.c 135
+assign_neighbor cp-src/clheir.hpp /^ void assign_neighbor(int direction, location */
+assoc_list merc-src/accumulator.m /^:- import_module assoc_list.$/
+associativity_assertion merc-src/accumulator.m /^:- pred associativity_assertion(module_info::in, l/
+at_end c-src/etags.c 249
+at_filename c-src/etags.c 247
+at_language c-src/etags.c 245
+at_least_one_member prol-src/natded.prolog /^at_least_one_member(X,[X|_]):-!.$/
+at_regexp c-src/etags.c 246
+at_stdin c-src/etags.c 248
+atom prol-src/natded.prolog /^atom(X) --> [X], {atomic(X)}.$/
+atomval prol-src/natded.prolog /^atomval(X) --> atom(X).$/
+aultparindent tex-src/texinfo.tex /^\\newdimen\\defaultparindent \\defaultparindent = 15p/
+aultparindent tex-src/texinfo.tex /^\\parindent = \\defaultparindent$/
+aultparindent\hang\textindent tex-src/texinfo.tex /^\\footstrut\\parindent=\\defaultparindent\\hang\\textin/
+auto_help c-src/etags.c 699
+b c-src/h.h 103
+b c-src/h.h 104
+b c-src/h.h 41
+b c.c /^b ()$/
+b c.c 180
+b c.c 259
+b c.c 260
+b c.c 262
+b cp-src/c.C 132
+b ruby-src/test1.ru /^ def b()$/
+backslash=0 tex-src/texinfo.tex /^\\let\\indexbackslash=0 %overridden during \\printin/
+bar c-src/c.c /^void bar() {while(0) {}}$/
+bar c-src/h.h 19
+bar c.c 143
+bar cp-src/x.cc /^XX::bar()$/
+bar1 ruby-src/test1.ru /^ attr_reader(:foo1, :bar1, # comment$/
+bar= ruby-src/test1.ru /^ attr_writer :bar,$/
+bas_syn prol-src/natded.prolog /^bas_syn(n(_)).$/
+base c-src/emacs/src/lisp.h 2188
+base cp-src/Range.h /^ double base (void) const { return rng_base; }$/
+base cp-src/c.C /^double base (void) const { return rng_base; }$/
+base_case_ids merc-src/accumulator.m /^:- func base_case_ids(accu_goal_store) = list(accu/
+base_case_ids_set merc-src/accumulator.m /^:- func base_case_ids_set(accu_goal_store) = set(a/
+baz= ruby-src/test1.ru /^ :baz,$/
+bb c.c 275
+bbb c.c 251
+bbbbbb c-src/h.h 113
+been_warned c-src/etags.c 222
+before_command_echo_length c-src/emacs/src/keyboard.c 130
+before_command_key_count c-src/emacs/src/keyboard.c 129
+begtoken c-src/etags.c /^#define begtoken(c) (_btk[CHAR (c)]) \/* c can star/
+behaviour_info erl-src/gs_dialog.erl /^behaviour_info(callbacks) ->$/
+bf=cmbx10 tex-src/texinfo.tex /^\\font\\defbf=cmbx10 scaled \\magstep1 %was 1314$/
+bind pyt-src/server.py /^ def bind(self, key, action):$/
+bind_polling_period c-src/emacs/src/keyboard.c /^bind_polling_period (int n)$/
+bits_word c-src/emacs/src/lisp.h 123
+bits_word c-src/emacs/src/lisp.h 127
+bla c.c /^int bla ()$/
+blah tex-src/testenv.tex /^\\section{blah}$/
+bletch el-src/TAGTEST.EL /^(foo::defmumble bletch beuarghh)$/
+blv c-src/emacs/src/lisp.h 689
+blv_found c-src/emacs/src/lisp.h /^blv_found (struct Lisp_Buffer_Local_Value *blv)$/
+bodyindent tex-src/texinfo.tex /^\\advance\\dimen2 by -\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\advance\\dimen3 by -\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\advance\\leftskip by -\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\advance\\leftskip by \\defbodyindent \\advance \\righ/
+bodyindent tex-src/texinfo.tex /^\\exdentamount=\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\newskip\\defbodyindent \\defbodyindent=.4in$/
+bool c.c 222
+bool merc-src/accumulator.m /^:- import_module bool.$/
+bool_header_size c-src/emacs/src/lisp.h 1472
+bool_vector_bitref c-src/emacs/src/lisp.h /^bool_vector_bitref (Lisp_Object a, EMACS_INT i)$/
+bool_vector_bytes c-src/emacs/src/lisp.h /^bool_vector_bytes (EMACS_INT size)$/
+bool_vector_data c-src/emacs/src/lisp.h /^bool_vector_data (Lisp_Object a)$/
+bool_vector_ref c-src/emacs/src/lisp.h /^bool_vector_ref (Lisp_Object a, EMACS_INT i)$/
+bool_vector_set c-src/emacs/src/lisp.h /^bool_vector_set (Lisp_Object a, EMACS_INT i, bool /
+bool_vector_size c-src/emacs/src/lisp.h /^bool_vector_size (Lisp_Object a)$/
+bool_vector_uchar_data c-src/emacs/src/lisp.h /^bool_vector_uchar_data (Lisp_Object a)$/
+bool_vector_words c-src/emacs/src/lisp.h /^bool_vector_words (EMACS_INT size)$/
+boolvar c-src/emacs/src/lisp.h 2287
+bracelev c-src/etags.c 2520
+bsp_DevId c-src/h.h 25
+bt c-src/emacs/src/lisp.h 2988
+btowc c-src/emacs/src/regex.h /^# define btowc(c) c$/
+buffer c-src/emacs/src/lisp.h 2000
+buffer c-src/emacs/src/regex.h 341
+buffer c-src/etags.c 238
+buffer c-src/h.h 119
+build prol-src/natded.prolog /^build([],Left,Left).$/
+build_pure_c_string c-src/emacs/src/lisp.h /^build_pure_c_string (const char *str)$/
+build_string c-src/emacs/src/lisp.h /^build_string (const char *str)$/
+buildact prol-src/natded.prolog /^buildact([SynIn],Right,RightPlus1):-$/
+builtin_lisp_symbol c-src/emacs/src/lisp.h /^builtin_lisp_symbol (int index)$/
+burst c-src/h.h 28
+busy c-src/emacs/src/gmalloc.c 158
+button_down_location c-src/emacs/src/keyboard.c 5210
+button_down_time c-src/emacs/src/keyboard.c 5218
+byte_stack c-src/emacs/src/lisp.h 3049
+bytecode_dest c-src/emacs/src/lisp.h 3037
+bytecode_top c-src/emacs/src/lisp.h 3036
+bytepos c-src/emacs/src/lisp.h 2016
+bytes_free c-src/emacs/src/gmalloc.c 314
+bytes_total c-src/emacs/src/gmalloc.c 310
+bytes_used c-src/emacs/src/gmalloc.c 312
+c c-src/h.h /^#define c() d$/
+c c-src/h.h 106
+c c.c 180
+c_ext c-src/etags.c 2271
+caccacacca c.c /^caccacacca (a,b,c,d,e,f,g)$/
+cacheLRUEntry_s c.c 172
+cacheLRUEntry_t c.c 177
+calculate_goal_info merc-src/accumulator.m /^:- pred calculate_goal_info(hlds_goal_expr::in, hl/
+calloc c-src/emacs/src/gmalloc.c /^calloc (size_t nmemb, size_t size)$/
+calloc c-src/emacs/src/gmalloc.c 1717
+calloc c-src/emacs/src/gmalloc.c 66
+calloc c-src/emacs/src/gmalloc.c 70
+can_be_null c-src/emacs/src/regex.h 370
+cancel_echoing c-src/emacs/src/keyboard.c /^cancel_echoing (void)$/
+canonicalize_filename c-src/etags.c /^canonicalize_filename (register char *fn)$/
+case_Lisp_Int c-src/emacs/src/lisp.h 438
+cat c-src/h.h 81
+cat cp-src/c.C 126
+cat cp-src/c.C 130
+cat prol-src/natded.prolog /^cat(A, Alpha@Beta, Ass3, Qs3, tree(fe,A:Alpha@Beta/
+cat_atoms prol-src/natded.prolog /^cat_atoms(A1,A2,A3):-$/
+cccccccccc c-src/h.h 115
+cdr c-src/emacs/src/lisp.h 1159
+cell y-src/parse.y 279
+cgrep html-src/software.html /^cgrep$/
+chain c-src/emacs/src/lisp.h 1162
+chain c-src/emacs/src/lisp.h 2206
+chain c-src/emacs/src/lisp.h 2396
+chain_subst merc-src/accumulator.m /^:- func chain_subst(accu_subst, accu_subst) = accu/
+chain_subst_2 merc-src/accumulator.m /^:- pred chain_subst_2(list(A)::in, map(A, B)::in, /
+char_bits c-src/emacs/src/lisp.h 2443
+char_table_specials c-src/emacs/src/lisp.h 1692
+charpos c-src/emacs/src/lisp.h 2011
+charset_unibyte c-src/emacs/src/regex.h 410
+chartonmstr pas-src/common.pas /^function chartonmstr; (*($/
+checkQuotation php-src/lce_functions.php /^ function checkQuotation($str)$/
+check_cons_list c-src/emacs/src/lisp.h /^# define check_cons_list() lisp_h_check_cons_list/
+checker make-src/Makefile /^checker:$/
+checkhdr c-src/emacs/src/gmalloc.c /^checkhdr (const struct hdr *hdr)$/
+checkiso html-src/software.html /^checkiso$/
+childDidExit objc-src/Subprocess.m /^- childDidExit$/
+chunks_free c-src/emacs/src/gmalloc.c 313
+chunks_used c-src/emacs/src/gmalloc.c 311
+cjava c-src/etags.c 2936
+class_method ruby-src/test.rb /^ def ClassExample.class_method$/
+classifyLine php-src/lce_functions.php /^ function classifyLine($line)$/
+clean make-src/Makefile /^clean:$/
+clear cp-src/conway.hpp /^ void clear(void) { alive = 0; }$/
+clear-abbrev-table c-src/abbrev.c /^DEFUN ("clear-abbrev-table", Fclear_abbrev_table, /
+clear-this-command-keys c-src/emacs/src/keyboard.c /^DEFUN ("clear-this-command-keys", Fclear_this_comm/
+clearAllKey objcpp-src/SimpleCalc.M /^- clearAllKey:sender$/
+clearKey objcpp-src/SimpleCalc.M /^- clearKey:sender$/
+clear_event c-src/emacs/src/keyboard.c /^clear_event (struct input_event *event)$/
+clear_input_pending c-src/emacs/src/keyboard.c /^clear_input_pending (void)$/
+clear_neighbors cp-src/clheir.cpp /^void discrete_location::clear_neighbors(void)$/
+clear_screen cp-src/screen.cpp /^void clear_screen(void)$/
+clear_waiting_for_input c-src/emacs/src/keyboard.c /^clear_waiting_for_input (void)$/
+cmd_error c-src/emacs/src/keyboard.c /^cmd_error (Lisp_Object data)$/
+cmd_error_internal c-src/emacs/src/keyboard.c /^cmd_error_internal (Lisp_Object data, const char */
+cmpfn c-src/emacs/src/lisp.h /^ bool (*cmpfn) (struct hash_table_test *t, Lisp_O/
+cmt prol-src/natded.prolog /^cmt:-$/
+cname c-src/etags.c 2519
+cno c-src/etags.c 224
+colori cp-src/c.C 40
+commaargvals prol-src/natded.prolog /^commaargvals(Args) -->$/
+command c-src/etags.c 187
+command-error-default-function c-src/emacs/src/keyboard.c /^DEFUN ("command-error-default-function", Fcommand_/
+command_loop c-src/emacs/src/keyboard.c /^command_loop (void)$/
+command_loop_1 c-src/emacs/src/keyboard.c /^command_loop_1 (void)$/
+command_loop_2 c-src/emacs/src/keyboard.c /^command_loop_2 (Lisp_Object ignore)$/
+command_loop_level c-src/emacs/src/keyboard.c 195
+comment php-src/lce_functions.php /^ function comment($line, $class)$/
+commutativity_assertion merc-src/accumulator.m /^:- pred commutativity_assertion(module_info::in,li/
+compile_empty prol-src/natded.prolog /^compile_empty:-$/
+compile_lex prol-src/natded.prolog /^compile_lex(File):-$/
+complete prol-src/natded.prolog /^complete(Cat):-$/
+complete-tag el-src/emacs/lisp/progmodes/etags.el /^(defun complete-tag ()$/
+compressor c-src/etags.c 188
+compressors c-src/etags.c 457
+compute_next_state cp-src/clheir.hpp /^ virtual void compute_next_state(void) { }$/
+compute_next_state cp-src/conway.hpp /^ void compute_next_state(void)$/
+conalgorithm html-src/algrthms.html /^Convolutionally$/
+concat c-src/etags.c /^concat (const char *s1, const char *s2, const char/
+concatenatenamestrings pas-src/common.pas /^function concatenatenamestrings; (*($/
+consider_token c-src/etags.c /^consider_token (char *str, int len, int c, int *c_/
+constant c-src/emacs/src/lisp.h 668
+constant c-src/h.h 29
+constant y-src/cccp.y 112
+constant_args c-src/h.h 27
+constype c-src/emacs/src/lisp.h 3739
+consult_lex prol-src/natded.prolog /^consult_lex:-$/
+contents c-src/emacs/src/lisp.h 1372
+contents c-src/emacs/src/lisp.h 1600
+contents c-src/emacs/src/lisp.h 1624
+count c-src/emacs/src/lisp.h 1863
+count_layers lua-src/allegro.lua /^local function count_layers (layer)$/
+count_words c-src/tab.c /^static int count_words(char *str, char delim)$/
+counter cp-src/c.C 33
+counter cp-src/c.C 36
+cow cp-src/c.C 127
+cow cp-src/c.C 131
+cplpl c-src/etags.c 2935
+create-bar forth-src/test-forth.fth /^: create-bar foo ;$/
+createPOEntries php-src/lce_functions.php /^ function createPOEntries()$/
+createWidgets pyt-src/server.py /^ def createWidgets(self):$/
+createWidgets pyt-src/server.py /^ def createWidgets(self, host):$/
+create_acc_call merc-src/accumulator.m /^:- func create_acc_call(hlds_goal::in(goal_plain_c/
+create_acc_goal merc-src/accumulator.m /^:- pred create_acc_goal(hlds_goal::in, accu_substs/
+create_new_base_goals merc-src/accumulator.m /^:- func create_new_base_goals(set(accu_goal_id), a/
+create_new_orig_recursive_goals merc-src/accumulator.m /^:- func create_new_orig_recursive_goals(set(accu_g/
+create_new_recursive_goals merc-src/accumulator.m /^:- func create_new_recursive_goals(set(accu_goal_i/
+create_new_var merc-src/accumulator.m /^:- pred create_new_var(prog_var::in, string::in, p/
+create_orig_goal merc-src/accumulator.m /^:- pred create_orig_goal(hlds_goal::in, accu_subst/
+cscInitTime cp-src/c.C 7
+cscSegmentationTime cp-src/c.C 8
+cstack c-src/etags.c 2523
+ctags make-src/Makefile /^ctags: etags.c ${OBJS}$/
+curlb c-src/etags.c 2929
+curlinepos c-src/etags.c 2931
+current-idle-time c-src/emacs/src/keyboard.c /^DEFUN ("current-idle-time", Fcurrent_idle_time, Sc/
+current-input-mode c-src/emacs/src/keyboard.c /^DEFUN ("current-input-mode", Fcurrent_input_mode, /
+current_kboard c-src/emacs/src/keyboard.c 85
+current_lb_is_new c-src/etags.c 2926
+curry-test scm-src/test.scm /^(define (((((curry-test a) b) c) d) e)$/
+cursor_position cp-src/screen.cpp /^void cursor_position(void)$/
+cursor_x cp-src/screen.cpp 15
+cursor_y cp-src/screen.cpp 15
+d c-src/emacs/src/lisp.h 4673
+d c-src/emacs/src/lisp.h 4679
+d c.c 180
+data c-src/emacs/src/lisp.h 1395
+data c-src/emacs/src/lisp.h 2129
+data c-src/emacs/src/lisp.h 2395
+ddefineseen c-src/etags.c 2462
+debian-bug html-src/software.html /^debian-bug.el$/
+debug_on_exit c-src/emacs/src/lisp.h 2984
+decimalKey objcpp-src/SimpleCalc.M /^- decimalKey:sender$/
+declared_special c-src/emacs/src/lisp.h 676
+decode_timer c-src/emacs/src/keyboard.c /^decode_timer (Lisp_Object timer, struct timespec */
+def c-src/h.h 35
+def c-src/h.h 38
+defalt c-src/emacs/src/lisp.h 1585
+default-tags-table-function el-src/emacs/lisp/progmodes/etags.el /^(defvar default-tags-table-function nil$/
+default_C_entries c-src/etags.c /^default_C_entries (FILE *inf)$/
+default_C_help c-src/etags.c 515
+default_C_help c-src/etags.c 523
+default_C_suffixes c-src/etags.c 512
+defcell c-src/emacs/src/lisp.h 2351
+define-abbrev c-src/abbrev.c /^DEFUN ("define-abbrev", Fdefine_abbrev, Sdefine_ab/
+define-abbrev-table c-src/abbrev.c /^DEFUN ("define-abbrev-table", Fdefine_abbrev_table/
+define-global-abbrev c-src/abbrev.c /^DEFUN ("define-global-abbrev", Fdefine_global_abbr/
+define-mode-abbrev c-src/abbrev.c /^DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, /
+defined_GC_CHECK_STRING_BYTES c-src/emacs/src/lisp.h 4663
+defined_GC_CHECK_STRING_BYTES c-src/emacs/src/lisp.h 4665
+definedef c-src/etags.c 2464
+defun_func1 c.c /^defun_func1()$/
+delegate objc-src/Subprocess.m /^- delegate$/
+deleteItem pyt-src/server.py /^ def deleteItem(self):$/
+delete_kboard c-src/emacs/src/keyboard.c /^delete_kboard (KBOARD *kb)$/
+deliver_input_available_signal c-src/emacs/src/keyboard.c /^deliver_input_available_signal (int sig)$/
+deliver_interrupt_signal c-src/emacs/src/keyboard.c /^deliver_interrupt_signal (int sig)$/
+deliver_user_signal c-src/emacs/src/keyboard.c /^deliver_user_signal (int sig)$/
+depth c-src/emacs/src/lisp.h 1618
+derived_analyses prol-src/natded.prolog /^derived_analyses([],[]).$/
+describe_abbrev c-src/abbrev.c /^describe_abbrev (sym, stream)$/
+detect_input_pending c-src/emacs/src/keyboard.c /^detect_input_pending (void)$/
+detect_input_pending_ignore_squeezables c-src/emacs/src/keyboard.c /^detect_input_pending_ignore_squeezables (void)$/
+detect_input_pending_run_timers c-src/emacs/src/keyboard.c /^detect_input_pending_run_timers (bool do_display)$/
+dialog_loop erl-src/gs_dialog.erl /^dialog_loop(Module, Window, Frame, Extra, Args) ->/
+dignorerest c-src/etags.c 2463
+discard-input c-src/emacs/src/keyboard.c /^DEFUN ("discard-input", Fdiscard_input, Sdiscard_i/
+discard_mouse_events c-src/emacs/src/keyboard.c /^discard_mouse_events (void)$/
+discrete_location cp-src/clheir.hpp /^ discrete_location(int xi, int yi, int zi):$/
+discrete_location cp-src/clheir.hpp 56
+display cp-src/conway.cpp /^void display(void)$/
+disposetextstring pas-src/common.pas /^procedure disposetextstring;(*($/
+dnone c-src/etags.c 2460
+doc c-src/emacs/src/lisp.h 1689
+dog c-src/h.h 81
+dog cp-src/c.C 126
+dog cp-src/c.C 130
+dotfill tex-src/texinfo.tex /^ \\null\\nobreak\\indexdotfill % Have leaders before/
+dotfill tex-src/texinfo.tex /^\\noindent\\hskip\\secondaryindent\\hbox{#1}\\indexdotf/
+double_click_count c-src/emacs/src/keyboard.c 5222
+drag_n_drop_syms c-src/emacs/src/keyboard.c 4629
+dribble c-src/emacs/src/keyboard.c 236
+dsharpseen c-src/etags.c 2461
+dummies tex-src/texinfo.tex /^{\\indexdummies % Must do this here, since \\bf, etc/
+dummy1 cp-src/burton.cpp /^::dummy::dummy test::dummy1(void)$/
+dummy2 cp-src/burton.cpp /^::dummy::dummy test::dummy2(::CORBA::Long dummy)$/
+dummy3 cp-src/burton.cpp /^::dummy::dummy test::dummy3(char* name, ::CORBA::L/
+dummydots tex-src/texinfo.tex /^\\let\\dots=\\indexdummydots$/
+dummyfont tex-src/texinfo.tex /^\\let\\b=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\code=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\emph=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\file=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\i=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\kbd=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\key=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\r=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\samp=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\sc=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\strong=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\t=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\tclose=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\var=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\w=\\indexdummyfont$/
+dummytex tex-src/texinfo.tex /^\\let\\TeX=\\indexdummytex$/
+dump pyt-src/server.py /^ def dump(self, folded):$/
+eabs c-src/emacs/src/lisp.h /^#define eabs(x) ((x) < 0 ? -(x) : (x))$/
+eassert c-src/emacs/src/lisp.h /^# define eassert(cond) \\$/
+eassert c-src/emacs/src/lisp.h /^# define eassert(cond) ((void) (false && (cond))) /
+eassume c-src/emacs/src/lisp.h /^# define eassume(cond) \\$/
+eassume c-src/emacs/src/lisp.h /^# define eassume(cond) assume (cond)$/
+eax c-src/sysdep.h 31
+eax c-src/sysdep.h 33
+echo_add_key c-src/emacs/src/keyboard.c /^echo_add_key (Lisp_Object c)$/
+echo_char c-src/emacs/src/keyboard.c /^echo_char (Lisp_Object c)$/
+echo_dash c-src/emacs/src/keyboard.c /^echo_dash (void)$/
+echo_kboard c-src/emacs/src/keyboard.c 166
+echo_keystrokes_p c-src/emacs/src/keyboard.c /^echo_keystrokes_p (void)$/
+echo_length c-src/emacs/src/keyboard.c /^echo_length (void)$/
+echo_message_buffer c-src/emacs/src/keyboard.c 171
+echo_now c-src/emacs/src/keyboard.c /^echo_now (void)$/
+echo_truncate c-src/emacs/src/keyboard.c /^echo_truncate (ptrdiff_t nchars)$/
+echoing c-src/emacs/src/keyboard.c 154
+editItem pyt-src/server.py /^ def editItem(self):$/
+editsite pyt-src/server.py /^ def editsite(self, site):$/
+edituser pyt-src/server.py /^ def edituser(self, user):$/
+egetenv c-src/emacs/src/lisp.h /^egetenv (const char *var)$/
+emacs_abort c-src/emacs/src/lisp.h /^extern _Noreturn void emacs_abort (void) NO_INLINE/
+end c-src/emacs/src/keyboard.c 8753
+end c-src/emacs/src/lisp.h 2039
+end c-src/emacs/src/regex.h 432
+endtoken c-src/etags.c /^#define endtoken(c) (_etk[CHAR (c)]) \/* c ends tok/
+enter_critical_section c-src/h.h 116
+entry perl-src/htlmify-cystic 218
+entry perl-src/htlmify-cystic 234
+entry perl-src/htlmify-cystic 245
+entry perl-src/htlmify-cystic 252
+entry perl-src/htlmify-cystic 268
+entry perl-src/htlmify-cystic 276
+entry perl-src/htlmify-cystic 281
+entry perl-src/htlmify-cystic 296
+equalsKey objcpp-src/SimpleCalc.M /^- equalsKey:sender$/
+erlang_atom c-src/etags.c /^erlang_atom (char *s)$/
+erlang_attribute c-src/etags.c /^erlang_attribute (char *s)$/
+erlang_func c-src/etags.c /^erlang_func (char *s, char *last)$/
+error c-src/emacs/src/lisp.h /^extern _Noreturn void error (const char *, ...) AT/
+error c-src/etags.c /^error (const char *format, ...)$/
+error c-src/etags.c /^static void error (const char *, ...) ATTRIBUTE_FO/
+error y-src/cccp.y /^error (msg)$/
+error_signaled c-src/etags.c 264
+etags el-src/emacs/lisp/progmodes/etags.el /^(defgroup etags nil "Tags tables."$/
+etags html-src/software.html /^Etags$/
+etags make-src/Makefile /^etags: etags.c ${OBJS}$/
+etags--xref-find-definitions el-src/emacs/lisp/progmodes/etags.el /^(defun etags--xref-find-definitions (pattern &opti/
+etags--xref-limit el-src/emacs/lisp/progmodes/etags.el /^(defconst etags--xref-limit 1000)$/
+etags-file-of-tag el-src/emacs/lisp/progmodes/etags.el /^(defun etags-file-of-tag (&optional relative) ; Do/
+etags-goto-tag-location el-src/emacs/lisp/progmodes/etags.el /^(defun etags-goto-tag-location (tag-info)$/
+etags-list-tags el-src/emacs/lisp/progmodes/etags.el /^(defun etags-list-tags (file) ; Doc string?$/
+etags-recognize-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun etags-recognize-tags-table ()$/
+etags-snarf-tag el-src/emacs/lisp/progmodes/etags.el /^(defun etags-snarf-tag (&optional use-explicit) ; /
+etags-tags-apropos el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-apropos (string) ; Doc string?$/
+etags-tags-apropos-additional el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-apropos-additional (regexp)$/
+etags-tags-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-completion-table () ; Doc string/
+etags-tags-included-tables el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-included-tables () ; Doc string?/
+etags-tags-table-files el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-table-files () ; Doc string?$/
+etags-verify-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun etags-verify-tags-table ()$/
+etags-xref-find el-src/emacs/lisp/progmodes/etags.el /^(defun etags-xref-find (action id)$/
+etags-xref-find-definitions-tag-order el-src/emacs/lisp/progmodes/etags.el /^(defvar etags-xref-find-definitions-tag-order '(ta/
+etags.1.man make-src/Makefile /^etags.1.man: etags.1$/
+etags_getcwd c-src/etags.c /^etags_getcwd (void)$/
+eval_dyn c-src/emacs/src/keyboard.c /^eval_dyn (Lisp_Object form)$/
+event-convert-list c-src/emacs/src/keyboard.c /^DEFUN ("event-convert-list", Fevent_convert_list, /
+event-symbol-parse-modifiers c-src/emacs/src/keyboard.c /^DEFUN ("internal-event-symbol-parse-modifiers", Fe/
+event_head c-src/emacs/src/keyboard.c 11021
+event_to_kboard c-src/emacs/src/keyboard.c /^event_to_kboard (struct input_event *event)$/
+exact c-src/emacs/src/gmalloc.c 200
+execute cp-src/c.C /^ void execute(CPluginCSCState& p, int w, in/
+exit c-src/exit.c /^DEFUN(exit, (status), int status)$/
+exit c-src/exit.strange_suffix /^DEFUN(exit, (status), int status)$/
+exit-recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("exit-recursive-edit", Fexit_recursive_edit/
+exit_critical_to_previous c-src/h.h 117
+exp y-src/atest.y 2
+exp y-src/cccp.y 156
+exp y-src/cccp.y 185
+exp y-src/parse.y 95
+exp1 y-src/cccp.y 148
+exp_list y-src/parse.y 263
+expand-abbrev c-src/abbrev.c /^DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_ab/
+expandmng prol-src/natded.prolog /^expandmng(var(V),var(V)).$/
+expandmng_tree prol-src/natded.prolog /^expandmng_tree(tree(Rule,Syn:Sem,Trees),$/
+expandmng_trees prol-src/natded.prolog /^expandmng_trees([],[]).$/
+expandsyn prol-src/natded.prolog /^expandsyn(Syn,Syn):-$/
+explicitly-quoted-pending-delete-mode el-src/TAGTEST.EL /^(defalias (quote explicitly-quoted-pending-delete-/
+expression_value y-src/cccp.y 68
+extras c-src/emacs/src/lisp.h 1603
+extvar c-src/h.h 109
+f c-src/c.c /^T f(){if(x){}$/
+f c-src/h.h 89
+f c.c /^int f$/
+f c.c 145
+f c.c 156
+f c.c 168
+f cp-src/c.C /^ void f() {}$/
+f cp-src/c.C /^ int f(){return 0;}; \/\/ first comment$/
+f cp-src/c.C /^A<float,B<int> > A<B<float>,int>::f(A<int>* x) {}$/
+f cp-src/c.C /^A<int>* f() {}$/
+f cp-src/c.C /^class B<int> { void f() {} };$/
+f cp-src/c.C /^int A<int>::f(A<int>* x) {}$/
+f cp-src/c.C /^int f(A<int> x) {}$/
+f cp-src/fail.C /^ int f() { return 5; }$/
+f cp-src/fail.C /^int A::B::f() { return 2; }$/
+f1 c.c /^ f1 () { \/* Do something. *\/; }$/
+f1 perl-src/kai-test.pl /^sub f1 {$/
+f2 c.c /^void f2 () { \/* Do something. *\/; }$/
+f2 perl-src/kai-test.pl /^sub main::f2 {$/
+f3 perl-src/kai-test.pl /^sub f3 {$/
+f4 perl-src/kai-test.pl /^sub Bar::f4 {$/
+f5 perl-src/kai-test.pl /^sub f5 {$/
+f6 perl-src/kai-test.pl /^sub f6 {$/
+f7 perl-src/kai-test.pl /^sub f7 {$/
+fast_string_match_ignore_case c-src/emacs/src/lisp.h /^fast_string_match_ignore_case (Lisp_Object regexp,/
+fastctags make-src/Makefile /^fastctags:$/
+fastetags make-src/Makefile /^fastetags:$/
+fastmap c-src/emacs/src/regex.h 355
+fastmap_accurate c-src/emacs/src/regex.h 383
+fatal c-src/etags.c /^fatal (const char *s1, const char *s2)$/
+fatala c.c /^void fatala () __attribute__ ((noreturn));$/
+fconst forth-src/test-forth.fth /^3.1415e fconstant fconst$/
+fdHandler objc-src/Subprocess.m /^- fdHandler:(int)theFd$/
+fdHandler objc-src/Subprocess.m /^fdHandler (int theFd, id self)$/
+fdefunkey c-src/etags.c 2409
+fdefunname c-src/etags.c 2410
+fdesc c-src/etags.c 201
+fdesc c-src/etags.c 212
+fdp c-src/etags.c 217
+ff cp-src/c.C /^ int ff(){return 1;};$/
+field_of_play cp-src/conway.cpp 18
+fignore c-src/etags.c 2416
+file-of-tag el-src/emacs/lisp/progmodes/etags.el /^(defun file-of-tag (&optional relative)$/
+file-of-tag-function el-src/emacs/lisp/progmodes/etags.el /^(defvar file-of-tag-function nil$/
+fileJoin php-src/lce_functions.php /^ function fileJoin()$/
+file_end perl-src/htlmify-cystic /^sub file_end ()$/
+file_index perl-src/htlmify-cystic 33
+file_tocs perl-src/htlmify-cystic 30
+filename_is_absolute c-src/etags.c /^filename_is_absolute (char *fn)$/
+filenames c-src/etags.c 196
+find-tag el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag (tagname &optional next-p regexp-p/
+find-tag-default-function el-src/emacs/lisp/progmodes/etags.el /^(defcustom find-tag-default-function nil$/
+find-tag-history el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-history nil) ; Doc string?$/
+find-tag-hook el-src/emacs/lisp/progmodes/etags.el /^(defcustom find-tag-hook nil$/
+find-tag-in-order el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-in-order (pattern$/
+find-tag-interactive el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-interactive (prompt &optional no-d/
+find-tag-marker-ring el-src/emacs/lisp/progmodes/etags.el /^(defvaralias 'find-tag-marker-ring 'xref--marker-r/
+find-tag-marker-ring-length el-src/emacs/lisp/progmodes/etags.el /^(define-obsolete-variable-alias 'find-tag-marker-r/
+find-tag-next-line-after-failure-p el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-next-line-after-failure-p nil$/
+find-tag-noselect el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-noselect (tagname &optional next-p/
+find-tag-other-frame el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-other-frame (tagname &optional nex/
+find-tag-other-window el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-other-window (tagname &optional ne/
+find-tag-regexp el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-regexp (regexp &optional next-p ot/
+find-tag-regexp-next-line-after-failure-p el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-regexp-next-line-after-failure-p /
+find-tag-regexp-search-function el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-regexp-search-function nil$/
+find-tag-regexp-tag-order el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-regexp-tag-order nil$/
+find-tag-search-function el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-search-function nil$/
+find-tag-tag el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-tag (string)$/
+find-tag-tag-order el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-tag-order nil$/
+find_entries c-src/etags.c /^find_entries (FILE *inf)$/
+find_user_signal_name c-src/emacs/src/keyboard.c /^find_user_signal_name (int sig)$/
+findcats prol-src/natded.prolog /^findcats([],Left,Left).$/
+finish_appendices perl-src/htlmify-cystic /^sub finish_appendices ()$/
+finish_sections perl-src/htlmify-cystic /^sub finish_sections ()$/
+finish_subsections perl-src/htlmify-cystic /^sub finish_subsections ()$/
+finish_subsubsections perl-src/htlmify-cystic /^sub finish_subsubsections ()$/
+finlist c-src/etags.c 2414
+first c-src/emacs/src/gmalloc.c 151
+fitchtreelist prol-src/natded.prolog /^fitchtreelist([]).$/
+fixup_locale c-src/emacs/src/lisp.h /^INLINE void fixup_locale (void) {}$/
+flag c-src/getopt.h 83
+flag2str pyt-src/server.py /^def flag2str(value, string):$/
+flistseen c-src/etags.c 2415
+fn c-src/exit.c /^ void EXFUN((*fn[1]), (NOARGS));$/
+fn c-src/exit.strange_suffix /^ void EXFUN((*fn[1]), (NOARGS));$/
+fnin y-src/parse.y 68
+focus_set pyt-src/server.py /^ def focus_set(self):$/
+follow_key c-src/emacs/src/keyboard.c /^follow_key (Lisp_Object keymap, Lisp_Object key)$/
+fonts tex-src/texinfo.tex /^\\obeyspaces \\obeylines \\ninett \\indexfonts \\rawbac/
+fonts\rm tex-src/texinfo.tex /^ \\indexfonts\\rm \\tolerance=9500 \\advance\\baseline/
+foo c-src/h.h 18
+foo c.c 150
+foo c.c 166
+foo c.c 167
+foo c.c 178
+foo c.c 189
+foo cp-src/c.C /^ foo() {$/
+foo cp-src/c.C 68
+foo cp-src/c.C 79
+foo cp-src/x.cc /^XX::foo()$/
+foo f-src/entry.for /^ character*(*) function foo()$/
+foo f-src/entry.strange /^ character*(*) function foo()$/
+foo f-src/entry.strange_suffix /^ character*(*) function foo()$/
+foo forth-src/test-forth.fth /^: foo (foo) ;$/
+foo php-src/ptest.php /^foo()$/
+foo ruby-src/test1.ru /^ attr_reader :foo$/
+foo! ruby-src/test1.ru /^ def foo!$/
+foo1 ruby-src/test1.ru /^ attr_reader(:foo1, :bar1, # comment$/
+foo2 ruby-src/test1.ru /^ alias_method ( :foo2, #cmmt$/
+foo==bar el-src/TAGTEST.EL /^(defun foo==bar () (message "hi")) ; Bug#5624$/
+foobar c-src/c.c /^int foobar() {;}$/
+foobar c.c /^extern void foobar (void) __attribute__ ((section /
+foobar2 c-src/h.h 20
+foobar2_ c-src/h.h 16
+foperator c-src/etags.c 2411
+force_auto_save_soon c-src/emacs/src/keyboard.c /^force_auto_save_soon (void)$/
+force_explicit_name c-src/etags.c 265
+force_quit_count c-src/emacs/src/keyboard.c 10387
+foreign_export merc-src/accumulator.m /^:- pragma foreign_export("C", unravel_univ(in, out/
+formatSize objc-src/PackInsp.m /^-(const char *)formatSize:(const char *)size inBuf/
+found c-src/emacs/src/lisp.h 2344
+fracas html-src/software.html /^Fracas$/
+frag c-src/emacs/src/gmalloc.c 152
+frame_local c-src/emacs/src/lisp.h 2341
+free c-src/emacs/src/gmalloc.c /^free (void *ptr)$/
+free c-src/emacs/src/gmalloc.c 166
+free c-src/emacs/src/gmalloc.c 1719
+free c-src/emacs/src/gmalloc.c 67
+free c-src/emacs/src/gmalloc.c 72
+free_fdesc c-src/etags.c /^free_fdesc (register fdesc *fdp)$/
+free_for prol-src/natded.prolog /^free_for(var(_),_,_).$/
+free_regexps c-src/etags.c /^free_regexps (void)$/
+free_tree c-src/etags.c /^free_tree (register node *np)$/
+free_var prol-src/natded.prolog /^free_var(var(V),var(V)).$/
+freehook c-src/emacs/src/gmalloc.c /^freehook (void *ptr)$/
+fresh_vars prol-src/natded.prolog /^fresh_vars(var(V),var(V)).$/
+fstartlist c-src/etags.c 2413
+func c-src/emacs/src/lisp.h /^ void (*func) (Lisp_Object);$/
+func c-src/emacs/src/lisp.h /^ void (*func) (int);$/
+func c-src/emacs/src/lisp.h /^ void (*func) (void *);$/
+func c-src/emacs/src/lisp.h /^ void (*func) (void);$/
+func1 c.c /^int func1$/
+func2 c.c /^int func2 (a,b$/
+func_key_syms c-src/emacs/src/keyboard.c 4626
+funcboo c.c /^bool funcboo ()$/
+funcpointer c-src/emacs/src/lisp.h 2126
+funcptr c-src/h.h /^ fu int (*funcptr) (void *ptr);$/
+function c-src/emacs/src/lisp.h 1685
+function c-src/emacs/src/lisp.h 2197
+function c-src/emacs/src/lisp.h 2985
+function c-src/emacs/src/lisp.h 694
+function c-src/etags.c 194
+functionp c-src/emacs/src/lisp.h /^functionp (Lisp_Object object)$/
+fval forth-src/test-forth.fth /^fconst fvalue fval$/
+fvar forth-src/test-forth.fth /^fvariable fvar$/
+fvdef c-src/etags.c 2418
+fvextern c-src/etags.c 2420
+fvnameseen c-src/etags.c 2412
+fvnone c-src/etags.c 2408
+fwd c-src/emacs/src/lisp.h 2346
+fwd c-src/emacs/src/lisp.h 690
+g cp-src/c.C /^ int g(){return 2;};$/
+galileo html-src/software.html /^GaliLEO$/
+gather pyt-src/server.py /^ def gather(self):$/
+gc_aset c-src/emacs/src/lisp.h /^gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Ob/
+gcmarkbit c-src/emacs/src/lisp.h 1974
+gcmarkbit c-src/emacs/src/lisp.h 1981
+gcmarkbit c-src/emacs/src/lisp.h 2035
+gcmarkbit c-src/emacs/src/lisp.h 2113
+gcmarkbit c-src/emacs/src/lisp.h 2204
+gcmarkbit c-src/emacs/src/lisp.h 656
+gcpro c-src/emacs/src/lisp.h 3042
+gcpro c-src/emacs/src/lisp.h 3132
+gen_help_event c-src/emacs/src/keyboard.c /^gen_help_event (Lisp_Object help, Lisp_Object fram/
+genalgorithm html-src/algrthms.html /^Generating the Data<\/font><\/i><\/b>$/
+generate_warning merc-src/accumulator.m /^:- pred generate_warning(module_info::in, prog_var/
+generate_warnings merc-src/accumulator.m /^:- pred generate_warnings(module_info::in, prog_va/
+generic_object cp-src/clheir.cpp /^generic_object::generic_object(void)$/
+generic_object cp-src/clheir.hpp 13
+getArchs objc-src/PackInsp.m /^-(void)getArchs$/
+getDomainNames php-src/lce_functions.php /^ function getDomainNames()$/
+getFoo lua-src/test.lua /^function Cube.data.getFoo ()$/
+getPOReader php-src/lce_functions.php /^ function &getPOReader($domain)$/
+getPath objc-src/PackInsp.m /^-(const char *)getPath:(char *)buf forType:(const /
+getPos lua-src/test.lua /^function Circle.getPos ()$/
+getPos lua-src/test.lua /^function Rectangle.getPos ()$/
+getTextDomains php-src/lce_functions.php /^ function getTextDomains($lines)$/
+get_compressor_from_suffix c-src/etags.c /^get_compressor_from_suffix (char *file, char **ext/
+get_contiguous_space c-src/emacs/src/gmalloc.c /^get_contiguous_space (ptrdiff_t size, void *positi/
+get_current_dir_name c-src/emacs/src/gmalloc.c 33
+get_input_pending c-src/emacs/src/keyboard.c /^get_input_pending (int flags)$/
+get_language_from_filename c-src/etags.c /^get_language_from_filename (char *file, int case_s/
+get_language_from_interpreter c-src/etags.c /^get_language_from_interpreter (char *interpreter)$/
+get_language_from_langname c-src/etags.c /^get_language_from_langname (const char *name)$/
+get_layer_by_name lua-src/allegro.lua /^local function get_layer_by_name (sprite, layer, n/
+get_tag c-src/etags.c /^get_tag (register char *bp, char **namepp)$/
+get_word c-src/tab.c /^static char *get_word(char **str, char delim)$/
+getcjmp c-src/emacs/src/keyboard.c 147
+getopt perl-src/yagrip.pl /^sub getopt {$/
+getopt.o make-src/Makefile /^getopt.o: emacs\/lib-src\/getopt.c$/
+getopt1.o make-src/Makefile /^getopt1.o: emacs\/lib-src\/getopt1.c$/
+getptys objc-src/Subprocess.m /^getptys (int *master, int *slave)$/
+gettext php-src/lce_functions.php /^ function gettext($msgid)$/
+ggg c-src/h.h 10
+ghi1 c-src/h.h 36
+ghi2 c-src/h.h 39
+giallo cp-src/c.C 40
+glider cp-src/conway.cpp /^void glider(int x, int y)$/
+gnu html-src/software.html /^Free software that I wrote for the GNU project or /
+gobble_input c-src/emacs/src/keyboard.c /^gobble_input (void)$/
+goto-tag-location-function el-src/emacs/lisp/progmodes/etags.el /^(defvar goto-tag-location-function nil$/
+goto_xy cp-src/screen.cpp /^void goto_xy(unsigned char x, unsigned char y)$/
+handleList pyt-src/server.py /^ def handleList(self, event):$/
+handleNew pyt-src/server.py /^ def handleNew(self, event):$/
+handle_async_input c-src/emacs/src/keyboard.c /^handle_async_input (void)$/
+handle_input_available_signal c-src/emacs/src/keyboard.c /^handle_input_available_signal (int sig)$/
+handle_interrupt c-src/emacs/src/keyboard.c /^handle_interrupt (bool in_signal_handler)$/
+handle_interrupt_signal c-src/emacs/src/keyboard.c /^handle_interrupt_signal (int sig)$/
+handle_user_signal c-src/emacs/src/keyboard.c /^handle_user_signal (int sig)$/
+handler c-src/emacs/src/lisp.h 3023
+handlertype c-src/emacs/src/lisp.h 3021
+has_arg c-src/getopt.h 82
+hash c-src/emacs/src/lisp.h 1843
+hash c-src/etags.c /^hash (const char *str, int len)$/
+hash_table_test c-src/emacs/src/lisp.h 1805
+hashfn c-src/emacs/src/lisp.h /^ EMACS_UINT (*hashfn) (struct hash_table_test *t,/
+hdr c-src/emacs/src/gmalloc.c 1860
+head_table c-src/emacs/src/keyboard.c 11027
+header c-src/emacs/src/lisp.h 1371
+header c-src/emacs/src/lisp.h 1388
+header c-src/emacs/src/lisp.h 1581
+header c-src/emacs/src/lisp.h 1610
+header c-src/emacs/src/lisp.h 1672
+header c-src/emacs/src/lisp.h 1826
+header_size c-src/emacs/src/lisp.h 1471
+heapsize c-src/emacs/src/gmalloc.c 361
+hello scm-src/test.scm /^(define hello "Hello, Emacs!")$/
+hello scm-src/test.scm /^(set! hello "Hello, world!")$/
+hello-world scm-src/test.scm /^(define (hello-world)$/
+help c-src/etags.c 193
+helpPanel objcpp-src/SimpleCalc.M /^- helpPanel:sender$/
+help_char_p c-src/emacs/src/keyboard.c /^help_char_p (Lisp_Object c)$/
+help_form_saved_window_configs c-src/emacs/src/keyboard.c 2156
+helpwin pyt-src/server.py /^def helpwin(helpdict):$/
+hide_cursor cp-src/screen.cpp /^void hide_cursor(void)$/
+hlds merc-src/accumulator.m /^:- import_module hlds.$/
+htmltreelist prol-src/natded.prolog /^htmltreelist([]).$/
+hybrid_aligned_alloc c-src/emacs/src/gmalloc.c /^hybrid_aligned_alloc (size_t alignment, size_t siz/
+hybrid_calloc c-src/emacs/src/gmalloc.c /^hybrid_calloc (size_t nmemb, size_t size)$/
+hybrid_free c-src/emacs/src/gmalloc.c /^hybrid_free (void *ptr)$/
+hybrid_get_current_dir_name c-src/emacs/src/gmalloc.c /^hybrid_get_current_dir_name (void)$/
+hybrid_malloc c-src/emacs/src/gmalloc.c /^hybrid_malloc (size_t size)$/
+hybrid_realloc c-src/emacs/src/gmalloc.c /^hybrid_realloc (void *ptr, size_t size)$/
+hypothetical_mem prol-src/natded.prolog /^hypothetical_mem(fi(N),Ass,_):-$/
+i c-src/c.c 2
+i c-src/emacs/src/lisp.h 4673
+i c-src/emacs/src/lisp.h 4679
+i c-src/emacs/src/lisp.h 567
+i c.c 169
+i cp-src/c.C 132
+ialpage tex-src/texinfo.tex /^ \\dimen@=\\pageheight \\advance\\dimen@ by-\\ht\\pa/
+ialpage tex-src/texinfo.tex /^ \\availdimen@=\\pageheight \\advance\\availdimen@ by/
+ialpage tex-src/texinfo.tex /^ \\dimen@=\\pageheight \\advance\\dimen@ by-\\ht\\parti/
+ialpage tex-src/texinfo.tex /^\\newbox\\partialpage$/
+ialpage= tex-src/texinfo.tex /^ \\output={\\global\\setbox\\partialpage=$/
+identify_goal_type merc-src/accumulator.m /^:- pred identify_goal_type(pred_id::in, proc_id::i/
+identify_out_and_out_prime merc-src/accumulator.m /^:- pred identify_out_and_out_prime(module_info::in/
+identify_recursive_calls merc-src/accumulator.m /^:- pred identify_recursive_calls(pred_id::in, proc/
+idx c-src/emacs/src/lisp.h 3150
+ignore_case c-src/etags.c 266
+ignore_mouse_drag_p c-src/emacs/src/keyboard.c 1256
+ill=\relax tex-src/texinfo.tex /^\\let\\refill=\\relax$/
+immediate_quit c-src/emacs/src/keyboard.c 174
+impatto html-src/softwarelibero.html /^Impatto pratico del software libero$/
+implementation merc-src/accumulator.m /^:- implementation.$/
+in_word_set c-src/etags.c /^in_word_set (register const char *str, register un/
+inattribute c-src/etags.c 2400
+inc cp-src/Range.h /^ double inc (void) const { return rng_inc; }$/
+index c-src/emacs/src/lisp.h 1856
+infabsdir c-src/etags.c 206
+infabsname c-src/etags.c 205
+infiles make-src/Makefile /^infiles = $(filter-out ${NONSRCS},${SRCS}) srclist/
+infname c-src/etags.c 204
+info c-src/emacs/src/gmalloc.c 157
+infoPanel objcpp-src/SimpleCalc.M /^- infoPanel:sender$/
+init c-src/etags.c /^init (void)$/
+init objc-src/Subprocess.m /^ andStdErr:(BOOL)wantsStdErr$/
+init objc-src/Subprocess.m /^- init:(const char *)subprocessString$/
+init objcpp-src/SimpleCalc.M /^- init$/
+init_control c.c 239
+init_kboard c-src/emacs/src/keyboard.c /^init_kboard (KBOARD *kb, Lisp_Object type)$/
+init_keyboard c-src/emacs/src/keyboard.c /^init_keyboard (void)$/
+init_registry cp-src/clheir.cpp /^void init_registry(void)$/
+init_tool_bar_items c-src/emacs/src/keyboard.c /^init_tool_bar_items (Lisp_Object reuse)$/
+inita c.c /^static void inita () {}$/
+initb c.c /^static void initb () {}$/
+initial_kboard c-src/emacs/src/keyboard.c 84
+initialize-new-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun initialize-new-tags-table ()$/
+initialize_goal_store merc-src/accumulator.m /^:- func initialize_goal_store(list(hlds_goal), ins/
+initialize_random_junk y-src/cccp.y /^initialize_random_junk ()$/
+input-pending-p c-src/emacs/src/keyboard.c /^DEFUN ("input-pending-p", Finput_pending_p, Sinput/
+input_available_clear_time c-src/emacs/src/keyboard.c 324
+input_pending c-src/emacs/src/keyboard.c 239
+input_polling_used c-src/emacs/src/keyboard.c /^input_polling_used (void)$/
+input_was_pending c-src/emacs/src/keyboard.c 287
+insert-abbrev-table-description c-src/abbrev.c /^DEFUN ("insert-abbrev-table-description", Finsert_/
+insertion_type c-src/emacs/src/lisp.h 1989
+insertname pas-src/common.pas /^function insertname;(*($/
+instance_method ruby-src/test.rb /^ def instance_method$/
+instance_method_equals= ruby-src/test.rb /^ def instance_method_equals=$/
+instance_method_exclamation! ruby-src/test.rb /^ def instance_method_exclamation!$/
+instance_method_question? ruby-src/test.rb /^ def instance_method_question?$/
+instr y-src/parse.y 81
+instruct c-src/etags.c 2527
+int merc-src/accumulator.m /^:- import_module int.$/
+intNumber go-src/test1.go 13
+integer c-src/emacs/src/lisp.h 2127
+integer y-src/cccp.y 112
+integer_overflow y-src/cccp.y /^integer_overflow ()$/
+integertonmstr pas-src/common.pas /^function integertonmstr; (* (TheInteger : integer)/
+intensity1 f-src/entry.for /^ & intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1 f-src/entry.strange /^ & intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1 f-src/entry.strange_suffix /^ & intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+interface merc-src/accumulator.m /^:- interface.$/
+interface_locate c-src/c.c /^interface_locate(void)$/
+intern c-src/emacs/src/lisp.h /^intern (const char *str)$/
+intern_c_string c-src/emacs/src/lisp.h /^intern_c_string (const char *str)$/
+internal_last_event_frame c-src/emacs/src/keyboard.c 228
+interned c-src/emacs/src/lisp.h 672
+interpreters c-src/etags.c 197
+interrupt_input c-src/emacs/src/keyboard.c 328
+interrupt_input_blocked c-src/emacs/src/keyboard.c 76
+interrupt_input_blocked c-src/emacs/src/lisp.h 3048
+interrupts_deferred c-src/emacs/src/keyboard.c 331
+intoken c-src/etags.c /^#define intoken(c) (_itk[CHAR (c)]) \/* c can be in/
+intspec c-src/emacs/src/lisp.h 1688
+intvar c-src/emacs/src/lisp.h 2277
+invalidate_nodes c-src/etags.c /^invalidate_nodes (fdesc *badfdp, node **npp)$/
+io merc-src/accumulator.m /^:- import_module io.$/
+ipc3dCSC19 cp-src/c.C 6
+ipc3dChannelType cp-src/c.C 1
+ipc3dIslandHierarchy cp-src/c.C 1
+ipc3dLinkControl cp-src/c.C 1
+irregular_location cp-src/clheir.hpp /^ irregular_location(double xi, double yi, doubl/
+irregular_location cp-src/clheir.hpp 47
+isComment php-src/lce_functions.php /^ function isComment($class)$/
+isHoliday cp-src/functions.cpp /^bool isHoliday ( Date d ){$/
+isLeap cp-src/functions.cpp /^bool isLeap ( int year ){$/
+is_associative_construction merc-src/accumulator.m /^:- pred is_associative_construction(module_info::i/
+is_curly_brace_form c-src/h.h 54
+is_explicit c-src/h.h 49
+is_func c-src/etags.c 221
+is_hor_space y-src/cccp.y 953
+is_idchar y-src/cccp.y 948
+is_idstart y-src/cccp.y 950
+is_muldiv_operation cp-src/c.C /^is_muldiv_operation(pc)$/
+is_ordset prol-src/ordsets.prolog /^is_ordset(X) :- var(X), !, fail.$/
+is_recursive_case merc-src/accumulator.m /^:- pred is_recursive_case(list(hlds_goal)::in, pre/
+iso_lispy_function_keys c-src/emacs/src/keyboard.c 5151
+isoperator prol-src/natded.prolog /^isoperator(Char):-$/
+isoptab prol-src/natded.prolog /^isoptab('%').$/
+iswhite c-src/etags.c /^#define iswhite(c) (_wht[CHAR (c)]) \/* c is white /
+item_properties c-src/emacs/src/keyboard.c 7568
+jmp c-src/emacs/src/lisp.h 3044
+just_read_file c-src/etags.c /^just_read_file (FILE *inf)$/
+kbd_buffer c-src/emacs/src/keyboard.c 291
+kbd_buffer_events_waiting c-src/emacs/src/keyboard.c /^kbd_buffer_events_waiting (void)$/
+kbd_buffer_get_event c-src/emacs/src/keyboard.c /^kbd_buffer_get_event (KBOARD **kbp,$/
+kbd_buffer_nr_stored c-src/emacs/src/keyboard.c /^kbd_buffer_nr_stored (void)$/
+kbd_buffer_store_event c-src/emacs/src/keyboard.c /^kbd_buffer_store_event (register struct input_even/
+kbd_buffer_store_event_hold c-src/emacs/src/keyboard.c /^kbd_buffer_store_event_hold (register struct input/
+kbd_buffer_store_help_event c-src/emacs/src/keyboard.c /^kbd_buffer_store_help_event (Lisp_Object frame, Li/
+kbd_buffer_unget_event c-src/emacs/src/keyboard.c /^kbd_buffer_unget_event (register struct input_even/
+kbd_fetch_ptr c-src/emacs/src/keyboard.c 297
+kbd_store_ptr c-src/emacs/src/keyboard.c 302
+kboard c-src/emacs/src/keyboard.c 860
+kboard_stack c-src/emacs/src/keyboard.c 858
+kboard_stack c-src/emacs/src/keyboard.c 864
+key_and_value c-src/emacs/src/lisp.h 1868
+keyremap c-src/emacs/src/keyboard.c 8742
+keyremap c-src/emacs/src/keyboard.c 8754
+keyremap_step c-src/emacs/src/keyboard.c /^keyremap_step (Lisp_Object *keybuf, int bufsize, v/
+keys_of_keyboard c-src/emacs/src/keyboard.c /^keys_of_keyboard (void)$/
+keyval prol-src/natded.prolog /^keyval(key(Key,Val)) --> [Key,'='], valseq(Val).$/
+keyvalcgi prol-src/natded.prolog /^keyvalcgi(Key,Val):-$/
+keyvalscgi prol-src/natded.prolog /^keyvalscgi(KeyVals),$/
+keyvalseq prol-src/natded.prolog /^keyvalseq([KeyVal|KeyVals]) --> $/
+keyword_parsing y-src/cccp.y 73
+keywords y-src/cccp.y 114
+keywords y-src/cccp.y 306
+kind c-src/emacs/src/keyboard.c 11024
+kind c-src/h.h 46
+kset_echo_string c-src/emacs/src/keyboard.c /^kset_echo_string (struct kboard *kb, Lisp_Object v/
+kset_kbd_queue c-src/emacs/src/keyboard.c /^kset_kbd_queue (struct kboard *kb, Lisp_Object val/
+kset_keyboard_translate_table c-src/emacs/src/keyboard.c /^kset_keyboard_translate_table (struct kboard *kb, /
+kset_last_prefix_arg c-src/emacs/src/keyboard.c /^kset_last_prefix_arg (struct kboard *kb, Lisp_Obje/
+kset_last_repeatable_command c-src/emacs/src/keyboard.c /^kset_last_repeatable_command (struct kboard *kb, L/
+kset_local_function_key_map c-src/emacs/src/keyboard.c /^kset_local_function_key_map (struct kboard *kb, Li/
+kset_overriding_terminal_local_map c-src/emacs/src/keyboard.c /^kset_overriding_terminal_local_map (struct kboard /
+kset_real_last_command c-src/emacs/src/keyboard.c /^kset_real_last_command (struct kboard *kb, Lisp_Ob/
+kset_system_key_syms c-src/emacs/src/keyboard.c /^kset_system_key_syms (struct kboard *kb, Lisp_Obje/
+lang c-src/etags.c 208
+lang c-src/etags.c 251
+lang c-src/etags.c 259
+lang_names c-src/etags.c 718
+language c-src/etags.c 199
+last-tag el-src/emacs/lisp/progmodes/etags.el /^(defvar last-tag nil$/
+last_abbrev_point c-src/abbrev.c 79
+last_auto_save c-src/emacs/src/keyboard.c 214
+last_heapinfo c-src/emacs/src/gmalloc.c 402
+last_mouse_button c-src/emacs/src/keyboard.c 5215
+last_mouse_x c-src/emacs/src/keyboard.c 5216
+last_mouse_y c-src/emacs/src/keyboard.c 5217
+last_non_minibuf_size c-src/emacs/src/keyboard.c 207
+last_point_position c-src/emacs/src/keyboard.c 217
+last_state_size c-src/emacs/src/gmalloc.c 401
+last_undo_boundary c-src/emacs/src/keyboard.c 1287
+lasta c.c 272
+lastargmargin tex-src/texinfo.tex /^\\newskip\\deflastargmargin \\deflastargmargin=18pt$/
+lastargmargin tex-src/texinfo.tex /^\\setbox0=\\hbox{\\hskip \\deflastargmargin{\\rm #2}\\hs/
+lastb c.c 278
+lb c-src/etags.c 2923
+lbs c-src/etags.c 2924
+lce php-src/lce_functions.php /^ function lce()$/
+lce_bindtextdomain php-src/lce_functions.php /^ function lce_bindtextdomain($d_name, $d_path/
+lce_bindtextdomain php-src/lce_functions.php /^ function lce_bindtextdomain($domain, $path)$/
+lce_dgettext php-src/lce_functions.php /^ function lce_dgettext($domain, $msgid)$/
+lce_geteditcode php-src/lce_functions.php /^ function lce_geteditcode($type, $name, $text, $r/
+lce_gettext php-src/lce_functions.php /^ function lce_gettext($msgid)$/
+lce_textdomain php-src/lce_functions.php /^ function lce_textdomain($domain)$/
+leasqr html-src/software.html /^Leasqr$/
+left c-src/etags.c 216
+left_shift y-src/cccp.y /^left_shift (a, b)$/
+len c-src/etags.c 237
+length c-src/etags.c 2495
+length y-src/cccp.y 113
+length y-src/cccp.y 44
+let c-src/emacs/src/lisp.h 2981
+letter tex-src/texinfo.tex /^ {#1}{Appendix \\appendixletter}{\\noexpand\\folio}}/
+letter tex-src/texinfo.tex /^ {\\appendixletter}$/
+letter tex-src/texinfo.tex /^ {\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\th/
+letter tex-src/texinfo.tex /^\\chapmacro {#1}{Appendix \\appendixletter}%$/
+letter tex-src/texinfo.tex /^\\gdef\\thissection{#1}\\secheading {#1}{\\appendixlet/
+letter tex-src/texinfo.tex /^\\subsecheading {#1}{\\appendixletter}{\\the\\secno}{\\/
+letter tex-src/texinfo.tex /^{#1}{\\appendixletter}{\\the\\secno}{\\noexpand\\folio}/
+letter tex-src/texinfo.tex /^{#1}{\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\/
+letter: tex-src/texinfo.tex /^\\xdef\\thischapter{Appendix \\appendixletter: \\noexp/
+level c-src/emacs/src/lisp.h 3153
+lex prol-src/natded.prolog /^lex(W,SynOut,Sem):-$/
+lexptr y-src/cccp.y 332
+libs merc-src/accumulator.m /^:- import_module libs.$/
+licenze html-src/softwarelibero.html /^Licenze d'uso di un programma$/
+limit cp-src/Range.h /^ double limit (void) const { return rng_limit; }$/
+line c-src/etags.c 2493
+line perl-src/htlmify-cystic 37
+line y-src/parse.y 87
+lineCount php-src/lce_functions.php /^ function lineCount($entry)$/
+linebuffer c-src/etags.c 239
+linebuffer_init c-src/etags.c /^linebuffer_init (linebuffer *lbp)$/
+linebuffer_setlen c-src/etags.c /^linebuffer_setlen (linebuffer *lbp, int toksize)$/
+lineno c-src/emacs/src/lisp.h 3147
+lineno c-src/etags.c 2506
+linepos c-src/etags.c 2507
+linepos c-src/etags.c 2922
+links html-src/software.html /^Links to interesting software$/
+lisp_eval_depth c-src/emacs/src/lisp.h 3045
+lisp_h_CHECK_LIST_CONS c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (C/
+lisp_h_CHECK_NUMBER c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGER/
+lisp_h_CHECK_SYMBOL c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP/
+lisp_h_CHECK_TYPE c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_TYPE(ok, predicate, x) \\$/
+lisp_h_CONSP c-src/emacs/src/lisp.h /^#define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons)$/
+lisp_h_EQ c-src/emacs/src/lisp.h /^#define lisp_h_EQ(x, y) (XLI (x) == XLI (y))$/
+lisp_h_FLOATP c-src/emacs/src/lisp.h /^#define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float)/
+lisp_h_INTEGERP c-src/emacs/src/lisp.h /^#define lisp_h_INTEGERP(x) ((XTYPE (x) & (Lisp_Int/
+lisp_h_MARKERP c-src/emacs/src/lisp.h /^#define lisp_h_MARKERP(x) (MISCP (x) && XMISCTYPE /
+lisp_h_MISCP c-src/emacs/src/lisp.h /^#define lisp_h_MISCP(x) (XTYPE (x) == Lisp_Misc)$/
+lisp_h_NILP c-src/emacs/src/lisp.h /^#define lisp_h_NILP(x) EQ (x, Qnil)$/
+lisp_h_SET_SYMBOL_VAL c-src/emacs/src/lisp.h /^#define lisp_h_SET_SYMBOL_VAL(sym, v) \\$/
+lisp_h_SYMBOLP c-src/emacs/src/lisp.h /^#define lisp_h_SYMBOLP(x) (XTYPE (x) == Lisp_Symbo/
+lisp_h_SYMBOL_CONSTANT_P c-src/emacs/src/lisp.h /^#define lisp_h_SYMBOL_CONSTANT_P(sym) (XSYMBOL (sy/
+lisp_h_SYMBOL_VAL c-src/emacs/src/lisp.h /^#define lisp_h_SYMBOL_VAL(sym) \\$/
+lisp_h_VECTORLIKEP c-src/emacs/src/lisp.h /^#define lisp_h_VECTORLIKEP(x) (XTYPE (x) == Lisp_V/
+lisp_h_XCAR c-src/emacs/src/lisp.h /^#define lisp_h_XCAR(c) XCONS (c)->car$/
+lisp_h_XCDR c-src/emacs/src/lisp.h /^#define lisp_h_XCDR(c) XCONS (c)->u.cdr$/
+lisp_h_XCONS c-src/emacs/src/lisp.h /^#define lisp_h_XCONS(a) \\$/
+lisp_h_XFASTINT c-src/emacs/src/lisp.h /^# define lisp_h_XFASTINT(a) XINT (a)$/
+lisp_h_XHASH c-src/emacs/src/lisp.h /^#define lisp_h_XHASH(a) XUINT (a)$/
+lisp_h_XIL c-src/emacs/src/lisp.h /^# define lisp_h_XIL(i) ((Lisp_Object) { i })$/
+lisp_h_XIL c-src/emacs/src/lisp.h /^# define lisp_h_XIL(i) (i)$/
+lisp_h_XINT c-src/emacs/src/lisp.h /^# define lisp_h_XINT(a) (XLI (a) >> INTTYPEBITS)$/
+lisp_h_XLI c-src/emacs/src/lisp.h /^# define lisp_h_XLI(o) ((o).i)$/
+lisp_h_XLI c-src/emacs/src/lisp.h /^# define lisp_h_XLI(o) (o)$/
+lisp_h_XPNTR c-src/emacs/src/lisp.h /^#define lisp_h_XPNTR(a) \\$/
+lisp_h_XSYMBOL c-src/emacs/src/lisp.h /^# define lisp_h_XSYMBOL(a) \\$/
+lisp_h_XTYPE c-src/emacs/src/lisp.h /^# define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a/
+lisp_h_XUNTAG c-src/emacs/src/lisp.h /^# define lisp_h_XUNTAG(a, type) ((void *) (intptr_/
+lisp_h_check_cons_list c-src/emacs/src/lisp.h /^# define lisp_h_check_cons_list() ((void) 0)$/
+lisp_h_make_number c-src/emacs/src/lisp.h /^# define lisp_h_make_number(n) \\$/
+lispy_accent_codes c-src/emacs/src/keyboard.c 4634
+lispy_accent_keys c-src/emacs/src/keyboard.c 4741
+lispy_drag_n_drop_names c-src/emacs/src/keyboard.c 5181
+lispy_function_keys c-src/emacs/src/keyboard.c 4768
+lispy_function_keys c-src/emacs/src/keyboard.c 5065
+lispy_kana_keys c-src/emacs/src/keyboard.c 5026
+lispy_modifier_list c-src/emacs/src/keyboard.c /^lispy_modifier_list (int modifiers)$/
+lispy_multimedia_keys c-src/emacs/src/keyboard.c 4962
+lispy_wheel_names c-src/emacs/src/keyboard.c 5174
+list c-src/emacs/src/gmalloc.c 186
+list merc-src/accumulator.m /^:- import_module list.$/
+list-tags el-src/emacs/lisp/progmodes/etags.el /^(defun list-tags (file &optional _next-match)$/
+list-tags-function el-src/emacs/lisp/progmodes/etags.el /^(defvar list-tags-function nil$/
+list2i c-src/emacs/src/lisp.h /^list2i (EMACS_INT x, EMACS_INT y)$/
+list3i c-src/emacs/src/lisp.h /^list3i (EMACS_INT x, EMACS_INT y, EMACS_INT w)$/
+list4i c-src/emacs/src/lisp.h /^list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMA/
+list_to_ord_set prol-src/ordsets.prolog /^list_to_ord_set(List, Set) :-$/
+lno c-src/etags.c 223
+load objc-src/PackInsp.m /^-load$/
+loadContentsOf objc-src/PackInsp.m /^-loadContentsOf:(const char *)type inTable:(HashTa/
+loadImage objc-src/PackInsp.m /^-loadImage$/
+loadKeyValuesFrom objc-src/PackInsp.m /^-loadKeyValuesFrom:(const char *)type inTable:(Has/
+loadPORManager php-src/lce_functions.php /^ function &loadPORManager()$/
+local_if_set c-src/emacs/src/lisp.h 2338
+location cp-src/clheir.hpp /^ location() { }$/
+location cp-src/clheir.hpp 33
+lookup y-src/cccp.y /^lookup (name, len, hash)$/
+lookup_call merc-src/accumulator.m /^:- pred lookup_call(accu_goal_store::in, accu_goal/
+lowcase c-src/etags.c /^#define lowcase(c) tolower (CHAR (c))$/
+lucid_event_type_list_p c-src/emacs/src/keyboard.c /^lucid_event_type_list_p (Lisp_Object object)$/
+mabort c-src/emacs/src/gmalloc.c /^mabort (enum mcheck_status status)$/
+mach_host_self c-src/machsyscalls.h /^SYSCALL (mach_host_self, -29,$/
+mach_msg_trap c-src/machsyscalls.h /^SYSCALL (mach_msg_trap, -25,$/
+mach_reply_port c-src/machsyscalls.h /^SYSCALL (mach_reply_port, -26,$/
+mach_task_self c-src/machsyscalls.h /^SYSCALL (mach_task_self, -28,$/
+mach_thread_self c-src/machsyscalls.h /^SYSCALL (mach_thread_self, -27,$/
+magic c-src/emacs/src/gmalloc.c 1863
+maintaining.info make-src/Makefile /^maintaining.info: maintaining.texi$/
+make-abbrev-table c-src/abbrev.c /^DEFUN ("make-abbrev-table", Fmake_abbrev_table, Sm/
+make_C_tag c-src/etags.c /^make_C_tag (bool isfun)$/
+make_coor prol-src/natded.prolog /^make_coor(s(_),Alpha,Sem1,Sem2,Alpha@Sem1@Sem2).$/
+make_ctrl_char c-src/emacs/src/keyboard.c /^make_ctrl_char (int c)$/
+make_fixnum_or_float c-src/emacs/src/lisp.h /^#define make_fixnum_or_float(val) \\$/
+make_formatted_string c-src/emacs/src/lisp.h /^extern Lisp_Object make_formatted_string (char *, /
+make_lisp_ptr c-src/emacs/src/lisp.h /^make_lisp_ptr (void *ptr, enum Lisp_Type type)$/
+make_lisp_symbol c-src/emacs/src/lisp.h /^make_lisp_symbol (struct Lisp_Symbol *sym)$/
+make_lispy_event c-src/emacs/src/keyboard.c /^make_lispy_event (struct input_event *event)$/
+make_lispy_focus_in c-src/emacs/src/keyboard.c /^make_lispy_focus_in (Lisp_Object frame)$/
+make_lispy_focus_out c-src/emacs/src/keyboard.c /^make_lispy_focus_out (Lisp_Object frame)$/
+make_lispy_movement c-src/emacs/src/keyboard.c /^make_lispy_movement (struct frame *frame, Lisp_Obj/
+make_lispy_position c-src/emacs/src/keyboard.c /^make_lispy_position (struct frame *f, Lisp_Object /
+make_lispy_switch_frame c-src/emacs/src/keyboard.c /^make_lispy_switch_frame (Lisp_Object frame)$/
+make_number c-src/emacs/src/lisp.h /^# define make_number(n) lisp_h_make_number (n)$/
+make_pointer_integer c-src/emacs/src/lisp.h /^make_pointer_integer (void *p)$/
+make_scroll_bar_position c-src/emacs/src/keyboard.c /^make_scroll_bar_position (struct input_event *ev, /
+make_tag c-src/etags.c /^make_tag (const char *name, \/* tag name, or NULL /
+make_uninit_sub_char_table c-src/emacs/src/lisp.h /^make_uninit_sub_char_table (int depth, int min_cha/
+make_uninit_vector c-src/emacs/src/lisp.h /^make_uninit_vector (ptrdiff_t size)$/
+malloc c-src/emacs/src/gmalloc.c /^extern void *malloc (size_t size) ATTRIBUTE_MALLOC/
+malloc c-src/emacs/src/gmalloc.c /^malloc (size_t size)$/
+malloc c-src/emacs/src/gmalloc.c 1715
+malloc c-src/emacs/src/gmalloc.c 64
+malloc c-src/emacs/src/gmalloc.c 68
+malloc_atfork_handler_child c-src/emacs/src/gmalloc.c /^malloc_atfork_handler_child (void)$/
+malloc_atfork_handler_parent c-src/emacs/src/gmalloc.c /^malloc_atfork_handler_parent (void)$/
+malloc_atfork_handler_prepare c-src/emacs/src/gmalloc.c /^malloc_atfork_handler_prepare (void)$/
+malloc_enable_thread c-src/emacs/src/gmalloc.c /^malloc_enable_thread (void)$/
+malloc_info c-src/emacs/src/gmalloc.c 167
+malloc_initialize_1 c-src/emacs/src/gmalloc.c /^malloc_initialize_1 (void)$/
+mallochook c-src/emacs/src/gmalloc.c /^mallochook (size_t size)$/
+man manpage make-src/Makefile /^man manpage: etags.1.man$/
+mao c-src/h.h 101
+map c-src/emacs/src/keyboard.c 8748
+map merc-src/accumulator.m /^:- import_module map.$/
+map_word prol-src/natded.prolog /^map_word([[_]|Ws],Exp):-$/
+mapping html-src/algrthms.html /^Mapping the Channel Symbols$/
+mapsyn prol-src/natded.prolog /^mapsyn(A\/B,AM\/BM):-$/
+mark_kboards c-src/emacs/src/keyboard.c /^mark_kboards (void)$/
+max c-src/emacs/src/lisp.h /^#define max(a, b) ((a) > (b) ? (a) : (b))$/
+max c-src/emacs/src/lisp.h 58
+max c.c /^__attribute__ ((always_inline)) max (int a, int b)/
+max c.c /^max (int a, int b)$/
+max cp-src/conway.cpp /^#define max(x,y) ((x > y) ? x : y)$/
+max_args c-src/emacs/src/lisp.h 1686
+max_num_directions cp-src/clheir.hpp 31
+max_num_generic_objects cp-src/clheir.cpp 9
+maxargs c-src/emacs/src/lisp.h 2831
+maybe merc-src/accumulator.m /^:- import_module maybe.$/
+maybe_gc c-src/emacs/src/lisp.h /^maybe_gc (void)$/
+mcCSC cp-src/c.C 6
+mcheck c-src/emacs/src/gmalloc.c /^mcheck (void (*func) (enum mcheck_status))$/
+mcheck_status c-src/emacs/src/gmalloc.c 283
+mcheck_used c-src/emacs/src/gmalloc.c 2012
+mdbcomp merc-src/accumulator.m /^:- import_module mdbcomp.$/
+me22b lua-src/test.lua /^ local function test.me22b (one)$/
+me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/
+memalign c-src/emacs/src/gmalloc.c /^memalign (size_t alignment, size_t size)$/
+member prol-src/natded.prolog /^member(X,[X|_]).$/
+member_lessthan_goalid merc-src/accumulator.m /^:- pred member_lessthan_goalid(accu_goal_store::in/
+memclear c-src/emacs/src/lisp.h /^memclear (void *p, ptrdiff_t nbytes)$/
+menu_bar_item c-src/emacs/src/keyboard.c /^menu_bar_item (Lisp_Object key, Lisp_Object item, /
+menu_bar_items c-src/emacs/src/keyboard.c /^menu_bar_items (Lisp_Object old)$/
+menu_bar_items_index c-src/emacs/src/keyboard.c 7369
+menu_bar_items_vector c-src/emacs/src/keyboard.c 7368
+menu_bar_one_keymap_changed_items c-src/emacs/src/keyboard.c 7363
+menu_item_eval_property c-src/emacs/src/keyboard.c /^menu_item_eval_property (Lisp_Object sexpr)$/
+menu_item_eval_property_1 c-src/emacs/src/keyboard.c /^menu_item_eval_property_1 (Lisp_Object arg)$/
+menu_separator_name_p c-src/emacs/src/keyboard.c /^menu_separator_name_p (const char *label)$/
+metasource c-src/etags.c 198
+min c-src/emacs/src/gmalloc.c /^#define min(a, b) ((a) < (b) ? (a) : (b))$/
+min c-src/emacs/src/lisp.h /^#define min(a, b) ((a) < (b) ? (a) : (b))$/
+min c-src/emacs/src/lisp.h 57
+min cp-src/conway.cpp /^#define min(x,y) ((x > y) ? y : x)$/
+min_args c-src/emacs/src/lisp.h 1686
+min_char c-src/emacs/src/lisp.h 1621
+minus cp-src/functions.cpp /^void Date::minus ( int days , int month , int year/
+miti html-src/softwarelibero.html /^Sfatiamo alcuni miti$/
+modifier_names c-src/emacs/src/keyboard.c 6319
+modifier_symbols c-src/emacs/src/keyboard.c 6327
+modify_event_symbol c-src/emacs/src/keyboard.c /^modify_event_symbol (ptrdiff_t symbol_num, int mod/
+module_class_method ruby-src/test.rb /^ def ModuleExample.module_class_method$/
+module_instance_method ruby-src/test.rb /^ def module_instance_method$/
+more= ruby-src/test1.ru /^ :more$/
+more_aligned_int c.c 165
+morecore_nolock c-src/emacs/src/gmalloc.c /^morecore_nolock (size_t size)$/
+morecore_recursing c-src/emacs/src/gmalloc.c 604
+mouse_syms c-src/emacs/src/keyboard.c 4627
+move cp-src/clheir.cpp /^void agent::move(int direction)$/
+mprobe c-src/emacs/src/gmalloc.c /^mprobe (void *ptr)$/
+msgid php-src/lce_functions.php /^ function msgid($line, $class)$/
+msgstr php-src/lce_functions.php /^ function msgstr($line, $class)$/
+mstats c-src/emacs/src/gmalloc.c 308
+mt prol-src/natded.prolog /^mt:-$/
+mtg html-src/software.html /^MTG$/
+multi_line c-src/etags.c 267
+multibyte c-src/emacs/src/regex.h 403
+my_printf c.c /^my_printf (void *my_object, const char *my_format,/
+my_struct c-src/h.h 91
+my_struct c.c 226
+my_typedef c-src/h.h 93
+my_typedef c.c 228
+mypi forth-src/test-forth.fth /^synonym mypi fconst$/
+n c-src/exit.c 28
+n c-src/exit.strange_suffix 28
+name c-src/emacs/src/keyboard.c 7241
+name c-src/emacs/src/lisp.h 1808
+name c-src/emacs/src/lisp.h 3144
+name c-src/emacs/src/lisp.h 682
+name c-src/etags.c 192
+name c-src/etags.c 218
+name c-src/etags.c 2271
+name c-src/etags.c 261
+name c-src/getopt.h 76
+name c-src/getopt.h 78
+name perl-src/htlmify-cystic 357
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Function}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Macro}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Special Form}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{User Option}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Variable}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{#1}\\deftpargs{#3}\\endgrou/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{#1}\\defunargs{#3}\\endgrou/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{#1}\\defvarargs{#3}\\endgro/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{Instance Variable of #1}%/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{Method on #1}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{\\defcvtype{} of #1}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{\\defoptype{} on #1}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#1} #2}{Function}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#1} #2}{Variable}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#2} #3}{#1}$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#2} #3}{#1}%$/
+name y-src/cccp.y 113
+name y-src/cccp.y 43
+named c-src/etags.c 2505
+namestringequal pas-src/common.pas /^function namestringequal;(*(var Name1,Name2 : Name/
+nargs c-src/emacs/src/lisp.h 2987
+need_adjustment c-src/emacs/src/lisp.h 1986
+neighbors cp-src/clheir.hpp 59
+nelem cp-src/Range.h /^ int nelem (void) const { return rng_nelem; }$/
+nestlev c-src/etags.c 2525
+new objc-src/PackInsp.m /^+new$/
+new perl-src/htlmify-cystic 163
+new_tag perl-src/htlmify-cystic 18
+newlb c-src/etags.c 2930
+newlinepos c-src/etags.c 2932
+newtextstring pas-src/common.pas /^function newtextstring; (*: TextString;*)$/
+next c-src/emacs/src/gmalloc.c 164
+next c-src/emacs/src/gmalloc.c 188
+next c-src/emacs/src/gmalloc.c 198
+next c-src/emacs/src/keyboard.c 7246
+next c-src/emacs/src/keyboard.c 861
+next c-src/emacs/src/lisp.h 1848
+next c-src/emacs/src/lisp.h 2009
+next c-src/emacs/src/lisp.h 2037
+next c-src/emacs/src/lisp.h 2192
+next c-src/emacs/src/lisp.h 3028
+next c-src/emacs/src/lisp.h 3134
+next c-src/emacs/src/lisp.h 700
+next c-src/etags.c 203
+next c.c 174
+next y-src/cccp.y 42
+next-file el-src/emacs/lisp/progmodes/etags.el /^(defun next-file (&optional initialize novisit)$/
+next-file-list el-src/emacs/lisp/progmodes/etags.el /^(defvar next-file-list nil$/
+next_alive cp-src/conway.hpp 7
+next_almost_prime c-src/emacs/src/lisp.h /^extern EMACS_INT next_almost_prime (EMACS_INT) ATT/
+next_free c-src/emacs/src/lisp.h 1851
+next_weak c-src/emacs/src/lisp.h 1875
+nextfree c-src/emacs/src/lisp.h 3029
+nfree c-src/emacs/src/gmalloc.c 150
+nl c-src/etags.c 2521
+no tex-src/texinfo.tex /^\\global\\advance \\appendixno by 1 \\message{Appendix/
+no tex-src/texinfo.tex /^\\ifnum\\secno=0 Appendix\\xreftie'char\\the\\appendixn/
+no tex-src/texinfo.tex /^\\newcount \\appendixno \\appendixno = `\\@$/
+no.\the\secno tex-src/texinfo.tex /^\\else \\ifnum \\subsecno=0 Section\\xreftie'char\\the\\/
+no.\the\secno.\the\subsecno tex-src/texinfo.tex /^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no.\the\secno.\the\subsecno.\the\subsubsecno tex-src/texinfo.tex /^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no_argument c-src/getopt.h 89
+no_lang_help c-src/etags.c 707
+no_sub c-src/emacs/src/regex.h 387
+nocase_tail c-src/etags.c /^nocase_tail (const char *cp)$/
+node c-src/etags.c 225
+node_st c-src/etags.c 214
+noderef tex-src/texinfo.tex /^\\appendixnoderef %$/
+nofonts tex-src/texinfo.tex /^{\\indexnofonts$/
+nofonts% tex-src/texinfo.tex /^{\\chapternofonts%$/
+none_help c-src/etags.c 703
+normalize prol-src/natded.prolog /^normalize(M,MNorm):-$/
+normalize_fresh prol-src/natded.prolog /^normalize_fresh(M,N):-$/
+normalize_tree prol-src/natded.prolog /^normalize_tree(tree(Rule,Syn:Sem,Trees),$/
+normalize_trees prol-src/natded.prolog /^normalize_trees([],[]).$/
+nosave pyt-src/server.py /^ def nosave(self):$/
+not_bol c-src/emacs/src/regex.h 391
+not_eol c-src/emacs/src/regex.h 394
+not_single_kboard_state c-src/emacs/src/keyboard.c /^not_single_kboard_state (KBOARD *kboard)$/
+notag2 c-src/dostorture.c 26
+notag2 c-src/torture.c 26
+notag4 c-src/dostorture.c 45
+notag4 c-src/torture.c 45
+notinname c-src/etags.c /^#define notinname(c) (_nin[CHAR (c)]) \/* c is not /
+npending c-src/emacs/src/keyboard.c 7244
+ntool_bar_items c-src/emacs/src/keyboard.c 7974
+numOfChannels cp-src/c.C 1
+num_columns cp-src/conway.cpp 16
+num_input_events c-src/emacs/src/keyboard.c 210
+num_regs c-src/emacs/src/regex.h 430
+num_rows cp-src/conway.cpp 15
+numberKeys objcpp-src/SimpleCalc.M /^- numberKeys:sender$/
+number_len c-src/etags.c /^static int number_len (long) ATTRIBUTE_CONST;$/
+numbervars prol-src/natded.prolog /^numbervars(X):-$/
+nvars c-src/emacs/src/lisp.h 3140
+objdef c-src/etags.c 2484
+object c-src/emacs/src/lisp.h 2128
+object_registry cp-src/clheir.cpp 10
+objtag c-src/etags.c 2453
+objvar c-src/emacs/src/lisp.h 2297
+obstack_chunk_alloc y-src/parse.y 47
+obstack_chunk_free y-src/parse.y 48
+ocatseen c-src/etags.c 2477
+octave_MDiagArray2_h cp-src/MDiagArray2.h 29
+octave_Range_h cp-src/Range.h 24
+oediff make-src/Makefile /^oediff: OTAGS ETAGS ${infiles}$/
+offset c-src/emacs/src/lisp.h 2305
+offset c-src/emacs/src/lisp.h 2365
+offset c-src/etags.c 2494
+oignore c-src/etags.c 2483
+oimplementation c-src/etags.c 2474
+oinbody c-src/etags.c 2478
+ok objc-src/PackInsp.m /^-ok:sender$/
+ok_to_echo_at_next_pause c-src/emacs/src/keyboard.c 159
+old_value c-src/emacs/src/lisp.h 2980
+omethodcolon c-src/etags.c 2481
+omethodparm c-src/etags.c 2482
+omethodsign c-src/etags.c 2479
+omethodtag c-src/etags.c 2480
+onone c-src/etags.c 2472
+oparenseen c-src/etags.c 2476
+open objc-src/PackInsp.m /^-open:sender$/
+open-dribble-file c-src/emacs/src/keyboard.c /^DEFUN ("open-dribble-file", Fopen_dribble_file, So/
+openInWorkspace objc-src/PackInsp.m /^static void openInWorkspace(const char *filename)$/
+operationKeys objcpp-src/SimpleCalc.M /^- operationKeys:sender$/
+operator y-src/cccp.y 438
+operator ++ cp-src/functions.cpp /^Date & Date::operator ++ ( void ){$/
+operator += cp-src/functions.cpp /^Date & Date::operator += ( int days ){$/
+operator - cp-src/c.C /^void operator -(int, int) {}$/
+operator - cp-src/functions.cpp /^int Date::operator - ( Date d ){$/
+operator -- cp-src/functions.cpp /^Date & Date::operator -- ( void ){$/
+operator -= cp-src/functions.cpp /^Date & Date::operator -= ( int days ){$/
+operator < cp-src/functions.cpp /^int Date::operator < ( Date d ) {$/
+operator << cp-src/functions.cpp /^ostream& operator << ( ostream &c, Date d ) {$/
+operator = cp-src/MDiagArray2.h /^ MDiagArray2<T>& operator = (const MDiagArray2<T>/
+operator = cp-src/functions.cpp /^Date & Date::operator = ( Date d ){$/
+operator == cp-src/functions.cpp /^int Date::operator == ( Date d ) {$/
+operator > cp-src/functions.cpp /^int Date::operator > ( Date d ) {$/
+operator >> cp-src/functions.cpp /^istream& operator >> ( istream &i, Date & dd ){$/
+operator MArray2<T> cp-src/MDiagArray2.h /^ operator MArray2<T> () const$/
+operator int cp-src/c.C /^void operator int(int, int) {}$/
+operator int cp-src/fail.C /^ operator int() const {return x;}$/
+operator+ cp-src/c.C /^ A operator+(A& a) {};$/
+operator+ cp-src/c.C /^const A& A::operator+(const A&) { }$/
+operator+ cp-src/c.C /^void operator+(int, int) {}$/
+opparsebody\Edefop\defopx\defopheader\defoptype tex-src/texinfo.tex /^\\defopparsebody\\Edefop\\defopx\\defopheader\\defoptyp/
+oprotocol c-src/etags.c 2473
+option c-src/getopt.h 73
+optional_argument c-src/getopt.h 91
+opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype tex-src/texinfo.tex /^\\defopvarparsebody\\Edefcv\\defcvx\\defcvarheader\\def/
+ord_add_element prol-src/ordsets.prolog /^ord_add_element([], Element, [Element]).$/
+ord_del_element prol-src/ordsets.prolog /^ord_del_element([], _, []).$/
+ord_disjoint prol-src/ordsets.prolog /^ord_disjoint(Set1, Set2) :-$/
+ord_intersect prol-src/ordsets.prolog /^ord_intersect([Head1|Tail1], [Head2|Tail2]) :-$/
+ord_intersection prol-src/ordsets.prolog /^ord_intersection(Sets, Intersection) :- $/
+ord_intersection prol-src/ordsets.prolog /^ord_intersection([], Set2, [], Set2).$/
+ord_intersection prol-src/ordsets.prolog /^ord_intersection([], _, []).$/
+ord_intersection2 prol-src/ordsets.prolog /^ord_intersection2(1, [Set|Sets], Set0, Sets0) :- !/
+ord_intersection3 prol-src/ordsets.prolog /^ord_intersection3(<, _, Set1, Head2, Tail2, Inters/
+ord_intersection4 prol-src/ordsets.prolog /^ord_intersection4(<, _, Set1, Head2, Tail2, Inters/
+ord_member prol-src/ordsets.prolog /^ord_member(X, [E|Es]) :-$/
+ord_seteq prol-src/ordsets.prolog /^ord_seteq(Set1, Set2) :-$/
+ord_setproduct prol-src/ordsets.prolog /^ord_setproduct([], _, []).$/
+ord_subset prol-src/ordsets.prolog /^ord_subset([], _).$/
+ord_subtract prol-src/ordsets.prolog /^ord_subtract(Set1, Set2, Union) :-$/
+ord_symdiff prol-src/ordsets.prolog /^ord_symdiff([], Set2, Set2).$/
+ord_union prol-src/ordsets.prolog /^ord_union(Set1, Set2, Union) :-$/
+ord_union prol-src/ordsets.prolog /^ord_union([], Union) :- !, Union = [].$/
+ord_union4 prol-src/ordsets.prolog /^ord_union4(<, Head, Set1, Head2, Tail2, [Head|Unio/
+ord_union_all prol-src/ordsets.prolog /^ord_union_all(1, [Set|Sets], Set, Sets) :- !.$/
+oss html-src/softwarelibero.html /^Il movimento open source$/
+otagseen c-src/etags.c 2475
+outputTime cp-src/c.C 9
+output_file perl-src/htlmify-cystic 35
+output_files perl-src/htlmify-cystic 32
+outputtable html-src/algrthms.html /^Output$/
+outsyn prol-src/natded.prolog /^outsyn(['Any'],_).$/
+p c-src/emacs/src/lisp.h 4673
+p c-src/emacs/src/lisp.h 4679
+p.x forth-src/test-forth.fth /^ 1 CELLS +FIELD p.x \\ A single cell filed name/
+p.y forth-src/test-forth.fth /^ 1 CELLS +FIELD p.y \\ A single cell field name/
+p/f ada-src/etags-test-for.ada /^ function p pragma Import (C,$/
+p/f ada-src/etags-test-for.ada /^function p ("p");$/
+pD c-src/emacs/src/lisp.h 165
+pD c-src/emacs/src/lisp.h 167
+pD c-src/emacs/src/lisp.h 169
+pD c-src/emacs/src/lisp.h 171
+pI c-src/emacs/src/lisp.h 106
+pI c-src/emacs/src/lisp.h 94
+pI c-src/emacs/src/lisp.h 99
+pMd c-src/emacs/src/lisp.h 150
+pMd c-src/emacs/src/lisp.h 155
+pMu c-src/emacs/src/lisp.h 151
+pMu c-src/emacs/src/lisp.h 156
+p_next c-src/etags.c 258
+pagesize c-src/emacs/src/gmalloc.c 1703
+pair merc-src/accumulator.m /^:- import_module pair.$/
+parent c-src/emacs/src/keyboard.c 8745
+parent c-src/emacs/src/lisp.h 1590
+parse prol-src/natded.prolog /^parse(Ws,Cat):-$/
+parseFromVars php-src/lce_functions.php /^ function parseFromVars($prefix)$/
+parse_c_expression y-src/cccp.y /^parse_c_expression (string)$/
+parse_cgi prol-src/natded.prolog /^parse_cgi(TokenList,KeyVals):-$/
+parse_error y-src/parse.y 82
+parse_escape y-src/cccp.y /^parse_escape (string_ptr)$/
+parse_hash y-src/parse.y 64
+parse_menu_item c-src/emacs/src/keyboard.c /^parse_menu_item (Lisp_Object item, int inmenubar)$/
+parse_modifiers c-src/emacs/src/keyboard.c /^parse_modifiers (Lisp_Object symbol)$/
+parse_modifiers_uncached c-src/emacs/src/keyboard.c /^parse_modifiers_uncached (Lisp_Object symbol, ptrd/
+parse_number y-src/cccp.y /^parse_number (olen)$/
+parse_return y-src/parse.y 74
+parse_return_error y-src/cccp.y 70
+parse_solitary_modifier c-src/emacs/src/keyboard.c /^parse_solitary_modifier (Lisp_Object symbol)$/
+parse_tool_bar_item c-src/emacs/src/keyboard.c /^parse_tool_bar_item (Lisp_Object key, Lisp_Object /
+parse_tree merc-src/accumulator.m /^:- import_module parse_tree.$/
+pat c-src/etags.c 262
+pattern c-src/etags.c 260
+pdlcount c-src/emacs/src/lisp.h 3046
+pending-delete-mode el-src/TAGTEST.EL /^(defalias 'pending-delete-mode 'delete-selection-m/
+pending_funcalls c-src/emacs/src/keyboard.c 4377
+pending_signals c-src/emacs/src/keyboard.c 80
+pfatal c-src/etags.c /^pfatal (const char *s1)$/
+pfdset c-src/h.h 57
+pfnote c-src/etags.c /^pfnote (char *name, bool is_func, char *linestart,/
+pinned c-src/emacs/src/lisp.h 679
+plain_C_entries c-src/etags.c /^plain_C_entries (FILE *inf)$/
+plain_C_suffixes c-src/etags.c 643
+plainc c-src/etags.c 2934
+plist c-src/emacs/src/lisp.h 2040
+plist c-src/emacs/src/lisp.h 697
+plus cp-src/functions.cpp /^void Date::plus ( int days , int month , int year /
+plus go-src/test1.go 5
+plusvalseq prol-src/natded.prolog /^plusvalseq([]) --> [].$/
+point forth-src/test-forth.fth /^BEGIN-STRUCTURE point \\ create the named structure/
+pointer c-src/emacs/src/lisp.h 2125
+poll_for_input c-src/emacs/src/keyboard.c /^poll_for_input (struct atimer *timer)$/
+poll_for_input_1 c-src/emacs/src/keyboard.c /^poll_for_input_1 (void)$/
+poll_suppress_count c-src/emacs/src/keyboard.c 1908
+poll_suppress_count c-src/emacs/src/lisp.h 3047
+poll_timer c-src/emacs/src/keyboard.c 1915
+pop-tag-mark el-src/emacs/lisp/progmodes/etags.el /^(defalias 'pop-tag-mark 'xref-pop-marker-stack)$/
+pop_kboard c-src/emacs/src/keyboard.c /^pop_kboard (void)$/
+popclass_above c-src/etags.c /^popclass_above (int bracelev)$/
+position_to_Time c-src/emacs/src/keyboard.c /^position_to_Time (ptrdiff_t pos)$/
+posix_memalign c-src/emacs/src/gmalloc.c /^posix_memalign (void **memptr, size_t alignment, s/
+posn-at-point c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_p/
+posn-at-x-y c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, /
+possible_sum_sign y-src/cccp.y /^#define possible_sum_sign(a, b, sum) ((((a) ^ (b))/
+post pyt-src/server.py /^ def post(self):$/
+pot_etags_version c-src/etags.c 81
+pp1 c-src/dostorture.c /^int pp1($/
+pp1 c-src/torture.c /^int pp1($/
+pp2 c-src/dostorture.c /^pp2$/
+pp2 c-src/torture.c /^pp2$/
+pp3 c-src/dostorture.c /^pp3(int bar)$/
+pp3 c-src/torture.c /^pp3(int bar)$/
+pp_bas_cat prol-src/natded.prolog /^pp_bas_cat(Cat):-$/
+pp_cat prol-src/natded.prolog /^pp_cat(Syn:Sem):-$/
+pp_exp prol-src/natded.prolog /^pp_exp('NIL'):-$/
+pp_exps prol-src/natded.prolog /^pp_exps([]).$/
+pp_html_fitch_tree prol-src/natded.prolog /^pp_html_fitch_tree(tree(der,Root,[ders(Words)]),M,/
+pp_html_table_fitch_tree prol-src/natded.prolog /^pp_html_table_fitch_tree(T):-$/
+pp_html_table_tree prol-src/natded.prolog /^pp_html_table_tree(T):-$/
+pp_html_tree prol-src/natded.prolog /^pp_html_tree(ass(Syn,V,'$VAR'(N))):-$/
+pp_html_trees prol-src/natded.prolog /^pp_html_trees([T|Ts],N,M):-$/
+pp_lam prol-src/natded.prolog /^pp_lam(Var^Alpha):-$/
+pp_lam_bracket prol-src/natded.prolog /^pp_lam_bracket(A^B):-$/
+pp_lam_paren prol-src/natded.prolog /^pp_lam_paren(Var^Alpha):-$/
+pp_paren prol-src/natded.prolog /^pp_paren(C):-$/
+pp_rule prol-src/natded.prolog /^pp_rule(fe):-write('\/E').$/
+pp_syn prol-src/natded.prolog /^pp_syn(A\/B):-$/
+pp_syn_back prol-src/natded.prolog /^pp_syn_back(A\/B):-$/
+pp_syn_paren prol-src/natded.prolog /^pp_syn_paren(A\/B):-$/
+pp_tree prol-src/natded.prolog /^pp_tree(T):-$/
+pp_trees prol-src/natded.prolog /^pp_trees([T|Ts],Column):-$/
+pp_word prol-src/natded.prolog /^pp_word(W):-$/
+pp_word_list prol-src/natded.prolog /^pp_word_list([]).$/
+pp_word_list_rest prol-src/natded.prolog /^pp_word_list_rest([]).$/
+predicate c-src/emacs/src/lisp.h 2307
+prev c-src/emacs/src/gmalloc.c 165
+prev c-src/emacs/src/gmalloc.c 189
+prev c-src/emacs/src/lisp.h 2191
+prev c.c 175
+printClassification php-src/lce_functions.php /^ function printClassification()$/
+print_help c-src/etags.c /^print_help (argument *argbuffer)$/
+print_language_names c-src/etags.c /^print_language_names (void)$/
+print_version c-src/etags.c /^print_version (void)$/
+printmax_t c-src/emacs/src/lisp.h 148
+printmax_t c-src/emacs/src/lisp.h 153
+proc c-src/h.h 87
+process_file c-src/etags.c /^process_file (FILE *fh, char *fn, language *lang)$/
+process_file_name c-src/etags.c /^process_file_name (char *file, language *lang)$/
+process_pending_signals c-src/emacs/src/keyboard.c /^process_pending_signals (void)$/
+process_special_events c-src/emacs/src/keyboard.c /^process_special_events (void)$/
+process_tool_bar_item c-src/emacs/src/keyboard.c /^process_tool_bar_item (Lisp_Object key, Lisp_Objec/
+prof make-src/Makefile /^prof: ETAGS$/
+prolog_atom c-src/etags.c /^prolog_atom (char *s, size_t pos)$/
+prolog_pr c-src/etags.c /^prolog_pr (char *s, char *last)$/
+prolog_skip_comment c-src/etags.c /^prolog_skip_comment (linebuffer *plb, FILE *inf)$/
+prop c-src/etags.c 209
+protect_malloc_state c-src/emacs/src/gmalloc.c /^protect_malloc_state (int protect_p)$/
+pthread_mutexattr_setprio_ceiling/f ada-src/2ataspri.adb /^ function pthread_mutexattr_setprio_ceiling$/
+pthread_mutexattr_setprotocol/f ada-src/2ataspri.adb /^ function pthread_mutexattr_setprotocol$/
+purpose c-src/emacs/src/lisp.h 1594
+push_kboard c-src/emacs/src/keyboard.c /^push_kboard (struct kboard *k)$/
+pushclass_above c-src/etags.c /^pushclass_above (int bracelev, char *str, int len)/
+put_entries c-src/etags.c /^put_entries (register node *np)$/
+pvec_type c-src/emacs/src/lisp.h 780
+quantizing html-src/algrthms.html /^Quantizing the Received$/
+questo ../c/c.web 34
+quiettest make-src/Makefile /^quiettest:$/
+quit_char c-src/emacs/src/keyboard.c 192
+quit_throw_to_read_char c-src/emacs/src/keyboard.c /^quit_throw_to_read_char (bool from_signal)$/
+qux ruby-src/test1.ru /^ alias_method :qux, :tee, attr_accessor(:bogus)/
+qux1 ruby-src/test1.ru /^ :qux1)$/
+qux= ruby-src/test1.ru /^ def qux=(tee)$/
+r0 c-src/sysdep.h 54
+r1 c-src/sysdep.h 55
+r_alloc c-src/emacs/src/lisp.h /^extern void *r_alloc (void **, size_t) ATTRIBUTE_A/
+range_exp y-src/parse.y 269
+range_exp_list y-src/parse.y 273
+raw_keybuf c-src/emacs/src/keyboard.c 116
+raw_keybuf_count c-src/emacs/src/keyboard.c 117
+rbtp c.c 240
+re_iswctype c-src/emacs/src/regex.h 602
+re_nsub c-src/emacs/src/regex.h 364
+re_pattern_buffer c-src/emacs/src/regex.h 335
+re_pattern_buffer c-src/h.h 119
+re_registers c-src/emacs/src/regex.h 428
+re_wchar_t c-src/emacs/src/regex.h 600
+re_wchar_t c-src/emacs/src/regex.h 623
+re_wctype c-src/emacs/src/regex.h 601
+re_wctype_t c-src/emacs/src/regex.h 599
+re_wctype_t c-src/emacs/src/regex.h 618
+re_wctype_to_bit c-src/emacs/src/regex.h /^# define re_wctype_to_bit(cc) 0$/
+read cp-src/conway.hpp /^ char read() { return alive; }$/
+read php-src/lce_functions.php /^ function read()$/
+read-key-sequence c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence", Fread_key_sequence, Sr/
+read-key-sequence-vector c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence-vector", Fread_key_seque/
+read1 ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+read2 ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+read_char c-src/emacs/src/keyboard.c /^read_char (int commandflag, Lisp_Object map,$/
+read_char_help_form_unwind c-src/emacs/src/keyboard.c /^read_char_help_form_unwind (void)$/
+read_char_minibuf_menu_prompt c-src/emacs/src/keyboard.c /^read_char_minibuf_menu_prompt (int commandflag,$/
+read_char_x_menu_prompt c-src/emacs/src/keyboard.c /^read_char_x_menu_prompt (Lisp_Object map,$/
+read_decoded_event_from_main_queue c-src/emacs/src/keyboard.c /^read_decoded_event_from_main_queue (struct timespe/
+read_event_from_main_queue c-src/emacs/src/keyboard.c /^read_event_from_main_queue (struct timespec *end_t/
+read_key_sequence c-src/emacs/src/keyboard.c /^read_key_sequence (Lisp_Object *keybuf, int bufsiz/
+read_key_sequence_cmd c-src/emacs/src/keyboard.c 232
+read_key_sequence_remapped c-src/emacs/src/keyboard.c 233
+read_key_sequence_vs c-src/emacs/src/keyboard.c /^read_key_sequence_vs (Lisp_Object prompt, Lisp_Obj/
+read_menu_command c-src/emacs/src/keyboard.c /^read_menu_command (void)$/
+read_toc perl-src/htlmify-cystic /^sub read_toc ()$/
+readable_events c-src/emacs/src/keyboard.c /^readable_events (int flags)$/
+readline c-src/etags.c /^readline (linebuffer *lbp, FILE *stream)$/
+readline_internal c-src/etags.c /^readline_internal (linebuffer *lbp, register FILE /
+realloc c-src/emacs/src/gmalloc.c /^realloc (void *ptr, size_t size)$/
+realloc c-src/emacs/src/gmalloc.c 1716
+realloc c-src/emacs/src/gmalloc.c 65
+realloc c-src/emacs/src/gmalloc.c 69
+reallochook c-src/emacs/src/gmalloc.c /^reallochook (void *ptr, size_t size)$/
+recent-keys c-src/emacs/src/keyboard.c /^DEFUN ("recent-keys", Frecent_keys, Srecent_keys, /
+recent_keys c-src/emacs/src/keyboard.c 100
+recent_keys_index c-src/emacs/src/keyboard.c 94
+record_asynch_buffer_change c-src/emacs/src/keyboard.c /^record_asynch_buffer_change (void)$/
+record_auto_save c-src/emacs/src/keyboard.c /^record_auto_save (void)$/
+record_char c-src/emacs/src/keyboard.c /^record_char (Lisp_Object c)$/
+record_menu_key c-src/emacs/src/keyboard.c /^record_menu_key (Lisp_Object c)$/
+record_single_kboard_state c-src/emacs/src/keyboard.c /^record_single_kboard_state ()$/
+record_xmalloc c-src/emacs/src/lisp.h /^extern void *record_xmalloc (size_t) ATTRIBUTE_ALL/
+recover_top_level_message c-src/emacs/src/keyboard.c 138
+recursion-depth c-src/emacs/src/keyboard.c /^DEFUN ("recursion-depth", Frecursion_depth, Srecur/
+recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("recursive-edit", Frecursive_edit, Srecursi/
+recursive_edit_1 c-src/emacs/src/keyboard.c /^recursive_edit_1 (void)$/
+recursive_edit_unwind c-src/emacs/src/keyboard.c /^recursive_edit_unwind (Lisp_Object buffer)$/
+redirect c-src/emacs/src/lisp.h 663
+reduce prol-src/natded.prolog /^reduce((X^M)@N,L):- % beta reduction$/
+reduce_subterm prol-src/natded.prolog /^reduce_subterm(M,M2):-$/
+refreshPort pyt-src/server.py /^ def refreshPort(self):$/
+reg_errcode_t c-src/emacs/src/regex.h 323
+reg_errcode_t c.c 279
+reg_syntax_t c-src/emacs/src/regex.h 43
+regex c-src/etags.c 219
+regex.o make-src/Makefile /^regex.o: emacs\/src\/regex.c$/
+regex_t c-src/emacs/src/regex.h 416
+regex_tag_multiline c-src/etags.c /^regex_tag_multiline (void)$/
+regexfile make-src/Makefile /^regexfile: Makefile$/
+regexp c-src/etags.c 256
+regexp c-src/etags.c 268
+registerAction objcpp-src/SimpleCalc.M /^- registerAction:(SEL)action$/
+register_heapinfo c-src/emacs/src/gmalloc.c /^register_heapinfo (void)$/
+regmatch_t c-src/emacs/src/regex.h 451
+regoff_t c-src/emacs/src/regex.h 423
+regs c-src/etags.c 263
+regs cp-src/screen.cpp 16
+regs_allocated c-src/emacs/src/regex.h 379
+regset c-src/h.h 31
+regular_top_level_message c-src/emacs/src/keyboard.c 143
+rehash_size c-src/emacs/src/lisp.h 1835
+rehash_threshold c-src/emacs/src/lisp.h 1839
+relative_filename c-src/etags.c /^relative_filename (char *file, char *dir)$/
+release distrib make-src/Makefile /^release distrib: web$/
+removeexp prol-src/natded.prolog /^removeexp(E,E,'NIL'):-!.$/
+reorder_modifiers c-src/emacs/src/keyboard.c /^reorder_modifiers (Lisp_Object symbol)$/
+request c.c /^request request (a, b)$/
+requeued_events_pending_p c-src/emacs/src/keyboard.c /^requeued_events_pending_p (void)$/
+require merc-src/accumulator.m /^:- import_module require.$/
+required_argument c-src/getopt.h 90
+reset-this-command-lengths c-src/emacs/src/keyboard.c /^DEFUN ("reset-this-command-lengths", Freset_this_c/
+restore_getcjmp c-src/emacs/src/keyboard.c /^restore_getcjmp (sys_jmp_buf temp)$/
+restore_kboard_configuration c-src/emacs/src/keyboard.c /^restore_kboard_configuration (int was_locked)$/
+return_to_command_loop c-src/emacs/src/keyboard.c 135
+reverse prol-src/natded.prolog /^reverse([],Ws,Ws).$/
+revert objc-src/PackInsp.m /^-revert:sender$/
+right c-src/etags.c 216
+right_shift y-src/cccp.y /^right_shift (a, b)$/
+ring1 c.c 241
+ring2 c.c 242
+rm_eo c-src/emacs/src/regex.h 450
+rm_so c-src/emacs/src/regex.h 449
+rng_base cp-src/Range.h 79
+rng_inc cp-src/Range.h 81
+rng_limit cp-src/Range.h 80
+rng_nelem cp-src/Range.h 83
+rosso cp-src/c.C 40
+rsyncfromfly make-src/Makefile /^rsyncfromfly:$/
+rsynctofly make-src/Makefile /^rsynctofly:$/
+rtint c-src/h.h 60
+rtint c-src/h.h 68
+rtstr c-src/h.h 61
+rtstr c-src/h.h 69
+rtunion_def c-src/h.h 58
+rtunion_def c-src/h.h 64
+rtx c-src/h.h 62
+rtxnp c-src/h.h 71
+rtxp c-src/h.h 70
+s c-src/emacs/src/lisp.h 4672
+s c-src/emacs/src/lisp.h 4678
+s1 cp-src/c.C 32
+s2 cp-src/c.C 35
+safe_run_hook_funcall c-src/emacs/src/keyboard.c /^safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Objec/
+safe_run_hooks c-src/emacs/src/keyboard.c /^safe_run_hooks (Lisp_Object hook)$/
+safe_run_hooks_1 c-src/emacs/src/keyboard.c /^safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *ar/
+safe_run_hooks_error c-src/emacs/src/keyboard.c /^safe_run_hooks_error (Lisp_Object error, ptrdiff_t/
+save pyt-src/server.py /^ def save(self):$/
+save_getcjmp c-src/emacs/src/keyboard.c /^save_getcjmp (sys_jmp_buf temp)$/
+save_type c-src/emacs/src/lisp.h /^save_type (struct Lisp_Save_Value *v, int n)$/
+savenstr c-src/etags.c /^savenstr (const char *cp, int len)$/
+savestr c-src/etags.c /^savestr (const char *cp)$/
+say go-src/test.go /^func say(msg string) {$/
+scan_separators c-src/etags.c /^scan_separators (char *name)$/
+scolonseen c-src/etags.c 2447
+scratch c-src/sysdep.h 56
+scroll_bar_parts c-src/emacs/src/keyboard.c 5189
+sec=\relax tex-src/texinfo.tex /^\\let\\appendixsec=\\relax$/
+section perl-src/htlmify-cystic 25
+section=\relax tex-src/texinfo.tex /^\\let\\appendixsection=\\relax$/
+section_href perl-src/htlmify-cystic /^sub section_href ($)$/
+section_name perl-src/htlmify-cystic /^sub section_name ($)$/
+section_name perl-src/htlmify-cystic 12
+section_toc perl-src/htlmify-cystic 15
+section_url perl-src/htlmify-cystic /^sub section_url ()$/
+section_url_base perl-src/htlmify-cystic /^sub section_url_base ()$/
+section_url_name perl-src/htlmify-cystic /^sub section_url_name ()$/
+select prol-src/natded.prolog /^select(X,[X|Xs],Xs).$/
+select-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun select-tags-table ()$/
+select-tags-table-mode el-src/emacs/lisp/progmodes/etags.el /^(define-derived-mode select-tags-table-mode specia/
+select-tags-table-mode-map el-src/emacs/lisp/progmodes/etags.el /^(defvar select-tags-table-mode-map ; Doc string?$/
+select-tags-table-quit el-src/emacs/lisp/progmodes/etags.el /^(defun select-tags-table-quit ()$/
+select-tags-table-select el-src/emacs/lisp/progmodes/etags.el /^(defun select-tags-table-select (button)$/
+select_last prol-src/natded.prolog /^select_last([X],X,[]).$/
+send objc-src/Subprocess.m /^- send:(const char *)string withNewline:(BOOL)want/
+send objc-src/Subprocess.m /^- send:(const char *)string$/
+separator_names c-src/emacs/src/keyboard.c 7372
+serializeToVars php-src/lce_functions.php /^ function serializeToVars($prefix)$/
+set cp-src/conway.hpp /^ void set(void) { alive = 1; }$/
+set merc-src/accumulator.m /^:- import_module set.$/
+set-input-interrupt-mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-interrupt-mode", Fset_input_inte/
+set-input-meta-mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-meta-mode", Fset_input_meta_mode/
+set-input-mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-mode", Fset_input_mode, Sset_inp/
+set-output-flow-control c-src/emacs/src/keyboard.c /^DEFUN ("set-output-flow-control", Fset_output_flow/
+set-quit-char c-src/emacs/src/keyboard.c /^DEFUN ("set-quit-char", Fset_quit_char, Sset_quit_/
+setDate cp-src/functions.cpp /^void Date::setDate ( int d , int m , int y ){$/
+setDelegate objc-src/Subprocess.m /^- setDelegate:anObject$/
+setRevertButtonTitle objc-src/PackInsp.m /^-setRevertButtonTitle$/
+set_base cp-src/Range.h /^ void set_base (double b) { rng_base = b; }$/
+set_char_table_contents c-src/emacs/src/lisp.h /^set_char_table_contents (Lisp_Object table, ptrdif/
+set_char_table_defalt c-src/emacs/src/lisp.h /^set_char_table_defalt (Lisp_Object table, Lisp_Obj/
+set_char_table_extras c-src/emacs/src/lisp.h /^set_char_table_extras (Lisp_Object table, ptrdiff_/
+set_char_table_purpose c-src/emacs/src/lisp.h /^set_char_table_purpose (Lisp_Object table, Lisp_Ob/
+set_hash_key_slot c-src/emacs/src/lisp.h /^set_hash_key_slot (struct Lisp_Hash_Table *h, ptrd/
+set_hash_value_slot c-src/emacs/src/lisp.h /^set_hash_value_slot (struct Lisp_Hash_Table *h, pt/
+set_inc cp-src/Range.h /^ void set_inc (double i) { rng_inc = i; }$/
+set_limit cp-src/Range.h /^ void set_limit (double l) { rng_limit = l; }$/
+set_overlay_plist c-src/emacs/src/lisp.h /^set_overlay_plist (Lisp_Object overlay, Lisp_Objec/
+set_poll_suppress_count c-src/emacs/src/keyboard.c /^set_poll_suppress_count (int count)$/
+set_prop c-src/emacs/src/keyboard.c /^set_prop (ptrdiff_t idx, Lisp_Object val)$/
+set_save_integer c-src/emacs/src/lisp.h /^set_save_integer (Lisp_Object obj, int n, ptrdiff_/
+set_save_pointer c-src/emacs/src/lisp.h /^set_save_pointer (Lisp_Object obj, int n, void *va/
+set_string_intervals c-src/emacs/src/lisp.h /^set_string_intervals (Lisp_Object s, INTERVAL i)$/
+set_sub_char_table_contents c-src/emacs/src/lisp.h /^set_sub_char_table_contents (Lisp_Object table, pt/
+set_symbol_function c-src/emacs/src/lisp.h /^set_symbol_function (Lisp_Object sym, Lisp_Object /
+set_symbol_next c-src/emacs/src/lisp.h /^set_symbol_next (Lisp_Object sym, struct Lisp_Symb/
+set_symbol_plist c-src/emacs/src/lisp.h /^set_symbol_plist (Lisp_Object sym, Lisp_Object pli/
+set_upto merc-src/accumulator.m /^:- func set_upto(accu_case, int) = set(accu_goal_i/
+set_waiting_for_input c-src/emacs/src/keyboard.c /^set_waiting_for_input (struct timespec *time_to_cl/
+setref tex-src/texinfo.tex /^\\expandafter\\expandafter\\expandafter\\appendixsetre/
+setup cp-src/c.C 5
+shift cp-src/functions.cpp /^void Date::shift ( void ){\/\/Shift this date to pre/
+shouldLoad objc-src/PackInsp.m /^-(BOOL)shouldLoad$/
+should_attempt_accu_transform merc-src/accumulator.m /^:- pred should_attempt_accu_transform(module_info:/
+should_attempt_accu_transform_2 merc-src/accumulator.m /^:- pred should_attempt_accu_transform_2(module_inf/
+should_see_this_array_type cp-src/c.C 156
+should_see_this_function_pointer cp-src/c.C 153
+should_see_this_one_enclosed_in_extern_C cp-src/c.C 149
+show erl-src/gs_dialog.erl /^show(Module, Title, Message, Args) ->$/
+showError objc-src/Subprocess.m /^showError (const char *errorString, id theDelegate/
+showInfo objc-src/PackInsp.m /^-showInfo:sender$/
+show_help_echo c-src/emacs/src/keyboard.c /^show_help_echo (Lisp_Object help, Lisp_Object wind/
+sig c-src/emacs/src/keyboard.c 7238
+signal_handler c-src/h.h 82
+signal_handler1 c-src/h.h 83
+signal_handler_t c-src/h.h 94
+simulation html-src/software.html /^Software that I wrote for supporting my research a/
+single_kboard c-src/emacs/src/keyboard.c 89
+single_kboard_state c-src/emacs/src/keyboard.c /^single_kboard_state ()$/
+site cp-src/conway.hpp /^ site(int xi, int yi): x(xi), y(yi), alive(0) {/
+site cp-src/conway.hpp 5
+size c-src/emacs/src/gmalloc.c 156
+size c-src/emacs/src/gmalloc.c 163
+size c-src/emacs/src/gmalloc.c 1862
+size c-src/emacs/src/lisp.h 1364
+size c-src/emacs/src/lisp.h 1390
+size c-src/etags.c 236
+size c-src/etags.c 2522
+skeyseen c-src/etags.c 2445
+skip_name c-src/etags.c /^skip_name (char *cp)$/
+skip_non_spaces c-src/etags.c /^skip_non_spaces (char *cp)$/
+skip_spaces c-src/etags.c /^skip_spaces (char *cp)$/
+snarf-tag-function el-src/emacs/lisp/progmodes/etags.el /^(defvar snarf-tag-function nil$/
+snone c-src/etags.c 2443
+solutions merc-src/accumulator.m /^:- import_module solutions.$/
+some_mouse_moved c-src/emacs/src/keyboard.c /^some_mouse_moved (void)$/
+space tex-src/texinfo.tex /^ {#2\\labelspace #1}\\dotfill\\doshortpageno{#3}}%/
+space tex-src/texinfo.tex /^ \\dosubsubsecentry{#2.#3.#4.#5\\labelspace#1}{#6}}/
+spacer c-src/emacs/src/lisp.h 1975
+spacer c-src/emacs/src/lisp.h 1982
+spacer c-src/emacs/src/lisp.h 2036
+spacer c-src/emacs/src/lisp.h 2205
+specbind_tag c-src/emacs/src/lisp.h 2943
+specbinding c-src/emacs/src/lisp.h 2955
+specialsymbol prol-src/natded.prolog /^specialsymbol(C1,C2,S):-$/
+splitexp prol-src/natded.prolog /^splitexp(E,E,('NIL','NIL')):-!.$/
+srclist make-src/Makefile /^srclist: Makefile$/
+ss3 c.c 255
+sss1 c.c 252
+sss2 c.c 253
+sstab prol-src/natded.prolog /^sstab(2,'C',',').$/
+st_C_attribute c-src/etags.c 2209
+st_C_class c-src/etags.c 2212
+st_C_define c-src/etags.c 2213
+st_C_enum c-src/etags.c 2213
+st_C_extern c-src/etags.c 2213
+st_C_gnumacro c-src/etags.c 2208
+st_C_ignore c-src/etags.c 2209
+st_C_javastruct c-src/etags.c 2210
+st_C_objend c-src/etags.c 2207
+st_C_objimpl c-src/etags.c 2207
+st_C_objprot c-src/etags.c 2207
+st_C_operator c-src/etags.c 2211
+st_C_struct c-src/etags.c 2213
+st_C_template c-src/etags.c 2212
+st_C_typedef c-src/etags.c 2213
+st_none c-src/etags.c 2206
+stack c.c 155
+stagseen c-src/etags.c 2446
+standalone make-src/Makefile /^standalone:$/
+start c-src/emacs/src/keyboard.c 8753
+start c-src/emacs/src/lisp.h 2038
+start c-src/emacs/src/regex.h 431
+start php-src/lce_functions.php /^ function start($line, $class)$/
+start y-src/cccp.y 143
+start_polling c-src/emacs/src/keyboard.c /^start_polling (void)$/
+start_up prol-src/natded.prolog /^start_up:-$/
+state_protected_p c-src/emacs/src/gmalloc.c 400
+statetable html-src/algrthms.html /^Next$/
+staticetags make-src/Makefile /^staticetags:$/
+step cp-src/clheir.hpp /^ virtual void step(void) { }$/
+step cp-src/conway.hpp /^ void step(void) { alive = next_alive; }$/
+step_everybody cp-src/clheir.cpp /^void step_everybody(void)$/
+stop_polling c-src/emacs/src/keyboard.c /^stop_polling (void)$/
+store_info merc-src/accumulator.m /^:- type store_info$/
+store_user_signal_events c-src/emacs/src/keyboard.c /^store_user_signal_events (void)$/
+stored_goal_plain_call merc-src/accumulator.m /^:- inst stored_goal_plain_call for goal_store.stor/
+str go-src/test1.go 9
+strcaseeq c-src/etags.c /^#define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=/
+streq c-src/etags.c /^#define streq(s,t) (assert ((s)!=NULL || (t)!=NULL/
+string merc-src/accumulator.m /^:- import_module string.$/
+string_intervals c-src/emacs/src/lisp.h /^string_intervals (Lisp_Object s)$/
+stripLine php-src/lce_functions.php /^ function stripLine($line, $class)$/
+stripname pas-src/common.pas /^function stripname; (* ($/
+strncaseeq c-src/etags.c /^#define strncaseeq(s,t,n) (assert ((s)!=NULL && (t/
+strneq c-src/etags.c /^#define strneq(s,t,n) (assert ((s)!=NULL || (t)!=N/
+structdef c-src/etags.c 2448
+stuff_buffered_input c-src/emacs/src/keyboard.c /^stuff_buffered_input (Lisp_Object stuffstring)$/
+subprocess objc-src/PackInsp.m /^-subprocess:(Subprocess *)sender output:(char *)bu/
+subprocessDone objc-src/PackInsp.m /^-subprocessDone:(Subprocess *)sender$/
+subsec=\relax tex-src/texinfo.tex /^\\let\\appendixsubsec=\\relax$/
+subsection perl-src/htlmify-cystic 26
+subsection=\relax tex-src/texinfo.tex /^\\let\\appendixsubsection=\\relax$/
+subsection_marker perl-src/htlmify-cystic 161
+subst prol-src/natded.prolog /^subst(var(Y),var(X),M,N):-$/
+substitute c-src/etags.c /^substitute (char *in, char *out, struct re_registe/
+subsubsec=\relax tex-src/texinfo.tex /^\\let\\appendixsubsubsec=\\relax$/
+subsubsection perl-src/htlmify-cystic 27
+subsubsection=\relax tex-src/texinfo.tex /^\\let\\appendixsubsubsection=\\relax$/
+subtle ruby-src/test1.ru /^ :tee ; attr_reader :subtle$/
+subtree prol-src/natded.prolog /^subtree(T,T).$/
+suffix c-src/etags.c 186
+suffixes c-src/etags.c 195
+suggest_asking_for_help c-src/etags.c /^suggest_asking_for_help (void)$/
+suspend-emacs c-src/emacs/src/keyboard.c /^DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_e/
+sval y-src/cccp.y 116
+swallow_events c-src/emacs/src/keyboard.c /^swallow_events (bool do_display)$/
+switch_line_buffers c-src/etags.c /^#define switch_line_buffers() (curndx = 1 - curndx/
+sxhash_combine c-src/emacs/src/lisp.h /^sxhash_combine (EMACS_UINT x, EMACS_UINT y)$/
+sym_type c-src/etags.c 2204
+symbol c-src/emacs/src/lisp.h 2980
+symbol_interned c-src/emacs/src/lisp.h 639
+symbol_name c-src/emacs/src/lisp.h 1687
+symbol_redirect c-src/emacs/src/lisp.h 646
+syms_of_abbrev c-src/abbrev.c /^syms_of_abbrev ()$/
+syms_of_keyboard c-src/emacs/src/keyboard.c /^syms_of_keyboard (void)$/
+synchronize_system_messages_locale c-src/emacs/src/lisp.h /^INLINE void synchronize_system_messages_locale (vo/
+synchronize_system_time_locale c-src/emacs/src/lisp.h /^INLINE void synchronize_system_time_locale (void) /
+syntax c-src/emacs/src/regex.h 350
+sys_jmp_buf c-src/emacs/src/lisp.h 2906
+sys_jmp_buf c-src/emacs/src/lisp.h 2910
+sys_jmp_buf c-src/emacs/src/lisp.h 2916
+sys_longjmp c-src/emacs/src/lisp.h /^# define sys_longjmp(j, v) _longjmp (j, v)$/
+sys_longjmp c-src/emacs/src/lisp.h /^# define sys_longjmp(j, v) longjmp (j, v)$/
+sys_longjmp c-src/emacs/src/lisp.h /^# define sys_longjmp(j, v) siglongjmp (j, v)$/
+sys_setjmp c-src/emacs/src/lisp.h /^# define sys_setjmp(j) _setjmp (j)$/
+sys_setjmp c-src/emacs/src/lisp.h /^# define sys_setjmp(j) setjmp (j)$/
+sys_setjmp c-src/emacs/src/lisp.h /^# define sys_setjmp(j) sigsetjmp (j, 0)$/
+syscall_error c-src/sysdep.h 34
+t cp-src/c.C 52
+t1 cp-src/c.C 34
+t2 cp-src/c.C 38
+tab_count_words c-src/tab.c /^int tab_count_words(char **tab)$/
+tab_delete_first c-src/tab.c /^int tab_delete_first(char **tab)$/
+tab_fill c-src/tab.c /^char **tab_fill(char *str, char delim)$/
+tab_free c-src/tab.c /^void tab_free(char **tab)$/
+tag-any-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-any-match-p (_tag)$/
+tag-exact-file-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-exact-file-name-match-p (tag)$/
+tag-exact-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-exact-match-p (tag)$/
+tag-file-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-file-name-match-p (tag)$/
+tag-find-file-of-tag el-src/emacs/lisp/progmodes/etags.el /^(defun tag-find-file-of-tag (file) ; Doc string?$/
+tag-find-file-of-tag-noselect el-src/emacs/lisp/progmodes/etags.el /^(defun tag-find-file-of-tag-noselect (file)$/
+tag-implicit-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-implicit-name-match-p (tag)$/
+tag-lines-already-matched el-src/emacs/lisp/progmodes/etags.el /^(defvar tag-lines-already-matched nil$/
+tag-partial-file-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-partial-file-name-match-p (_tag)$/
+tag-re-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-re-match-p (re)$/
+tag-symbol-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-symbol-match-p (tag)$/
+tag-word-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-word-match-p (tag)$/
+tag1 c-src/dostorture.c /^(*tag1 (sig, handler)) ()$/
+tag1 c-src/h.h 110
+tag1 c-src/torture.c /^(*tag1 (sig, handler)) ()$/
+tag2 c-src/dostorture.c /^(*tag2 (sig, handler)) ()$/
+tag2 c-src/torture.c /^(*tag2 (sig, handler)) ()$/
+tag3 c-src/dostorture.c /^(*tag3 (int sig, void (*handler) (int))) (int)$/
+tag3 c-src/torture.c /^(*tag3 (int sig, void (*handler) (int))) (int)$/
+tag4 c-src/dostorture.c /^(*tag4 (int sig, void (*handler) (int))) (int)$/
+tag4 c-src/torture.c /^(*tag4 (int sig, void (*handler) (int))) (int)$/
+tag5 c-src/dostorture.c /^tag5 (handler, arg)$/
+tag5 c-src/torture.c /^tag5 (handler, arg)$/
+tag6 c-src/dostorture.c /^tag6 (void (*handler) (void *), void *arg)$/
+tag6 c-src/torture.c /^tag6 (void (*handler) (void *), void *arg)$/
+tag_or_ch c-src/emacs/src/lisp.h 3026
+taggedfname c-src/etags.c 207
+tags make-src/Makefile /^tags: TAGS$/
+tags-add-tables el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-add-tables 'ask-user$/
+tags-apropos el-src/emacs/lisp/progmodes/etags.el /^(defun tags-apropos (regexp)$/
+tags-apropos-additional-actions el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-apropos-additional-actions nil$/
+tags-apropos-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-apropos-function nil$/
+tags-apropos-verbose el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-apropos-verbose nil$/
+tags-case-fold-search el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-case-fold-search 'default$/
+tags-complete-tags-table-file el-src/emacs/lisp/progmodes/etags.el /^(defun tags-complete-tags-table-file (string predi/
+tags-completion-at-point-function el-src/emacs/lisp/progmodes/etags.el /^(defun tags-completion-at-point-function ()$/
+tags-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-completion-table ()$/
+tags-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-completion-table nil$/
+tags-completion-table-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-completion-table-function nil$/
+tags-compression-info-list el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-compression-info-list$/
+tags-expand-table-name el-src/emacs/lisp/progmodes/etags.el /^(defun tags-expand-table-name (file)$/
+tags-file-name el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-file-name nil$/
+tags-included-tables el-src/emacs/lisp/progmodes/etags.el /^(defun tags-included-tables ()$/
+tags-included-tables el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-included-tables nil$/
+tags-included-tables-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-included-tables-function nil$/
+tags-lazy-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-lazy-completion-table ()$/
+tags-location-ring el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-location-ring (make-ring xref-marker-/
+tags-loop-continue el-src/emacs/lisp/progmodes/etags.el /^(defun tags-loop-continue (&optional first-time)$/
+tags-loop-eval el-src/emacs/lisp/progmodes/etags.el /^(defun tags-loop-eval (form)$/
+tags-loop-operate el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-loop-operate nil$/
+tags-loop-revert-buffers el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-loop-revert-buffers nil$/
+tags-loop-scan el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-loop-scan$/
+tags-next-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-next-table ()$/
+tags-query-replace el-src/emacs/lisp/progmodes/etags.el /^(defun tags-query-replace (from to &optional delim/
+tags-recognize-empty-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-recognize-empty-tags-table ()$/
+tags-reset-tags-tables el-src/emacs/lisp/progmodes/etags.el /^(defun tags-reset-tags-tables ()$/
+tags-revert-without-query el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-revert-without-query nil$/
+tags-search el-src/emacs/lisp/progmodes/etags.el /^(defun tags-search (regexp &optional file-list-for/
+tags-select-tags-table el-src/emacs/lisp/progmodes/etags.el /^(define-button-type 'tags-select-tags-table$/
+tags-table-check-computed-list el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-check-computed-list ()$/
+tags-table-computed-list el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-computed-list nil$/
+tags-table-computed-list-for el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-computed-list-for nil$/
+tags-table-extend-computed-list el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-extend-computed-list ()$/
+tags-table-files el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-files ()$/
+tags-table-files el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-files nil$/
+tags-table-files-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-files-function nil$/
+tags-table-format-functions el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-format-functions '(etags-recogn/
+tags-table-including el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-including (this-file core-only)$/
+tags-table-list el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-table-list nil$/
+tags-table-list-member el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-list-member (file list)$/
+tags-table-list-pointer el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-list-pointer nil$/
+tags-table-list-started-at el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-list-started-at nil$/
+tags-table-mode el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-mode ()$/
+tags-table-set-list el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-set-list nil$/
+tags-tag-face el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-tag-face 'default$/
+tags-verify-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-verify-table (file)$/
+tags-with-face el-src/emacs/lisp/progmodes/etags.el /^(defmacro tags-with-face (face &rest body)$/
+target_multibyte c-src/emacs/src/regex.h 407
+tcpdump html-src/software.html /^tcpdump$/
+teats cp-src/c.C 127
+tee ruby-src/test1.ru /^ attr_accessor :tee$/
+tee= ruby-src/test1.ru /^ attr_accessor :tee$/
+temporarily_switch_to_single_kboard c-src/emacs/src/keyboard.c /^temporarily_switch_to_single_kboard (struct frame /
+tend c-src/etags.c 2432
+term merc-src/accumulator.m /^:- import_module term.$/
+terminate objc-src/Subprocess.m /^- terminate:sender$/
+terminateInput objc-src/Subprocess.m /^- terminateInput$/
+test c-src/emacs/src/lisp.h 1871
+test cp-src/c.C 86
+test erl-src/gs_dialog.erl /^test() ->$/
+test go-src/test1.go /^func test(p plus) {$/
+test make-src/Makefile /^test:$/
+test php-src/ptest.php /^test $/
+test-begin scm-src/test.scm /^(define-syntax test-begin$/
+test.me22b lua-src/test.lua /^ local function test.me22b (one)$/
+test.me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/
+test1 rs-src/test.rs /^fn test1() {$/
+test_crlf1 test_crlf.c /^void test_crlf1()$/
+test_crlf2 tset_crlf.c /^void test_crlf2()$/
+test_undefined c-src/emacs/src/keyboard.c /^test_undefined (Lisp_Object binding)$/
+texttreelist prol-src/natded.prolog /^texttreelist([]).$/
+there-is-a-=-in-the-middle! scm-src/test.scm /^(define (there-is-a-=-in-the-middle!) #t)$/
+this c-src/a/b/b.c 1
+this-command-keys c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys", Fthis_command_keys, St/
+this-command-keys-vector c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys-vector", Fthis_command_k/
+this-single-command-keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-keys", Fthis_single_co/
+this-single-command-raw-keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-raw-keys", Fthis_singl/
+this_command_key_count c-src/emacs/src/keyboard.c 108
+this_command_key_count_reset c-src/emacs/src/keyboard.c 112
+this_command_keys c-src/emacs/src/keyboard.c 107
+this_file_toc perl-src/htlmify-cystic 29
+this_single_command_key_start c-src/emacs/src/keyboard.c 125
+tignore c-src/etags.c 2433
+timer_check c-src/emacs/src/keyboard.c /^timer_check (void)$/
+timer_check_2 c-src/emacs/src/keyboard.c /^timer_check_2 (Lisp_Object timers, Lisp_Object idl/
+timer_idleness_start_time c-src/emacs/src/keyboard.c 335
+timer_last_idleness_start_time c-src/emacs/src/keyboard.c 340
+timer_resume_idle c-src/emacs/src/keyboard.c /^timer_resume_idle (void)$/
+timer_start_idle c-src/emacs/src/keyboard.c /^timer_start_idle (void)$/
+timer_stop_idle c-src/emacs/src/keyboard.c /^timer_stop_idle (void)$/
+timers_run c-src/emacs/src/keyboard.c 320
+tinbody c-src/etags.c 2431
+tkeyseen c-src/etags.c 2429
+tnone c-src/etags.c 2428
+toc_line perl-src/htlmify-cystic /^sub toc_line ($)$/
+toggleDescription objc-src/PackInsp.m /^-toggleDescription$/
+tok c-src/etags.c 2491
+token c-src/etags.c 2508
+token y-src/cccp.y 437
+token y-src/cccp.y 439
+tokenize prol-src/natded.prolog /^tokenize([C1,C2,C3|Cs],Xs-Ys,TsResult):- % spe/
+tokenizeatom prol-src/natded.prolog /^tokenizeatom(Atom,Ws):-$/
+tokentab2 y-src/cccp.y 442
+tool_bar_item_properties c-src/emacs/src/keyboard.c 7970
+tool_bar_items c-src/emacs/src/keyboard.c /^tool_bar_items (Lisp_Object reuse, int *nitems)$/
+tool_bar_items_vector c-src/emacs/src/keyboard.c 7965
+toolkit_menubar_in_use c-src/emacs/src/keyboard.c /^toolkit_menubar_in_use (struct frame *f)$/
+top-level c-src/emacs/src/keyboard.c /^DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, /
+top_level merc-src/accumulator.m /^:- type top_level$/
+top_level_1 c-src/emacs/src/keyboard.c /^top_level_1 (Lisp_Object ignore)$/
+top_level_2 c-src/emacs/src/keyboard.c /^top_level_2 (void)$/
+total_keys c-src/emacs/src/keyboard.c 97
+total_size_of_entries c-src/etags.c /^total_size_of_entries (register node *np)$/
+total_surrounding cp-src/conway.cpp /^int site::total_surrounding(void)$/
+totally_unblock_input c-src/emacs/src/keyboard.c /^totally_unblock_input (void)$/
+tpcmd c-src/h.h 15
+tpcmd c-src/h.h 8
+track-mouse c-src/emacs/src/keyboard.c /^DEFUN ("internal--track-mouse", Ftrack_mouse, Stra/
+tracking_off c-src/emacs/src/keyboard.c /^tracking_off (Lisp_Object old_value)$/
+traffic_light cp-src/conway.cpp /^void traffic_light(int x, int y)$/
+translate c-src/emacs/src/regex.h 361
+treats cp-src/c.C 131
+tt prol-src/natded.prolog /^tt:-$/
+tt=cmtt10 tex-src/texinfo.tex /^\\font\\deftt=cmtt10 scaled \\magstep1$/
+tty_read_avail_input c-src/emacs/src/keyboard.c /^tty_read_avail_input (struct terminal *terminal,$/
+ttypeseen c-src/etags.c 2430
+typdef c-src/etags.c 2434
+type c-src/emacs/src/gmalloc.c 145
+type c-src/emacs/src/lisp.h 1973
+type c-src/emacs/src/lisp.h 1980
+type c-src/emacs/src/lisp.h 2034
+type c-src/emacs/src/lisp.h 2112
+type c-src/emacs/src/lisp.h 2203
+type c-src/emacs/src/lisp.h 2276
+type c-src/emacs/src/lisp.h 2286
+type c-src/emacs/src/lisp.h 2296
+type c-src/emacs/src/lisp.h 2304
+type c-src/emacs/src/lisp.h 2364
+type c-src/emacs/src/lisp.h 3025
+type c-src/etags.c 2271
+typefunargs tex-src/texinfo.tex /^\\deftypefunargs {#3}\\endgroup %$/
+typefunargs tex-src/texinfo.tex /^\\deftypefunargs {#4}\\endgroup %$/
+typemargin tex-src/texinfo.tex /^\\newskip\\deftypemargin \\deftypemargin=12pt$/
+typemargin tex-src/texinfo.tex /^\\rlap{\\rightline{{\\rm #2}\\hskip \\deftypemargin}}}%/
+u c-src/emacs/src/lisp.h 2397
+u_any c-src/emacs/src/lisp.h 2214
+u_boolfwd c-src/emacs/src/lisp.h 2371
+u_buffer_objfwd c-src/emacs/src/lisp.h 2373
+u_finalizer c-src/emacs/src/lisp.h 2219
+u_free c-src/emacs/src/lisp.h 2215
+u_intfwd c-src/emacs/src/lisp.h 2370
+u_kboard_objfwd c-src/emacs/src/lisp.h 2374
+u_marker c-src/emacs/src/lisp.h 2216
+u_objfwd c-src/emacs/src/lisp.h 2372
+u_overlay c-src/emacs/src/lisp.h 2217
+u_save_value c-src/emacs/src/lisp.h 2218
+unargs tex-src/texinfo.tex /^\\defunargs {#2}\\endgroup %$/
+unargs tex-src/texinfo.tex /^\\defunargs {#3}\\endgroup %$/
+unblock_input c-src/emacs/src/keyboard.c /^unblock_input (void)$/
+unblock_input_to c-src/emacs/src/keyboard.c /^unblock_input_to (int level)$/
+unchar c-src/h.h 99
+unexpand-abbrev c-src/abbrev.c /^DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexp/
+univ merc-src/accumulator.m /^:- import_module univ.$/
+unravel_univ merc-src/accumulator.m /^:- some [T] pred unravel_univ(univ::in, T::out) is/
+unread_switch_frame c-src/emacs/src/keyboard.c 204
+unsignedp y-src/cccp.y 112
+unwind c-src/emacs/src/lisp.h 2962
+unwind_int c-src/emacs/src/lisp.h 2972
+unwind_ptr c-src/emacs/src/lisp.h 2967
+unwind_void c-src/emacs/src/lisp.h 2976
+update_accumulator_pred merc-src/accumulator.m /^:- pred update_accumulator_pred(pred_id::in, proc_/
+uprintmax_t c-src/emacs/src/lisp.h 149
+uprintmax_t c-src/emacs/src/lisp.h 154
+usage perl-src/yagrip.pl /^sub usage {$/
+usecharno c-src/etags.c 210
+used c-src/emacs/src/regex.h 347
+used_syntax c-src/emacs/src/regex.h 398
+user_cmp_function c-src/emacs/src/lisp.h 1814
+user_error c-src/emacs/src/keyboard.c /^user_error (const char *msg)$/
+user_hash_function c-src/emacs/src/lisp.h 1811
+user_signal_info c-src/emacs/src/keyboard.c 7235
+user_signals c-src/emacs/src/keyboard.c 7250
+usfreelock_ptr/t ada-src/etags-test-for.ada /^ type usfreelock_ptr is access$/
+val c-src/emacs/src/lisp.h 3027
+val c-src/emacs/src/lisp.h 691
+val c-src/getopt.h 84
+val prol-src/natded.prolog /^val(X) --> ['['], valseq(X), [']'].$/
+valcell c-src/emacs/src/lisp.h 2357
+valid c-src/etags.c 220
+valid c-src/etags.c 2502
+validate php-src/lce_functions.php /^ function validate($value)$/
+valloc c-src/emacs/src/gmalloc.c /^valloc (size_t size)$/
+valseq prol-src/natded.prolog /^valseq([Val|Vals]) --> val(Val), plusvalseq(Vals)./
+value c-src/emacs/src/lisp.h 687
+value y-src/cccp.y 112
+var c-src/emacs/src/keyboard.c 11023
+var c-src/emacs/src/lisp.h 3137
+varargs tex-src/texinfo.tex /^\\defvarargs {#2}\\endgroup %$/
+varargs tex-src/texinfo.tex /^\\defvarargs {#3}\\endgroup %$/
+varset merc-src/accumulator.m /^:- import_module varset.$/
+vcopy c-src/emacs/src/lisp.h /^vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Objec/
+vectorlike_header c-src/emacs/src/lisp.h 1343
+verde cp-src/c.C 40
+verify-tags-table-function el-src/emacs/lisp/progmodes/etags.el /^(defvar verify-tags-table-function nil$/
+verify_ascii c-src/emacs/src/lisp.h /^# define verify_ascii(str) (str)$/
+vignore c-src/etags.c 2417
+visit-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun visit-tags-table (file &optional local)$/
+visit-tags-table-buffer el-src/emacs/lisp/progmodes/etags.el /^(defun visit-tags-table-buffer (&optional cont)$/
+void c-src/emacs/src/lisp.h /^INLINE void (check_cons_list) (void) { lisp_h_chec/
+voidfuncptr c-src/emacs/src/lisp.h 2108
+voidval y-src/cccp.y 115
+wait_status_ptr_t c.c 161
+waiting_for_input c-src/emacs/src/keyboard.c 150
+warning y-src/cccp.y /^warning (msg)$/
+weak c-src/emacs/src/lisp.h 1830
+weak_alias c-src/emacs/src/gmalloc.c /^weak_alias (free, cfree)$/
+web ftp publish make-src/Makefile /^web ftp publish:$/
+what c-src/etags.c 252
+wheel_syms c-src/emacs/src/keyboard.c 4628
+where c-src/emacs/src/lisp.h 2348
+where c-src/emacs/src/lisp.h 2980
+where cp-src/clheir.hpp 77
+where_in_registry cp-src/clheir.hpp 15
+windowWillClose objcpp-src/SimpleCalc.M /^- windowWillClose:sender$/
+wipe_kboard c-src/emacs/src/keyboard.c /^wipe_kboard (KBOARD *kb)$/
+womboid c-src/h.h 63
+womboid c-src/h.h 75
+word_size c-src/emacs/src/lisp.h 1473
+write php-src/lce_functions.php /^ function write($save="yes")$/
+write php-src/lce_functions.php /^ function write()$/
+write1= ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+write2= ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+write_abbrev c-src/abbrev.c /^write_abbrev (sym, stream)$/
+write_classname c-src/etags.c /^write_classname (linebuffer *cn, const char *quali/
+write_lex prol-src/natded.prolog /^write_lex(File):-$/
+write_lex_cat prol-src/natded.prolog /^write_lex_cat(File):-$/
+write_xyc cp-src/screen.cpp /^void write_xyc(int x, int y, char c)$/
+writebreak prol-src/natded.prolog /^writebreak([]).$/
+writebreaklex prol-src/natded.prolog /^writebreaklex([]).$/
+writecat prol-src/natded.prolog /^writecat(np(ind(sng),nm(_)),np,[],[]):-!.$/
+writelist prol-src/natded.prolog /^writelist([der(Ws)|Ws2]):-$/
+writelistsubs prol-src/natded.prolog /^writelistsubs([],X):-$/
+writenamestring pas-src/common.pas /^procedure writenamestring;(*($/
+writesubs prol-src/natded.prolog /^writesubs([]).$/
+writesups prol-src/natded.prolog /^writesups([]).$/
+written c-src/etags.c 211
+x c.c 153
+x c.c 179
+x c.c 188
+x c.c 189
+x cp-src/c.C 53
+x cp-src/c.C 80
+x cp-src/clheir.hpp 49
+x cp-src/clheir.hpp 58
+x cp-src/conway.hpp 7
+x cp-src/fail.C 10
+x cp-src/fail.C 44
+x tex-src/texinfo.tex /^\\refx{#1-snt}{} [\\printednodename], page\\tie\\refx{/
+x-get-selection-internal c.c /^ Fx_get_selection_internal, Sx_get_selection/
+x-get-selection-internal c.c /^DEFUN ("x-get-selection-internal", Fx_get_selectio/
+xcar_addr c-src/emacs/src/lisp.h /^xcar_addr (Lisp_Object c)$/
+xcdr_addr c-src/emacs/src/lisp.h /^xcdr_addr (Lisp_Object c)$/
+xdiff make-src/Makefile /^xdiff: ETAGS EXTAGS ${infiles}$/
+xmalloc c-src/etags.c /^xmalloc (size_t size)$/
+xnew c-src/etags.c /^#define xnew(n, Type) ((Type *) xmalloc ((n) /
+xrealloc c-src/etags.c /^xrealloc (void *ptr, size_t size)$/
+xref-etags-location el-src/emacs/lisp/progmodes/etags.el /^(defclass xref-etags-location (xref-location)$/
+xref-location-line el-src/emacs/lisp/progmodes/etags.el /^(cl-defmethod xref-location-line ((l xref-etags-lo/
+xref-location-marker el-src/emacs/lisp/progmodes/etags.el /^(cl-defmethod xref-location-marker ((l xref-etags-/
+xref-make-etags-location el-src/emacs/lisp/progmodes/etags.el /^(defun xref-make-etags-location (tag-info file)$/
+xrnew c-src/etags.c /^#define xrnew(op, n, Type) ((op) = (Type *) xreall/
+xx make-src/Makefile /^xx="this line is here because of a fontlock bug$/
+xyz ruby-src/test1.ru /^ alias_method :xyz,$/
+y cp-src/clheir.hpp 49
+y cp-src/clheir.hpp 58
+y cp-src/conway.hpp 7
+y-get-selection-internal c.c /^ Fy_get_selection_internal, Sy_get_selection_/
+yyalloc /usr/share/bison/bison.simple 83
+yyalloc /usr/share/bison/bison.simple 84
+yyclearin /usr/share/bison/bison.simple 149
+yyclearin /usr/share/bison/bison.simple 150
+yydebug /usr/share/bison/bison.simple 237
+yydebug /usr/share/bison/bison.simple 238
+yyerrhandle /usr/share/bison/bison.simple 848
+yyerrlab1 /usr/share/bison/bison.simple 823
+yyerrok /usr/share/bison/bison.simple 148
+yyerrok /usr/share/bison/bison.simple 149
+yyerror y-src/cccp.y /^yyerror (s)$/
+yyerrstatus /usr/share/bison/bison.simple 846
+yylex y-src/cccp.y /^yylex ()$/
+yyls /usr/share/bison/bison.simple 88
+yyls /usr/share/bison/bison.simple 89
+yylsp /usr/share/bison/bison.simple 748
+yylsp /usr/share/bison/bison.simple 921
+yymemcpy /usr/share/bison/bison.simple /^yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T/
+yymemcpy /usr/share/bison/bison.simple 264
+yymemcpy /usr/share/bison/bison.simple 265
+yyn /usr/share/bison/bison.simple 755
+yyn /usr/share/bison/bison.simple 861
+yyn /usr/share/bison/bison.simple 895
+yyn /usr/share/bison/bison.simple 903
+yynewstate /usr/share/bison/bison.simple 763
+yynewstate /usr/share/bison/bison.simple 925
+yyparse /usr/share/bison/bison.simple /^yyparse (YYPARSE_PARAM_ARG)$/
+yyresult /usr/share/bison/bison.simple 932
+yyresult /usr/share/bison/bison.simple 939
+yyresult /usr/share/bison/bison.simple 947
+yyreturn /usr/share/bison/bison.simple 933
+yyreturn /usr/share/bison/bison.simple 940
+yyss /usr/share/bison/bison.simple 85
+yyss /usr/share/bison/bison.simple 86
+yystate /usr/share/bison/bison.simple 757
+yystate /usr/share/bison/bison.simple 761
+yystate /usr/share/bison/bison.simple 875
+yystate /usr/share/bison/bison.simple 924
+yystpcpy /usr/share/bison/bison.simple /^yystpcpy (char *yydest, const char *yysrc)$/
+yystpcpy /usr/share/bison/bison.simple 316
+yystpcpy /usr/share/bison/bison.simple 317
+yystrlen /usr/share/bison/bison.simple /^yystrlen (const char *yystr)$/
+yystrlen /usr/share/bison/bison.simple 293
+yystrlen /usr/share/bison/bison.simple 294
+yyvs /usr/share/bison/bison.simple 86
+yyvs /usr/share/bison/bison.simple 87
+yyvsp /usr/share/bison/bison.simple 746
+yyvsp /usr/share/bison/bison.simple 919
+z c.c 144
+z c.c 164
+z cp-src/clheir.hpp 49
+z cp-src/clheir.hpp 58
+| tex-src/texinfo.tex /^\\def|{{\\tt \\char '174}}$/
+~ tex-src/texinfo.tex /^\\def~{{\\tt \\char '176}}$/
+~A cp-src/c.C /^A::~A() {}$/
+~B cp-src/c.C /^ ~B() {};$/
+~MDiagArray2 cp-src/MDiagArray2.h /^ ~MDiagArray2 (void) { }$/
+~generic_object cp-src/clheir.cpp /^generic_object::~generic_object(void)$/
diff --git a/test/manual/etags/CTAGS.good_update b/test/manual/etags/CTAGS.good_update
new file mode 100644
index 00000000000..c618b9582da
--- /dev/null
+++ b/test/manual/etags/CTAGS.good_update
@@ -0,0 +1,4483 @@
+
+#a-defer-word forth-src/test-forth.fth /^defer #a-defer-word$/
+#some-storage forth-src/test-forth.fth /^2000 buffer: #some-storage$/
+$0x80 c-src/sysdep.h 32
+$SYS_##syscall_na c-src/sysdep.h 31
+$domain php-src/lce_functions.php 175
+$filename php-src/lce_functions.php 174
+$ignore_ws php-src/lce_functions.php 171
+$memassign php-src/ptest.php 9
+$memassign_space php-src/ptest.php 10
+$member php-src/ptest.php 8
+$msgid php-src/lce_functions.php 107
+$msgid php-src/lce_functions.php 165
+$msgid_lc php-src/lce_functions.php 113
+$msgstr php-src/lce_functions.php 108
+$msgstr php-src/lce_functions.php 166
+$msgstr_lc php-src/lce_functions.php 114
+$po_entries php-src/lce_functions.php 172
+$poe_num php-src/lce_functions.php 173
+$por_a php-src/lce_functions.php 500
+$prefix php-src/lce_functions.php 72
+$state php-src/lce_functions.php 170
+$sys_comment php-src/lce_functions.php 110
+$sys_comment php-src/lce_functions.php 168
+$sys_comment_lc php-src/lce_functions.php 116
+$test php-src/ptest.php 12
+$unk_comment php-src/lce_functions.php 111
+$unk_comment php-src/lce_functions.php 169
+$unk_comment_lc php-src/lce_functions.php 117
+$user_comment php-src/lce_functions.php 109
+$user_comment php-src/lce_functions.php 167
+$user_comment_lc php-src/lce_functions.php 115
+${CHECKOBJS} make-src/Makefile /^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/
+%cdiff make-src/Makefile /^%cdiff: CTAGS% CTAGS ${infiles}$/
+%ediff make-src/Makefile /^%ediff: ETAGS% ETAGS ${infiles}$/
+($_,$flag,$opt,$f,$r,@temp perl-src/yagrip.pl 8
+($prog,$_,@list perl-src/yagrip.pl 39
+($string,$flag,@string,@temp,@last perl-src/yagrip.pl 40
+(a-forth-constant forth-src/test-forth.fth /^constant (a-forth-constant$/
+(another-forth-word) forth-src/test-forth.fth /^: (another-forth-word) ( -- )$/
+(foo) forth-src/test-forth.fth /^: (foo) 1 ;$/
++ ruby-src/test.rb /^ def +(y)$/
++ tex-src/texinfo.tex /^\\def+{{\\tt \\char 43}}$/
+.PRECIOUS make-src/Makefile /^.PRECIOUS: ETAGS CTAGS ETAGS16 CTAGS16 ETAGS17 CTA/
+/.notdef ps-src/rfc1245.ps /^\/.notdef \/.notdef \/.notdef \/.notdef \/.notdef \/.not/
+/.notdef ps-src/rfc1245.ps /^\/.notdef \/.notdef \/.notdef \/.notdef \/space \/exclam/
+/A ps-src/rfc1245.ps /^\/A { $/
+/Acircumflex ps-src/rfc1245.ps /^\/Acircumflex \/Ecircumflex \/Aacute \/Edieresis \/Egra/
+/B ps-src/rfc1245.ps /^\/B { $/
+/BEGINBITMAP2BIT ps-src/rfc1245.ps /^\/BEGINBITMAP2BIT { $/
+/BEGINBITMAP2BITc ps-src/rfc1245.ps /^\/BEGINBITMAP2BITc { $/
+/BEGINBITMAPBW ps-src/rfc1245.ps /^\/BEGINBITMAPBW { $/
+/BEGINBITMAPBWc ps-src/rfc1245.ps /^\/BEGINBITMAPBWc { $/
+/BEGINBITMAPGRAY ps-src/rfc1245.ps /^\/BEGINBITMAPGRAY { $/
+/BEGINBITMAPGRAYc ps-src/rfc1245.ps /^\/BEGINBITMAPGRAYc { $/
+/BEGINPRINTCODE ps-src/rfc1245.ps /^\/BEGINPRINTCODE { $/
+/BF ps-src/rfc1245.ps /^\/BF { $/
+/BITMAPCOLOR ps-src/rfc1245.ps /^\/BITMAPCOLOR { $/
+/BITMAPCOLORc ps-src/rfc1245.ps /^\/BITMAPCOLORc { $/
+/BITMAPGRAY ps-src/rfc1245.ps /^\/BITMAPGRAY { $/
+/BITMAPGRAYc ps-src/rfc1245.ps /^\/BITMAPGRAYc { $/
+/C ps-src/rfc1245.ps /^\/C { $/
+/COMMONBITMAP ps-src/rfc1245.ps /^\/COMMONBITMAP { $/
+/COMMONBITMAPc ps-src/rfc1245.ps /^\/COMMONBITMAPc { $/
+/D ps-src/rfc1245.ps /^\/D {curveto} bind def$/
+/DiacriticEncoding ps-src/rfc1245.ps /^\/DiacriticEncoding [$/
+/E ps-src/rfc1245.ps /^\/E {lineto} bind def$/
+/ENDBITMAP ps-src/rfc1245.ps /^\/ENDBITMAP {$/
+/ENDPRINTCODE ps-src/rfc1245.ps /^\/ENDPRINTCODE {$/
+/F ps-src/rfc1245.ps /^\/F { $/
+/FMBEGINEPSF ps-src/rfc1245.ps /^\/FMBEGINEPSF { $/
+/FMBEGINPAGE ps-src/rfc1245.ps /^\/FMBEGINPAGE { $/
+/FMDEFINEFONT ps-src/rfc1245.ps /^\/FMDEFINEFONT { $/
+/FMDOCUMENT ps-src/rfc1245.ps /^\/FMDOCUMENT { $/
+/FMENDEPSF ps-src/rfc1245.ps /^\/FMENDEPSF {$/
+/FMENDPAGE ps-src/rfc1245.ps /^\/FMENDPAGE {$/
+/FMLOCAL ps-src/rfc1245.ps /^\/FMLOCAL {$/
+/FMNORMALIZEGRAPHICS ps-src/rfc1245.ps /^\/FMNORMALIZEGRAPHICS { $/
+/FMVERSION ps-src/rfc1245.ps /^\/FMVERSION {$/
+/FMversion ps-src/rfc1245.ps /^\/FMversion (2.0) def $/
+/Fmcc ps-src/rfc1245.ps /^\/Fmcc {$/
+/FrameDict ps-src/rfc1245.ps /^\/FrameDict 190 dict def $/
+/G ps-src/rfc1245.ps /^\/G { $/
+/H ps-src/rfc1245.ps /^\/H { $/
+/Icircumflex ps-src/rfc1245.ps /^\/Icircumflex \/Idieresis \/Igrave \/Oacute \/Ocircumfl/
+/L ps-src/rfc1245.ps /^\/L \/M \/N \/O \/P \/Q \/R \/S \/T \/U \/V \/W \/X \/Y \/Z \/brac/
+/L ps-src/rfc1245.ps /^\/L { $/
+/M ps-src/rfc1245.ps /^\/M {newpath moveto} bind def$/
+/N ps-src/rfc1245.ps /^\/N { $/
+/Ntilde ps-src/rfc1245.ps /^\/Ntilde \/Odieresis \/Udieresis \/aacute \/agrave \/aci/
+/O ps-src/rfc1245.ps /^\/O {closepath} bind def$/
+/Otilde ps-src/rfc1245.ps /^\/Otilde \/OE \/oe \/endash \/emdash \/quotedblleft \/quo/
+/P ps-src/rfc1245.ps /^\/P { $/
+/PF ps-src/rfc1245.ps /^\/PF { $/
+/R ps-src/rfc1245.ps /^\/R { $/
+/RF ps-src/rfc1245.ps /^\/RF { $/
+/RR ps-src/rfc1245.ps /^\/RR { $/
+/ReEncode ps-src/rfc1245.ps /^\/ReEncode { $/
+/S ps-src/rfc1245.ps /^\/S { $/
+/SF ps-src/rfc1245.ps /^\/SF { $/
+/T ps-src/rfc1245.ps /^\/T { $/
+/TF ps-src/rfc1245.ps /^\/TF { $/
+/U ps-src/rfc1245.ps /^\/U { $/
+/Uacute ps-src/rfc1245.ps /^\/Uacute \/Ucircumflex \/Ugrave \/dotlessi \/circumflex/
+/V ps-src/rfc1245.ps /^\/V { $/
+/W ps-src/rfc1245.ps /^\/W { $/
+/X ps-src/rfc1245.ps /^\/X { $/
+/Y ps-src/rfc1245.ps /^\/Y { $/
+/Z ps-src/rfc1245.ps /^\/Z {$/
+/atilde ps-src/rfc1245.ps /^\/atilde \/aring \/ccedilla \/eacute \/egrave \/ecircumf/
+/bl ps-src/rfc1245.ps /^\/bl { $/
+/braceright ps-src/rfc1245.ps /^\/braceright \/asciitilde \/.notdef \/Adieresis \/Aring/
+/bracketright ps-src/rfc1245.ps /^\/bracketright \/asciicircum \/underscore \/grave \/a \//
+/breve ps-src/rfc1245.ps /^\/breve \/dotaccent \/ring \/cedilla \/hungarumlaut \/og/
+/cfs ps-src/rfc1245.ps /^\/cfs { $/
+/colorsetup ps-src/rfc1245.ps /^\/colorsetup {$/
+/desperatepapersize ps-src/rfc1245.ps /^\/desperatepapersize {$/
+/dieresis ps-src/rfc1245.ps /^\/dieresis \/.notdef \/AE \/Oslash \/.notdef \/.notdef \//
+/dmatrix ps-src/rfc1245.ps /^\/dmatrix matrix def$/
+/dnormalize ps-src/rfc1245.ps /^\/dnormalize {$/
+/dpi ps-src/rfc1245.ps /^\/dpi 72 0 dmatrix defaultmatrix dtransform$/
+/exclamdown ps-src/rfc1245.ps /^\/exclamdown \/logicalnot \/.notdef \/florin \/.notdef /
+/fakecolorsetup ps-src/rfc1245.ps /^\/fakecolorsetup {$/
+/fillprocs ps-src/rfc1245.ps /^\/fillprocs 32 array def$/
+/fl ps-src/rfc1245.ps /^\/fl { $/
+/fraction ps-src/rfc1245.ps /^\/fraction \/currency \/guilsinglleft \/guilsinglright/
+/freq ps-src/rfc1245.ps /^\/freq dpi 18.75 div 8 div round dup 0 eq {pop 1} i/
+/gn ps-src/rfc1245.ps /^\/gn { $/
+/graymode ps-src/rfc1245.ps /^\/graymode true def$/
+/grayness ps-src/rfc1245.ps /^\/grayness {$/
+/guillemotleft ps-src/rfc1245.ps /^\/guillemotleft \/guillemotright \/ellipsis \/.notdef /
+/home/www/pub/etags.c.gz make-src/Makefile /^\/home\/www\/pub\/etags.c.gz: etags.c$/
+/home/www/pub/software/unix/etags.tar.gz make-src/Makefile /^\/home\/www\/pub\/software\/unix\/etags.tar.gz: Makefile/
+/hx ps-src/rfc1245.ps /^\/hx { $/
+/i ps-src/rfc1245.ps /^\/i \/j \/k \/l \/m \/n \/o \/p \/q \/r \/s \/t \/u \/v \/w \/x \/y/
+/iacute ps-src/rfc1245.ps /^\/iacute \/igrave \/icircumflex \/idieresis \/ntilde \/o/
+/ic ps-src/rfc1245.ps /^\/ic [ $/
+/inch ps-src/rfc1245.ps /^\/inch {72 mul} def$/
+/ip ps-src/rfc1245.ps /^\/ip { $/
+/less ps-src/rfc1245.ps /^\/less \/equal \/greater \/question \/at \/A \/B \/C \/D \/E/
+/lnormalize ps-src/rfc1245.ps /^\/lnormalize { $/
+/manualpapersize ps-src/rfc1245.ps /^\/manualpapersize {$/
+/max ps-src/rfc1245.ps /^\/max {2 copy lt {exch} if pop} bind def$/
+/min ps-src/rfc1245.ps /^\/min {2 copy gt {exch} if pop} bind def$/
+/ms ps-src/rfc1245.ps /^\/ms { $/
+/nbluet ps-src/rfc1245.ps /^\/nbluet 256 array def$/
+/ngrayt ps-src/rfc1245.ps /^\/ngrayt 256 array def$/
+/ngreent ps-src/rfc1245.ps /^\/ngreent 256 array def$/
+/normalize ps-src/rfc1245.ps /^\/normalize {$/
+/nredt ps-src/rfc1245.ps /^\/nredt 256 array def$/
+/numbersign ps-src/rfc1245.ps /^\/numbersign \/dollar \/percent \/ampersand \/quotesing/
+/ocircumflex ps-src/rfc1245.ps /^\/ocircumflex \/odieresis \/otilde \/uacute \/ugrave \/u/
+/ordfeminine ps-src/rfc1245.ps /^\/ordfeminine \/ordmasculine \/.notdef \/ae \/oslash \/q/
+/pagedimen ps-src/rfc1245.ps /^\/pagedimen { $/
+/papersize ps-src/rfc1245.ps /^\/papersize {$/
+/paragraph ps-src/rfc1245.ps /^\/paragraph \/germandbls \/registered \/copyright \/tra/
+/parenright ps-src/rfc1245.ps /^\/parenright \/asterisk \/plus \/comma \/hyphen \/period/
+/periodcentered ps-src/rfc1245.ps /^\/periodcentered \/quotesinglbase \/quotedblbase \/per/
+/quoteleft ps-src/rfc1245.ps /^\/quoteleft \/quoteright \/.notdef \/.notdef \/ydieresi/
+/restorematrix ps-src/rfc1245.ps /^\/restorematrix {$/
+/s1 ps-src/rfc1245.ps /^\/s1 1 string def$/
+/sangle ps-src/rfc1245.ps /^\/sangle 1 0 dmatrix defaultmatrix dtransform exch /
+/savematrix ps-src/rfc1245.ps /^\/savematrix {$/
+/setmanualfeed ps-src/rfc1245.ps /^\/setmanualfeed {$/
+/setpapername ps-src/rfc1245.ps /^\/setpapername { $/
+/setpattern ps-src/rfc1245.ps /^\/setpattern {$/
+/two ps-src/rfc1245.ps /^\/two \/three \/four \/five \/six \/seven \/eight \/nine \//
+/udieresis ps-src/rfc1245.ps /^\/udieresis \/dagger \/.notdef \/cent \/sterling \/secti/
+/wbytes ps-src/rfc1245.ps /^\/wbytes { $/
+/wh ps-src/rfc1245.ps /^\/wh { $/
+/yen ps-src/rfc1245.ps /^\/yen \/.notdef \/.notdef \/.notdef \/.notdef \/.notdef /
+2const forth-src/test-forth.fth /^3 4 2constant 2const$/
+2val forth-src/test-forth.fth /^2const 2value 2val$/
+2var forth-src/test-forth.fth /^2variable 2var$/
+:a-forth-dictionary-entry forth-src/test-forth.fth /^create :a-forth-dictionary-entry$/
+< tex-src/texinfo.tex /^\\def<{{\\tt \\less}}$/
+<< ruby-src/test.rb /^ def <<(y)$/
+<= ruby-src/test.rb /^ def <=(y)$/
+<=> ruby-src/test.rb /^ def <=>(y)$/
+= tex-src/texinfo.tex /^\\global\\def={{\\tt \\char 61}}}$/
+= tex-src/texinfo.tex /^\\global\\let\\section = \\appendixsec$/
+= tex-src/texinfo.tex /^\\global\\let\\section = \\numberedsec$/
+= tex-src/texinfo.tex /^\\global\\let\\section = \\unnumberedsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsection = \\appendixsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsection = \\numberedsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsection = \\unnumberedsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsubsection = \\appendixsubsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsubsection = \\numberedsubsubsec$/
+= tex-src/texinfo.tex /^\\global\\let\\subsubsection = \\unnumberedsubsubsec$/
+=/f ada-src/etags-test-for.ada /^ function "=" (L, R : System.Address) return Boo/
+== ruby-src/test.rb /^ def ==(y)$/
+=== ruby-src/test.rb /^ def ===(y)$/
+=\indexdummyfont tex-src/texinfo.tex /^\\let\\cite=\\indexdummyfont$/
+=\relax tex-src/texinfo.tex /^\\let\\appendix=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\chapter=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\section=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\subsection=\\relax$/
+=\relax tex-src/texinfo.tex /^\\let\\subsubsection=\\relax$/
+=\smartitalic tex-src/texinfo.tex /^\\let\\cite=\\smartitalic$/
+=starts-with-equals! scm-src/test.scm /^(define =starts-with-equals! #t)$/
+> tex-src/texinfo.tex /^\\def>{{\\tt \\gtr}}$/
+>field1 forth-src/test-forth.fth /^ 9 field >field1$/
+>field2 forth-src/test-forth.fth /^ 5 field >field2$/
+A c.c 162
+A cp-src/c.C /^void A::A() {}$/
+A cp-src/c.C 117
+A cp-src/c.C 39
+A cp-src/c.C 56
+A cp-src/c.C 57
+A cp-src/c.C 73
+A cp-src/fail.C 23
+A cp-src/fail.C 7
+A ruby-src/test1.ru /^class A$/
+A ruby-src/test1.ru /^module A$/
+ABC ruby-src/test1.ru 11
+ADASRC make-src/Makefile /^ADASRC=etags-test-for.ada 2ataspri.adb 2ataspri.ad/
+ADDRESS c-src/emacs/src/gmalloc.c /^#define ADDRESS(B) ((void *) (((B) - 1) * BLOCKSIZ/
+ALIGNOF_STRUCT_LISP_VECTOR c-src/emacs/src/lisp.h 1378
+ALLOCATED_BEFORE_DUMPING c-src/emacs/src/gmalloc.c /^#define ALLOCATED_BEFORE_DUMPING(P) \\$/
+ALLOCATE_PSEUDOVECTOR c-src/emacs/src/lisp.h /^#define ALLOCATE_PSEUDOVECTOR(type, field, tag) /
+ALLOCATE_ZEROED_PSEUDOVECTOR c-src/emacs/src/lisp.h /^#define ALLOCATE_ZEROED_PSEUDOVECTOR(type, field, /
+AND y-src/cccp.c 11
+ANSIC c-src/h.h 84
+ANSIC c-src/h.h 85
+AREF c-src/emacs/src/lisp.h /^AREF (Lisp_Object array, ptrdiff_t idx)$/
+ARGS make-src/Makefile /^ARGS=- < srclist$/
+ARITH_EQUAL c-src/emacs/src/lisp.h 3498
+ARITH_GRTR c-src/emacs/src/lisp.h 3501
+ARITH_GRTR_OR_EQUAL c-src/emacs/src/lisp.h 3503
+ARITH_LESS c-src/emacs/src/lisp.h 3500
+ARITH_LESS_OR_EQUAL c-src/emacs/src/lisp.h 3502
+ARITH_NOTEQUAL c-src/emacs/src/lisp.h 3499
+ARRAYELTS c-src/emacs/src/lisp.h /^#define ARRAYELTS(arr) (sizeof (arr) \/ sizeof (arr/
+ARRAYP c-src/emacs/src/lisp.h /^ARRAYP (Lisp_Object x)$/
+ARRAY_MARK_FLAG c-src/emacs/src/lisp.h 768
+ASCII_CHAR_P c-src/emacs/src/lisp.h /^#define ASCII_CHAR_P(c) UNSIGNED_CMP (c, <, 0x80)$/
+ASET c-src/emacs/src/lisp.h /^ASET (Lisp_Object array, ptrdiff_t idx, Lisp_Objec/
+ASIZE c-src/emacs/src/lisp.h /^ASIZE (Lisp_Object array)$/
+ASRC make-src/Makefile /^ASRC=empty.zz empty.zz.gz$/
+AST_Array::AST_Array cp-src/c.C /^AST_Array::AST_Array(UTL_ScopedName *n, unsigned l/
+AST_ConcreteType::AST_ConcreteType cp-src/c.C /^AST_ConcreteType::AST_ConcreteType(AST_Decl::NodeT/
+AST_Root cp-src/c.C 92
+AT cp-src/c.C 52
+AU cp-src/c.C 53
+AUTOLOADP c-src/emacs/src/lisp.h /^AUTOLOADP (Lisp_Object x)$/
+AUTO_CONS c-src/emacs/src/lisp.h /^#define AUTO_CONS(name, a, b) Lisp_Object name = A/
+AUTO_CONS_EXPR c-src/emacs/src/lisp.h /^#define AUTO_CONS_EXPR(a, b) \\$/
+AUTO_LIST1 c-src/emacs/src/lisp.h /^#define AUTO_LIST1(name, a) \\$/
+AUTO_LIST2 c-src/emacs/src/lisp.h /^#define AUTO_LIST2(name, a, b) \\$/
+AUTO_LIST3 c-src/emacs/src/lisp.h /^#define AUTO_LIST3(name, a, b, c) \\$/
+AUTO_LIST4 c-src/emacs/src/lisp.h /^#define AUTO_LIST4(name, a, b, c, d) \\$/
+AUTO_STRING c-src/emacs/src/lisp.h /^#define AUTO_STRING(name, str) \\$/
+AVAIL_ALLOCA c-src/emacs/src/lisp.h /^#define AVAIL_ALLOCA(size) (sa_avail -= (size), al/
+Abort_Handler_Pointer/t ada-src/2ataspri.ads /^ type Abort_Handler_Pointer is access procedure /
+Abort_Task/p ada-src/2ataspri.adb /^ procedure Abort_Task (T : TCB_Ptr) is$/
+Abort_Task/p ada-src/2ataspri.ads /^ procedure Abort_Task (T : TCB_Ptr);$/
+Abort_Wrapper/p ada-src/2ataspri.adb /^ procedure Abort_Wrapper$/
+Ada_funcs c-src/etags.c /^Ada_funcs (FILE *inf)$/
+Ada_getit c-src/etags.c /^Ada_getit (FILE *inf, const char *name_qualifier)$/
+Ada_help c-src/etags.c 475
+Ada_suffixes c-src/etags.c 473
+AddNullToNmStr pas-src/common.pas /^function AddNullToNmStr; (*($/
+Address_To_Call_State/f ada-src/2ataspri.adb /^ function Address_To_Call_State is new$/
+Address_To_TCB_Ptr/f ada-src/2ataspri.ads /^ function Address_To_TCB_Ptr is new$/
+Advanced usage tex-src/gzip.texi /^@node Advanced usage, Environment, Invoking gzip, /
+Aligned_Cons c-src/emacs/src/lisp.h 4670
+Aligned_String c-src/emacs/src/lisp.h 4676
+AppendTextString pas-src/common.pas /^function AppendTextString;(*($/
+Arith_Comparison c-src/emacs/src/lisp.h 3497
+Asm_help c-src/etags.c 504
+Asm_labels c-src/etags.c /^Asm_labels (FILE *inf)$/
+Asm_suffixes c-src/etags.c 493
+B cp-src/c.C /^void B::B() {}$/
+B cp-src/c.C 122
+B cp-src/c.C 54
+B cp-src/c.C 56
+B cp-src/c.C 74
+B cp-src/fail.C 24
+B cp-src/fail.C 8
+B ruby-src/test1.ru /^ class B$/
+BE_Node cp-src/c.C /^void BE_Node::BE_Node() {}$/
+BE_Node cp-src/c.C 77
+BITS_PER_BITS_WORD c-src/emacs/src/lisp.h 125
+BITS_PER_BITS_WORD c-src/emacs/src/lisp.h 129
+BITS_PER_CHAR c-src/emacs/src/lisp.h 136
+BITS_PER_EMACS_INT c-src/emacs/src/lisp.h 139
+BITS_PER_LONG c-src/emacs/src/lisp.h 138
+BITS_PER_SHORT c-src/emacs/src/lisp.h 137
+BITS_WORD_MAX c-src/emacs/src/lisp.h 124
+BITS_WORD_MAX c-src/emacs/src/lisp.h 128
+BLACK cp-src/screen.hpp 12
+BLOCK c-src/emacs/src/gmalloc.c /^#define BLOCK(A) (((char *) (A) - _heapbase) \/ BLO/
+BLOCKIFY c-src/emacs/src/gmalloc.c /^#define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) \//
+BLOCKLOG c-src/emacs/src/gmalloc.c 125
+BLOCKSIZE c-src/emacs/src/gmalloc.c 126
+BLUE cp-src/screen.hpp 13
+BOOL_VECTOR_BITS_PER_CHAR c-src/emacs/src/lisp.h 114
+BOOL_VECTOR_BITS_PER_CHAR c-src/emacs/src/lisp.h 115
+BOOL_VECTOR_P c-src/emacs/src/lisp.h /^BOOL_VECTOR_P (Lisp_Object a)$/
+BROWN cp-src/screen.hpp 18
+BUFFERP c-src/emacs/src/lisp.h /^BUFFERP (Lisp_Object a)$/
+BUFFERSIZE objc-src/Subprocess.h 43
+BUFFER_OBJFWDP c-src/emacs/src/lisp.h /^BUFFER_OBJFWDP (union Lisp_Fwd *a)$/
+BYTE_MARK_STACK c-src/emacs/src/lisp.h 3181
+Bar lua-src/test.lua /^function Square.something:Bar ()$/
+Bar perl-src/kai-test.pl /^package Bar;$/
+Barrier_Function_Pointer/t ada-src/etags-test-for.ada /^ type Barrier_Function_Pointer is access$/
+Bidule/b ada-src/etags-test-for.ada /^ protected body Bidule is$/
+Bidule/b ada-src/waroquiers.ada /^ protected body Bidule is$/
+Bidule/t ada-src/etags-test-for.ada /^ protected Bidule is$/
+Bidule/t ada-src/waroquiers.ada /^ protected Bidule is$/
+Body_Required/f ada-src/etags-test-for.ada /^ function Body_Required$/
+Boo cp-src/c.C /^ Boo(int _i, int _a, int _b) : i(_i), a(_a), b(/
+Boo cp-src/c.C 129
+Boo::Boo cp-src/c.C /^Boo::Boo(Boo) :$/
+ButtonBar pyt-src/server.py /^def ButtonBar(frame, legend, ref, alternatives, co/
+C cp-src/fail.C /^ C(int i) {x = i;}$/
+C cp-src/fail.C 25
+C cp-src/fail.C 9
+CALLMANY c-src/emacs/src/lisp.h /^#define CALLMANY(f, array) (f) (ARRAYELTS (array),/
+CALLN c-src/emacs/src/lisp.h /^#define CALLN(f, ...) CALLMANY (f, ((Lisp_Object [/
+CAR c-src/emacs/src/lisp.h /^CAR (Lisp_Object c)$/
+CAR_SAFE c-src/emacs/src/lisp.h /^CAR_SAFE (Lisp_Object c)$/
+CATCHER c-src/emacs/src/lisp.h 3021
+CDR c-src/emacs/src/lisp.h /^CDR (Lisp_Object c)$/
+CDR_SAFE c-src/emacs/src/lisp.h /^CDR_SAFE (Lisp_Object c)$/
+CFLAGS make-src/Makefile /^CFLAGS=${WARNINGS} -ansi -g3 # -pg -O$/
+CHAR c-src/etags.c /^#define CHAR(x) ((unsigned int)(x) & (CHARS - 1))/
+CHAR y-src/cccp.c 7
+CHARACTERBITS c-src/emacs/src/lisp.h 2457
+CHARS c-src/etags.c 157
+CHARTAB_SIZE_BITS c-src/emacs/src/lisp.h 1565
+CHARTAB_SIZE_BITS_0 c-src/emacs/src/lisp.h 1567
+CHARTAB_SIZE_BITS_1 c-src/emacs/src/lisp.h 1568
+CHARTAB_SIZE_BITS_2 c-src/emacs/src/lisp.h 1569
+CHARTAB_SIZE_BITS_3 c-src/emacs/src/lisp.h 1570
+CHAR_ALT c-src/emacs/src/lisp.h 2445
+CHAR_BIT c-src/emacs/src/lisp.h 2957
+CHAR_BIT c-src/emacs/src/lisp.h 2959
+CHAR_BIT c-src/emacs/src/lisp.h 2964
+CHAR_BIT c-src/emacs/src/lisp.h 2969
+CHAR_BIT c-src/emacs/src/lisp.h 2974
+CHAR_BIT c-src/emacs/src/lisp.h 2978
+CHAR_BIT c-src/emacs/src/lisp.h 2983
+CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 593
+CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 597
+CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 605
+CHAR_CTL c-src/emacs/src/lisp.h 2449
+CHAR_HYPER c-src/emacs/src/lisp.h 2447
+CHAR_META c-src/emacs/src/lisp.h 2450
+CHAR_MODIFIER_MASK c-src/emacs/src/lisp.h 2452
+CHAR_SHIFT c-src/emacs/src/lisp.h 2448
+CHAR_SUPER c-src/emacs/src/lisp.h 2446
+CHAR_TABLE_EXTRA_SLOTS c-src/emacs/src/lisp.h /^CHAR_TABLE_EXTRA_SLOTS (struct Lisp_Char_Table *ct/
+CHAR_TABLE_P c-src/emacs/src/lisp.h /^CHAR_TABLE_P (Lisp_Object a)$/
+CHAR_TABLE_REF c-src/emacs/src/lisp.h /^CHAR_TABLE_REF (Lisp_Object ct, int idx)$/
+CHAR_TABLE_REF_ASCII c-src/emacs/src/lisp.h /^CHAR_TABLE_REF_ASCII (Lisp_Object ct, ptrdiff_t id/
+CHAR_TABLE_SET c-src/emacs/src/lisp.h /^CHAR_TABLE_SET (Lisp_Object ct, int idx, Lisp_Obje/
+CHAR_TABLE_STANDARD_SLOTS c-src/emacs/src/lisp.h 1697
+CHAR_TYPE_SIZE y-src/cccp.y 87
+CHECKFLAGS make-src/Makefile /^CHECKFLAGS=-DDEBUG -Wno-unused-function$/
+CHECKOBJS make-src/Makefile /^CHECKOBJS=chkmalloc.o chkxm.o$/
+CHECK_ARRAY c-src/emacs/src/lisp.h /^CHECK_ARRAY (Lisp_Object x, Lisp_Object predicate)/
+CHECK_BOOL_VECTOR c-src/emacs/src/lisp.h /^CHECK_BOOL_VECTOR (Lisp_Object x)$/
+CHECK_BUFFER c-src/emacs/src/lisp.h /^CHECK_BUFFER (Lisp_Object x)$/
+CHECK_CONS c-src/emacs/src/lisp.h /^CHECK_CONS (Lisp_Object x)$/
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h 571
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h 572
+CHECK_LISP_OBJECT_TYPE c-src/emacs/src/lisp.h 579
+CHECK_LIST c-src/emacs/src/lisp.h /^CHECK_LIST (Lisp_Object x)$/
+CHECK_LIST_CONS c-src/emacs/src/lisp.h /^# define CHECK_LIST_CONS(x, y) lisp_h_CHECK_LIST_C/
+CHECK_NATNUM c-src/emacs/src/lisp.h /^CHECK_NATNUM (Lisp_Object x)$/
+CHECK_NUMBER c-src/emacs/src/lisp.h /^# define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x)$/
+CHECK_NUMBER_CAR c-src/emacs/src/lisp.h /^CHECK_NUMBER_CAR (Lisp_Object x)$/
+CHECK_NUMBER_CDR c-src/emacs/src/lisp.h /^CHECK_NUMBER_CDR (Lisp_Object x)$/
+CHECK_NUMBER_COERCE_MARKER c-src/emacs/src/lisp.h /^#define CHECK_NUMBER_COERCE_MARKER(x) \\$/
+CHECK_NUMBER_OR_FLOAT c-src/emacs/src/lisp.h /^CHECK_NUMBER_OR_FLOAT (Lisp_Object x)$/
+CHECK_NUMBER_OR_FLOAT_COERCE_MARKER c-src/emacs/src/lisp.h /^#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) /
+CHECK_PROCESS c-src/emacs/src/lisp.h /^CHECK_PROCESS (Lisp_Object x)$/
+CHECK_RANGED_INTEGER c-src/emacs/src/lisp.h /^#define CHECK_RANGED_INTEGER(x, lo, hi) \\$/
+CHECK_STRING_CAR c-src/emacs/src/lisp.h /^CHECK_STRING_CAR (Lisp_Object x)$/
+CHECK_SYMBOL c-src/emacs/src/lisp.h /^# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x)$/
+CHECK_TYPE c-src/emacs/src/lisp.h /^# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK/
+CHECK_TYPE_RANGED_INTEGER c-src/emacs/src/lisp.h /^#define CHECK_TYPE_RANGED_INTEGER(type, x) \\$/
+CHECK_VECTOR c-src/emacs/src/lisp.h /^CHECK_VECTOR (Lisp_Object x)$/
+CHECK_VECTOR_OR_STRING c-src/emacs/src/lisp.h /^CHECK_VECTOR_OR_STRING (Lisp_Object x)$/
+CHECK_WINDOW c-src/emacs/src/lisp.h /^CHECK_WINDOW (Lisp_Object x)$/
+CK_ABS_C y-src/parse.y /^#define CK_ABS_C(x) if((x)<MIN_COL || (x)>MAX_COL)/
+CK_ABS_R y-src/parse.y /^#define CK_ABS_R(x) if((x)<MIN_ROW || (x)>MAX_ROW)/
+CK_REL_C y-src/parse.y /^#define CK_REL_C(x) if( ((x)>0 && MAX_COL-(x)<cu/
+CK_REL_R y-src/parse.y /^#define CK_REL_R(x) if( ((x)>0 && MAX_ROW-(x)<cu/
+CMultiChannelCSC19_3D cp-src/c.C 2
+CNL c-src/etags.c /^#define CNL() \\$/
+CNL_SAVE_DEFINEDEF c-src/etags.c /^#define CNL_SAVE_DEFINEDEF() \\$/
+COBOLFLAGS make-src/Makefile /^COBOLFLAGS=--language=none --regex='\/.......[a-zA-/
+COLORS cp-src/screen.hpp 11
+COMPILEDP c-src/emacs/src/lisp.h /^COMPILEDP (Lisp_Object a)$/
+COMPILED_ARGLIST c-src/emacs/src/lisp.h 2431
+COMPILED_BYTECODE c-src/emacs/src/lisp.h 2432
+COMPILED_CONSTANTS c-src/emacs/src/lisp.h 2433
+COMPILED_DOC_STRING c-src/emacs/src/lisp.h 2435
+COMPILED_INTERACTIVE c-src/emacs/src/lisp.h 2436
+COMPILED_STACK_DEPTH c-src/emacs/src/lisp.h 2434
+CONDITION_CASE c-src/emacs/src/lisp.h 3021
+CONSP c-src/emacs/src/lisp.h /^# define CONSP(x) lisp_h_CONSP (x)$/
+CONSTYPE_HEAP c-src/emacs/src/lisp.h 3739
+CONSTYPE_PURE c-src/emacs/src/lisp.h 3739
+CONS_TO_INTEGER c-src/emacs/src/lisp.h /^#define CONS_TO_INTEGER(cons, type, var) \\$/
+CONVERT_CHARSTRING_TO_VALUE pas-src/common.pas /^procedure CONVERT_CHARSTRING_TO_VALUE;(*($/
+CPPFLAGS make-src/Makefile /^CPPFLAGS=${CHECKFLAGS} -DSTDC_HEADERS -DHAVE_GETCW/
+CPSRC make-src/Makefile /^CPSRC=c.C abstract.C abstract.H cfront.H burton.cp/
+CSRC make-src/Makefile /^CSRC=abbrev.c ..\/etags\/h.h .\/\/c.c torture.c getopt/
+CTAGS c-src/etags.c 146
+CTAGS c-src/etags.c 147
+CTAGS c-src/etags.c 149
+CTAGS make-src/Makefile /^CTAGS: ctags ${infiles}$/
+CTAGS% make-src/Makefile /^CTAGS%: ctags% ${infiles}$/
+CTAGS13 CTAGS14 CTAGS15 make-src/Makefile /^CTAGS13 CTAGS14 CTAGS15: ctags% ${infiles}$/
+CYAN cp-src/screen.hpp 15
+C_AUTO c-src/etags.c 2198
+C_EXT c-src/etags.c 2193
+C_JAVA c-src/etags.c 2197
+C_PLAIN c-src/etags.c 2194
+C_PLPL c-src/etags.c 2195
+C_STAR c-src/etags.c 2196
+C_entries c-src/etags.c /^C_entries (int c_ext, FILE *inf)$/
+C_stab_entry c-src/etags.c 2271
+C_symtype c-src/etags.c /^C_symtype (char *str, int len, int c_ext)$/
+ChangeFileType pas-src/common.pas /^function ChangeFileType; (*(FileName : NameString;/
+Circle.getPos lua-src/test.lua /^function Circle.getPos ()$/
+Cjava_entries c-src/etags.c /^Cjava_entries (FILE *inf)$/
+Cjava_help c-src/etags.c 551
+Cjava_suffixes c-src/etags.c 549
+ClassExample ruby-src/test.rb /^ class ClassExample$/
+Clear/p ada-src/2ataspri.adb /^ procedure Clear (Cell : in out TAS_Cell) is$/
+Clear/p ada-src/2ataspri.ads /^ procedure Clear (Cell : in out TAS_Cell)/
+Cobol_help c-src/etags.c 558
+Cobol_paragraphs c-src/etags.c /^Cobol_paragraphs (FILE *inf)$/
+Cobol_suffixes c-src/etags.c 556
+CommentAD php-src/lce_functions.php /^ function CommentAD($/
+CommentAD php-src/lce_functions.php 70
+ConcatT pas-src/common.pas /^function ConcatT;(*($/
+Concept Index tex-src/gzip.texi /^@node Concept Index, , Problems, Top$/
+Cond_Signal/p ada-src/2ataspri.adb /^ procedure Cond_Signal (Cond : in out Condition_/
+Cond_Signal/p ada-src/2ataspri.ads /^ procedure Cond_Signal (Cond : in out Condition_/
+Cond_Timed_Wait/p ada-src/2ataspri.adb /^ procedure Cond_Timed_Wait$/
+Cond_Timed_Wait/p ada-src/2ataspri.ads /^ procedure Cond_Timed_Wait$/
+Cond_Wait/p ada-src/2ataspri.adb /^ procedure Cond_Wait (Cond : in out Condition_Va/
+Cond_Wait/p ada-src/2ataspri.ads /^ procedure Cond_Wait (Cond : in out Condition_Va/
+Condition_Variable/t ada-src/2ataspri.ads /^ type Condition_Variable is private;$/
+Condition_Variable/t ada-src/2ataspri.ads /^ type Condition_Variable is$/
+Configure pyt-src/server.py /^class Configure(Frame, ControlEdit):$/
+ConfirmQuit pyt-src/server.py /^def ConfirmQuit(frame, context):$/
+Constant ruby-src/test1.ru 42
+ControlEdit pyt-src/server.py /^class ControlEdit(Frame):$/
+Controls pyt-src/server.py /^class Controls:$/
+CopyTextString pas-src/common.pas /^function CopyTextString;(*($/
+Copying tex-src/gzip.texi /^@node Copying, Overview, , Top$/
+Cplusplus_entries c-src/etags.c /^Cplusplus_entries (FILE *inf)$/
+Cplusplus_help c-src/etags.c 540
+Cplusplus_suffixes c-src/etags.c 535
+Create_LL_Task/p ada-src/2ataspri.adb /^ procedure Create_LL_Task$/
+Create_LL_Task/p ada-src/2ataspri.ads /^ procedure Create_LL_Task$/
+Cstar_entries c-src/etags.c /^Cstar_entries (FILE *inf)$/
+Cstar_suffixes c-src/etags.c 562
+Cube.data.getFoo lua-src/test.lua /^function Cube.data.getFoo ()$/
+D cp-src/fail.C /^ D() : ::A::T2::T(97), x(1066) {}$/
+D cp-src/fail.C 41
+DAEMON_RUNNING c-src/emacs/src/lisp.h 4258
+DAEMON_RUNNING c-src/emacs/src/lisp.h 4262
+DARKGRAY cp-src/screen.hpp 20
+DEAFUN c.c /^DEAFUN ("expand-file-name", Fexpand_file_name, Sex/
+DEBUG c-src/etags.c 84
+DEBUG c-src/etags.c 85
+DEBUG c-src/etags.c 87
+DEBUG objc-src/PackInsp.m 37
+DECLARE_GDB_SYM c-src/emacs/src/lisp.h /^#define DECLARE_GDB_SYM(type, id) type const id EX/
+DEFAULT_HASH_SIZE c-src/emacs/src/lisp.h 1940
+DEFAULT_REHASH_SIZE c-src/emacs/src/lisp.h 1950
+DEFAULT_REHASH_THRESHOLD c-src/emacs/src/lisp.h 1946
+DEFINE_GDB_SYMBOL_BEGIN c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_BEGIN(type, id) DECLARE/
+DEFINE_GDB_SYMBOL_BEGIN c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_BEGIN(type, id) extern /
+DEFINE_GDB_SYMBOL_END c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_END(id) = id;$/
+DEFINE_GDB_SYMBOL_END c-src/emacs/src/lisp.h /^# define DEFINE_GDB_SYMBOL_END(val) ;$/
+DEFINE_LISP_SYMBOL c-src/emacs/src/lisp.h /^#define DEFINE_LISP_SYMBOL(name) \\$/
+DEFINE_NON_NIL_Q_SYMBOL_MACROS c-src/emacs/src/lisp.h 755
+DEFSYM c-src/emacs/src/lisp.h /^#define DEFSYM(sym, name) \/* empty *\/$/
+DEFSYM c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (SYMBOL_CONSTANT_P, int, (Lisp_Ob/
+DEFUN c-src/emacs/src/lisp.h /^#define DEFUN(lname, fnname, sname, minargs, maxar/
+DEFUN_ARGS_0 c-src/emacs/src/lisp.h 714
+DEFUN_ARGS_1 c-src/emacs/src/lisp.h 715
+DEFUN_ARGS_2 c-src/emacs/src/lisp.h 716
+DEFUN_ARGS_3 c-src/emacs/src/lisp.h 717
+DEFUN_ARGS_4 c-src/emacs/src/lisp.h 718
+DEFUN_ARGS_5 c-src/emacs/src/lisp.h 719
+DEFUN_ARGS_6 c-src/emacs/src/lisp.h 721
+DEFUN_ARGS_7 c-src/emacs/src/lisp.h 723
+DEFUN_ARGS_8 c-src/emacs/src/lisp.h 725
+DEFUN_ARGS_MANY c-src/emacs/src/lisp.h 712
+DEFUN_ARGS_UNEVALLED c-src/emacs/src/lisp.h 713
+DEFUN_func2 c.c /^DEFUN_func2()$/
+DEFVAR_BOOL c-src/emacs/src/lisp.h /^#define DEFVAR_BOOL(lname, vname, doc) \\$/
+DEFVAR_BUFFER_DEFAULTS c-src/emacs/src/lisp.h /^#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) /
+DEFVAR_INT c-src/emacs/src/lisp.h /^#define DEFVAR_INT(lname, vname, doc) \\$/
+DEFVAR_KBOARD c-src/emacs/src/lisp.h /^#define DEFVAR_KBOARD(lname, vname, doc) \\$/
+DEFVAR_LISP c-src/emacs/src/lisp.h /^#define DEFVAR_LISP(lname, vname, doc) \\$/
+DEFVAR_LISP_NOPRO c-src/emacs/src/lisp.h /^#define DEFVAR_LISP_NOPRO(lname, vname, doc) \\$/
+DEVICE_LAST c-src/h.h 24
+DEVICE_SWP c-src/h.h 23
+DOS_NT c-src/etags.c 117
+DOS_NT c-src/etags.c 118
+DUMPED c-src/emacs/src/gmalloc.c 80
+Debug cp-src/functions.cpp /^void Debug ( int lineno, int level, char* func , c/
+Def_ ruby-src/test1.ru 12
+DisposeANameList pas-src/common.pas /^procedure DisposeANameList( $/
+DisposeNameList pas-src/common.pas /^procedure DisposeNameList;$/
+ELEM_I c-src/h.h 3
+ELSRC make-src/Makefile /^ELSRC=TAGTEST.EL emacs\/lisp\/progmodes\/etags.el$/
+EMACS_INT c-src/emacs/src/lisp.h 103
+EMACS_INT c-src/emacs/src/lisp.h 91
+EMACS_INT c-src/emacs/src/lisp.h 96
+EMACS_INT_MAX c-src/emacs/src/lisp.h 105
+EMACS_INT_MAX c-src/emacs/src/lisp.h 93
+EMACS_INT_MAX c-src/emacs/src/lisp.h 98
+EMACS_LISP_H c-src/emacs/src/lisp.h 22
+EMACS_NAME c-src/etags.c 786
+EMACS_UINT c-src/emacs/src/lisp.h 104
+EMACS_UINT c-src/emacs/src/lisp.h 92
+EMACS_UINT c-src/emacs/src/lisp.h 97
+ENTRY c-src/sysdep.h /^#define ENTRY(name) \\$/
+ENUM_BF c-src/emacs/src/lisp.h /^#define ENUM_BF(TYPE) enum TYPE$/
+ENUM_BF c-src/emacs/src/lisp.h /^#define ENUM_BF(TYPE) unsigned int$/
+EQ c-src/emacs/src/lisp.h /^# define EQ(x, y) lisp_h_EQ (x, y)$/
+EQUAL y-src/cccp.c 12
+ERLSRC make-src/Makefile /^ERLSRC=gs_dialog.erl lines.erl lists.erl$/
+ERROR y-src/cccp.c 9
+ERROR y-src/parse.y 304
+ETAGS make-src/Makefile /^ETAGS: FRC etags ${infiles}$/
+ETAGS% make-src/Makefile /^ETAGS%: FRC etags% ${infiles}$/
+ETAGS12 make-src/Makefile /^ETAGS12: etags12 ${infiles}$/
+ETAGS13 ETAGS14 ETAGS15 make-src/Makefile /^ETAGS13 ETAGS14 ETAGS15: etags% ${infiles}$/
+EXFUN c-src/emacs/src/lisp.h /^#define EXFUN(fnname, maxargs) \\$/
+EXTAGS make-src/Makefile /^EXTAGS: extags ${infiles} Makefile$/
+EXTERNALLY_VISIBLE c-src/emacs/src/keyboard.c 3497
+EXTERNALLY_VISIBLE c-src/emacs/src/keyboard.c 4372
+EmptyNmStr pas-src/common.pas /^function EmptyNmStr(* : NameString*);$/
+Environment tex-src/gzip.texi /^@node Environment, Tapes, Advanced usage, Top$/
+Erlang_functions c-src/etags.c /^Erlang_functions (FILE *inf)$/
+Erlang_help c-src/etags.c 567
+Erlang_suffixes c-src/etags.c 565
+ErrStrToNmStr pas-src/common.pas /^function ErrStrToNmStr;(*($/
+Error_Information/t ada-src/2ataspri.ads /^ type Error_Information is new Interfaces.C.POSI/
+Exit_LL_Task/p ada-src/2ataspri.adb /^ procedure Exit_LL_Task is$/
+Exit_LL_Task/p ada-src/2ataspri.ads /^ procedure Exit_LL_Task;$/
+ExtractCommentInfo pas-src/common.pas /^procedure ExtractCommentInfo; (*($/
+FASTCFLAGS make-src/Makefile /^FASTCFLAGS=-O3 -finline-functions -ffast-math -fun/
+FASTCFLAGSWARN make-src/Makefile /^FASTCFLAGSWARN=${WARNINGS} -Werror ${FASTCFLAGS}$/
+FILTER make-src/Makefile /^FILTER=grep -v '\\.[Cchefy][lor]*,[1-9][0-9]*' || t/
+FINALIZERP c-src/emacs/src/lisp.h /^FINALIZERP (Lisp_Object x)$/
+FINAL_FREE_BLOCKS c-src/emacs/src/gmalloc.c 135
+FIXNUM_BITS c-src/emacs/src/lisp.h 252
+FIXNUM_OVERFLOW_P c-src/emacs/src/lisp.h /^#define FIXNUM_OVERFLOW_P(i) \\$/
+FIXNUM_OVERFLOW_P c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (EQ, bool, (Lisp_Object x, Lisp_O/
+FLOATP c-src/emacs/src/lisp.h /^# define FLOATP(x) lisp_h_FLOATP (x)$/
+FLOAT_TO_STRING_BUFSIZE c-src/emacs/src/lisp.h 3927
+FORTHSRC make-src/Makefile /^FORTHSRC=test-forth.fth$/
+FOR_EACH_ALIST_VALUE c-src/emacs/src/lisp.h /^#define FOR_EACH_ALIST_VALUE(head_var, list_var, v/
+FOR_EACH_TAIL c-src/emacs/src/lisp.h /^#define FOR_EACH_TAIL(hare, list, tortoise, n) \\$/
+FRAMEP c-src/emacs/src/lisp.h /^FRAMEP (Lisp_Object a)$/
+FRC make-src/Makefile /^FRC:;$/
+FREEFLOOD c-src/emacs/src/gmalloc.c 1858
+FSRC make-src/Makefile /^FSRC=entry.for entry.strange_suffix entry.strange$/
+FUN0 y-src/parse.y /^yylex FUN0()$/
+FUN1 y-src/parse.y /^str_to_col FUN1(char **,str)$/
+FUN1 y-src/parse.y /^yyerror FUN1(char *, s)$/
+FUN2 y-src/parse.y /^make_list FUN2(YYSTYPE, car, YYSTYPE, cdr)$/
+FUN2 y-src/parse.y /^parse_cell_or_range FUN2(char **,ptr, struct rng */
+FUNCTIONP c-src/emacs/src/lisp.h /^FUNCTIONP (Lisp_Object obj)$/
+FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 4766
+FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 5061
+F_getit c-src/etags.c /^F_getit (FILE *inf)$/
+F_takeprec c-src/etags.c /^F_takeprec (void)$/
+Fabbrev_expansion c-src/abbrev.c /^DEFUN ("abbrev-expansion", Fabbrev_expansion, Sabb/
+Fabbrev_symbol c-src/abbrev.c /^DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_sy/
+Fabort_recursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("abort-recursive-edit", Fabort_recursive_ed/
+Fails_t c-src/h.h 5
+Fclear_abbrev_table c-src/abbrev.c /^DEFUN ("clear-abbrev-table", Fclear_abbrev_table, /
+Fclear_this_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("clear-this-command-keys", Fclear_this_comm/
+Fcommand_error_default_function c-src/emacs/src/keyboard.c /^DEFUN ("command-error-default-function", Fcommand_/
+Fcurrent_idle_time c-src/emacs/src/keyboard.c /^DEFUN ("current-idle-time", Fcurrent_idle_time, Sc/
+Fcurrent_input_mode c-src/emacs/src/keyboard.c /^DEFUN ("current-input-mode", Fcurrent_input_mode, /
+Fdefine_abbrev c-src/abbrev.c /^DEFUN ("define-abbrev", Fdefine_abbrev, Sdefine_ab/
+Fdefine_abbrev_table c-src/abbrev.c /^DEFUN ("define-abbrev-table", Fdefine_abbrev_table/
+Fdefine_global_abbrev c-src/abbrev.c /^DEFUN ("define-global-abbrev", Fdefine_global_abbr/
+Fdefine_mode_abbrev c-src/abbrev.c /^DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, /
+Fdiscard_input c-src/emacs/src/keyboard.c /^DEFUN ("discard-input", Fdiscard_input, Sdiscard_i/
+Fevent_convert_list c-src/emacs/src/keyboard.c /^DEFUN ("event-convert-list", Fevent_convert_list, /
+Fevent_symbol_parse_modifiers c-src/emacs/src/keyboard.c /^DEFUN ("internal-event-symbol-parse-modifiers", Fe/
+Fexit_recursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("exit-recursive-edit", Fexit_recursive_edit/
+Fexpand_abbrev c-src/abbrev.c /^DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_ab/
+Finalize_Cond/p ada-src/2ataspri.adb /^ procedure Finalize_Cond (Cond : in out Conditio/
+Finalize_Cond/p ada-src/2ataspri.ads /^ procedure Finalize_Cond (Cond : in out Conditio/
+Finalize_Lock/p ada-src/2ataspri.adb /^ procedure Finalize_Lock (L : in out Lock) is$/
+Finalize_Lock/p ada-src/2ataspri.ads /^ procedure Finalize_Lock (L : in out Lock);$/
+Finalize_TAS_Cell/p ada-src/2ataspri.adb /^ procedure Finalize_TAS_Cell (Cell : in out TAS_/
+Finalize_TAS_Cell/p ada-src/2ataspri.ads /^ procedure Finalize_TAS_Cell (Cell : in out TA/
+Finput_pending_p c-src/emacs/src/keyboard.c /^DEFUN ("input-pending-p", Finput_pending_p, Sinput/
+Finsert_abbrev_table_description c-src/abbrev.c /^DEFUN ("insert-abbrev-table-description", Finsert_/
+First100Chars pas-src/common.pas /^procedure First100Chars; (*($/
+Fmake_abbrev_table c-src/abbrev.c /^DEFUN ("make-abbrev-table", Fmake_abbrev_table, Sm/
+Foo perl-src/kai-test.pl /^package Foo;$/
+Foo::Bar perl-src/kai-test.pl /^package Foo::Bar;$/
+Fopen_dribble_file c-src/emacs/src/keyboard.c /^DEFUN ("open-dribble-file", Fopen_dribble_file, So/
+Forth_help c-src/etags.c 573
+Forth_suffixes c-src/etags.c 571
+Forth_words c-src/etags.c /^Forth_words (FILE *inf)$/
+Fortran_functions c-src/etags.c /^Fortran_functions (FILE *inf)$/
+Fortran_help c-src/etags.c 579
+Fortran_suffixes c-src/etags.c 577
+Fposn_at_point c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_p/
+Fposn_at_x_y c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, /
+Fread_key_sequence c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence", Fread_key_sequence, Sr/
+Fread_key_sequence_vector c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence-vector", Fread_key_seque/
+Frecent_keys c-src/emacs/src/keyboard.c /^DEFUN ("recent-keys", Frecent_keys, Srecent_keys, /
+Frecursion_depth c-src/emacs/src/keyboard.c /^DEFUN ("recursion-depth", Frecursion_depth, Srecur/
+Frecursive_edit c-src/emacs/src/keyboard.c /^DEFUN ("recursive-edit", Frecursive_edit, Srecursi/
+Freset_this_command_lengths c-src/emacs/src/keyboard.c /^DEFUN ("reset-this-command-lengths", Freset_this_c/
+Fset_input_interrupt_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-interrupt-mode", Fset_input_inte/
+Fset_input_meta_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-meta-mode", Fset_input_meta_mode/
+Fset_input_mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-mode", Fset_input_mode, Sset_inp/
+Fset_output_flow_control c-src/emacs/src/keyboard.c /^DEFUN ("set-output-flow-control", Fset_output_flow/
+Fset_quit_char c-src/emacs/src/keyboard.c /^DEFUN ("set-quit-char", Fset_quit_char, Sset_quit_/
+Fsuspend_emacs c-src/emacs/src/keyboard.c /^DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_e/
+Fthis_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys", Fthis_command_keys, St/
+Fthis_command_keys_vector c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys-vector", Fthis_command_k/
+Fthis_single_command_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-keys", Fthis_single_co/
+Fthis_single_command_raw_keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-raw-keys", Fthis_singl/
+Ftop_level c-src/emacs/src/keyboard.c /^DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, /
+Ftrack_mouse c-src/emacs/src/keyboard.c /^DEFUN ("internal--track-mouse", Ftrack_mouse, Stra/
+Funexpand_abbrev c-src/abbrev.c /^DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexp/
+Fx_get_selection_internal c.c /^ Fx_get_selection_internal, Sx_get_selection/
+Fx_get_selection_internal c.c /^DEFUN ("x-get-selection-internal", Fx_get_selectio/
+Fy_get_selection_internal c.c /^ Fy_get_selection_internal, Sy_get_selection_/
+GCALIGNED c-src/emacs/src/lisp.h 288
+GCALIGNED c-src/emacs/src/lisp.h 290
+GCALIGNMENT c-src/emacs/src/lisp.h 243
+GCPRO1 c-src/emacs/src/lisp.h /^#define GCPRO1(a) \\$/
+GCPRO1 c-src/emacs/src/lisp.h /^#define GCPRO1(varname) ((void) gcpro1)$/
+GCPRO2 c-src/emacs/src/lisp.h /^#define GCPRO2(a, b) \\$/
+GCPRO2 c-src/emacs/src/lisp.h /^#define GCPRO2(varname1, varname2) ((void) gcpro2,/
+GCPRO3 c-src/emacs/src/lisp.h /^#define GCPRO3(a, b, c) \\$/
+GCPRO3 c-src/emacs/src/lisp.h /^#define GCPRO3(varname1, varname2, varname3) \\$/
+GCPRO4 c-src/emacs/src/lisp.h /^#define GCPRO4(a, b, c, d) \\$/
+GCPRO4 c-src/emacs/src/lisp.h /^#define GCPRO4(varname1, varname2, varname3, varna/
+GCPRO5 c-src/emacs/src/lisp.h /^#define GCPRO5(a, b, c, d, e) \\$/
+GCPRO5 c-src/emacs/src/lisp.h /^#define GCPRO5(varname1, varname2, varname3, varna/
+GCPRO6 c-src/emacs/src/lisp.h /^#define GCPRO6(a, b, c, d, e, f) \\$/
+GCPRO6 c-src/emacs/src/lisp.h /^#define GCPRO6(varname1, varname2, varname3, varna/
+GCPRO7 c-src/emacs/src/lisp.h /^#define GCPRO7(a, b, c, d, e, f, g) \\$/
+GCPRO7 c-src/emacs/src/lisp.h /^#define GCPRO7(a, b, c, d, e, f, g) (GCPRO6 (a, b,/
+GCTYPEBITS c-src/emacs/src/lisp.h /^DEFINE_GDB_SYMBOL_BEGIN (int, GCTYPEBITS)$/
+GCTYPEBITS c-src/emacs/src/lisp.h 67
+GC_MAKE_GCPROS_NOOPS c-src/emacs/src/lisp.h 3172
+GC_MARK_STACK c-src/emacs/src/lisp.h 3177
+GC_MARK_STACK_CHECK_GCPROS c-src/emacs/src/lisp.h 3173
+GC_USE_GCPROS_AS_BEFORE c-src/emacs/src/lisp.h 3171
+GC_USE_GCPROS_CHECK_ZOMBIES c-src/emacs/src/lisp.h 3174
+GE y-src/parse.c 8
+GENERIC_PTR y-src/cccp.y 56
+GENERIC_PTR y-src/cccp.y 58
+GEQ y-src/cccp.c 15
+GETOPTOBJS make-src/Makefile /^GETOPTOBJS= #getopt.o getopt1.o$/
+GREEN cp-src/screen.hpp 14
+GROW_RAW_KEYBUF c-src/emacs/src/keyboard.c 119
+GatherControls pyt-src/server.py /^ def GatherControls(self):$/
+GetLayerByName lua-src/allegro.lua /^function GetLayerByName (name)$/
+GetNameList pas-src/common.pas /^function GetNameList; (* : BinNodePointer;*)$/
+GetNewNameListNode pas-src/common.pas /^function GetNewNameListNode;(*($/
+GetTextRef pas-src/common.pas /^function GetTextRef;(*($/
+GetUniqueLayerName lua-src/allegro.lua /^function GetUniqueLayerName ()$/
+Get_Own_Priority/f ada-src/2ataspri.adb /^ function Get_Own_Priority return System.Any_Pri/
+Get_Own_Priority/f ada-src/2ataspri.ads /^ function Get_Own_Priority return System.Any_Pri/
+Get_Priority/f ada-src/2ataspri.adb /^ function Get_Priority (T : TCB_Ptr) return Syst/
+Get_Priority/f ada-src/2ataspri.ads /^ function Get_Priority (T : TCB_Ptr) return Syst/
+HASH_HASH c-src/emacs/src/lisp.h /^HASH_HASH (struct Lisp_Hash_Table *h, ptrdiff_t id/
+HASH_INDEX c-src/emacs/src/lisp.h /^HASH_INDEX (struct Lisp_Hash_Table *h, ptrdiff_t i/
+HASH_KEY c-src/emacs/src/lisp.h /^HASH_KEY (struct Lisp_Hash_Table *h, ptrdiff_t idx/
+HASH_NEXT c-src/emacs/src/lisp.h /^HASH_NEXT (struct Lisp_Hash_Table *h, ptrdiff_t id/
+HASH_TABLE_P c-src/emacs/src/lisp.h /^HASH_TABLE_P (Lisp_Object a)$/
+HASH_TABLE_SIZE c-src/emacs/src/lisp.h /^HASH_TABLE_SIZE (struct Lisp_Hash_Table *h)$/
+HASH_VALUE c-src/emacs/src/lisp.h /^HASH_VALUE (struct Lisp_Hash_Table *h, ptrdiff_t i/
+HAVE_NTGUI c-src/etags.c 116
+HEAP c-src/emacs/src/gmalloc.c 131
+HTMLSRC make-src/Makefile /^HTMLSRC=softwarelibero.html index.shtml algrthms.h/
+HTML_help c-src/etags.c 584
+HTML_labels c-src/etags.c /^HTML_labels (FILE *inf)$/
+HTML_suffixes c-src/etags.c 582
+IEEE_FLOATING_POINT c-src/emacs/src/lisp.h 2415
+IMAGEP c-src/emacs/src/lisp.h /^IMAGEP (Lisp_Object x)$/
+INPUT_EVENT_POS_MAX c-src/emacs/src/keyboard.c 3698
+INPUT_EVENT_POS_MIN c-src/emacs/src/keyboard.c 3701
+INSERT_TREE_NODE pas-src/common.pas /^procedure INSERT_TREE_NODE;(*( $/
+INSTANTIATE_MDIAGARRAY_FRIENDS cp-src/MDiagArray2.h /^#define INSTANTIATE_MDIAGARRAY_FRIENDS(T) \\$/
+INT c-src/h.h 32
+INT y-src/cccp.c 6
+INTEGERP c-src/emacs/src/lisp.h /^# define INTEGERP(x) lisp_h_INTEGERP (x)$/
+INTEGER_TO_CONS c-src/emacs/src/lisp.h /^#define INTEGER_TO_CONS(i) \\$/
+INTERVAL c-src/emacs/src/lisp.h 1149
+INTMASK c-src/emacs/src/lisp.h 437
+INTTYPEBITS c-src/emacs/src/lisp.h 249
+INT_BIT c-src/emacs/src/gmalloc.c 124
+INT_TYPE_SIZE y-src/cccp.y 91
+ISALNUM c-src/etags.c /^#define ISALNUM(c) isalnum (CHAR (c))$/
+ISALPHA c-src/etags.c /^#define ISALPHA(c) isalpha (CHAR (c))$/
+ISDIGIT c-src/etags.c /^#define ISDIGIT(c) isdigit (CHAR (c))$/
+ISLOWER c-src/etags.c /^#define ISLOWER(c) islower (CHAR (c))$/
+ISO_FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 5149
+ISUPPER c-src/etags.c /^# define ISUPPER(c) isupper (CHAR (c))$/
+IS_DAEMON c-src/emacs/src/lisp.h 4257
+IS_DAEMON c-src/emacs/src/lisp.h 4261
+InitNameList pas-src/common.pas /^procedure InitNameList;$/
+InitNameStringPool pas-src/common.pas /^procedure InitNameStringPool;$/
+InitializeStringPackage pas-src/common.pas /^procedure InitializeStringPackage;$/
+Initialize_Cond/p ada-src/2ataspri.adb /^ procedure Initialize_Cond (Cond : in out Condit/
+Initialize_Cond/p ada-src/2ataspri.ads /^ procedure Initialize_Cond (Cond : in out Condit/
+Initialize_LL_Tasks/p ada-src/2ataspri.adb /^ procedure Initialize_LL_Tasks (T : TCB_Ptr) is$/
+Initialize_LL_Tasks/p ada-src/2ataspri.ads /^ procedure Initialize_LL_Tasks (T : TCB_Ptr);$/
+Initialize_Lock/p ada-src/2ataspri.adb /^ procedure Initialize_Lock$/
+Initialize_Lock/p ada-src/2ataspri.ads /^ procedure Initialize_Lock (Prio : System.Any_Pr/
+Initialize_TAS_Cell/p ada-src/2ataspri.adb /^ procedure Initialize_TAS_Cell (Cell : out TAS_C/
+Initialize_TAS_Cell/p ada-src/2ataspri.ads /^ procedure Initialize_TAS_Cell (Cell : out TA/
+Inner1/b ada-src/etags-test-for.ada /^ package body Inner1 is$/
+Inner1/b ada-src/waroquiers.ada /^ package body Inner1 is$/
+Inner1/s ada-src/etags-test-for.ada /^ package Inner1 is$/
+Inner1/s ada-src/waroquiers.ada /^ package Inner1 is$/
+Inner2/b ada-src/etags-test-for.ada /^ package body Inner2 is$/
+Inner2/b ada-src/waroquiers.ada /^ package body Inner2 is$/
+Inner2/s ada-src/etags-test-for.ada /^ package Inner2 is$/
+Inner2/s ada-src/waroquiers.ada /^ package Inner2 is$/
+Install_Abort_Handler/p ada-src/2ataspri.adb /^ procedure Install_Abort_Handler (Handler : Abor/
+Install_Abort_Handler/p ada-src/2ataspri.ads /^ procedure Install_Abort_Handler (Handler : Abor/
+Install_Error_Handler/p ada-src/2ataspri.adb /^ procedure Install_Error_Handler (Handler : Syst/
+Install_Error_Handler/p ada-src/2ataspri.ads /^ procedure Install_Error_Handler (Handler : Syst/
+Invoking gzip tex-src/gzip.texi /^@node Invoking gzip, Advanced usage, Sample, Top$/
+IpAddrKind rs-src/test.rs 3
+IsControlChar pas-src/common.pas /^function IsControlChar; (*($/
+IsControlCharName pas-src/common.pas /^function IsControlCharName($/
+Is_Set/f ada-src/2ataspri.adb /^ function Is_Set (Cell : in TAS_Cell) return Bo/
+Is_Set/f ada-src/2ataspri.ads /^ function Is_Set (Cell : in TAS_Cell)/
+JAVASRC make-src/Makefile /^JAVASRC=AWTEMul.java KeyEve.java SMan.java SysCol./
+KBD_BUFFER_SIZE c-src/emacs/src/keyboard.c 82
+KBYTES objc-src/PackInsp.m 58
+KEY_TO_CHAR c-src/emacs/src/keyboard.c /^#define KEY_TO_CHAR(k) (XINT (k) & ((1 << CHARACTE/
+LATEST make-src/Makefile /^LATEST=17$/
+LCE_COMMENT php-src/lce_functions.php 13
+LCE_COMMENT_TOOL php-src/lce_functions.php 17
+LCE_COMMENT_USER php-src/lce_functions.php 15
+LCE_FUNCTIONS php-src/lce_functions.php 4
+LCE_MSGID php-src/lce_functions.php 19
+LCE_MSGSTR php-src/lce_functions.php 21
+LCE_TEXT php-src/lce_functions.php 23
+LCE_UNKNOWN php-src/lce_functions.php 9
+LCE_WS php-src/lce_functions.php 11
+LDFLAGS make-src/Makefile /^LDFLAGS=#-static -lc_p$/
+LE y-src/parse.c 7
+LEQ y-src/cccp.c 14
+LIGHTBLUE cp-src/screen.hpp 21
+LIGHTCYAN cp-src/screen.hpp 23
+LIGHTGRAY cp-src/screen.hpp 19
+LIGHTGREEN cp-src/screen.hpp 22
+LIGHTMAGENTA cp-src/screen.hpp 25
+LIGHTRED cp-src/screen.hpp 24
+LISP_INITIALLY c-src/emacs/src/lisp.h /^#define LISP_INITIALLY(i) (i)$/
+LISP_INITIALLY c-src/emacs/src/lisp.h /^#define LISP_INITIALLY(i) {i}$/
+LISP_INITIALLY_ZERO c-src/emacs/src/lisp.h 582
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^#define LISP_MACRO_DEFUN(name, type, argdecls, arg/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (CONSP, bool, (Lisp_Object x), (x/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (NILP, bool, (Lisp_Object x), (x)/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (SYMBOL_VAL, Lisp_Object, (struct/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XCAR, Lisp_Object, (Lisp_Object /
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XCONS, struct Lisp_Cons *, (Lisp/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XHASH, EMACS_INT, (Lisp_Object a/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XLI, EMACS_INT, (Lisp_Object o),/
+LISP_MACRO_DEFUN c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN (XPNTR, void *, (Lisp_Object a), /
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^#define LISP_MACRO_DEFUN_VOID(name, argdecls, args/
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN_VOID (CHECK_LIST_CONS, (Lisp_Obje/
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN_VOID (CHECK_TYPE,$/
+LISP_MACRO_DEFUN_VOID c-src/emacs/src/lisp.h /^LISP_MACRO_DEFUN_VOID (SET_SYMBOL_VAL,$/
+LISTCONTENTS objc-src/PackInsp.m 39
+LISTCONTENTSBUTTON objc-src/PackInsp.m 48
+LISTDESCRIPTIONBUTTON objc-src/PackInsp.m 49
+LL_Assert/p ada-src/2ataspri.adb /^ procedure LL_Assert (B : Boolean; M : String) i/
+LL_Assert/p ada-src/2ataspri.ads /^ procedure LL_Assert (B : Boolean; M : String);$/
+LL_Task_Procedure_Access/t ada-src/2ataspri.ads /^ type LL_Task_Procedure_Access is access procedu/
+LL_Task_Procedure_Access/t ada-src/etags-test-for.ada /^ type LL_Task_Procedure_Access is access procedu/
+LL_Wrapper/p ada-src/2ataspri.adb /^ procedure LL_Wrapper (T : TCB_Ptr) is$/
+LL_Wrapper/p ada-src/2ataspri.adb /^ procedure LL_Wrapper (T : TCB_Ptr);$/
+LL_Wrapper/p ada-src/etags-test-for.ada /^ procedure LL_Wrapper (T : TCB_Ptr);$/
+LOCALIZE objc-src/PackInsp.m /^#define LOCALIZE(s) NXLoadLocalizedStringFromTabl/
+LOCALIZE_ARCH objc-src/PackInsp.m /^#define LOCALIZE_ARCH(s) NXLoadLocalizedStringFrom/
+LOCK c-src/emacs/src/gmalloc.c /^#define LOCK() \\$/
+LOCK c-src/emacs/src/gmalloc.c /^#define LOCK()$/
+LOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define LOCK_ALIGNED_BLOCKS() \\$/
+LOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define LOCK_ALIGNED_BLOCKS()$/
+LONG_TYPE_SIZE y-src/cccp.y 95
+LOOKING_AT c-src/etags.c /^#define LOOKING_AT(cp, kw) \/* kw is the keyword, /
+LOOKING_AT_NOCASE c-src/etags.c /^#define LOOKING_AT_NOCASE(cp, kw) \/* the keyword i/
+LOOKUP objc-src/PackInsp.m /^#define LOOKUP(key, notfound) ([table isKey:key] ?/
+LOOKUP objc-src/PackInsp.m 176
+LOOP_ON_INPUT_LINES c-src/etags.c /^#define LOOP_ON_INPUT_LINES(file_pointer, line_buf/
+LSH y-src/cccp.c 16
+LTGT cp-src/MDiagArray2.h 144
+LTGT cp-src/MDiagArray2.h 35
+LTGT cp-src/MDiagArray2.h 39
+LTGT cp-src/MDiagArray2.h 42
+LUASRC make-src/Makefile /^LUASRC=allegro.lua$/
+L_CELL y-src/parse.c 10
+L_CONST y-src/parse.c 13
+L_FN0 y-src/parse.c 14
+L_FN1 y-src/parse.c 15
+L_FN1R y-src/parse.c 20
+L_FN2 y-src/parse.c 16
+L_FN2R y-src/parse.c 21
+L_FN3 y-src/parse.c 17
+L_FN3R y-src/parse.c 22
+L_FN4 y-src/parse.c 18
+L_FN4R y-src/parse.c 23
+L_FNN y-src/parse.c 19
+L_FNNR y-src/parse.c 24
+L_GE y-src/parse.c 27
+L_LE y-src/parse.c 25
+L_NE y-src/parse.c 26
+L_RANGE y-src/parse.c 11
+L_VAR y-src/parse.c 12
+L_getit c-src/etags.c /^L_getit (void)$/
+LabeledEntry pyt-src/server.py /^class LabeledEntry(Frame):$/
+Lang_function c-src/etags.c 182
+Lang_function c-src/h.h 6
+Lisp_Bits c-src/emacs/src/lisp.h 239
+Lisp_Bool_Vector c-src/emacs/src/lisp.h 1384
+Lisp_Boolfwd c-src/emacs/src/lisp.h 2284
+Lisp_Buffer_Local_Value c-src/emacs/src/lisp.h 2334
+Lisp_Buffer_Objfwd c-src/emacs/src/lisp.h 2302
+Lisp_Char_Table c-src/emacs/src/lisp.h 1575
+Lisp_Compiled c-src/emacs/src/lisp.h 2429
+Lisp_Cons c-src/emacs/src/lisp.h 475
+Lisp_Finalizer c-src/emacs/src/lisp.h 2186
+Lisp_Float c-src/emacs/src/lisp.h 2391
+Lisp_Float c-src/emacs/src/lisp.h 477
+Lisp_Free c-src/emacs/src/lisp.h 2201
+Lisp_Fwd c-src/emacs/src/lisp.h 2368
+Lisp_Fwd_Bool c-src/emacs/src/lisp.h 505
+Lisp_Fwd_Buffer_Obj c-src/emacs/src/lisp.h 507
+Lisp_Fwd_Int c-src/emacs/src/lisp.h 504
+Lisp_Fwd_Kboard_Obj c-src/emacs/src/lisp.h 508
+Lisp_Fwd_Obj c-src/emacs/src/lisp.h 506
+Lisp_Fwd_Type c-src/emacs/src/lisp.h 502
+Lisp_Hash_Table c-src/emacs/src/lisp.h 1823
+Lisp_Int0 c-src/emacs/src/lisp.h 461
+Lisp_Int1 c-src/emacs/src/lisp.h 462
+Lisp_Intfwd c-src/emacs/src/lisp.h 2274
+Lisp_Kboard_Objfwd c-src/emacs/src/lisp.h 2362
+Lisp_Marker c-src/emacs/src/lisp.h 1978
+Lisp_Misc c-src/emacs/src/lisp.h 2212
+Lisp_Misc c-src/emacs/src/lisp.h 458
+Lisp_Misc_Any c-src/emacs/src/lisp.h 1971
+Lisp_Misc_Finalizer c-src/emacs/src/lisp.h 491
+Lisp_Misc_Float c-src/emacs/src/lisp.h 494
+Lisp_Misc_Free c-src/emacs/src/lisp.h 487
+Lisp_Misc_Limit c-src/emacs/src/lisp.h 496
+Lisp_Misc_Marker c-src/emacs/src/lisp.h 488
+Lisp_Misc_Overlay c-src/emacs/src/lisp.h 489
+Lisp_Misc_Save_Value c-src/emacs/src/lisp.h 490
+Lisp_Misc_Type c-src/emacs/src/lisp.h 485
+Lisp_Object c-src/emacs/src/lisp.h 567
+Lisp_Object c-src/emacs/src/lisp.h 577
+Lisp_Objfwd c-src/emacs/src/lisp.h 2294
+Lisp_Overlay c-src/emacs/src/lisp.h 2021
+Lisp_Save_Type c-src/emacs/src/lisp.h 2064
+Lisp_Save_Value c-src/emacs/src/lisp.h 2110
+Lisp_String c-src/emacs/src/lisp.h 466
+Lisp_Sub_Char_Table c-src/emacs/src/lisp.h 1606
+Lisp_Subr c-src/emacs/src/lisp.h 1670
+Lisp_Symbol c-src/emacs/src/lisp.h 454
+Lisp_Symbol c-src/emacs/src/lisp.h 654
+Lisp_Type c-src/emacs/src/lisp.h 451
+Lisp_Vector c-src/emacs/src/lisp.h 1369
+Lisp_Vectorlike c-src/emacs/src/lisp.h 472
+Lisp_functions c-src/etags.c /^Lisp_functions (FILE *inf)$/
+Lisp_help c-src/etags.c 591
+Lisp_suffixes c-src/etags.c 589
+ListEdit pyt-src/server.py /^class ListEdit(Frame):$/
+Locate pas-src/common.pas /^function Locate; (*($/
+Lock/t ada-src/2ataspri.ads /^ type Lock is private;$/
+Lock/t ada-src/2ataspri.ads /^ type Lock is$/
+LowerCaseNmStr pas-src/common.pas /^function LowerCaseNmStr; (*($/
+Lua_functions c-src/etags.c /^Lua_functions (FILE *inf)$/
+Lua_help c-src/etags.c 600
+Lua_suffixes c-src/etags.c 598
+MAGENTA cp-src/screen.hpp 17
+MAGICBYTE c-src/emacs/src/gmalloc.c 1856
+MAGICFREE c-src/emacs/src/gmalloc.c 1855
+MAGICWORD c-src/emacs/src/gmalloc.c 1854
+MAKE make-src/Makefile /^MAKE:=$(MAKE) --no-print-directory$/
+MAKESRC make-src/Makefile /^MAKESRC=Makefile$/
+MALLOCFLOOD c-src/emacs/src/gmalloc.c 1857
+MANY c-src/emacs/src/lisp.h 2833
+MARKERP c-src/emacs/src/lisp.h /^# define MARKERP(x) lisp_h_MARKERP (x)$/
+MAXPATHLEN c-src/etags.c 115
+MAX_ALLOCA c-src/emacs/src/lisp.h 4556
+MAX_ENCODED_BYTES c-src/emacs/src/keyboard.c 2254
+MAX_HASH_VALUE c-src/etags.c 2329
+MAX_WORD_LENGTH c-src/etags.c 2327
+MAYBEREL y-src/parse.y /^#define MAYBEREL(p) (*(p)=='[' && (isdigit((p)[1])/
+MBYTES objc-src/PackInsp.m 59
+MCHECK_DISABLED c-src/emacs/src/gmalloc.c 285
+MCHECK_FREE c-src/emacs/src/gmalloc.c 287
+MCHECK_HEAD c-src/emacs/src/gmalloc.c 288
+MCHECK_OK c-src/emacs/src/gmalloc.c 286
+MCHECK_TAIL c-src/emacs/src/gmalloc.c 289
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (T *d, int r, int c) : DiagArray2<T>/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (const Array<T>& a) : DiagArray2<T> /
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (const DiagArray2<T>& a) : DiagArray/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (const MDiagArray2<T>& a) : DiagArra/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (int r, int c) : DiagArray2<T> (r, c/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (int r, int c, const T& val) : DiagA/
+MDiagArray2 cp-src/MDiagArray2.h /^ MDiagArray2 (void) : DiagArray2<T> () { }$/
+MDiagArray2 cp-src/MDiagArray2.h 78
+MIN_HASH_VALUE c-src/etags.c 2328
+MIN_WORD_LENGTH c-src/etags.c 2326
+MISCP c-src/emacs/src/lisp.h /^# define MISCP(x) lisp_h_MISCP (x)$/
+MOST_NEGATIVE_FIXNUM c-src/emacs/src/lisp.h 835
+MOST_POSITIVE_FIXNUM c-src/emacs/src/lisp.h 834
+MOVE c-src/sysdep.h /^#define MOVE(x,y) movl x, y$/
+MSDOS c-src/etags.c 100
+MSDOS c-src/etags.c 106
+MSDOS c-src/etags.c 107
+MSDOS c-src/etags.c 110
+MSGSEL f-src/entry.for /^ ENTRY MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange /^ ENTRY MSGSEL ( TYPE )$/
+MSGSEL f-src/entry.strange_suffix /^ ENTRY MSGSEL ( TYPE )$/
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c /^#define MULTI_LETTER_MOD(BIT, NAME, LEN) \\$/
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c /^#define MULTI_LETTER_MOD(BIT, NAME, LEN) \\$/
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c 6231
+MULTI_LETTER_MOD c-src/emacs/src/keyboard.c 6764
+Machin_T/b ada-src/waroquiers.ada /^ protected body Machin_T is$/
+Machin_T/t ada-src/etags-test-for.ada /^ protected Machin_T is$/
+Machin_T/t ada-src/etags-test-for.ada /^ protected type Machin_T is$/
+Machin_T/t ada-src/waroquiers.ada /^ protected type Machin_T is$/
+Machine_Exceptions/t ada-src/2ataspri.ads /^ type Machine_Exceptions is new Interfaces.C.POS/
+MakeDispose pyt-src/server.py /^ def MakeDispose(self):$/
+MakeSitelist pyt-src/server.py /^ def MakeSitelist(self, master):$/
+Makefile_filenames c-src/etags.c 603
+Makefile_help c-src/etags.c 605
+Makefile_targets c-src/etags.c /^Makefile_targets (FILE *inf)$/
+Mc cp-src/c.C /^int main (void) { my_function0(0); my_function1(1)/
+Mcccp y-src/cccp.y /^main ()$/
+Mconway.cpp cp-src/conway.cpp /^void main(void)$/
+Metags c-src/etags.c /^main (int argc, char **argv)$/
+Mfail cp-src/fail.C /^main()$/
+Mkai-test.pl perl-src/kai-test.pl /^package main;$/
+ModuleExample ruby-src/test.rb /^module ModuleExample$/
+More_Lisp_Bits c-src/emacs/src/lisp.h 801
+MoveLayerAfter lua-src/allegro.lua /^function MoveLayerAfter (this_one)$/
+MoveLayerBefore lua-src/allegro.lua /^function MoveLayerBefore (this_one)$/
+MoveLayerBottom lua-src/allegro.lua /^function MoveLayerBottom ()$/
+MoveLayerTop lua-src/allegro.lua /^function MoveLayerTop ()$/
+Mtest.go go-src/test.go /^func main() {$/
+Mtest.go go-src/test.go 1
+Mtest.rs rs-src/test.rs /^fn main() {$/
+Mtest1.go go-src/test1.go /^func main() {$/
+Mtest1.go go-src/test1.go 1
+Mx.cc cp-src/x.cc /^main(int argc, char *argv[])$/
+NAME y-src/cccp.c 8
+NATNUMP c-src/emacs/src/lisp.h /^NATNUMP (Lisp_Object x)$/
+NDEBUG c-src/etags.c 88
+NE y-src/parse.c 6
+NEG y-src/parse.c 9
+NEXT_ALMOST_PRIME_LIMIT c-src/emacs/src/lisp.h 3573
+NILP c-src/emacs/src/lisp.h /^# define NILP(x) lisp_h_NILP (x)$/
+NIL_IS_ZERO c-src/emacs/src/lisp.h 1515
+NONPOINTER_BITS c-src/emacs/src/lisp.h 78
+NONPOINTER_BITS c-src/emacs/src/lisp.h 80
+NONSRCS make-src/Makefile /^NONSRCS=entry.strange lists.erl clheir.hpp.gz$/
+NOTEQUAL y-src/cccp.c 13
+NULL y-src/cccp.y 51
+NULL_PTR y-src/cccp.y 63
+NUMSTATS objc-src/PackInsp.h 36
+NUM_MOD_NAMES c-src/emacs/src/keyboard.c 6325
+NUM_RECENT_KEYS c-src/emacs/src/keyboard.c 91
+NameHasChar pas-src/common.pas /^function NameHasChar; (* (TheName : NameString; Th/
+NameStringLess pas-src/common.pas /^function NameStringLess;(*(var Name1,Name2 : NameS/
+NewLayer lua-src/allegro.lua /^function NewLayer (name, x, y, w, h)$/
+NewLayerSet lua-src/allegro.lua /^function NewLayerSet (name)$/
+NewNameString pas-src/common.pas /^procedure NewNameString; (* (var NSP: NameStringPo/
+NmStrToErrStr pas-src/common.pas /^function NmStrToErrStr;(*($/
+NmStrToInteger pas-src/common.pas /^function NmStrToInteger; (* (Str : NameString) : i/
+OBJCPPSRC make-src/Makefile /^OBJCPPSRC=SimpleCalc.H SimpleCalc.M$/
+OBJCSRC make-src/Makefile /^OBJCSRC=Subprocess.h Subprocess.m PackInsp.h PackI/
+OBJS make-src/Makefile /^OBJS=${GETOPTOBJS} ${REGEXOBJS} ${CHECKOBJS}$/
+OPENBUTTON objc-src/PackInsp.m 47
+OPTIONS make-src/Makefile /^OPTIONS=--members --declarations --regex=@regexfil/
+OR y-src/cccp.c 10
+OTAGS make-src/Makefile /^OTAGS: oetags ${SRCS} srclist$/
+OVERLAYP c-src/emacs/src/lisp.h /^OVERLAYP (Lisp_Object x)$/
+Objc_help c-src/etags.c 613
+Objc_suffixes c-src/etags.c 609
+OperatorFun c-src/h.h 88
+Overview tex-src/gzip.texi /^@node Overview, Sample, Copying, Top$/
+PASSRC make-src/Makefile /^PASSRC=common.pas$/
+PDT c-src/h.h /^ Date 04 May 87 235311 PDT (Mon)$/
+PERLSRC make-src/Makefile /^PERLSRC=htlmify-cystic yagrip.pl kai-test.pl mirro/
+PHPSRC make-src/Makefile /^PHPSRC=lce_functions.php ptest.php sendmail.php$/
+PHP_functions c-src/etags.c /^PHP_functions (FILE *inf)$/
+PHP_help c-src/etags.c 639
+PHP_suffixes c-src/etags.c 637
+POEntry php-src/lce_functions.php /^ function POEntry()$/
+POEntry php-src/lce_functions.php 105
+POEntryAD php-src/lce_functions.php 29
+PORManager php-src/lce_functions.php /^ function PORManager()$/
+PORManager php-src/lce_functions.php 498
+POReader php-src/lce_functions.php /^ function POReader($domain, $filename)$/
+POReader php-src/lce_functions.php 163
+POSTSCRIPTFLAGS make-src/Makefile /^POSTSCRIPTFLAGS=--language=none --regex='#\/[^ \\t{]/
+PRINT_UNDOCUMENTED_OPTIONS_HELP c-src/etags.c 804
+PROCESSP c-src/emacs/src/lisp.h /^PROCESSP (Lisp_Object a)$/
+PROLSRC make-src/Makefile /^PROLSRC=ordsets.prolog natded.prolog$/
+PROP c-src/emacs/src/keyboard.c /^#define PROP(IDX) AREF (tool_bar_item_properties, /
+PROP c-src/emacs/src/keyboard.c 8379
+PROTECT_MALLOC_STATE c-src/emacs/src/gmalloc.c /^#define PROTECT_MALLOC_STATE(PROT) \/* empty *\/$/
+PROTECT_MALLOC_STATE c-src/emacs/src/gmalloc.c /^#define PROTECT_MALLOC_STATE(PROT) protect_malloc_/
+PRTPKG f-src/entry.for /^ LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PRTPKG f-src/entry.strange /^ LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PRTPKG f-src/entry.strange_suffix /^ LOGICAL FUNCTION PRTPKG ( SHORT, LONG, EXPL,/
+PSEUDO c-src/sysdep.h /^#define PSEUDO(name, syscall_name, args) /
+PSEUDOVECSIZE c-src/emacs/src/lisp.h /^#define PSEUDOVECSIZE(type, nonlispfield) \\$/
+PSEUDOVECTORP c-src/emacs/src/lisp.h /^PSEUDOVECTORP (Lisp_Object a, int code)$/
+PSEUDOVECTOR_AREA_BITS c-src/emacs/src/lisp.h 818
+PSEUDOVECTOR_FLAG c-src/emacs/src/lisp.h 774
+PSEUDOVECTOR_REST_BITS c-src/emacs/src/lisp.h 813
+PSEUDOVECTOR_REST_MASK c-src/emacs/src/lisp.h 814
+PSEUDOVECTOR_SIZE_BITS c-src/emacs/src/lisp.h 808
+PSEUDOVECTOR_SIZE_MASK c-src/emacs/src/lisp.h 809
+PSEUDOVECTOR_TYPEP c-src/emacs/src/lisp.h /^PSEUDOVECTOR_TYPEP (struct vectorlike_header *a, i/
+PSSRC make-src/Makefile /^PSSRC=rfc1245.ps$/
+PS_functions c-src/etags.c /^PS_functions (FILE *inf)$/
+PS_help c-src/etags.c 649
+PS_suffixes c-src/etags.c 647
+PTY_LENGTH objc-src/Subprocess.m 21
+PTY_TEMPLATE objc-src/Subprocess.m 20
+PUSH_C_STR c-src/emacs/src/keyboard.c /^#define PUSH_C_STR(str, listvar) \\$/
+PUSH_HANDLER c-src/emacs/src/lisp.h /^#define PUSH_HANDLER(c, tag_ch_val, handlertype) \\/
+PVEC_BOOL_VECTOR c-src/emacs/src/lisp.h 787
+PVEC_BUFFER c-src/emacs/src/lisp.h 788
+PVEC_CHAR_TABLE c-src/emacs/src/lisp.h 796
+PVEC_COMPILED c-src/emacs/src/lisp.h 795
+PVEC_FONT c-src/emacs/src/lisp.h 798
+PVEC_FRAME c-src/emacs/src/lisp.h 785
+PVEC_FREE c-src/emacs/src/lisp.h 783
+PVEC_HASH_TABLE c-src/emacs/src/lisp.h 789
+PVEC_NORMAL_VECTOR c-src/emacs/src/lisp.h 782
+PVEC_OTHER c-src/emacs/src/lisp.h 793
+PVEC_PROCESS c-src/emacs/src/lisp.h 784
+PVEC_SUBR c-src/emacs/src/lisp.h 792
+PVEC_SUB_CHAR_TABLE c-src/emacs/src/lisp.h 797
+PVEC_TERMINAL c-src/emacs/src/lisp.h 790
+PVEC_TYPE_MASK c-src/emacs/src/lisp.h 819
+PVEC_WINDOW c-src/emacs/src/lisp.h 786
+PVEC_WINDOW_CONFIGURATION c-src/emacs/src/lisp.h 791
+PYTSRC make-src/Makefile /^PYTSRC=server.py$/
+PackageInspector objc-src/PackInsp.h /^@interface PackageInspector:WMInspector$/
+Pascal_functions c-src/etags.c /^Pascal_functions (FILE *inf)$/
+Pascal_help c-src/etags.c 621
+Pascal_suffixes c-src/etags.c 619
+Perl_functions c-src/etags.c /^Perl_functions (FILE *inf)$/
+Perl_help c-src/etags.c 630
+Perl_interpreters c-src/etags.c 628
+Perl_suffixes c-src/etags.c 626
+Pkg1/b ada-src/etags-test-for.ada /^package body Pkg1 is$/
+Pkg1/b ada-src/waroquiers.ada /^package body Pkg1 is$/
+Pkg1/s ada-src/etags-test-for.ada /^package Pkg1 is$/
+Pkg1/s ada-src/waroquiers.ada /^package Pkg1 is$/
+Pkg1_Func1/f ada-src/etags-test-for.ada /^ function Pkg1_Func1 return Boolean is separate;$/
+Pkg1_Func1/f ada-src/etags-test-for.ada /^ function Pkg1_Func1 return Boolean;$/
+Pkg1_Func1/f ada-src/etags-test-for.ada /^function Pkg1_Func1 return Boolean is$/
+Pkg1_Func1/f ada-src/waroquiers.ada /^ function Pkg1_Func1 return Boolean is separate;$/
+Pkg1_Func1/f ada-src/waroquiers.ada /^ function Pkg1_Func1 return Boolean;$/
+Pkg1_Func1/f ada-src/waroquiers.ada /^function Pkg1_Func1 return Boolean is$/
+Pkg1_Func2/f ada-src/etags-test-for.ada /^ function Pkg1_Func2 (Ijk : Integer; Z : Integer)/
+Pkg1_Func2/f ada-src/waroquiers.ada /^ function Pkg1_Func2 (Ijk : Integer; Z : Integer)/
+Pkg1_Pkg1/b ada-src/etags-test-for.ada /^ package body Pkg1_Pkg1 is separate;$/
+Pkg1_Pkg1/b ada-src/etags-test-for.ada /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/b ada-src/waroquiers.ada /^ package body Pkg1_Pkg1 is separate;$/
+Pkg1_Pkg1/b ada-src/waroquiers.ada /^package body Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s ada-src/etags-test-for.ada /^ package Pkg1_Pkg1 is$/
+Pkg1_Pkg1/s ada-src/waroquiers.ada /^ package Pkg1_Pkg1 is$/
+Pkg1_Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Pkg1_Proc1 is$/
+Pkg1_Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Pkg1_Proc1;$/
+Pkg1_Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Pkg1_Proc1 is$/
+Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc1;$/
+Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc1 is$/
+Pkg1_Proc1/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc1;$/
+Pkg1_Proc2/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc2 (I : Integer) is$/
+Pkg1_Proc2/p ada-src/etags-test-for.ada /^ procedure Pkg1_Proc2 (I : Integer);$/
+Pkg1_Proc2/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc2 (I : Integer) is$/
+Pkg1_Proc2/p ada-src/waroquiers.ada /^ procedure Pkg1_Proc2 (I : Integer);$/
+PostControls pyt-src/server.py /^ def PostControls(self):$/
+Pre_Call_State/t ada-src/2ataspri.ads /^ type Pre_Call_State is new System.Address;$/
+PrintAdd go-src/test1.go /^func (n intNumber) PrintAdd() {$/
+PrintAdd go-src/test1.go /^func (s str) PrintAdd() {$/
+Private objc-src/Subprocess.m /^@interface Subprocess(Private)$/
+Private_T/b ada-src/etags-test-for.ada /^ task body Private_T is$/
+Private_T/b ada-src/waroquiers.ada /^ task body Private_T is$/
+Private_T/k ada-src/etags-test-for.ada /^ task Private_T;$/
+Private_T/k ada-src/waroquiers.ada /^ task Private_T;$/
+Private_T/p ada-src/etags-test-for.ada /^ procedure Private_T is$/
+Private_T/p ada-src/etags-test-for.ada /^ procedure Private_T;$/
+Private_T/p ada-src/waroquiers.ada /^ procedure Private_T is$/
+Private_T/p ada-src/waroquiers.ada /^ procedure Private_T;$/
+Private_T/t ada-src/etags-test-for.ada /^ type Private_T is private;$/
+Private_T/t ada-src/etags-test-for.ada /^ type Private_T is$/
+Private_T/t ada-src/waroquiers.ada /^ type Private_T is private;$/
+Private_T/t ada-src/waroquiers.ada /^ type Private_T is$/
+Problems tex-src/gzip.texi /^@node Problems, Concept Index, Tapes, Top$/
+Proc/t ada-src/2ataspri.ads /^ type Proc is access procedure (Addr : System.Ad/
+Prolog_functions c-src/etags.c /^Prolog_functions (FILE *inf)$/
+Prolog_help c-src/etags.c 654
+Prolog_suffixes c-src/etags.c 652
+Public_T/t ada-src/etags-test-for.ada /^ type Public_T is$/
+Public_T/t ada-src/waroquiers.ada /^ type Public_T is$/
+Python_functions c-src/etags.c /^Python_functions (FILE *inf)$/
+Python_help c-src/etags.c 660
+Python_suffixes c-src/etags.c 658
+QUIT c-src/emacs/src/lisp.h 3101
+QUITP c-src/emacs/src/lisp.h 3112
+RANGED_INTEGERP c-src/emacs/src/lisp.h /^RANGED_INTEGERP (intmax_t lo, Lisp_Object x, intma/
+RCSid objc-src/PackInsp.m 30
+READABLE_EVENTS_DO_TIMERS_NOW c-src/emacs/src/keyboard.c 346
+READABLE_EVENTS_FILTER_EVENTS c-src/emacs/src/keyboard.c 347
+READABLE_EVENTS_IGNORE_SQUEEZABLES c-src/emacs/src/keyboard.c 348
+RECC_ALNUM c-src/emacs/src/regex.h 610
+RECC_ALPHA c-src/emacs/src/regex.h 610
+RECC_ASCII c-src/emacs/src/regex.h 617
+RECC_BLANK c-src/emacs/src/regex.h 615
+RECC_CNTRL c-src/emacs/src/regex.h 613
+RECC_DIGIT c-src/emacs/src/regex.h 614
+RECC_ERROR c-src/emacs/src/regex.h 609
+RECC_GRAPH c-src/emacs/src/regex.h 611
+RECC_LOWER c-src/emacs/src/regex.h 612
+RECC_MULTIBYTE c-src/emacs/src/regex.h 616
+RECC_NONASCII c-src/emacs/src/regex.h 616
+RECC_PRINT c-src/emacs/src/regex.h 611
+RECC_PUNCT c-src/emacs/src/regex.h 613
+RECC_SPACE c-src/emacs/src/regex.h 615
+RECC_UNIBYTE c-src/emacs/src/regex.h 617
+RECC_UPPER c-src/emacs/src/regex.h 612
+RECC_WORD c-src/emacs/src/regex.h 610
+RECC_XDIGIT c-src/emacs/src/regex.h 614
+RED cp-src/screen.hpp 16
+REGEX make-src/Makefile /^REGEX=\/[ \\t]*DEFVAR_[A-Z_ \\t\\n(]+"\\([^"]+\\)"\/$/
+REGEXOBJS make-src/Makefile /^REGEXOBJS=regex.o$/
+REGS_FIXED c-src/emacs/src/regex.h 378
+REGS_REALLOCATE c-src/emacs/src/regex.h 377
+REGS_UNALLOCATED c-src/emacs/src/regex.h 376
+REG_BADBR c-src/emacs/src/regex.h 313
+REG_BADPAT c-src/emacs/src/regex.h 305
+REG_BADRPT c-src/emacs/src/regex.h 316
+REG_EBRACE c-src/emacs/src/regex.h 312
+REG_EBRACK c-src/emacs/src/regex.h 310
+REG_ECOLLATE c-src/emacs/src/regex.h 306
+REG_ECTYPE c-src/emacs/src/regex.h 307
+REG_EEND c-src/emacs/src/regex.h 319
+REG_EESCAPE c-src/emacs/src/regex.h 308
+REG_ENOSYS c-src/emacs/src/regex.h 297
+REG_ENOSYS c.c 279
+REG_EPAREN c-src/emacs/src/regex.h 311
+REG_ERANGE c-src/emacs/src/regex.h 314
+REG_ERANGEX c-src/emacs/src/regex.h 322
+REG_ERPAREN c-src/emacs/src/regex.h 321
+REG_ESIZE c-src/emacs/src/regex.h 320
+REG_ESPACE c-src/emacs/src/regex.h 315
+REG_ESUBREG c-src/emacs/src/regex.h 309
+REG_EXTENDED c-src/emacs/src/regex.h 263
+REG_ICASE c-src/emacs/src/regex.h 267
+REG_NEWLINE c-src/emacs/src/regex.h 272
+REG_NOERROR c-src/emacs/src/regex.h 300
+REG_NOMATCH c-src/emacs/src/regex.h 301
+REG_NOSUB c-src/emacs/src/regex.h 276
+REG_NOTBOL c-src/emacs/src/regex.h 286
+REG_NOTEOL c-src/emacs/src/regex.h 289
+RELEASELIST make-src/Makefile /^RELEASELIST=pot@gnu.org xemacs-review@xemacs.org j/
+RESUME_POLLING c-src/emacs/src/keyboard.c 2170
+RETURN_UNGCPRO c-src/emacs/src/lisp.h /^#define RETURN_UNGCPRO(expr) \\$/
+RE_BACKSLASH_ESCAPE_IN_LISTS c-src/emacs/src/regex.h 47
+RE_BK_PLUS_QM c-src/emacs/src/regex.h 52
+RE_CHAR_CLASSES c-src/emacs/src/regex.h 58
+RE_CONTEXT_INDEP_ANCHORS c-src/emacs/src/regex.h 72
+RE_CONTEXT_INDEP_OPS c-src/emacs/src/regex.h 80
+RE_CONTEXT_INVALID_OPS c-src/emacs/src/regex.h 84
+RE_DEBUG c-src/emacs/src/regex.h 161
+RE_DOT_NEWLINE c-src/emacs/src/regex.h 88
+RE_DOT_NOT_NULL c-src/emacs/src/regex.h 92
+RE_DUP_MAX c-src/emacs/src/regex.h 253
+RE_DUP_MAX c-src/emacs/src/regex.h 256
+RE_FRUGAL c-src/emacs/src/regex.h 147
+RE_HAT_LISTS_NOT_NEWLINE c-src/emacs/src/regex.h 96
+RE_INTERVALS c-src/emacs/src/regex.h 101
+RE_LIMITED_OPS c-src/emacs/src/regex.h 105
+RE_NEWLINE_ALT c-src/emacs/src/regex.h 109
+RE_NO_BK_BRACES c-src/emacs/src/regex.h 114
+RE_NO_BK_PARENS c-src/emacs/src/regex.h 118
+RE_NO_BK_REFS c-src/emacs/src/regex.h 122
+RE_NO_BK_VBAR c-src/emacs/src/regex.h 126
+RE_NO_EMPTY_RANGES c-src/emacs/src/regex.h 132
+RE_NO_GNU_OPS c-src/emacs/src/regex.h 144
+RE_NO_NEWLINE_ANCHOR c-src/emacs/src/regex.h 153
+RE_NO_POSIX_BACKTRACKING c-src/emacs/src/regex.h 140
+RE_NREGS c-src/emacs/src/regex.h 440
+RE_SHY_GROUPS c-src/emacs/src/regex.h 150
+RE_SYNTAX_AWK c-src/emacs/src/regex.h 186
+RE_SYNTAX_ED c-src/emacs/src/regex.h 216
+RE_SYNTAX_EGREP c-src/emacs/src/regex.h 206
+RE_SYNTAX_EMACS c-src/emacs/src/regex.h 183
+RE_SYNTAX_GNU_AWK c-src/emacs/src/regex.h 193
+RE_SYNTAX_GREP c-src/emacs/src/regex.h 201
+RE_SYNTAX_POSIX_AWK c-src/emacs/src/regex.h 197
+RE_SYNTAX_POSIX_BASIC c-src/emacs/src/regex.h 225
+RE_SYNTAX_POSIX_EGREP c-src/emacs/src/regex.h 212
+RE_SYNTAX_POSIX_EXTENDED c-src/emacs/src/regex.h 234
+RE_SYNTAX_POSIX_MINIMAL_BASIC c-src/emacs/src/regex.h 231
+RE_SYNTAX_POSIX_MINIMAL_EXTENDED c-src/emacs/src/regex.h 242
+RE_SYNTAX_SED c-src/emacs/src/regex.h 218
+RE_TRANSLATE_TYPE c-src/emacs/src/regex.h 332
+RE_UNMATCHED_RIGHT_PAREN_ORD c-src/emacs/src/regex.h 136
+RSH y-src/cccp.c 17
+RTE/s ada-src/2ataspri.adb /^ package RTE renames Interfaces.C.POSIX_RTE;$/
+RUN make-src/Makefile /^RUN=$/
+RUN make-src/Makefile /^RUN=time --quiet --format '%U + %S: %E'$/
+RXINCLUDE make-src/Makefile /^RXINCLUDE=-Iemacs\/src$/
+Range cp-src/Range.h /^ Range (const Range& r)$/
+Range cp-src/Range.h /^ Range (double b, double l)$/
+Range cp-src/Range.h /^ Range (double b, double l, double i)$/
+Range cp-src/Range.h /^ Range (void)$/
+Range cp-src/Range.h 35
+ReadVacation cp-src/functions.cpp /^void ReadVacation ( char *filename ) {$/
+Read_Lock/p ada-src/2ataspri.adb /^ procedure Read_Lock (L : in out Lock; Ceiling_V/
+Read_Lock/p ada-src/2ataspri.ads /^ procedure Read_Lock (L : in out Lock; Ceiling_V/
+Rectangle.getPos lua-src/test.lua /^function Rectangle.getPos ()$/
+ReleaseNameString pas-src/common.pas /^procedure ReleaseNameString; (* (var NSP: NameStri/
+RemoveLayer lua-src/allegro.lua /^function RemoveLayer ()$/
+RemoveUnderlineControl pas-src/common.pas /^function RemoveUnderlineControl; (*($/
+ReprOfChar pas-src/common.pas /^function ReprOfChar; (*( ch : char) : NameString;*/
+S c.c 156
+SAFE_ALLOCA c-src/emacs/src/lisp.h /^#define SAFE_ALLOCA(size) ((size) <= sa_avail \\/
+SAFE_ALLOCA_LISP c-src/emacs/src/lisp.h /^#define SAFE_ALLOCA_LISP(buf, nelt) \\$/
+SAFE_ALLOCA_STRING c-src/emacs/src/lisp.h /^#define SAFE_ALLOCA_STRING(ptr, string) \\$/
+SAFE_FREE c-src/emacs/src/lisp.h /^#define SAFE_FREE() \\$/
+SAFE_NALLOCA c-src/emacs/src/lisp.h /^#define SAFE_NALLOCA(buf, multiplier, nitems) \\/
+SAVE_FUNCPOINTER c-src/emacs/src/lisp.h 2049
+SAVE_INTEGER c-src/emacs/src/lisp.h 2048
+SAVE_OBJECT c-src/emacs/src/lisp.h 2051
+SAVE_POINTER c-src/emacs/src/lisp.h 2050
+SAVE_SLOT_BITS c-src/emacs/src/lisp.h 2055
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2062
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2114
+SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2123
+SAVE_TYPE_FUNCPTR_PTR_OBJ c-src/emacs/src/lisp.h 2076
+SAVE_TYPE_INT_INT c-src/emacs/src/lisp.h 2066
+SAVE_TYPE_INT_INT_INT c-src/emacs/src/lisp.h 2067
+SAVE_TYPE_MEMORY c-src/emacs/src/lisp.h 2080
+SAVE_TYPE_OBJ_OBJ c-src/emacs/src/lisp.h 2069
+SAVE_TYPE_OBJ_OBJ_OBJ c-src/emacs/src/lisp.h 2070
+SAVE_TYPE_OBJ_OBJ_OBJ_OBJ c-src/emacs/src/lisp.h 2071
+SAVE_TYPE_PTR_INT c-src/emacs/src/lisp.h 2073
+SAVE_TYPE_PTR_OBJ c-src/emacs/src/lisp.h 2074
+SAVE_TYPE_PTR_PTR c-src/emacs/src/lisp.h 2075
+SAVE_UNUSED c-src/emacs/src/lisp.h 2047
+SAVE_VALUEP c-src/emacs/src/lisp.h /^SAVE_VALUEP (Lisp_Object x)$/
+SAVE_VALUE_SLOTS c-src/emacs/src/lisp.h 2058
+SBYTES c-src/emacs/src/lisp.h /^SBYTES (Lisp_Object string)$/
+SCHARS c-src/emacs/src/lisp.h /^SCHARS (Lisp_Object string)$/
+SCREEN_FP cp-src/screen.hpp /^#define SCREEN_FP(x,y) \\$/
+SCREEN_START cp-src/screen.hpp 33
+SDATA c-src/emacs/src/lisp.h /^SDATA (Lisp_Object string)$/
+SDTrefGetInteger pas-src/common.pas /^function SDTrefGetInteger : integer;$/
+SDTrefIsEnd pas-src/common.pas /^function SDTrefIsEnd : Boolean;$/
+SDTrefRecToString pas-src/common.pas /^procedure SDTrefRecToString (* ($/
+SDTrefSkipSpaces pas-src/common.pas /^procedure SDTrefSkipSpaces;$/
+SDTrefStringToRec pas-src/common.pas /^procedure SDTrefStringToRec (* ($/
+SETPRT f-src/entry.for /^ ENTRY SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SETPRT f-src/entry.strange /^ ENTRY SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SETPRT f-src/entry.strange_suffix /^ ENTRY SETPRT ( SHORT, EXPL, LONG, TRACE, D/
+SET_SYMBOL_BLV c-src/emacs/src/lisp.h /^SET_SYMBOL_BLV (struct Lisp_Symbol *sym, struct Li/
+SET_SYMBOL_FWD c-src/emacs/src/lisp.h /^SET_SYMBOL_FWD (struct Lisp_Symbol *sym, union Lis/
+SET_SYMBOL_VAL c-src/emacs/src/lisp.h /^# define SET_SYMBOL_VAL(sym, v) lisp_h_SET_SYMBOL_/
+SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c /^#define SINGLE_LETTER_MOD(BIT) \\$/
+SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c 6212
+SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c 6763
+SIZEFORMAT objc-src/PackInsp.m 57
+SPECPDL_BACKTRACE c-src/emacs/src/lisp.h 2948
+SPECPDL_INDEX c-src/emacs/src/lisp.h /^SPECPDL_INDEX (void)$/
+SPECPDL_LET c-src/emacs/src/lisp.h 2949
+SPECPDL_LET_DEFAULT c-src/emacs/src/lisp.h 2952
+SPECPDL_LET_LOCAL c-src/emacs/src/lisp.h 2951
+SPECPDL_UNWIND c-src/emacs/src/lisp.h 2944
+SPECPDL_UNWIND_INT c-src/emacs/src/lisp.h 2946
+SPECPDL_UNWIND_PTR c-src/emacs/src/lisp.h 2945
+SPECPDL_UNWIND_VOID c-src/emacs/src/lisp.h 2947
+SRCS make-src/Makefile /^SRCS=Makefile ${ADASRC} ${ASRC} ${CSRC} ${CPSRC} $/
+SREF c-src/emacs/src/lisp.h /^SREF (Lisp_Object string, ptrdiff_t index)$/
+SSDATA c-src/emacs/src/lisp.h /^SSDATA (Lisp_Object string)$/
+SSET c-src/emacs/src/lisp.h /^SSET (Lisp_Object string, ptrdiff_t index, unsigne/
+STACK_CONS c-src/emacs/src/lisp.h /^#define STACK_CONS(a, b) \\$/
+STATE_ABORT php-src/lce_functions.php 25
+STATE_COMPRESSD objc-src/PackInsp.m 54
+STATE_INSTALLED objc-src/PackInsp.m 53
+STATE_LOOP php-src/lce_functions.php 27
+STATE_OK php-src/lce_functions.php 26
+STATE_UNINSTALLED objc-src/PackInsp.m 52
+STAT_EQ objc-src/PackInsp.m /^#define STAT_EQ(s1, s2) ((s1)->st_ino == (s2)->st_/
+STDIN c-src/etags.c 408
+STDIN c-src/etags.c 411
+STOP_POLLING c-src/emacs/src/keyboard.c 2166
+STRING_BYTES c-src/emacs/src/lisp.h /^STRING_BYTES (struct Lisp_String *s)$/
+STRING_BYTES_BOUND c-src/emacs/src/lisp.h 1261
+STRING_MULTIBYTE c-src/emacs/src/lisp.h /^STRING_MULTIBYTE (Lisp_Object str)$/
+STRING_SET_CHARS c-src/emacs/src/lisp.h /^STRING_SET_CHARS (Lisp_Object string, ptrdiff_t ne/
+STRING_SET_MULTIBYTE c-src/emacs/src/lisp.h /^#define STRING_SET_MULTIBYTE(STR) \\$/
+STRING_SET_UNIBYTE c-src/emacs/src/lisp.h /^#define STRING_SET_UNIBYTE(STR) \\$/
+SUBRP c-src/emacs/src/lisp.h /^SUBRP (Lisp_Object a)$/
+SUB_CHAR_TABLE_OFFSET c-src/emacs/src/lisp.h 1701
+SUB_CHAR_TABLE_P c-src/emacs/src/lisp.h /^SUB_CHAR_TABLE_P (Lisp_Object a)$/
+SXHASH_REDUCE c-src/emacs/src/lisp.h /^SXHASH_REDUCE (EMACS_UINT x)$/
+SYMBOLP c-src/emacs/src/lisp.h /^# define SYMBOLP(x) lisp_h_SYMBOLP (x)$/
+SYMBOL_BLV c-src/emacs/src/lisp.h /^SYMBOL_BLV (struct Lisp_Symbol *sym)$/
+SYMBOL_CONSTANT_P c-src/emacs/src/lisp.h /^# define SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONS/
+SYMBOL_FORWARDED c-src/emacs/src/lisp.h 651
+SYMBOL_FWD c-src/emacs/src/lisp.h /^SYMBOL_FWD (struct Lisp_Symbol *sym)$/
+SYMBOL_INDEX c-src/emacs/src/lisp.h /^#define SYMBOL_INDEX(sym) i##sym$/
+SYMBOL_INTERNED c-src/emacs/src/lisp.h 642
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY c-src/emacs/src/lisp.h 643
+SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P c-src/emacs/src/lisp.h /^SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object /
+SYMBOL_INTERNED_P c-src/emacs/src/lisp.h /^SYMBOL_INTERNED_P (Lisp_Object sym)$/
+SYMBOL_LOCALIZED c-src/emacs/src/lisp.h 650
+SYMBOL_NAME c-src/emacs/src/lisp.h /^SYMBOL_NAME (Lisp_Object sym)$/
+SYMBOL_PLAINVAL c-src/emacs/src/lisp.h 648
+SYMBOL_UNINTERNED c-src/emacs/src/lisp.h 641
+SYMBOL_VAL c-src/emacs/src/lisp.h /^# define SYMBOL_VAL(sym) lisp_h_SYMBOL_VAL (sym)$/
+SYMBOL_VARALIAS c-src/emacs/src/lisp.h 649
+SYSCALL c-src/machsyscalls.c /^#define SYSCALL(name, number, type, args, typed_ar/
+Sample tex-src/gzip.texi /^@node Sample, Invoking gzip, Overview, Top$/
+Scheme_functions c-src/etags.c /^Scheme_functions (FILE *inf)$/
+Scheme_help c-src/etags.c 667
+Scheme_suffixes c-src/etags.c 665
+SelectLayer lua-src/allegro.lua /^function SelectLayer (layer)$/
+Self/f ada-src/2ataspri.adb /^ function Self return TCB_Ptr is$/
+Self/f ada-src/2ataspri.ads /^ function Self return TCB_Ptr;$/
+Server pyt-src/server.py /^class Server:$/
+ServerEdit pyt-src/server.py /^class ServerEdit(Frame):$/
+Set_Own_Priority/p ada-src/2ataspri.adb /^ procedure Set_Own_Priority (Prio : System.Any_P/
+Set_Own_Priority/p ada-src/2ataspri.ads /^ procedure Set_Own_Priority (Prio : System.Any_P/
+Set_Priority/p ada-src/2ataspri.adb /^ procedure Set_Priority$/
+Set_Priority/p ada-src/2ataspri.ads /^ procedure Set_Priority (T : TCB_Ptr; Prio : Sys/
+SimpleCalc objcpp-src/SimpleCalc.H /^@interface SimpleCalc:Object$/
+SkipBlanks pas-src/common.pas /^function SkipBlanks; (*($/
+SkipChars pas-src/common.pas /^function SkipChars; (*($/
+SkipSpaces pas-src/common.pas /^procedure SkipSpaces; (* (Str : NameString; var I /
+Square.something:Bar lua-src/test.lua /^function Square.something:Bar ()$/
+StartDay cp-src/functions.cpp /^Date StartDay(Date a,int days){\/\/Function to calcu/
+StripPath pas-src/common.pas /^function StripPath; (*($/
+SubString pas-src/common.pas /^function SubString; (*($/
+Subprocess objc-src/Subprocess.h /^@interface Subprocess:Object$/
+Subprocess objc-src/Subprocess.h 41
+System.Task_Primitives/b ada-src/2ataspri.adb /^package body System.Task_Primitives is$/
+System.Task_Primitives/s ada-src/2ataspri.ads /^package System.Task_Primitives is$/
+T cp-src/fail.C 14
+T2 cp-src/fail.C 16
+T3 c.c 163
+TAGS make-src/Makefile /^TAGS: etags.c$/
+TAG_PTR c-src/emacs/src/lisp.h /^#define TAG_PTR(tag, ptr) \\$/
+TAG_SYMOFFSET c-src/emacs/src/lisp.h /^#define TAG_SYMOFFSET(offset) \\$/
+TAS_Cell/t ada-src/2ataspri.ads /^ type TAS_Cell is private;$/
+TAS_Cell/t ada-src/2ataspri.ads /^ type TAS_Cell is$/
+TCB_Ptr/t ada-src/2ataspri.ads /^ type TCB_Ptr is access all Task_Control_Block;$/
+TCLFLAGS make-src/Makefile /^TCLFLAGS=--lang=none --regex='\/proc[ \\t]+\\([^ \\t]+/
+TERMINALP c-src/emacs/src/lisp.h /^TERMINALP (Lisp_Object a)$/
+TEST php-src/ptest.php 1
+TEXSRC make-src/Makefile /^TEXSRC=testenv.tex gzip.texi texinfo.tex nonewline/
+TEX_LESC c-src/etags.c 4986
+TEX_SESC c-src/etags.c 4987
+TEX_clgrp c-src/etags.c 4922
+TEX_decode_env c-src/etags.c /^TEX_decode_env (const char *evarname, const char */
+TEX_defenv c-src/etags.c 4912
+TEX_esc c-src/etags.c 4920
+TEX_mode c-src/etags.c /^TEX_mode (FILE *inf)$/
+TEX_opgrp c-src/etags.c 4921
+TEX_toktab c-src/etags.c 4908
+TOTAL_KEYWORDS c-src/etags.c 2325
+TSL/s ada-src/2ataspri.adb /^ package TSL renames System.Tasking_Soft_Links;$/
+TYPESTOSTAT objc-src/PackInsp.h 37
+TYPE_RANGED_INTEGERP c-src/emacs/src/lisp.h /^#define TYPE_RANGED_INTEGERP(type, x) \\$/
+Tapes tex-src/gzip.texi /^@node Tapes, Problems, Environment, Top$/
+Task_Control_Block/t ada-src/2ataspri.ads /^ type Task_Control_Block is record$/
+Task_Storage_Size/t ada-src/2ataspri.ads /^ type Task_Storage_Size is new Interfaces.C.size/
+Task_Type/b ada-src/etags-test-for.ada /^ task body Task_Type is$/
+Task_Type/b ada-src/waroquiers.ada /^ task body Task_Type is$/
+Task_Type/k ada-src/etags-test-for.ada /^ task type Task_Type is$/
+Task_Type/k ada-src/waroquiers.ada /^ task type Task_Type is$/
+TeX_commands c-src/etags.c /^TeX_commands (FILE *inf)$/
+TeX_help c-src/etags.c 674
+TeX_suffixes c-src/etags.c 672
+Test_Abort/p ada-src/2ataspri.adb /^ procedure Test_Abort is$/
+Test_Abort/p ada-src/2ataspri.ads /^ procedure Test_Abort;$/
+Test_And_Set/p ada-src/2ataspri.adb /^ procedure Test_And_Set (Cell : in out TAS_Cell;/
+Test_And_Set/p ada-src/2ataspri.ads /^ procedure Test_And_Set (Cell : in out TAS_Cell;/
+Texinfo_help c-src/etags.c 688
+Texinfo_nodes c-src/etags.c /^Texinfo_nodes (FILE *inf)$/
+Texinfo_suffixes c-src/etags.c 686
+Time_to_position c-src/emacs/src/keyboard.c /^Time_to_position (Time encoded_pos)$/
+To_Lower pas-src/common.pas /^function To_Lower;(*(ch:char) : char;*)$/
+To_Start_Addr/f ada-src/2ataspri.adb /^ function To_Start_Addr is new$/
+To_TCB_Ptr/f ada-src/2ataspri.adb /^ function To_TCB_Ptr is new$/
+To_Upper pas-src/common.pas /^function To_Upper;(*(ch:char) : char;*)$/
+To_void_ptr/f ada-src/2ataspri.adb /^ function To_void_ptr is new$/
+Top tex-src/gzip.texi /^@node Top, , , (dir)$/
+Truc.Bidule/b ada-src/etags-test-for.ada /^package body Truc.Bidule is$/
+Truc.Bidule/b ada-src/waroquiers.ada /^package body Truc.Bidule is$/
+Truc.Bidule/s ada-src/etags-test-for.ada /^package Truc.Bidule is$/
+Truc.Bidule/s ada-src/waroquiers.ada /^package Truc.Bidule is$/
+Truc/s ada-src/etags-test-for.ada /^package Truc is$/
+Truc/s ada-src/waroquiers.ada /^package Truc is$/
+Type_Specific_Data/t ada-src/etags-test-for.ada /^ type Type_Specific_Data is record$/
+UCHAR c-src/emacs/src/lisp.h 2424
+UNARY y-src/cccp.c 18
+UNDEFINED c-src/h.h 118
+UNEVALLED c-src/emacs/src/lisp.h 2834
+UNGCPRO c-src/emacs/src/lisp.h 3202
+UNGCPRO c-src/emacs/src/lisp.h 3257
+UNGCPRO c-src/emacs/src/lisp.h 3353
+UNLOCK c-src/emacs/src/gmalloc.c /^#define UNLOCK() \\$/
+UNLOCK c-src/emacs/src/gmalloc.c /^#define UNLOCK()$/
+UNLOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define UNLOCK_ALIGNED_BLOCKS() \\$/
+UNLOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define UNLOCK_ALIGNED_BLOCKS()$/
+UNSIGNED_CMP c-src/emacs/src/lisp.h /^#define UNSIGNED_CMP(a, op, b) \\$/
+USE_LSB_TAG c-src/emacs/src/lisp.h /^DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG)$/
+USE_LSB_TAG c-src/emacs/src/lisp.h 271
+USE_PTHREAD c-src/emacs/src/gmalloc.c 25
+USE_SAFE_ALLOCA c-src/emacs/src/lisp.h 4560
+USE_STACK_CONS c-src/emacs/src/lisp.h 4689
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4652
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4658
+USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4659
+USE_STACK_STRING c-src/emacs/src/lisp.h 4691
+U_CHAR y-src/cccp.y 38
+Unlock/p ada-src/2ataspri.adb /^ procedure Unlock (L : in out Lock) is$/
+Unlock/p ada-src/2ataspri.ads /^ procedure Unlock (L : in out Lock);$/
+User pyt-src/server.py /^class User:$/
+UserEdit pyt-src/server.py /^class UserEdit(Frame):$/
+VALBITS c-src/emacs/src/lisp.h 246
+VALMASK c-src/emacs/src/lisp.h /^DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK)$/
+VALMASK c-src/emacs/src/lisp.h 829
+VAL_MAX c-src/emacs/src/lisp.h 263
+VECSIZE c-src/emacs/src/lisp.h /^#define VECSIZE(type) \\$/
+VECTORLIKEP c-src/emacs/src/lisp.h /^# define VECTORLIKEP(x) lisp_h_VECTORLIKEP (x)$/
+VECTORP c-src/emacs/src/lisp.h /^VECTORP (Lisp_Object x)$/
+VERSION c-src/etags.c 789
+VERSION erl-src/gs_dialog.erl /^-define(VERSION, '2001.1101').$/
+VERSION objc-src/PackInsp.m 34
+VHDLFLAGS make-src/Makefile /^VHDLFLAGS=--language=none --regex='\/[ \\t]*\\(ARCHIT/
+Vabbrev_start_location c-src/abbrev.c 63
+Vabbrev_start_location_buffer c-src/abbrev.c 66
+Vabbrev_table_name_list c-src/abbrev.c 43
+ValToNmStr pas-src/common.pas /^function ValToNmStr; (*($/
+Vfundamental_mode_abbrev_table c-src/abbrev.c 52
+Vglobal_abbrev_table c-src/abbrev.c 48
+Vlast_abbrev c-src/abbrev.c 70
+Vlast_abbrev_text c-src/abbrev.c 75
+Vlispy_mouse_stem c-src/emacs/src/keyboard.c 5172
+WAIT_READING_MAX c-src/emacs/src/lisp.h 4281
+WAIT_READING_MAX c-src/emacs/src/lisp.h 4283
+WARNINGS make-src/Makefile /^WARNINGS=-pedantic -Wall -Wpointer-arith -Winline /
+WCHAR_TYPE_SIZE y-src/cccp.y 99
+WHITE cp-src/screen.hpp 27
+WINDOWP c-src/emacs/src/lisp.h /^WINDOWP (Lisp_Object a)$/
+WINDOWSNT c-src/etags.c 101
+WINDOWSNT c-src/etags.c 102
+WINDOW_CONFIGURATIONP c-src/emacs/src/lisp.h /^WINDOW_CONFIGURATIONP (Lisp_Object a)$/
+WORKING objc-src/PackInsp.m 368
+WorkingDays cp-src/functions.cpp /^int WorkingDays(Date a, Date b){$/
+Write_Lock/p ada-src/2ataspri.adb /^ procedure Write_Lock (L : in out Lock; Ceiling_/
+Write_Lock/p ada-src/2ataspri.ads /^ procedure Write_Lock (L : in out Lock; Ceiling_/
+X c-src/h.h 100
+XBOOL_VECTOR c-src/emacs/src/lisp.h /^XBOOL_VECTOR (Lisp_Object a)$/
+XBUFFER c-src/emacs/src/lisp.h /^XBUFFER (Lisp_Object a)$/
+XBUFFER_OBJFWD c-src/emacs/src/lisp.h /^XBUFFER_OBJFWD (union Lisp_Fwd *a)$/
+XCAR c-src/emacs/src/lisp.h /^# define XCAR(c) lisp_h_XCAR (c)$/
+XCDR c-src/emacs/src/lisp.h /^# define XCDR(c) lisp_h_XCDR (c)$/
+XCHAR_TABLE c-src/emacs/src/lisp.h /^XCHAR_TABLE (Lisp_Object a)$/
+XCHG_0 c-src/sysdep.h 47
+XCHG_1 c-src/sysdep.h 48
+XCHG_2 c-src/sysdep.h 49
+XCHG_3 c-src/sysdep.h 50
+XCHG_4 c-src/sysdep.h 51
+XCHG_5 c-src/sysdep.h 52
+XCONS c-src/emacs/src/lisp.h /^# define XCONS(a) lisp_h_XCONS (a)$/
+XDEFUN c.c /^XDEFUN ("x-get-selection-internal", Fx_get_selecti/
+XFASTINT c-src/emacs/src/lisp.h /^# define XFASTINT(a) lisp_h_XFASTINT (a)$/
+XFASTINT c-src/emacs/src/lisp.h /^XFASTINT (Lisp_Object a)$/
+XFINALIZER c-src/emacs/src/lisp.h /^XFINALIZER (Lisp_Object a)$/
+XFLOAT c-src/emacs/src/lisp.h /^XFLOAT (Lisp_Object a)$/
+XFLOATINT c-src/emacs/src/lisp.h /^XFLOATINT (Lisp_Object n)$/
+XFLOAT_DATA c-src/emacs/src/lisp.h /^XFLOAT_DATA (Lisp_Object f)$/
+XFWDTYPE c-src/emacs/src/lisp.h /^XFWDTYPE (union Lisp_Fwd *a)$/
+XHASH c-src/emacs/src/lisp.h /^# define XHASH(a) lisp_h_XHASH (a)$/
+XHASH_TABLE c-src/emacs/src/lisp.h /^XHASH_TABLE (Lisp_Object a)$/
+XIL c-src/emacs/src/lisp.h /^# define XIL(i) lisp_h_XIL (i)$/
+XINT c-src/emacs/src/lisp.h /^# define XINT(a) lisp_h_XINT (a)$/
+XINT c-src/emacs/src/lisp.h /^XINT (Lisp_Object a)$/
+XINTPTR c-src/emacs/src/lisp.h /^XINTPTR (Lisp_Object a)$/
+XLI c-src/emacs/src/lisp.h /^# define XLI(o) lisp_h_XLI (o)$/
+XLI_BUILTIN_LISPSYM c-src/emacs/src/lisp.h /^#define XLI_BUILTIN_LISPSYM(iname) TAG_SYMOFFSET (/
+XMARKER c-src/emacs/src/lisp.h /^XMARKER (Lisp_Object a)$/
+XMISC c-src/emacs/src/lisp.h /^XMISC (Lisp_Object a)$/
+XMISCANY c-src/emacs/src/lisp.h /^XMISCANY (Lisp_Object a)$/
+XMISCTYPE c-src/emacs/src/lisp.h /^XMISCTYPE (Lisp_Object a)$/
+XOVERLAY c-src/emacs/src/lisp.h /^XOVERLAY (Lisp_Object a)$/
+XPNTR c-src/emacs/src/lisp.h /^# define XPNTR(a) lisp_h_XPNTR (a)$/
+XPROCESS c-src/emacs/src/lisp.h /^XPROCESS (Lisp_Object a)$/
+XSAVE_FUNCPOINTER c-src/emacs/src/lisp.h /^XSAVE_FUNCPOINTER (Lisp_Object obj, int n)$/
+XSAVE_INTEGER c-src/emacs/src/lisp.h /^XSAVE_INTEGER (Lisp_Object obj, int n)$/
+XSAVE_OBJECT c-src/emacs/src/lisp.h /^XSAVE_OBJECT (Lisp_Object obj, int n)$/
+XSAVE_POINTER c-src/emacs/src/lisp.h /^XSAVE_POINTER (Lisp_Object obj, int n)$/
+XSAVE_VALUE c-src/emacs/src/lisp.h /^XSAVE_VALUE (Lisp_Object a)$/
+XSETBOOL_VECTOR c-src/emacs/src/lisp.h /^#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a/
+XSETBUFFER c-src/emacs/src/lisp.h /^#define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, /
+XSETCDR c-src/emacs/src/lisp.h /^XSETCDR (Lisp_Object c, Lisp_Object n)$/
+XSETCHAR_TABLE c-src/emacs/src/lisp.h /^#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a,/
+XSETCOMPILED c-src/emacs/src/lisp.h /^#define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b/
+XSETCONS c-src/emacs/src/lisp.h /^#define XSETCONS(a, b) ((a) = make_lisp_ptr (b, Li/
+XSETFASTINT c-src/emacs/src/lisp.h /^#define XSETFASTINT(a, b) ((a) = make_natnum (b))$/
+XSETFLOAT c-src/emacs/src/lisp.h /^#define XSETFLOAT(a, b) ((a) = make_lisp_ptr (b, L/
+XSETINT c-src/emacs/src/lisp.h /^#define XSETINT(a, b) ((a) = make_number (b))$/
+XSETMISC c-src/emacs/src/lisp.h /^#define XSETMISC(a, b) ((a) = make_lisp_ptr (b, Li/
+XSETPROCESS c-src/emacs/src/lisp.h /^#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b,/
+XSETPSEUDOVECTOR c-src/emacs/src/lisp.h /^#define XSETPSEUDOVECTOR(a, b, code) \\$/
+XSETPVECTYPE c-src/emacs/src/lisp.h /^#define XSETPVECTYPE(v, code) \\$/
+XSETPVECTYPESIZE c-src/emacs/src/lisp.h /^#define XSETPVECTYPESIZE(v, code, lispsize, restsi/
+XSETSTRING c-src/emacs/src/lisp.h /^#define XSETSTRING(a, b) ((a) = make_lisp_ptr (b, /
+XSETSUBR c-src/emacs/src/lisp.h /^#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PV/
+XSETSUB_CHAR_TABLE c-src/emacs/src/lisp.h /^#define XSETSUB_CHAR_TABLE(a, b) (XSETPSEUDOVECTOR/
+XSETSYMBOL c-src/emacs/src/lisp.h /^#define XSETSYMBOL(a, b) ((a) = make_lisp_symbol (/
+XSETTERMINAL c-src/emacs/src/lisp.h /^#define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b/
+XSETTYPED_PSEUDOVECTOR c-src/emacs/src/lisp.h /^#define XSETTYPED_PSEUDOVECTOR(a, b, size, code) /
+XSETVECTOR c-src/emacs/src/lisp.h /^#define XSETVECTOR(a, b) ((a) = make_lisp_ptr (b, /
+XSETWINDOW c-src/emacs/src/lisp.h /^#define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, /
+XSETWINDOW_CONFIGURATION c-src/emacs/src/lisp.h /^#define XSETWINDOW_CONFIGURATION(a, b) \\$/
+XSET_HASH_TABLE c-src/emacs/src/lisp.h /^#define XSET_HASH_TABLE(VAR, PTR) \\$/
+XSTRING c-src/emacs/src/lisp.h /^XSTRING (Lisp_Object a)$/
+XSUBR c-src/emacs/src/lisp.h /^XSUBR (Lisp_Object a)$/
+XSUB_CHAR_TABLE c-src/emacs/src/lisp.h /^XSUB_CHAR_TABLE (Lisp_Object a)$/
+XSYMBOL c-src/emacs/src/lisp.h /^# define XSYMBOL(a) lisp_h_XSYMBOL (a)$/
+XSYMBOL c-src/emacs/src/lisp.h /^XSYMBOL (Lisp_Object a)$/
+XTERMINAL c-src/emacs/src/lisp.h /^XTERMINAL (Lisp_Object a)$/
+XTYPE c-src/emacs/src/lisp.h /^# define XTYPE(a) lisp_h_XTYPE (a)$/
+XTYPE c-src/emacs/src/lisp.h /^XTYPE (Lisp_Object a)$/
+XUNTAG c-src/emacs/src/lisp.h /^# define XUNTAG(a, type) lisp_h_XUNTAG (a, type)$/
+XUNTAG c-src/emacs/src/lisp.h /^XUNTAG (Lisp_Object a, int type)$/
+XWINDOW c-src/emacs/src/lisp.h /^XWINDOW (Lisp_Object a)$/
+XX cp-src/x.cc 1
+Xyzzy ruby-src/test1.ru 13
+Y c-src/h.h 100
+YACC c-src/etags.c 2199
+YELLOW cp-src/screen.hpp 26
+YSRC make-src/Makefile /^YSRC=parse.y parse.c atest.y cccp.c cccp.y$/
+YYABORT /usr/share/bison/bison.simple 153
+YYABORT /usr/share/bison/bison.simple 154
+YYACCEPT /usr/share/bison/bison.simple 152
+YYACCEPT /usr/share/bison/bison.simple 153
+YYBACKUP /usr/share/bison/bison.simple /^#define YYBACKUP(Token, Value) \\$/
+YYBISON y-src/cccp.c 4
+YYBISON y-src/parse.c 4
+YYDPRINTF /usr/share/bison/bison.simple /^# define YYDPRINTF(Args) \\$/
+YYDPRINTF /usr/share/bison/bison.simple /^# define YYDPRINTF(Args)$/
+YYEMPTY /usr/share/bison/bison.simple 150
+YYEMPTY /usr/share/bison/bison.simple 151
+YYEOF /usr/share/bison/bison.simple 151
+YYEOF /usr/share/bison/bison.simple 152
+YYERRCODE /usr/share/bison/bison.simple 178
+YYERRCODE /usr/share/bison/bison.simple 179
+YYERROR /usr/share/bison/bison.simple 154
+YYERROR /usr/share/bison/bison.simple 155
+YYFAIL /usr/share/bison/bison.simple 158
+YYFAIL /usr/share/bison/bison.simple 159
+YYFPRINTF /usr/share/bison/bison.simple 225
+YYFPRINTF /usr/share/bison/bison.simple 226
+YYINITDEPTH /usr/share/bison/bison.simple 244
+YYINITDEPTH /usr/share/bison/bison.simple 245
+YYLEX /usr/share/bison/bison.simple 200
+YYLEX /usr/share/bison/bison.simple 201
+YYLEX /usr/share/bison/bison.simple 202
+YYLEX /usr/share/bison/bison.simple 203
+YYLEX /usr/share/bison/bison.simple 206
+YYLEX /usr/share/bison/bison.simple 207
+YYLEX /usr/share/bison/bison.simple 208
+YYLEX /usr/share/bison/bison.simple 209
+YYLEX /usr/share/bison/bison.simple 212
+YYLEX /usr/share/bison/bison.simple 213
+YYLLOC_DEFAULT /usr/share/bison/bison.simple /^# define YYLLOC_DEFAULT(Current, Rhs, N) \\$/
+YYMAXDEPTH /usr/share/bison/bison.simple 255
+YYMAXDEPTH /usr/share/bison/bison.simple 256
+YYMAXDEPTH /usr/share/bison/bison.simple 259
+YYMAXDEPTH /usr/share/bison/bison.simple 260
+YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 351
+YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 354
+YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 358
+YYPARSE_PARAM_DECL /usr/share/bison/bison.simple 352
+YYPARSE_PARAM_DECL /usr/share/bison/bison.simple 355
+YYPARSE_PARAM_DECL /usr/share/bison/bison.simple 359
+YYPOPSTACK /usr/share/bison/bison.simple 445
+YYPOPSTACK /usr/share/bison/bison.simple 447
+YYRECOVERING /usr/share/bison/bison.simple /^#define YYRECOVERING() (!!yyerrstatus)$/
+YYSIZE_T /usr/share/bison/bison.simple 128
+YYSIZE_T /usr/share/bison/bison.simple 129
+YYSIZE_T /usr/share/bison/bison.simple 131
+YYSIZE_T /usr/share/bison/bison.simple 132
+YYSIZE_T /usr/share/bison/bison.simple 136
+YYSIZE_T /usr/share/bison/bison.simple 137
+YYSIZE_T /usr/share/bison/bison.simple 140
+YYSIZE_T /usr/share/bison/bison.simple 141
+YYSIZE_T /usr/share/bison/bison.simple 145
+YYSIZE_T /usr/share/bison/bison.simple 146
+YYSIZE_T /usr/share/bison/bison.simple 51
+YYSIZE_T /usr/share/bison/bison.simple 52
+YYSIZE_T /usr/share/bison/bison.simple 56
+YYSIZE_T /usr/share/bison/bison.simple 57
+YYSIZE_T /usr/share/bison/bison.simple 71
+YYSIZE_T /usr/share/bison/bison.simple 72
+YYSIZE_T /usr/share/bison/bison.simple 75
+YYSIZE_T /usr/share/bison/bison.simple 76
+YYSTACK_ALLOC /usr/share/bison/bison.simple 50
+YYSTACK_ALLOC /usr/share/bison/bison.simple 51
+YYSTACK_ALLOC /usr/share/bison/bison.simple 55
+YYSTACK_ALLOC /usr/share/bison/bison.simple 56
+YYSTACK_ALLOC /usr/share/bison/bison.simple 59
+YYSTACK_ALLOC /usr/share/bison/bison.simple 60
+YYSTACK_ALLOC /usr/share/bison/bison.simple 78
+YYSTACK_ALLOC /usr/share/bison/bison.simple 79
+YYSTACK_BYTES /usr/share/bison/bison.simple /^# define YYSTACK_BYTES(N) \\$/
+YYSTACK_FREE /usr/share/bison/bison.simple /^# define YYSTACK_FREE(Ptr) do { \/* empty *\/; } wh/
+YYSTACK_FREE /usr/share/bison/bison.simple 79
+YYSTACK_FREE /usr/share/bison/bison.simple 80
+YYSTACK_GAP_MAX /usr/share/bison/bison.simple 93
+YYSTACK_GAP_MAX /usr/share/bison/bison.simple 94
+YYSTACK_RELOCATE /usr/share/bison/bison.simple /^# define YYSTACK_RELOCATE(Type, Stack) \\$/
+YYSTACK_RELOCATE /usr/share/bison/bison.simple 548
+YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) std::x$/
+YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) x$/
+YYSTYPE y-src/parse.y 72
+YYSTYPE y-src/parse.y 73
+YYTERROR /usr/share/bison/bison.simple 177
+YYTERROR /usr/share/bison/bison.simple 178
+YY_DECL_NON_LSP_VARIABLES /usr/share/bison/bison.simple 374
+YY_DECL_VARIABLES /usr/share/bison/bison.simple 385
+YY_DECL_VARIABLES /usr/share/bison/bison.simple 391
+Yacc_entries c-src/etags.c /^Yacc_entries (FILE *inf)$/
+Yacc_help c-src/etags.c 693
+Yacc_suffixes c-src/etags.c 691
+Z c-src/h.h 100
+[] ruby-src/test.rb /^ def [](y)$/
+[]= ruby-src/test.rb /^ def []=(y, val)$/
+\ tex-src/texinfo.tex /^\\def\\ {{\\fontdimen2\\font=\\tclosesave{} }}%$/
+\ tex-src/texinfo.tex /^\\gdef\\sepspaces{\\def {\\ }}}$/
+\' tex-src/texinfo.tex /^\\def\\'{{'}}$/
+\* tex-src/texinfo.tex /^\\def\\*{\\hfil\\break\\hbox{}\\ignorespaces}$/
+\. tex-src/texinfo.tex /^\\def\\.{.\\spacefactor=3000 }$/
+\: tex-src/texinfo.tex /^\\def\\:{\\spacefactor=1000 }$/
+\@ tex-src/texinfo.tex /^\\def\\@{@}%$/
+\@ tex-src/texinfo.tex /^\\def\\@{{\\tt \\char '100}}$/
+\CHAPFopen tex-src/texinfo.tex /^\\def\\CHAPFopen{$/
+\CHAPFplain tex-src/texinfo.tex /^\\def\\CHAPFplain{$/
+\CHAPPAGodd tex-src/texinfo.tex /^\\def\\CHAPPAGodd{$/
+\CHAPPAGoff tex-src/texinfo.tex /^\\def\\CHAPPAGoff{$/
+\CHAPPAGon tex-src/texinfo.tex /^\\def\\CHAPPAGon{$/
+\ENVcheck tex-src/texinfo.tex /^\\def\\ENVcheck{%$/
+\Ealphaenumerate tex-src/texinfo.tex /^\\def\\Ealphaenumerate{\\Eenumerate}$/
+\Ecapsenumerate tex-src/texinfo.tex /^\\def\\Ecapsenumerate{\\Eenumerate}$/
+\Ecartouche tex-src/texinfo.tex /^\\def\\Ecartouche{%$/
+\Edescription tex-src/texinfo.tex /^\\def\\Edescription{\\Etable}% Necessary kludge.$/
+\Edisplay tex-src/texinfo.tex /^\\def\\Edisplay{\\endgroup\\afterenvbreak}%$/
+\Eexample tex-src/texinfo.tex /^\\def\\Eexample{\\Elisp}$/
+\Eflushleft tex-src/texinfo.tex /^\\def\\Eflushleft{\\endgroup\\afterenvbreak}%$/
+\Eflushright tex-src/texinfo.tex /^\\def\\Eflushright{\\endgroup\\afterenvbreak}%$/
+\Eformat tex-src/texinfo.tex /^\\def\\Eformat{\\endgroup\\afterenvbreak}$/
+\Eftable tex-src/texinfo.tex /^\\def\\Eftable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Egroup tex-src/texinfo.tex /^ \\def\\Egroup{\\egroup\\endgroup}%$/
+\Eifclear tex-src/texinfo.tex /^\\def\\Eifclear{}$/
+\Eifset tex-src/texinfo.tex /^\\def\\Eifset{}$/
+\Eiftex tex-src/texinfo.tex /^\\def\\Eiftex{}$/
+\Elisp tex-src/texinfo.tex /^\\def\\Elisp{\\endgroup\\afterenvbreak}%$/
+\Equotation tex-src/texinfo.tex /^\\def\\Equotation{\\par\\endgroup\\afterenvbreak}%$/
+\Esmallexample tex-src/texinfo.tex /^\\def\\Esmallexample{\\Elisp}$/
+\Esmallexample tex-src/texinfo.tex /^\\global\\def\\Esmallexample{\\Esmalllisp}$/
+\Esmalllisp tex-src/texinfo.tex /^\\def\\Esmalllisp{\\endgroup\\afterenvbreak}%$/
+\Etable tex-src/texinfo.tex /^\\def\\Etable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\Etitlepage tex-src/texinfo.tex /^\\def\\Etitlepage{%$/
+\Evtable tex-src/texinfo.tex /^\\def\\Evtable{\\endgraf\\endgroup\\afterenvbreak}%$/
+\HEADINGSafter tex-src/texinfo.tex /^\\def\\HEADINGSafter{\\let\\HEADINGShook=\\HEADINGSdoub/
+\HEADINGSdouble tex-src/texinfo.tex /^\\def\\HEADINGSdouble{$/
+\HEADINGSdoublex tex-src/texinfo.tex /^\\def\\HEADINGSdoublex{%$/
+\HEADINGSoff tex-src/texinfo.tex /^\\def\\HEADINGSoff{$/
+\HEADINGSon tex-src/texinfo.tex /^\\def\\HEADINGSon{\\HEADINGSdouble}$/
+\HEADINGSon tex-src/texinfo.tex /^\\global\\def\\HEADINGSon{\\HEADINGSdouble}}$/
+\HEADINGSon tex-src/texinfo.tex /^\\global\\def\\HEADINGSon{\\HEADINGSsingle}}$/
+\HEADINGSsingle tex-src/texinfo.tex /^\\def\\HEADINGSsingle{$/
+\HEADINGSsingleafter tex-src/texinfo.tex /^\\def\\HEADINGSsingleafter{\\let\\HEADINGShook=\\HEADIN/
+\HEADINGSsinglex tex-src/texinfo.tex /^\\def\\HEADINGSsinglex{%$/
+\TeX tex-src/texinfo.tex /^\\def\\TeX{\\realbackslash TeX}$/
+\TeX tex-src/texinfo.tex /^\\def\\TeX{\\realbackslash TeX}%$/
+\Yappendixletterandtype tex-src/texinfo.tex /^\\def\\Yappendixletterandtype{%$/
+\Ynothing tex-src/texinfo.tex /^\\def\\Ynothing{}$/
+\Ypagenumber tex-src/texinfo.tex /^\\def\\Ypagenumber{\\folio}$/
+\Ysectionnumberandtype tex-src/texinfo.tex /^\\def\\Ysectionnumberandtype{%$/
+\Ytitle tex-src/texinfo.tex /^\\def\\Ytitle{\\thischapter}$/
+\_ tex-src/texinfo.tex /^\\def\\_{\\lvvmode \\kern.06em \\vbox{\\hrule width.3em /
+\_ tex-src/texinfo.tex /^\\def\\_{{\\realbackslash _}}%$/
+\` tex-src/texinfo.tex /^\\def\\`{{`}}$/
+\aboveenvbreak tex-src/texinfo.tex /^\\def\\aboveenvbreak{{\\advance\\aboveenvskipamount by/
+\activedoublequote tex-src/texinfo.tex /^\\def\\activedoublequote{{\\tt \\char '042}}$/
+\activeparens tex-src/texinfo.tex /^\\def\\activeparens{%$/
+\afourpaper tex-src/texinfo.tex /^\\def\\afourpaper{$/
+\afterenvbreak tex-src/texinfo.tex /^\\def\\afterenvbreak{\\endgraf \\ifdim\\lastskip<\\above/
+\alphaenumerate tex-src/texinfo.tex /^\\def\\alphaenumerate{\\enumerate{a}}$/
+\appendix tex-src/texinfo.tex /^\\outer\\def\\appendix{\\parsearg\\appendixzzz}$/
+\appendixletter tex-src/texinfo.tex /^\\def\\appendixletter{\\char\\the\\appendixno}$/
+\appendixnoderef tex-src/texinfo.tex /^\\def\\appendixnoderef{\\ifx\\lastnode\\relax\\else$/
+\appendixsec tex-src/texinfo.tex /^\\outer\\def\\appendixsec{\\parsearg\\appendixsectionzz/
+\appendixsection tex-src/texinfo.tex /^\\outer\\def\\appendixsection{\\parsearg\\appendixsecti/
+\appendixsectionzzz tex-src/texinfo.tex /^\\def\\appendixsectionzzz #1{\\seccheck{appendixsecti/
+\appendixsetref tex-src/texinfo.tex /^\\def\\appendixsetref#1{%$/
+\appendixsubsec tex-src/texinfo.tex /^\\outer\\def\\appendixsubsec{\\parsearg\\appendixsubsec/
+\appendixsubseczzz tex-src/texinfo.tex /^\\def\\appendixsubseczzz #1{\\seccheck{appendixsubsec/
+\appendixsubsubsec tex-src/texinfo.tex /^\\outer\\def\\appendixsubsubsec{\\parsearg\\appendixsub/
+\appendixsubsubseczzz tex-src/texinfo.tex /^\\def\\appendixsubsubseczzz #1{\\seccheck{appendixsub/
+\appendixzzz tex-src/texinfo.tex /^\\def\\appendixzzz #1{\\seccheck{appendix}%$/
+\asis tex-src/texinfo.tex /^\\def\\asis#1{#1}$/
+\author tex-src/texinfo.tex /^ \\def\\author{\\parsearg\\authorzzz}%$/
+\authorfont tex-src/texinfo.tex /^ \\def\\authorfont{\\authorrm \\normalbaselineskip =/
+\authorzzz tex-src/texinfo.tex /^ \\def\\authorzzz##1{\\ifseenauthor\\else\\vskip 0pt /
+\b tex-src/texinfo.tex /^\\def\\b##1{\\realbackslash b {##1}}$/
+\b tex-src/texinfo.tex /^\\def\\b##1{\\realbackslash b {##1}}%$/
+\b tex-src/texinfo.tex /^\\def\\b#1{{\\bf #1}}$/
+\balancecolumns tex-src/texinfo.tex /^\\def\\balancecolumns{%$/
+\begin tex-src/texinfo.tex /^\\outer\\def\\begin{\\parsearg\\beginxxx}$/
+\begindoublecolumns tex-src/texinfo.tex /^\\def\\begindoublecolumns{\\begingroup$/
+\beginxxx tex-src/texinfo.tex /^\\def\\beginxxx #1{%$/
+\bf tex-src/texinfo.tex /^\\def\\bf{\\realbackslash bf }$/
+\bf tex-src/texinfo.tex /^\\def\\bf{\\realbackslash bf }%$/
+\bullet tex-src/texinfo.tex /^\\def\\bullet{$\\ptexbullet$}$/
+\bye tex-src/texinfo.tex /^\\outer\\def\\bye{\\pagealignmacro\\tracingstats=1\\ptex/
+\capsenumerate tex-src/texinfo.tex /^\\def\\capsenumerate{\\enumerate{A}}$/
+\cartbot tex-src/texinfo.tex /^\\def\\cartbot{\\hbox to \\cartouter{\\hskip\\lskip$/
+\cartouche tex-src/texinfo.tex /^\\long\\def\\cartouche{%$/
+\carttop tex-src/texinfo.tex /^\\def\\carttop{\\hbox to \\cartouter{\\hskip\\lskip$/
+\cbl tex-src/texinfo.tex /^\\def\\cbl{{\\circle\\char'012\\hskip -6pt}}$/
+\cbr tex-src/texinfo.tex /^\\def\\cbr{{\\hskip 6pt\\circle\\char'011}}$/
+\center tex-src/texinfo.tex /^\\def\\center{\\parsearg\\centerzzz}$/
+\centerzzz tex-src/texinfo.tex /^\\def\\centerzzz #1{{\\advance\\hsize by -\\leftskip$/
+\chapbreak tex-src/texinfo.tex /^\\def\\chapbreak{\\dobreak \\chapheadingskip {-4000}}$/
+\chapentry tex-src/texinfo.tex /^\\def\\chapentry#1#2#3{\\dochapentry{#2\\labelspace#1}/
+\chapentryfonts tex-src/texinfo.tex /^\\def\\chapentryfonts{\\secfonts \\rm}$/
+\chapfonts tex-src/texinfo.tex /^\\def\\chapfonts{%$/
+\chapheading tex-src/texinfo.tex /^\\def\\chapheading{\\parsearg\\chapheadingzzz}$/
+\chapheadingzzz tex-src/texinfo.tex /^\\def\\chapheadingzzz #1{\\chapbreak %$/
+\chapoddpage tex-src/texinfo.tex /^\\def\\chapoddpage{\\chappager \\ifodd\\pageno \\else \\h/
+\chappager tex-src/texinfo.tex /^\\def\\chappager{\\par\\vfill\\supereject}$/
+\chapter tex-src/texinfo.tex /^\\outer\\def\\chapter{\\parsearg\\chapterzzz}$/
+\chapternofonts tex-src/texinfo.tex /^\\def\\chapternofonts{%$/
+\chapterzzz tex-src/texinfo.tex /^\\def\\chapterzzz #1{\\seccheck{chapter}%$/
+\char tex-src/texinfo.tex /^\\def\\char{\\realbackslash char}$/
+\char tex-src/texinfo.tex /^\\def\\char{\\realbackslash char}%$/
+\chfopen tex-src/texinfo.tex /^\\def\\chfopen #1#2{\\chapoddpage {\\chapfonts$/
+\chfplain tex-src/texinfo.tex /^\\def\\chfplain #1#2{%$/
+\cindex tex-src/texinfo.tex /^\\def\\cindex {\\cpindex}$/
+\cindexsub tex-src/texinfo.tex /^\\def\\cindexsub {\\begingroup\\obeylines\\cindexsub}$/
+\cite tex-src/texinfo.tex /^\\def\\cite##1{\\realbackslash cite {##1}}$/
+\cite tex-src/texinfo.tex /^\\def\\cite##1{\\realbackslash cite {##1}}%$/
+\clear tex-src/texinfo.tex /^\\def\\clear{\\parsearg\\clearxxx}$/
+\clearxxx tex-src/texinfo.tex /^\\def\\clearxxx #1{$/
+\code tex-src/texinfo.tex /^\\def\\code##1{\\realbackslash code {##1}}$/
+\code tex-src/texinfo.tex /^\\def\\code##1{\\realbackslash code {##1}}%$/
+\comment tex-src/texinfo.tex /^\\def\\comment{\\catcode 64=\\other \\catcode 123=\\othe/
+\commentxxx tex-src/texinfo.tex /^\\def\\commentxxx #1{\\catcode 64=0 \\catcode 123=1 \\c/
+\contents tex-src/texinfo.tex /^\\outer\\def\\contents{%$/
+\copyright tex-src/texinfo.tex /^\\def\\copyright{\\realbackslash copyright }%$/
+\copyright tex-src/texinfo.tex /^\\def\\copyright{\\realbackslash copyright}$/
+\cropmarks tex-src/texinfo.tex /^\\def\\cropmarks{\\let\\onepageout=\\croppageout }$/
+\croppageout tex-src/texinfo.tex /^\\def\\croppageout#1{\\hoffset=0pt % make sure this d/
+\ctl tex-src/texinfo.tex /^\\def\\ctl{{\\circle\\char'013\\hskip -6pt}}% 6pt from /
+\ctr tex-src/texinfo.tex /^\\def\\ctr{{\\hskip 6pt\\circle\\char'010}}$/
+\ctrl tex-src/texinfo.tex /^\\def\\ctrl #1{{\\tt \\rawbackslash \\hat}#1}$/
+\defcodeindex tex-src/texinfo.tex /^\\def\\defcodeindex{\\parsearg\\newcodeindex}$/
+\defcv tex-src/texinfo.tex /^\\def\\defcv #1 {\\def\\defcvtype{#1}%$/
+\defcvarheader tex-src/texinfo.tex /^\\def\\defcvarheader #1#2#3{%$/
+\defcvx tex-src/texinfo.tex /^\\def\\defcvx #1 {\\errmessage{@defcvx in invalid con/
+\deffn tex-src/texinfo.tex /^\\def\\deffn{\\defmethparsebody\\Edeffn\\deffnx\\deffnhe/
+\deffnheader tex-src/texinfo.tex /^\\def\\deffnheader #1#2#3{\\doind {fn}{\\code{#2}}%$/
+\deffnx tex-src/texinfo.tex /^\\def\\deffnx #1 {\\errmessage{@deffnx in invalid con/
+\defindex tex-src/texinfo.tex /^\\def\\defindex{\\parsearg\\newindex}$/
+\defivar tex-src/texinfo.tex /^\\def\\defivar{\\defvrparsebody\\Edefivar\\defivarx\\def/
+\defivarheader tex-src/texinfo.tex /^\\def\\defivarheader #1#2#3{%$/
+\defivarx tex-src/texinfo.tex /^\\def\\defivarx #1 {\\errmessage{@defivarx in invalid/
+\defmac tex-src/texinfo.tex /^\\def\\defmac{\\defparsebody\\Edefmac\\defmacx\\defmache/
+\defmacheader tex-src/texinfo.tex /^\\def\\defmacheader #1#2{\\doind {fn}{\\code{#1}}% Mak/
+\defmacx tex-src/texinfo.tex /^\\def\\defmacx #1 {\\errmessage{@defmacx in invalid c/
+\defmethod tex-src/texinfo.tex /^\\def\\defmethod{\\defmethparsebody\\Edefmethod\\defmet/
+\defmethodheader tex-src/texinfo.tex /^\\def\\defmethodheader #1#2#3{%$/
+\defmethodx tex-src/texinfo.tex /^\\def\\defmethodx #1 {\\errmessage{@defmethodx in inv/
+\defmethparsebody tex-src/texinfo.tex /^\\def\\defmethparsebody #1#2#3#4 {\\begingroup\\inENV /
+\defname tex-src/texinfo.tex /^\\def\\defname #1#2{%$/
+\defop tex-src/texinfo.tex /^\\def\\defop #1 {\\def\\defoptype{#1}%$/
+\defopheader tex-src/texinfo.tex /^\\def\\defopheader #1#2#3{%$/
+\defopparsebody tex-src/texinfo.tex /^\\def\\defopparsebody #1#2#3#4#5 {\\begingroup\\inENV /
+\defopt tex-src/texinfo.tex /^\\def\\defopt{\\defvarparsebody\\Edefopt\\defoptx\\defop/
+\defoptheader tex-src/texinfo.tex /^\\def\\defoptheader #1#2{\\doind {vr}{\\code{#1}}% Mak/
+\defoptx tex-src/texinfo.tex /^\\def\\defoptx #1 {\\errmessage{@defoptx in invalid c/
+\defopvarparsebody tex-src/texinfo.tex /^\\def\\defopvarparsebody #1#2#3#4#5 {\\begingroup\\inE/
+\defopx tex-src/texinfo.tex /^\\def\\defopx #1 {\\errmessage{@defopx in invalid con/
+\defparsebody tex-src/texinfo.tex /^\\def\\defparsebody #1#2#3{\\begingroup\\inENV% Enviro/
+\defspec tex-src/texinfo.tex /^\\def\\defspec{\\defparsebody\\Edefspec\\defspecx\\defsp/
+\defspecheader tex-src/texinfo.tex /^\\def\\defspecheader #1#2{\\doind {fn}{\\code{#1}}% Ma/
+\defspecx tex-src/texinfo.tex /^\\def\\defspecx #1 {\\errmessage{@defspecx in invalid/
+\deftp tex-src/texinfo.tex /^\\def\\deftp{\\defvrparsebody\\Edeftp\\deftpx\\deftphead/
+\deftpargs tex-src/texinfo.tex /^\\def\\deftpargs #1{\\bf \\defvarargs{#1}}$/
+\deftpheader tex-src/texinfo.tex /^\\def\\deftpheader #1#2#3{\\doind {tp}{\\code{#2}}%$/
+\deftpx tex-src/texinfo.tex /^\\def\\deftpx #1 {\\errmessage{@deftpx in invalid con/
+\deftypefn tex-src/texinfo.tex /^\\def\\deftypefn{\\defmethparsebody\\Edeftypefn\\deftyp/
+\deftypefnheader tex-src/texinfo.tex /^\\def\\deftypefnheader #1#2#3{\\deftypefnheaderx{#1}{/
+\deftypefnheaderx tex-src/texinfo.tex /^\\def\\deftypefnheaderx #1#2#3 #4\\relax{%$/
+\deftypefnx tex-src/texinfo.tex /^\\def\\deftypefnx #1 {\\errmessage{@deftypefnx in inv/
+\deftypefun tex-src/texinfo.tex /^\\def\\deftypefun{\\defparsebody\\Edeftypefun\\deftypef/
+\deftypefunargs tex-src/texinfo.tex /^\\def\\deftypefunargs #1{%$/
+\deftypefunheader tex-src/texinfo.tex /^\\def\\deftypefunheader #1#2{\\deftypefunheaderx{#1}#/
+\deftypefunheaderx tex-src/texinfo.tex /^\\def\\deftypefunheaderx #1#2 #3\\relax{%$/
+\deftypeunx tex-src/texinfo.tex /^\\def\\deftypeunx #1 {\\errmessage{@deftypeunx in inv/
+\deftypevar tex-src/texinfo.tex /^\\def\\deftypevar{\\defvarparsebody\\Edeftypevar\\defty/
+\deftypevarheader tex-src/texinfo.tex /^\\def\\deftypevarheader #1#2{%$/
+\deftypevarx tex-src/texinfo.tex /^\\def\\deftypevarx #1 {\\errmessage{@deftypevarx in i/
+\deftypevr tex-src/texinfo.tex /^\\def\\deftypevr{\\defvrparsebody\\Edeftypevr\\deftypev/
+\deftypevrheader tex-src/texinfo.tex /^\\def\\deftypevrheader #1#2#3{\\doind {vr}{\\code{#3}}/
+\deftypevrx tex-src/texinfo.tex /^\\def\\deftypevrx #1 {\\errmessage{@deftypevrx in inv/
+\defun tex-src/texinfo.tex /^\\def\\defun{\\defparsebody\\Edefun\\defunx\\defunheader/
+\defunargs tex-src/texinfo.tex /^\\def\\defunargs #1{\\functionparens \\sl$/
+\defunheader tex-src/texinfo.tex /^\\def\\defunheader #1#2{\\doind {fn}{\\code{#1}}% Make/
+\defunx tex-src/texinfo.tex /^\\def\\defunx #1 {\\errmessage{@defunx in invalid con/
+\defvar tex-src/texinfo.tex /^\\def\\defvar{\\defvarparsebody\\Edefvar\\defvarx\\defva/
+\defvarargs tex-src/texinfo.tex /^\\def\\defvarargs #1{\\normalparens #1%$/
+\defvarheader tex-src/texinfo.tex /^\\def\\defvarheader #1#2{\\doind {vr}{\\code{#1}}% Mak/
+\defvarparsebody tex-src/texinfo.tex /^\\def\\defvarparsebody #1#2#3{\\begingroup\\inENV% Env/
+\defvarx tex-src/texinfo.tex /^\\def\\defvarx #1 {\\errmessage{@defvarx in invalid c/
+\defvr tex-src/texinfo.tex /^\\def\\defvr{\\defvrparsebody\\Edefvr\\defvrx\\defvrhead/
+\defvrheader tex-src/texinfo.tex /^\\def\\defvrheader #1#2#3{\\doind {vr}{\\code{#2}}%$/
+\defvrparsebody tex-src/texinfo.tex /^\\def\\defvrparsebody #1#2#3#4 {\\begingroup\\inENV %$/
+\defvrx tex-src/texinfo.tex /^\\def\\defvrx #1 {\\errmessage{@defvrx in invalid con/
+\description tex-src/texinfo.tex /^\\def\\description{\\tablez{\\dontindex}{1}{}{}{}{}}$/
+\df tex-src/texinfo.tex /^\\def\\df{\\let\\tentt=\\deftt \\let\\tenbf = \\defbf \\bf}/
+\dfn tex-src/texinfo.tex /^\\def\\dfn##1{\\realbackslash dfn {##1}}$/
+\direntry tex-src/texinfo.tex /^\\def\\direntry{\\begingroup\\direntryxxx}$/
+\direntryxxx tex-src/texinfo.tex /^\\long\\def\\direntryxxx #1\\end direntry{\\endgroup\\ig/
+\display tex-src/texinfo.tex /^\\def\\display{\\begingroup\\inENV %This group ends at/
+\dmn tex-src/texinfo.tex /^\\def\\dmn#1{\\thinspace #1}$/
+\dobreak tex-src/texinfo.tex /^\\def\\dobreak#1#2{\\par\\ifdim\\lastskip<#1\\removelast/
+\dochapentry tex-src/texinfo.tex /^\\def\\dochapentry#1#2{%$/
+\docodeindex tex-src/texinfo.tex /^\\def\\docodeindex#1{\\edef\\indexname{#1}\\parsearg\\si/
+\doind tex-src/texinfo.tex /^\\def\\doind #1#2{%$/
+\doindex tex-src/texinfo.tex /^\\def\\doindex#1{\\edef\\indexname{#1}\\parsearg\\single/
+\donoderef tex-src/texinfo.tex /^\\def\\donoderef{\\ifx\\lastnode\\relax\\else$/
+\dontindex tex-src/texinfo.tex /^\\def\\dontindex #1{}$/
+\dopageno tex-src/texinfo.tex /^\\def\\dopageno#1{{\\rm #1}}$/
+\doprintindex tex-src/texinfo.tex /^\\def\\doprintindex#1{%$/
+\dosecentry tex-src/texinfo.tex /^\\def\\dosecentry#1#2{%$/
+\dosetq tex-src/texinfo.tex /^\\def\\dosetq #1#2{{\\let\\folio=0 \\turnoffactive%$/
+\doshortpageno tex-src/texinfo.tex /^\\def\\doshortpageno#1{{\\rm #1}}$/
+\dosubind tex-src/texinfo.tex /^\\def\\dosubind #1#2#3{%$/
+\dosubsecentry tex-src/texinfo.tex /^\\def\\dosubsecentry#1#2{%$/
+\dosubsubsecentry tex-src/texinfo.tex /^\\def\\dosubsubsecentry#1#2{%$/
+\dots tex-src/texinfo.tex /^\\def\\dots{$\\ldots$}$/
+\dots tex-src/texinfo.tex /^\\def\\dots{\\realbackslash dots }%$/
+\dots tex-src/texinfo.tex /^\\def\\dots{\\realbackslash dots}$/
+\doublecolumnout tex-src/texinfo.tex /^\\def\\doublecolumnout{\\splittopskip=\\topskip \\split/
+\emph tex-src/texinfo.tex /^\\def\\emph##1{\\realbackslash emph {##1}}$/
+\end tex-src/texinfo.tex /^\\def\\end{\\parsearg\\endxxx}$/
+\enddoublecolumns tex-src/texinfo.tex /^\\def\\enddoublecolumns{\\output={\\balancecolumns}\\ej/
+\endxxx tex-src/texinfo.tex /^\\def\\endxxx #1{%$/
+\entry tex-src/texinfo.tex /^\\def\\entry #1#2{\\begingroup$/
+\enumerate tex-src/texinfo.tex /^\\def\\enumerate{\\parsearg\\enumeratezzz}$/
+\enumeratey tex-src/texinfo.tex /^\\def\\enumeratey #1 #2\\endenumeratey{%$/
+\enumeratezzz tex-src/texinfo.tex /^\\def\\enumeratezzz #1{\\enumeratey #1 \\endenumerate/
+\equiv tex-src/texinfo.tex /^\\def\\equiv{\\leavevmode\\lower.1ex\\hbox to 1em{\\hfil/
+\equiv tex-src/texinfo.tex /^\\def\\equiv{\\realbackslash equiv}$/
+\error tex-src/texinfo.tex /^\\def\\error{\\leavevmode\\lower.7ex\\copy\\errorbox}$/
+\errorE tex-src/texinfo.tex /^\\def\\errorE#1{$/
+\evenfooting tex-src/texinfo.tex /^\\def\\evenfooting{\\parsearg\\evenfootingxxx}$/
+\evenheading tex-src/texinfo.tex /^\\def\\evenheading{\\parsearg\\evenheadingxxx}$/
+\everyfooting tex-src/texinfo.tex /^\\def\\everyfooting{\\parsearg\\everyfootingxxx}$/
+\everyheading tex-src/texinfo.tex /^\\def\\everyheading{\\parsearg\\everyheadingxxx}$/
+\ewbot tex-src/texinfo.tex /^\\def\\ewbot{\\vrule height0pt depth\\cornerthick widt/
+\ewtop tex-src/texinfo.tex /^\\def\\ewtop{\\vrule height\\cornerthick depth0pt widt/
+\exdent tex-src/texinfo.tex /^\\def\\exdent{\\parsearg\\exdentyyy}$/
+\exdentyyy tex-src/texinfo.tex /^\\def\\exdentyyy #1{{\\hfil\\break\\hbox{\\kern -\\exdent/
+\expansion tex-src/texinfo.tex /^\\def\\expansion{\\leavevmode\\raise.1ex\\hbox to 1em{\\/
+\expansion tex-src/texinfo.tex /^\\def\\expansion{\\realbackslash expansion}$/
+\file tex-src/texinfo.tex /^\\def\\file##1{\\realbackslash file {##1}}$/
+\file tex-src/texinfo.tex /^\\def\\file##1{\\realbackslash file {##1}}%$/
+\finalout tex-src/texinfo.tex /^\\def\\finalout{\\overfullrule=0pt}$/
+\findex tex-src/texinfo.tex /^\\def\\findex {\\fnindex}$/
+\finishtitlepage tex-src/texinfo.tex /^\\def\\finishtitlepage{%$/
+\flushcr tex-src/texinfo.tex /^\\def\\flushcr{\\ifx\\par\\lisppar \\def\\next##1{}\\else /
+\flushleft tex-src/texinfo.tex /^\\def\\flushleft{%$/
+\flushright tex-src/texinfo.tex /^\\def\\flushright{%$/
+\fnitemindex tex-src/texinfo.tex /^\\def\\fnitemindex #1{\\doind {fn}{\\code{#1}}}%$/
+\format tex-src/texinfo.tex /^\\def\\format{\\begingroup\\inENV %This group ends at /
+\frenchspacing tex-src/texinfo.tex /^\\def\\frenchspacing{\\sfcode46=1000 \\sfcode63=1000 \\/
+\ftable tex-src/texinfo.tex /^\\def\\ftable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\gloggingall tex-src/texinfo.tex /^\\def\\gloggingall{\\begingroup \\globaldefs = 1 \\logg/
+\group tex-src/texinfo.tex /^\\def\\group{\\begingroup$/
+\gtr tex-src/texinfo.tex /^\\def\\gtr{\\realbackslash gtr}$/
+\gtr tex-src/texinfo.tex /^\\def\\gtr{\\realbackslash gtr}%$/
+\hat tex-src/texinfo.tex /^\\def\\hat{\\realbackslash hat}$/
+\hat tex-src/texinfo.tex /^\\def\\hat{\\realbackslash hat}%$/
+\heading tex-src/texinfo.tex /^\\def\\heading{\\parsearg\\secheadingi}$/
+\headings tex-src/texinfo.tex /^\\def\\headings #1 {\\csname HEADINGS#1\\endcsname}$/
+\i tex-src/texinfo.tex /^\\def\\i##1{\\realbackslash i {##1}}$/
+\i tex-src/texinfo.tex /^\\def\\i##1{\\realbackslash i {##1}}%$/
+\ifclear tex-src/texinfo.tex /^\\def\\ifclear{\\begingroup\\ignoresections\\parsearg\\i/
+\ifclearfail tex-src/texinfo.tex /^\\def\\ifclearfail{\\begingroup\\ignoresections\\ifclea/
+\ifclearfailxxx tex-src/texinfo.tex /^\\long\\def\\ifclearfailxxx #1\\end ifclear{\\endgroup\\/
+\ifclearxxx tex-src/texinfo.tex /^\\def\\ifclearxxx #1{\\endgroup$/
+\ifinfo tex-src/texinfo.tex /^\\def\\ifinfo{\\begingroup\\ignoresections\\ifinfoxxx}$/
+\ifinfoxxx tex-src/texinfo.tex /^\\long\\def\\ifinfoxxx #1\\end ifinfo{\\endgroup\\ignore/
+\ifset tex-src/texinfo.tex /^\\def\\ifset{\\begingroup\\ignoresections\\parsearg\\ifs/
+\ifsetfail tex-src/texinfo.tex /^\\def\\ifsetfail{\\begingroup\\ignoresections\\ifsetfai/
+\ifsetfailxxx tex-src/texinfo.tex /^\\long\\def\\ifsetfailxxx #1\\end ifset{\\endgroup\\igno/
+\ifsetxxx tex-src/texinfo.tex /^\\def\\ifsetxxx #1{\\endgroup$/
+\iftex tex-src/texinfo.tex /^\\def\\iftex{}$/
+\ifusingtt tex-src/texinfo.tex /^\\def\\ifusingtt#1#2{\\ifdim \\fontdimen3\\the\\font=0pt/
+\ignore tex-src/texinfo.tex /^\\def\\ignore{\\begingroup\\ignoresections$/
+\ignoresections tex-src/texinfo.tex /^\\def\\ignoresections{%$/
+\ignorexxx tex-src/texinfo.tex /^\\long\\def\\ignorexxx #1\\end ignore{\\endgroup\\ignore/
+\ii tex-src/texinfo.tex /^\\def\\ii#1{{\\it #1}} % italic font$/
+\inENV tex-src/texinfo.tex /^\\newif\\ifENV \\ENVfalse \\def\\inENV{\\ifENV\\relax\\els/
+\include tex-src/texinfo.tex /^\\def\\include{\\parsearg\\includezzz}$/
+\includezzz tex-src/texinfo.tex /^\\def\\includezzz #1{{\\def\\thisfile{#1}\\input #1$/
+\indexbackslash tex-src/texinfo.tex /^ \\def\\indexbackslash{\\rawbackslashxx}$/
+\indexdotfill tex-src/texinfo.tex /^\\def\\indexdotfill{\\cleaders$/
+\indexdummies tex-src/texinfo.tex /^\\def\\indexdummies{%$/
+\indexdummydots tex-src/texinfo.tex /^\\def\\indexdummydots{...}$/
+\indexdummyfont tex-src/texinfo.tex /^\\def\\indexdummyfont#1{#1}$/
+\indexdummytex tex-src/texinfo.tex /^\\def\\indexdummytex{TeX}$/
+\indexfonts tex-src/texinfo.tex /^\\def\\indexfonts{%$/
+\indexnofonts tex-src/texinfo.tex /^\\def\\indexnofonts{%$/
+\infoappendix tex-src/texinfo.tex /^\\def\\infoappendix{\\parsearg\\appendixzzz}$/
+\infoappendixsec tex-src/texinfo.tex /^\\def\\infoappendixsec{\\parsearg\\appendixseczzz}$/
+\infoappendixsubsec tex-src/texinfo.tex /^\\def\\infoappendixsubsec{\\parsearg\\appendixsubseczz/
+\infoappendixsubsubsec tex-src/texinfo.tex /^\\def\\infoappendixsubsubsec{\\parsearg\\appendixsubsu/
+\infochapter tex-src/texinfo.tex /^\\def\\infochapter{\\parsearg\\chapterzzz}$/
+\inforef tex-src/texinfo.tex /^\\def\\inforef #1{\\inforefzzz #1,,,,**}$/
+\inforefzzz tex-src/texinfo.tex /^\\def\\inforefzzz #1,#2,#3,#4**{See Info file \\file{/
+\infosection tex-src/texinfo.tex /^\\def\\infosection{\\parsearg\\sectionzzz}$/
+\infosubsection tex-src/texinfo.tex /^\\def\\infosubsection{\\parsearg\\subsectionzzz}$/
+\infosubsubsection tex-src/texinfo.tex /^\\def\\infosubsubsection{\\parsearg\\subsubsectionzzz}/
+\infotop tex-src/texinfo.tex /^\\def\\infotop{\\parsearg\\unnumberedzzz}$/
+\infounnumbered tex-src/texinfo.tex /^\\def\\infounnumbered{\\parsearg\\unnumberedzzz}$/
+\infounnumberedsec tex-src/texinfo.tex /^\\def\\infounnumberedsec{\\parsearg\\unnumberedseczzz}/
+\infounnumberedsubsec tex-src/texinfo.tex /^\\def\\infounnumberedsubsec{\\parsearg\\unnumberedsubs/
+\infounnumberedsubsubsec tex-src/texinfo.tex /^\\def\\infounnumberedsubsubsec{\\parsearg\\unnumbereds/
+\initial tex-src/texinfo.tex /^\\def\\initial #1{%$/
+\internalBitem tex-src/texinfo.tex /^\\def\\internalBitem{\\smallbreak \\parsearg\\itemzzz}$/
+\internalBitemx tex-src/texinfo.tex /^\\def\\internalBitemx{\\par \\parsearg\\itemzzz}$/
+\internalBkitem tex-src/texinfo.tex /^\\def\\internalBkitem{\\smallbreak \\parsearg\\kitemzzz/
+\internalBkitemx tex-src/texinfo.tex /^\\def\\internalBkitemx{\\par \\parsearg\\kitemzzz}$/
+\internalBxitem tex-src/texinfo.tex /^\\def\\internalBxitem "#1"{\\def\\xitemsubtopix{#1} \\s/
+\internalBxitemx tex-src/texinfo.tex /^\\def\\internalBxitemx "#1"{\\def\\xitemsubtopix{#1} \\/
+\internalsetq tex-src/texinfo.tex /^\\def\\internalsetq #1#2{'xrdef {#1}{\\csname #2\\endc/
+\item tex-src/texinfo.tex /^\\def\\item{\\errmessage{@item while not in a table}}/
+\itemcontents tex-src/texinfo.tex /^\\def\\itemcontents{#1}%$/
+\itemfont tex-src/texinfo.tex /^\\def\\itemfont{#2}%$/
+\itemize tex-src/texinfo.tex /^\\def\\itemize{\\parsearg\\itemizezzz}$/
+\itemizeitem tex-src/texinfo.tex /^\\def\\itemizeitem{%$/
+\itemizey tex-src/texinfo.tex /^\\def\\itemizey #1#2{%$/
+\itemizezzz tex-src/texinfo.tex /^\\def\\itemizezzz #1{%$/
+\itemx tex-src/texinfo.tex /^\\def\\itemx{\\errmessage{@itemx while not in a table/
+\itemzzz tex-src/texinfo.tex /^\\def\\itemzzz #1{\\begingroup %$/
+\kbd tex-src/texinfo.tex /^\\def\\kbd##1{\\realbackslash kbd {##1}}$/
+\kbd tex-src/texinfo.tex /^\\def\\kbd##1{\\realbackslash kbd {##1}}%$/
+\kbd tex-src/texinfo.tex /^\\def\\kbd#1{\\def\\look{#1}\\expandafter\\kbdfoo\\look??/
+\kbdfoo tex-src/texinfo.tex /^\\def\\kbdfoo#1#2#3\\par{\\def\\one{#1}\\def\\three{#3}\\d/
+\key tex-src/texinfo.tex /^\\def\\key #1{{\\tt \\exhyphenpenalty=10000\\uppercase{/
+\key tex-src/texinfo.tex /^\\def\\key##1{\\realbackslash key {##1}}$/
+\key tex-src/texinfo.tex /^\\def\\key##1{\\realbackslash key {##1}}%$/
+\kindex tex-src/texinfo.tex /^\\def\\kindex {\\kyindex}$/
+\kitem tex-src/texinfo.tex /^\\def\\kitem{\\errmessage{@kitem while not in a table/
+\kitemx tex-src/texinfo.tex /^\\def\\kitemx{\\errmessage{@kitemx while not in a tab/
+\kitemzzz tex-src/texinfo.tex /^\\def\\kitemzzz #1{\\dosubind {kw}{\\code{#1}}{for {\\b/
+\l tex-src/texinfo.tex /^\\def\\l#1{{\\li #1}\\null} % $/
+\labelspace tex-src/texinfo.tex /^\\def\\labelspace{\\hskip1em \\relax}$/
+\lbrb tex-src/texinfo.tex /^\\def\\lbrb{{\\bf\\char`\\[}} \\def\\rbrb{{\\bf\\char`\\]}}$/
+\less tex-src/texinfo.tex /^\\def\\less{\\realbackslash less}$/
+\less tex-src/texinfo.tex /^\\def\\less{\\realbackslash less}%$/
+\linenumber tex-src/texinfo.tex /^ \\def\\linenumber{\\the\\inputlineno:\\space}$/
+\lisp tex-src/texinfo.tex /^\\def\\lisp{\\aboveenvbreak$/
+\loggingall tex-src/texinfo.tex /^\\def\\loggingall{\\tracingcommands2 \\tracingstats2 $/
+\losespace tex-src/texinfo.tex /^\\def\\losespace #1{#1}$/
+\lowercaseenumerate tex-src/texinfo.tex /^\\def\\lowercaseenumerate{%$/
+\lvvmode tex-src/texinfo.tex /^\\def\\lvvmode{\\vbox to 0pt{}}$/
+\majorheading tex-src/texinfo.tex /^\\def\\majorheading{\\parsearg\\majorheadingzzz}$/
+\majorheadingzzz tex-src/texinfo.tex /^\\def\\majorheadingzzz #1{%$/
+\math tex-src/texinfo.tex /^\\def\\math#1{\\implicitmath #1\\implicitmath}$/
+\menu tex-src/texinfo.tex /^\\long\\def\\menu #1\\end menu{}$/
+\minus tex-src/texinfo.tex /^\\def\\minus{$-$}$/
+\mylbrace tex-src/texinfo.tex /^\\def\\mylbrace {{\\tt \\char '173}}$/
+\myrbrace tex-src/texinfo.tex /^\\def\\myrbrace {{\\tt \\char '175}}$/
+\need tex-src/texinfo.tex /^\\def\\need{\\parsearg\\needx}$/
+\needx tex-src/texinfo.tex /^\\def\\needx#1{%$/
+\newcodeindex tex-src/texinfo.tex /^\\def\\newcodeindex #1{$/
+\newindex tex-src/texinfo.tex /^\\def\\newindex #1{$/
+\next tex-src/texinfo.tex /^\\def\\next##1{}\\next}$/
+\nm tex-src/testenv.tex /^\\newcommand{\\nm}[2]{\\nomenclature{#1}{#2}}$/
+\node tex-src/texinfo.tex /^\\def\\node{\\ENVcheck\\parsearg\\nodezzz}$/
+\nodexxx[ tex-src/texinfo.tex /^\\def\\nodexxx[#1,#2]{\\gdef\\lastnode{#1}}$/
+\nodezzz tex-src/texinfo.tex /^\\def\\nodezzz#1{\\nodexxx [#1,]}$/
+\nofillexdent tex-src/texinfo.tex /^\\def\\nofillexdent{\\parsearg\\nofillexdentyyy}$/
+\nofillexdentyyy tex-src/texinfo.tex /^\\def\\nofillexdentyyy #1{{\\advance \\leftskip by -\\e/
+\normalbackslash tex-src/texinfo.tex /^\\def\\normalbackslash{{\\tt\\rawbackslashxx}}$/
+\normalcaret tex-src/texinfo.tex /^\\def\\normalcaret{^}$/
+\normaldoublequote tex-src/texinfo.tex /^\\def\\normaldoublequote{"}$/
+\normalgreater tex-src/texinfo.tex /^\\def\\normalgreater{>}$/
+\normalless tex-src/texinfo.tex /^\\def\\normalless{<}$/
+\normalplus tex-src/texinfo.tex /^\\def\\normalplus{+}$/
+\normaltilde tex-src/texinfo.tex /^\\def\\normaltilde{~}$/
+\normalunderscore tex-src/texinfo.tex /^\\def\\normalunderscore{_}$/
+\normalverticalbar tex-src/texinfo.tex /^\\def\\normalverticalbar{|}$/
+\nsbot tex-src/texinfo.tex /^\\def\\nsbot{\\vbox$/
+\nstop tex-src/texinfo.tex /^\\def\\nstop{\\vbox$/
+\numberedsec tex-src/texinfo.tex /^\\outer\\def\\numberedsec{\\parsearg\\seczzz}$/
+\numberedsubsec tex-src/texinfo.tex /^\\outer\\def\\numberedsubsec{\\parsearg\\numberedsubsec/
+\numberedsubseczzz tex-src/texinfo.tex /^\\def\\numberedsubseczzz #1{\\seccheck{subsection}%$/
+\numberedsubsubsec tex-src/texinfo.tex /^\\outer\\def\\numberedsubsubsec{\\parsearg\\numberedsub/
+\numberedsubsubseczzz tex-src/texinfo.tex /^\\def\\numberedsubsubseczzz #1{\\seccheck{subsubsecti/
+\numericenumerate tex-src/texinfo.tex /^\\def\\numericenumerate{%$/
+\oddfooting tex-src/texinfo.tex /^\\def\\oddfooting{\\parsearg\\oddfootingxxx}$/
+\oddheading tex-src/texinfo.tex /^\\def\\oddheading{\\parsearg\\oddheadingxxx}$/
+\onepageout tex-src/texinfo.tex /^\\def\\onepageout#1{\\hoffset=\\normaloffset$/
+\opencontents tex-src/texinfo.tex /^\\def\\opencontents{\\openout \\contentsfile = \\jobnam/
+\openindices tex-src/texinfo.tex /^\\def\\openindices{%$/
+\opnr tex-src/texinfo.tex /^\\def\\opnr{{\\sf\\char`\\(}} \\def\\clnr{{\\sf\\char`\\)}} /
+\page tex-src/texinfo.tex /^ \\def\\page{%$/
+\page tex-src/texinfo.tex /^\\def\\page{\\par\\vfill\\supereject}$/
+\pagebody tex-src/texinfo.tex /^\\def\\pagebody#1{\\vbox to\\pageheight{\\boxmaxdepth=\\/
+\pagesofar tex-src/texinfo.tex /^\\def\\pagesofar{\\unvbox\\partialpage %$/
+\parsearg tex-src/texinfo.tex /^\\def\\parsearg #1{\\let\\next=#1\\begingroup\\obeylines/
+\parseargline tex-src/texinfo.tex /^\\def\\parseargline{\\begingroup \\obeylines \\parsearg/
+\parseargx tex-src/texinfo.tex /^\\def\\parseargx{%$/
+\pindex tex-src/texinfo.tex /^\\def\\pindex {\\pgindex}$/
+\plainsecheading tex-src/texinfo.tex /^\\def\\plainsecheading #1{\\secheadingi {#1}}$/
+\point tex-src/texinfo.tex /^\\def\\point{$\\star$}$/
+\primary tex-src/texinfo.tex /^\\def\\primary #1{\\line{#1\\hfil}}$/
+\print tex-src/texinfo.tex /^\\def\\print{\\leavevmode\\lower.1ex\\hbox to 1em{\\hfil/
+\print tex-src/texinfo.tex /^\\def\\print{\\realbackslash print}$/
+\printedmanual tex-src/texinfo.tex /^\\def\\printedmanual{\\ignorespaces #5}%$/
+\printedmanual tex-src/texinfo.tex /^section ``\\printednodename'' in \\cite{\\printedmanu/
+\printednodename tex-src/texinfo.tex /^\\def\\printednodename{\\ignorespaces #1}%$/
+\printednodename tex-src/texinfo.tex /^\\def\\printednodename{\\ignorespaces #3}%$/
+\printindex tex-src/texinfo.tex /^\\def\\printindex{\\parsearg\\doprintindex}$/
+\pxref tex-src/texinfo.tex /^\\def\\pxref#1{see \\xrefX[#1,,,,,,,]}$/
+\quotation tex-src/texinfo.tex /^\\def\\quotation{%$/
+\r tex-src/texinfo.tex /^\\def\\r##1{\\realbackslash r {##1}}$/
+\r tex-src/texinfo.tex /^\\def\\r##1{\\realbackslash r {##1}}%$/
+\r tex-src/texinfo.tex /^\\def\\r#1{{\\rm #1}} % roman font$/
+\rawbackslashxx tex-src/texinfo.tex /^\\def\\rawbackslashxx{\\indexbackslash}% \\indexbacksl/
+\rawbackslashxx tex-src/texinfo.tex /^\\def\\rawbackslashxx{\\indexbackslash}%$/
+\readauxfile tex-src/texinfo.tex /^\\def\\readauxfile{%$/
+\ref tex-src/texinfo.tex /^\\def\\ref#1{\\xrefX[#1,,,,,,,]}$/
+\refx tex-src/texinfo.tex /^\\def\\refx#1#2{%$/
+\resetmathfonts tex-src/texinfo.tex /^\\def\\resetmathfonts{%$/
+\result tex-src/texinfo.tex /^\\def\\result{\\leavevmode\\raise.15ex\\hbox to 1em{\\hf/
+\result tex-src/texinfo.tex /^\\def\\result{\\realbackslash result}$/
+\rm tex-src/texinfo.tex /^\\def\\rm{\\realbackslash rm }%$/
+\samp tex-src/texinfo.tex /^\\def\\samp #1{`\\tclose{#1}'\\null}$/
+\samp tex-src/texinfo.tex /^\\def\\samp##1{\\realbackslash samp {##1}}$/
+\samp tex-src/texinfo.tex /^\\def\\samp##1{\\realbackslash samp {##1}}%$/
+\sc tex-src/texinfo.tex /^\\def\\sc#1{{\\smallcaps#1}} % smallcaps font$/
+\seccheck tex-src/texinfo.tex /^\\def\\seccheck#1{\\if \\pageno<0 %$/
+\secentry tex-src/texinfo.tex /^ \\def\\secentry ##1##2##3##4{}$/
+\secentry tex-src/texinfo.tex /^\\def\\secentry#1#2#3#4{\\dosecentry{#2.#3\\labelspace/
+\secentryfonts tex-src/texinfo.tex /^\\def\\secentryfonts{\\textfonts}$/
+\secfonts tex-src/texinfo.tex /^\\def\\secfonts{%$/
+\secheading tex-src/texinfo.tex /^\\def\\secheading #1#2#3{\\secheadingi {#2.#3\\enspace/
+\secheadingbreak tex-src/texinfo.tex /^\\def\\secheadingbreak{\\dobreak \\secheadingskip {-10/
+\secheadingi tex-src/texinfo.tex /^\\def\\secheadingi #1{{\\advance \\secheadingskip by \\/
+\secondary tex-src/texinfo.tex /^\\def\\secondary #1#2{$/
+\seczzz tex-src/texinfo.tex /^\\def\\seczzz #1{\\seccheck{section}%$/
+\set tex-src/texinfo.tex /^\\def\\set{\\parsearg\\setxxx}$/
+\setchapternewpage tex-src/texinfo.tex /^\\def\\setchapternewpage #1 {\\csname CHAPPAG#1\\endcs/
+\setchapterstyle tex-src/texinfo.tex /^\\def\\setchapterstyle #1 {\\csname CHAPF#1\\endcsname/
+\setdeffont tex-src/texinfo.tex /^\\def\\setdeffont #1 {\\csname DEF#1\\endcsname}$/
+\setfilename tex-src/texinfo.tex /^\\def\\setfilename{%$/
+\setref tex-src/texinfo.tex /^\\def\\setref#1{%$/
+\settitle tex-src/texinfo.tex /^\\def\\settitle{\\parsearg\\settitlezzz}$/
+\settitlezzz tex-src/texinfo.tex /^\\def\\settitlezzz #1{\\gdef\\thistitle{#1}}$/
+\setxxx tex-src/texinfo.tex /^\\def\\setxxx #1{$/
+\sf tex-src/texinfo.tex /^\\def\\sf{\\fam=\\sffam \\tensf}$/
+\sf tex-src/texinfo.tex /^\\def\\sf{\\realbackslash sf}%$/
+\shortchapentry tex-src/texinfo.tex /^\\def\\shortchapentry#1#2#3{%$/
+\shortunnumberedentry tex-src/texinfo.tex /^\\def\\shortunnumberedentry#1#2{%$/
+\singlecodeindexer tex-src/texinfo.tex /^\\def\\singlecodeindexer #1{\\doind{\\indexname}{\\code/
+\singleindexer tex-src/texinfo.tex /^\\def\\singleindexer #1{\\doind{\\indexname}{#1}}$/
+\singlespace tex-src/texinfo.tex /^\\def\\singlespace{%$/
+\sl tex-src/texinfo.tex /^\\def\\sl{\\realbackslash sl }%$/
+\smallbook tex-src/texinfo.tex /^\\def\\smallbook{$/
+\smalllispx tex-src/texinfo.tex /^\\def\\smalllispx{\\aboveenvbreak\\begingroup\\inENV$/
+\smartitalic tex-src/texinfo.tex /^\\def\\smartitalic#1{{\\sl #1}\\futurelet\\next\\smartit/
+\smartitalicx tex-src/texinfo.tex /^\\def\\smartitalicx{\\ifx\\next,\\else\\ifx\\next-\\else\\i/
+\sp tex-src/texinfo.tex /^\\def\\sp{\\parsearg\\spxxx}$/
+\splitoff tex-src/texinfo.tex /^\\def\\splitoff#1#2\\endmark{\\def\\first{#1}\\def\\rest{/
+\spxxx tex-src/texinfo.tex /^\\def\\spxxx #1{\\par \\vskip #1\\baselineskip}$/
+\startcontents tex-src/texinfo.tex /^\\def\\startcontents#1{%$/
+\startenumeration tex-src/texinfo.tex /^\\def\\startenumeration#1{%$/
+\subheading tex-src/texinfo.tex /^\\def\\subheading{\\parsearg\\subsecheadingi}$/
+\subsecentry tex-src/texinfo.tex /^ \\def\\subsecentry ##1##2##3##4##5{}$/
+\subsecentry tex-src/texinfo.tex /^\\def\\subsecentry#1#2#3#4#5{\\dosubsecentry{#2.#3.#4/
+\subsecfonts tex-src/texinfo.tex /^\\def\\subsecfonts{%$/
+\subsecheading tex-src/texinfo.tex /^\\def\\subsecheading #1#2#3#4{\\subsecheadingi {#2.#3/
+\subsecheadingbreak tex-src/texinfo.tex /^\\def\\subsecheadingbreak{\\dobreak \\subsecheadingski/
+\subsecheadingi tex-src/texinfo.tex /^\\def\\subsecheadingi #1{{\\advance \\subsecheadingski/
+\subsubheading tex-src/texinfo.tex /^\\def\\subsubheading{\\parsearg\\subsubsecheadingi}$/
+\subsubsecentry tex-src/texinfo.tex /^ \\def\\subsubsecentry ##1##2##3##4##5##6{}$/
+\subsubsecentry tex-src/texinfo.tex /^\\def\\subsubsecentry#1#2#3#4#5#6{%$/
+\subsubsecfonts tex-src/texinfo.tex /^\\def\\subsubsecfonts{\\subsecfonts} % Maybe this sho/
+\subsubsecheading tex-src/texinfo.tex /^\\def\\subsubsecheading #1#2#3#4#5{\\subsubsecheading/
+\subsubsecheadingi tex-src/texinfo.tex /^\\def\\subsubsecheadingi #1{{\\advance \\subsecheading/
+\subtitle tex-src/texinfo.tex /^ \\def\\subtitle{\\parsearg\\subtitlezzz}%$/
+\subtitlefont tex-src/texinfo.tex /^ \\def\\subtitlefont{\\subtitlerm \\normalbaselinesk/
+\subtitlezzz tex-src/texinfo.tex /^ \\def\\subtitlezzz##1{{\\subtitlefont \\rightline{#/
+\summarycontents tex-src/texinfo.tex /^\\outer\\def\\summarycontents{%$/
+\supereject tex-src/texinfo.tex /^\\def\\supereject{\\par\\penalty -20000\\footnoteno =0 /
+\syncodeindex tex-src/texinfo.tex /^\\def\\syncodeindex #1 #2 {%$/
+\synindex tex-src/texinfo.tex /^\\def\\synindex #1 #2 {%$/
+\t tex-src/texinfo.tex /^\\def\\t##1{\\realbackslash r {##1}}%$/
+\t tex-src/texinfo.tex /^\\def\\t#1{{\\tt \\exhyphenpenalty=10000\\rawbackslash /
+\table tex-src/texinfo.tex /^\\def\\table{\\begingroup\\inENV\\obeylines\\obeyspaces\\/
+\tablez tex-src/texinfo.tex /^\\def\\tablez #1#2#3#4#5#6{%$/
+\tclose tex-src/texinfo.tex /^\\def\\tclose##1{\\realbackslash tclose {##1}}$/
+\tclose tex-src/texinfo.tex /^\\def\\tclose##1{\\realbackslash tclose {##1}}%$/
+\tclose tex-src/texinfo.tex /^\\def\\tclose#1{{\\rm \\tcloserm=\\fontdimen2\\font \\tt /
+\tex tex-src/texinfo.tex /^\\def\\tex{\\begingroup$/
+\texinfoversion tex-src/texinfo.tex /^\\def\\texinfoversion{2.73}$/
+\textfonts tex-src/texinfo.tex /^\\def\\textfonts{%$/
+\thearg tex-src/texinfo.tex /^ \\def\\thearg{#1}%$/
+\thearg tex-src/texinfo.tex /^ \\ifx\\thearg\\empty \\def\\thearg{1}\\fi$/
+\thischapter tex-src/texinfo.tex /^ \\unnumbchapmacro{#1}\\def\\thischapter{}%$/
+\thischapter tex-src/texinfo.tex /^\\def\\thischapter{} \\def\\thissection{}$/
+\thischaptername tex-src/texinfo.tex /^\\def\\thischaptername{No Chapter Title}$/
+\thisfile tex-src/texinfo.tex /^\\def\\thisfile{}$/
+\thistitle tex-src/texinfo.tex /^\\def\\thistitle{No Title}$/
+\tie tex-src/texinfo.tex /^\\def\\tie{\\penalty 10000\\ } % Save plain tex de/
+\tindex tex-src/texinfo.tex /^\\def\\tindex {\\tpindex}$/
+\title tex-src/texinfo.tex /^ \\def\\title{\\parsearg\\titlezzz}%$/
+\titlefont tex-src/texinfo.tex /^\\def\\titlefont#1{{\\titlerm #1}}$/
+\titlepage tex-src/texinfo.tex /^\\def\\titlepage{\\begingroup \\parindent=0pt \\textfon/
+\titlezzz tex-src/texinfo.tex /^ \\def\\titlezzz##1{\\leftline{\\titlefont{##1}}$/
+\today tex-src/texinfo.tex /^\\def\\today{\\number\\day\\space$/
+\top tex-src/texinfo.tex /^\\outer\\def\\top{\\parsearg\\unnumberedzzz}$/
+\tt tex-src/texinfo.tex /^\\def\\tt{\\realbackslash tt}$/
+\tt tex-src/texinfo.tex /^\\def\\tt{\\realbackslash tt}%$/
+\turnoffactive tex-src/texinfo.tex /^\\def\\turnoffactive{\\let"=\\normaldoublequote$/
+\unnchfopen tex-src/texinfo.tex /^\\def\\unnchfopen #1{%$/
+\unnchfplain tex-src/texinfo.tex /^\\def\\unnchfplain #1{%$/
+\unnumbchapentry tex-src/texinfo.tex /^\\def\\unnumbchapentry#1#2{\\dochapentry{#1}{#2}}$/
+\unnumbered tex-src/texinfo.tex /^\\outer\\def\\unnumbered{\\parsearg\\unnumberedzzz}$/
+\unnumberedsec tex-src/texinfo.tex /^\\outer\\def\\unnumberedsec{\\parsearg\\unnumberedseczz/
+\unnumberedseczzz tex-src/texinfo.tex /^\\def\\unnumberedseczzz #1{\\seccheck{unnumberedsec}%/
+\unnumberedsubsec tex-src/texinfo.tex /^\\outer\\def\\unnumberedsubsec{\\parsearg\\unnumberedsu/
+\unnumberedsubseczzz tex-src/texinfo.tex /^\\def\\unnumberedsubseczzz #1{\\seccheck{unnumberedsu/
+\unnumberedsubsubsec tex-src/texinfo.tex /^\\outer\\def\\unnumberedsubsubsec{\\parsearg\\unnumbere/
+\unnumberedsubsubseczzz tex-src/texinfo.tex /^\\def\\unnumberedsubsubseczzz #1{\\seccheck{unnumbere/
+\unnumberedzzz tex-src/texinfo.tex /^\\def\\unnumberedzzz #1{\\seccheck{unnumbered}%$/
+\unnumbnoderef tex-src/texinfo.tex /^\\def\\unnumbnoderef{\\ifx\\lastnode\\relax\\else$/
+\unnumbsecentry tex-src/texinfo.tex /^ \\def\\unnumbsecentry ##1##2{}$/
+\unnumbsecentry tex-src/texinfo.tex /^\\def\\unnumbsecentry#1#2{\\dosecentry{#1}{#2}}$/
+\unnumbsetref tex-src/texinfo.tex /^\\def\\unnumbsetref#1{%$/
+\unnumbsubsecentry tex-src/texinfo.tex /^ \\def\\unnumbsubsecentry ##1##2{}$/
+\unnumbsubsecentry tex-src/texinfo.tex /^\\def\\unnumbsubsecentry#1#2{\\dosubsecentry{#1}{#2}}/
+\unnumbsubsubsecentry tex-src/texinfo.tex /^ \\def\\unnumbsubsubsecentry ##1##2{}$/
+\unnumbsubsubsecentry tex-src/texinfo.tex /^\\def\\unnumbsubsubsecentry#1#2{\\dosubsubsecentry{#1/
+\uppercaseenumerate tex-src/texinfo.tex /^\\def\\uppercaseenumerate{%$/
+\var tex-src/texinfo.tex /^\\def\\var##1{\\realbackslash var {##1}}$/
+\var tex-src/texinfo.tex /^\\def\\var##1{\\realbackslash var {##1}}%$/
+\vindex tex-src/texinfo.tex /^\\def\\vindex {\\vrindex}$/
+\vritemindex tex-src/texinfo.tex /^\\def\\vritemindex #1{\\doind {vr}{\\code{#1}}}%$/
+\vtable tex-src/texinfo.tex /^\\def\\vtable{\\begingroup\\inENV\\obeylines\\obeyspaces/
+\w tex-src/texinfo.tex /^\\def\\w#1{\\leavevmode\\hbox{#1}}$/
+\w tex-src/texinfo.tex /^\\def\\w{\\realbackslash w }%$/
+\w tex-src/texinfo.tex /^\\def\\w{\\realbackslash w}$/
+\xitem tex-src/texinfo.tex /^\\def\\xitem{\\errmessage{@xitem while not in a table/
+\xitemx tex-src/texinfo.tex /^\\def\\xitemx{\\errmessage{@xitemx while not in a tab/
+\xitemzzz tex-src/texinfo.tex /^\\def\\xitemzzz #1{\\dosubind {kw}{\\code{#1}}{for {\\b/
+\xkey tex-src/texinfo.tex /^\\def\\xkey{\\key}$/
+\xrdef tex-src/texinfo.tex /^\\def\\xrdef #1#2{$/
+\xref tex-src/texinfo.tex /^\\def\\xref#1{See \\xrefX[#1,,,,,,,]}$/
+\xrefX[ tex-src/texinfo.tex /^\\def\\xrefX[#1,#2,#3,#4,#5,#6]{\\begingroup%$/
+^ tex-src/texinfo.tex /^\\def^{{\\tt \\hat}}$/
+_ tex-src/texinfo.tex /^\\def_{\\ifusingtt\\normalunderscore\\_}$/
+_GETOPT_H c-src/getopt.h 19
+_GNU_SOURCE c-src/etags.c 94
+_REGEX_H c-src/emacs/src/regex.h 21
+_RE_SYNTAX_POSIX_COMMON c-src/emacs/src/regex.h 221
+_Restrict_ c-src/emacs/src/regex.h 540
+_Restrict_ c-src/emacs/src/regex.h 542
+_Restrict_ c-src/emacs/src/regex.h 544
+_Restrict_arr_ c-src/emacs/src/regex.h 555
+_Restrict_arr_ c-src/emacs/src/regex.h 557
+_UCHAR_T c-src/emacs/src/lisp.h 2423
+__COLORS cp-src/screen.hpp 9
+__default_morecore c-src/emacs/src/gmalloc.c /^__default_morecore (ptrdiff_t increment)$/
+__init__ pyt-src/server.py /^ def __init__(self):$/
+__init__ pyt-src/server.py /^ def __init__(self, Master, text, textvar, widt/
+__init__ pyt-src/server.py /^ def __init__(self, host, sitelist, master=None/
+__init__ pyt-src/server.py /^ def __init__(self, master=None):$/
+__init__ pyt-src/server.py /^ def __init__(self, newlegend, list, editor, ma/
+__init__ pyt-src/server.py /^ def __init__(self, user, userlist, master=None/
+__ip c.c 159
+__libc_atexit c-src/exit.c 30
+__libc_atexit c-src/exit.strange_suffix 30
+__malloc_extra_blocks c-src/emacs/src/gmalloc.c 381
+__malloc_initialize c-src/emacs/src/gmalloc.c /^__malloc_initialize (void)$/
+__malloc_initialized c-src/emacs/src/gmalloc.c 379
+__repr__ pyt-src/server.py /^ def __repr__(self):$/
+__sbrk c-src/emacs/src/gmalloc.c 1513
+__str__ pyt-src/server.py /^ def __str__(self):$/
+__up c.c 160
+_aligned_blocks c-src/emacs/src/gmalloc.c 1004
+_aligned_blocks_mutex c-src/emacs/src/gmalloc.c 518
+_bar? ruby-src/test1.ru /^ def self._bar?(abc)$/
+_bytes_free c-src/emacs/src/gmalloc.c 376
+_bytes_used c-src/emacs/src/gmalloc.c 374
+_chunks_free c-src/emacs/src/gmalloc.c 375
+_chunks_used c-src/emacs/src/gmalloc.c 373
+_fraghead c-src/emacs/src/gmalloc.c 370
+_free c-src/emacs/src/gmalloc.c /^_free (void *ptr)$/
+_free_internal c-src/emacs/src/gmalloc.c /^_free_internal (void *ptr)$/
+_free_internal_nolock c-src/emacs/src/gmalloc.c /^_free_internal_nolock (void *ptr)$/
+_heapbase c-src/emacs/src/gmalloc.c 355
+_heapindex c-src/emacs/src/gmalloc.c 364
+_heapinfo c-src/emacs/src/gmalloc.c 358
+_heaplimit c-src/emacs/src/gmalloc.c 367
+_malloc c-src/emacs/src/gmalloc.c /^_malloc (size_t size)$/
+_malloc_internal c-src/emacs/src/gmalloc.c /^_malloc_internal (size_t size)$/
+_malloc_internal_nolock c-src/emacs/src/gmalloc.c /^_malloc_internal_nolock (size_t size)$/
+_malloc_mutex c-src/emacs/src/gmalloc.c 517
+_malloc_thread_enabled_p c-src/emacs/src/gmalloc.c 519
+_realloc c-src/emacs/src/gmalloc.c /^_realloc (void *ptr, size_t size)$/
+_realloc_internal c-src/emacs/src/gmalloc.c /^_realloc_internal (void *ptr, size_t size)$/
+_realloc_internal_nolock c-src/emacs/src/gmalloc.c /^_realloc_internal_nolock (void *ptr, size_t size)$/
+` ruby-src/test.rb /^ def `(command)$/
+a c-src/h.h 103
+a c-src/h.h 40
+a c.c /^a ()$/
+a c.c /^a()$/
+a c.c 152
+a c.c 180
+a cp-src/c.C 132
+a ruby-src/test1.ru /^ def a()$/
+a-forth-constant! forth-src/test-forth.fth /^99 constant a-forth-constant!$/
+a-forth-value? forth-src/test-forth.fth /^55 value a-forth-value?$/
+a-forth-word forth-src/test-forth.fth /^: a-forth-word ( a b c -- )$/
+a-forth-word forth-src/test-forth.fth /^: a-forth-word ( a b c -- a*b+c ) + * ;$/
+a0 c-src/emacs/src/lisp.h /^ Lisp_Object (*a0) (void);$/
+a1 c-src/emacs/src/lisp.h /^ Lisp_Object (*a1) (Lisp_Object);$/
+a2 c-src/emacs/src/lisp.h /^ Lisp_Object (*a2) (Lisp_Object, Lisp_Object)/
+a3 c-src/emacs/src/lisp.h /^ Lisp_Object (*a3) (Lisp_Object, Lisp_Object,/
+a4 c-src/emacs/src/lisp.h /^ Lisp_Object (*a4) (Lisp_Object, Lisp_Object,/
+a5 c-src/emacs/src/lisp.h /^ Lisp_Object (*a5) (Lisp_Object, Lisp_Object,/
+a6 c-src/emacs/src/lisp.h /^ Lisp_Object (*a6) (Lisp_Object, Lisp_Object,/
+a7 c-src/emacs/src/lisp.h /^ Lisp_Object (*a7) (Lisp_Object, Lisp_Object,/
+a8 c-src/emacs/src/lisp.h /^ Lisp_Object (*a8) (Lisp_Object, Lisp_Object,/
+aMANY c-src/emacs/src/lisp.h /^ Lisp_Object (*aMANY) (ptrdiff_t, Lisp_Object/
+aUNEVALLED c-src/emacs/src/lisp.h /^ Lisp_Object (*aUNEVALLED) (Lisp_Object args)/
+aa c.c 269
+aa c.c 279
+aaa c.c 249
+aaa c.c 269
+aaaaaa c-src/h.h 111
+abbrev-expansion c-src/abbrev.c /^DEFUN ("abbrev-expansion", Fabbrev_expansion, Sabb/
+abbrev-symbol c-src/abbrev.c /^DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_sy/
+abbrev_all_caps c-src/abbrev.c 58
+abbrevs_changed c-src/abbrev.c 56
+abc c-src/h.h 33
+abc c-src/h.h 37
+abort-recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("abort-recursive-edit", Fabort_recursive_ed/
+abs/f ada-src/etags-test-for.ada /^ function "abs" (Right : Complex) return Real'/
+absolute_dirname c-src/etags.c /^absolute_dirname (char *file, char *dir)$/
+absolute_filename c-src/etags.c /^absolute_filename (char *file, char *dir)$/
+abt cp-src/c.C 55
+acc_pred_info merc-src/accumulator.m /^:- pred acc_pred_info(list(mer_type)::in, list(pro/
+acc_proc_info merc-src/accumulator.m /^:- pred acc_proc_info(list(prog_var)::in, prog_var/
+acc_unification merc-src/accumulator.m /^:- pred acc_unification(pair(prog_var)::in, hlds_g/
+acc_var_subst_init merc-src/accumulator.m /^:- pred acc_var_subst_init(list(prog_var)::in,$/
+accent_key_syms c-src/emacs/src/keyboard.c 4625
+access_keymap_keyremap c-src/emacs/src/keyboard.c /^access_keymap_keyremap (Lisp_Object map, Lisp_Obje/
+accu_assoc merc-src/accumulator.m /^:- pred accu_assoc(module_info::in, vartypes::in, /
+accu_assoc merc-src/accumulator.m /^:- type accu_assoc$/
+accu_base merc-src/accumulator.m /^:- type accu_base$/
+accu_before merc-src/accumulator.m /^:- pred accu_before(module_info::in, vartypes::in,/
+accu_case merc-src/accumulator.m /^:- type accu_case$/
+accu_construct merc-src/accumulator.m /^:- pred accu_construct(module_info::in, vartypes::/
+accu_construct_assoc merc-src/accumulator.m /^:- pred accu_construct_assoc(module_info::in, vart/
+accu_create_goal merc-src/accumulator.m /^:- pred accu_create_goal(accu_goal_id::in, list(pr/
+accu_divide_base_case merc-src/accumulator.m /^:- pred accu_divide_base_case(module_info::in, var/
+accu_goal_id merc-src/accumulator.m /^:- type accu_goal_id$/
+accu_goal_list merc-src/accumulator.m /^:- func accu_goal_list(list(accu_goal_id), accu_go/
+accu_goal_store merc-src/accumulator.m /^:- type accu_goal_store == goal_store(accu_goal_id/
+accu_has_heuristic merc-src/accumulator.m /^:- pred accu_has_heuristic(module_name::in, string/
+accu_heuristic merc-src/accumulator.m /^:- pred accu_heuristic(module_name::in, string::in/
+accu_is_associative merc-src/accumulator.m /^:- pred accu_is_associative(module_info::in, pred_/
+accu_is_update merc-src/accumulator.m /^:- pred accu_is_update(module_info::in, pred_id::i/
+accu_process_assoc_set merc-src/accumulator.m /^:- pred accu_process_assoc_set(module_info::in, ac/
+accu_process_update_set merc-src/accumulator.m /^:- pred accu_process_update_set(module_info::in, a/
+accu_related merc-src/accumulator.m /^:- pred accu_related(module_info::in, vartypes::in/
+accu_rename merc-src/accumulator.m /^:- func accu_rename(list(accu_goal_id), accu_subst/
+accu_sets merc-src/accumulator.m /^:- type accu_sets$/
+accu_sets_init merc-src/accumulator.m /^:- pred accu_sets_init(accu_sets::out) is det.$/
+accu_stage1 merc-src/accumulator.m /^:- pred accu_stage1(module_info::in, vartypes::in,/
+accu_stage1_2 merc-src/accumulator.m /^:- pred accu_stage1_2(module_info::in, vartypes::i/
+accu_stage2 merc-src/accumulator.m /^:- pred accu_stage2(module_info::in, proc_info::in/
+accu_stage3 merc-src/accumulator.m /^:- pred accu_stage3(accu_goal_id::in, list(prog_va/
+accu_standardize merc-src/accumulator.m /^:- pred accu_standardize(hlds_goal::in, hlds_goal:/
+accu_store merc-src/accumulator.m /^:- pred accu_store(accu_case::in, hlds_goal::in,$/
+accu_subst merc-src/accumulator.m /^:- type accu_subst == map(prog_var, prog_var).$/
+accu_substs merc-src/accumulator.m /^:- type accu_substs$/
+accu_substs_init merc-src/accumulator.m /^:- pred accu_substs_init(list(prog_var)::in, prog_/
+accu_top_level merc-src/accumulator.m /^:- pred accu_top_level(top_level::in, hlds_goal::i/
+accu_transform_proc merc-src/accumulator.m /^:- pred accu_transform_proc(pred_proc_id::in, pred/
+accu_update merc-src/accumulator.m /^:- pred accu_update(module_info::in, vartypes::in,/
+accu_warning merc-src/accumulator.m /^:- type accu_warning$/
+act prol-src/natded.prolog /^act(OutForm,OutSyn,Ws):-$/
+action prol-src/natded.prolog /^action(KeyVals):-$/
+active_maps c-src/emacs/src/keyboard.c /^active_maps (Lisp_Object first_event)$/
+actout prol-src/natded.prolog /^actout('Text',Trees):-$/
+addArchs objc-src/PackInsp.m /^-(void)addArchs:(const char *)string$/
+addPOReader php-src/lce_functions.php /^ function addPOReader($d_name, &$por)$/
+add_active prol-src/natded.prolog /^add_active([],Cat,Goal):-$/
+add_command_key c-src/emacs/src/keyboard.c /^add_command_key (Lisp_Object key)$/
+add_edge prol-src/natded.prolog /^add_edge(Left,Right,Cat):-$/
+add_node c-src/etags.c /^add_node (node *np, node **cur_node_p)$/
+add_regex c-src/etags.c /^add_regex (char *regexp_pattern, language *lang)$/
+add_user_signal c-src/emacs/src/keyboard.c /^add_user_signal (int sig, const char *name)$/
+addnoise html-src/algrthms.html /^Adding Noise to the$/
+address y-src/cccp.y 113
+adjust_point_for_property c-src/emacs/src/keyboard.c /^adjust_point_for_property (ptrdiff_t last_pt, bool/
+agent cp-src/clheir.hpp 75
+algorithms html-src/algrthms.html /^Description$/
+alias c-src/emacs/src/lisp.h 688
+align c-src/emacs/src/gmalloc.c /^align (size_t size)$/
+alignas c-src/emacs/src/lisp.h /^# define alignas(alignment) \/* empty *\/$/
+aligned c-src/emacs/src/gmalloc.c 199
+aligned_alloc c-src/emacs/src/gmalloc.c /^aligned_alloc (size_t alignment, size_t size)$/
+aligned_alloc c-src/emacs/src/gmalloc.c 1718
+aligned_alloc c-src/emacs/src/gmalloc.c 71
+alignlist c-src/emacs/src/gmalloc.c 196
+alive cp-src/conway.hpp 7
+all_kboards c-src/emacs/src/keyboard.c 86
+allocate_kboard c-src/emacs/src/keyboard.c /^allocate_kboard (Lisp_Object type)$/
+allocated c-src/emacs/src/regex.h 344
+an_extern_linkage c-src/h.h 44
+an_extern_linkage c-src/h.h 56
+an_extern_linkage_ptr c-src/h.h 43
+analyze_regex c-src/etags.c /^analyze_regex (char *regex_arg)$/
+andkeyvalseq prol-src/natded.prolog /^andkeyvalseq(KeyVals) --> ['&'], keyvalseq(KeyVals/
+animals c-src/h.h 81
+animals cp-src/c.C 126
+animals cp-src/c.C 130
+any_kboard_state c-src/emacs/src/keyboard.c /^any_kboard_state ()$/
+appDidInit objcpp-src/SimpleCalc.M /^- appDidInit:sender$/
+append prol-src/natded.prolog /^append([],Xs,Xs).$/
+appendToDisplay objcpp-src/SimpleCalc.M /^- appendToDisplay:(const char *)theDigit$/
+append_list prol-src/natded.prolog /^append_list([],[]).$/
+append_string pas-src/common.pas /^procedure append_string;(*($/
+append_tool_bar_item c-src/emacs/src/keyboard.c /^append_tool_bar_item (void)$/
+appendix perl-src/htlmify-cystic 24
+appendix_name perl-src/htlmify-cystic 13
+appendix_toc perl-src/htlmify-cystic 16
+apply_modifiers c-src/emacs/src/keyboard.c /^apply_modifiers (int modifiers, Lisp_Object base)$/
+apply_modifiers_uncached c-src/emacs/src/keyboard.c /^apply_modifiers_uncached (int modifiers, char *bas/
+aref_addr c-src/emacs/src/lisp.h /^aref_addr (Lisp_Object array, ptrdiff_t idx)$/
+arg c-src/emacs/src/lisp.h 2961
+arg c-src/emacs/src/lisp.h 2966
+arg c-src/emacs/src/lisp.h 2971
+arg c-src/h.h 13
+arg_type c-src/etags.c 250
+arglist y-src/cccp.y 41
+argno y-src/cccp.y 45
+args c-src/emacs/src/lisp.h 2986
+args c-src/h.h 30
+argsindent tex-src/texinfo.tex /^\\dimen1=\\hsize \\advance \\dimen1 by -\\defargsindent/
+argsindent tex-src/texinfo.tex /^\\newskip\\defargsindent \\defargsindent=50pt$/
+argsindent tex-src/texinfo.tex /^\\parshape 2 0in \\dimen0 \\defargsindent \\dimen1 /
+argument c-src/etags.c 253
+argvals prol-src/natded.prolog /^argvals([]) --> [].$/
+array c.c 190
+ascii c-src/emacs/src/lisp.h 1598
+asort cp-src/functions.cpp /^void asort(int *a, int num){$/
+assemby-code-word forth-src/test-forth.fth /^code assemby-code-word ( dunno what it does )$/
+assert c-src/etags.c /^# define assert(x) ((void) 0)$/
+assert c-src/etags.c 135
+assign_neighbor cp-src/clheir.hpp /^ void assign_neighbor(int direction, location */
+assoc_list merc-src/accumulator.m /^:- import_module assoc_list.$/
+associativity_assertion merc-src/accumulator.m /^:- pred associativity_assertion(module_info::in, l/
+at_end c-src/etags.c 249
+at_filename c-src/etags.c 247
+at_language c-src/etags.c 245
+at_least_one_member prol-src/natded.prolog /^at_least_one_member(X,[X|_]):-!.$/
+at_regexp c-src/etags.c 246
+at_stdin c-src/etags.c 248
+atom prol-src/natded.prolog /^atom(X) --> [X], {atomic(X)}.$/
+atomval prol-src/natded.prolog /^atomval(X) --> atom(X).$/
+aultparindent tex-src/texinfo.tex /^\\newdimen\\defaultparindent \\defaultparindent = 15p/
+aultparindent tex-src/texinfo.tex /^\\parindent = \\defaultparindent$/
+aultparindent\hang\textindent tex-src/texinfo.tex /^\\footstrut\\parindent=\\defaultparindent\\hang\\textin/
+auto_help c-src/etags.c 699
+b c-src/h.h 103
+b c-src/h.h 104
+b c-src/h.h 41
+b c.c /^b ()$/
+b c.c 180
+b c.c 259
+b c.c 260
+b c.c 262
+b cp-src/c.C 132
+b ruby-src/test1.ru /^ def b()$/
+backslash=0 tex-src/texinfo.tex /^\\let\\indexbackslash=0 %overridden during \\printin/
+bar c-src/c.c /^void bar() {while(0) {}}$/
+bar c-src/h.h 19
+bar c.c 143
+bar cp-src/x.cc /^XX::bar()$/
+bar1 ruby-src/test1.ru /^ attr_reader(:foo1, :bar1, # comment$/
+bar= ruby-src/test1.ru /^ attr_writer :bar,$/
+bas_syn prol-src/natded.prolog /^bas_syn(n(_)).$/
+base c-src/emacs/src/lisp.h 2188
+base cp-src/Range.h /^ double base (void) const { return rng_base; }$/
+base cp-src/c.C /^double base (void) const { return rng_base; }$/
+base_case_ids merc-src/accumulator.m /^:- func base_case_ids(accu_goal_store) = list(accu/
+base_case_ids_set merc-src/accumulator.m /^:- func base_case_ids_set(accu_goal_store) = set(a/
+baz= ruby-src/test1.ru /^ :baz,$/
+bb c.c 275
+bbb c.c 251
+bbbbbb c-src/h.h 113
+been_warned c-src/etags.c 222
+before_command_echo_length c-src/emacs/src/keyboard.c 130
+before_command_key_count c-src/emacs/src/keyboard.c 129
+begtoken c-src/etags.c /^#define begtoken(c) (_btk[CHAR (c)]) \/* c can star/
+behaviour_info erl-src/gs_dialog.erl /^behaviour_info(callbacks) ->$/
+bf=cmbx10 tex-src/texinfo.tex /^\\font\\defbf=cmbx10 scaled \\magstep1 %was 1314$/
+bind pyt-src/server.py /^ def bind(self, key, action):$/
+bind_polling_period c-src/emacs/src/keyboard.c /^bind_polling_period (int n)$/
+bits_word c-src/emacs/src/lisp.h 123
+bits_word c-src/emacs/src/lisp.h 127
+bla c.c /^int bla ()$/
+blah tex-src/testenv.tex /^\\section{blah}$/
+bletch el-src/TAGTEST.EL /^(foo::defmumble bletch beuarghh)$/
+blv c-src/emacs/src/lisp.h 689
+blv_found c-src/emacs/src/lisp.h /^blv_found (struct Lisp_Buffer_Local_Value *blv)$/
+bodyindent tex-src/texinfo.tex /^\\advance\\dimen2 by -\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\advance\\dimen3 by -\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\advance\\leftskip by -\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\advance\\leftskip by \\defbodyindent \\advance \\righ/
+bodyindent tex-src/texinfo.tex /^\\exdentamount=\\defbodyindent$/
+bodyindent tex-src/texinfo.tex /^\\newskip\\defbodyindent \\defbodyindent=.4in$/
+bool c.c 222
+bool merc-src/accumulator.m /^:- import_module bool.$/
+bool_header_size c-src/emacs/src/lisp.h 1472
+bool_vector_bitref c-src/emacs/src/lisp.h /^bool_vector_bitref (Lisp_Object a, EMACS_INT i)$/
+bool_vector_bytes c-src/emacs/src/lisp.h /^bool_vector_bytes (EMACS_INT size)$/
+bool_vector_data c-src/emacs/src/lisp.h /^bool_vector_data (Lisp_Object a)$/
+bool_vector_ref c-src/emacs/src/lisp.h /^bool_vector_ref (Lisp_Object a, EMACS_INT i)$/
+bool_vector_set c-src/emacs/src/lisp.h /^bool_vector_set (Lisp_Object a, EMACS_INT i, bool /
+bool_vector_size c-src/emacs/src/lisp.h /^bool_vector_size (Lisp_Object a)$/
+bool_vector_uchar_data c-src/emacs/src/lisp.h /^bool_vector_uchar_data (Lisp_Object a)$/
+bool_vector_words c-src/emacs/src/lisp.h /^bool_vector_words (EMACS_INT size)$/
+boolvar c-src/emacs/src/lisp.h 2287
+bracelev c-src/etags.c 2520
+bsp_DevId c-src/h.h 25
+bt c-src/emacs/src/lisp.h 2988
+btowc c-src/emacs/src/regex.h /^# define btowc(c) c$/
+buffer c-src/emacs/src/lisp.h 2000
+buffer c-src/emacs/src/regex.h 341
+buffer c-src/etags.c 238
+buffer c-src/h.h 119
+build prol-src/natded.prolog /^build([],Left,Left).$/
+build_pure_c_string c-src/emacs/src/lisp.h /^build_pure_c_string (const char *str)$/
+build_string c-src/emacs/src/lisp.h /^build_string (const char *str)$/
+buildact prol-src/natded.prolog /^buildact([SynIn],Right,RightPlus1):-$/
+builtin_lisp_symbol c-src/emacs/src/lisp.h /^builtin_lisp_symbol (int index)$/
+burst c-src/h.h 28
+busy c-src/emacs/src/gmalloc.c 158
+button_down_location c-src/emacs/src/keyboard.c 5210
+button_down_time c-src/emacs/src/keyboard.c 5218
+byte_stack c-src/emacs/src/lisp.h 3049
+bytecode_dest c-src/emacs/src/lisp.h 3037
+bytecode_top c-src/emacs/src/lisp.h 3036
+bytepos c-src/emacs/src/lisp.h 2016
+bytes_free c-src/emacs/src/gmalloc.c 314
+bytes_total c-src/emacs/src/gmalloc.c 310
+bytes_used c-src/emacs/src/gmalloc.c 312
+c c-src/h.h /^#define c() d$/
+c c-src/h.h 106
+c c.c 180
+c_ext c-src/etags.c 2271
+caccacacca c.c /^caccacacca (a,b,c,d,e,f,g)$/
+cacheLRUEntry_s c.c 172
+cacheLRUEntry_t c.c 177
+calculate_goal_info merc-src/accumulator.m /^:- pred calculate_goal_info(hlds_goal_expr::in, hl/
+calloc c-src/emacs/src/gmalloc.c /^calloc (size_t nmemb, size_t size)$/
+calloc c-src/emacs/src/gmalloc.c 1717
+calloc c-src/emacs/src/gmalloc.c 66
+calloc c-src/emacs/src/gmalloc.c 70
+can_be_null c-src/emacs/src/regex.h 370
+cancel_echoing c-src/emacs/src/keyboard.c /^cancel_echoing (void)$/
+canonicalize_filename c-src/etags.c /^canonicalize_filename (register char *fn)$/
+case_Lisp_Int c-src/emacs/src/lisp.h 438
+cat c-src/h.h 81
+cat cp-src/c.C 126
+cat cp-src/c.C 130
+cat prol-src/natded.prolog /^cat(A, Alpha@Beta, Ass3, Qs3, tree(fe,A:Alpha@Beta/
+cat_atoms prol-src/natded.prolog /^cat_atoms(A1,A2,A3):-$/
+cccccccccc c-src/h.h 115
+cdr c-src/emacs/src/lisp.h 1159
+cell y-src/parse.y 279
+cgrep html-src/software.html /^cgrep$/
+chain c-src/emacs/src/lisp.h 1162
+chain c-src/emacs/src/lisp.h 2206
+chain c-src/emacs/src/lisp.h 2396
+chain_subst merc-src/accumulator.m /^:- func chain_subst(accu_subst, accu_subst) = accu/
+chain_subst_2 merc-src/accumulator.m /^:- pred chain_subst_2(list(A)::in, map(A, B)::in, /
+char_bits c-src/emacs/src/lisp.h 2443
+char_table_specials c-src/emacs/src/lisp.h 1692
+charpos c-src/emacs/src/lisp.h 2011
+charset_unibyte c-src/emacs/src/regex.h 410
+chartonmstr pas-src/common.pas /^function chartonmstr; (*($/
+checkQuotation php-src/lce_functions.php /^ function checkQuotation($str)$/
+check_cons_list c-src/emacs/src/lisp.h /^# define check_cons_list() lisp_h_check_cons_list/
+checker make-src/Makefile /^checker:$/
+checkhdr c-src/emacs/src/gmalloc.c /^checkhdr (const struct hdr *hdr)$/
+checkiso html-src/software.html /^checkiso$/
+childDidExit objc-src/Subprocess.m /^- childDidExit$/
+chunks_free c-src/emacs/src/gmalloc.c 313
+chunks_used c-src/emacs/src/gmalloc.c 311
+cjava c-src/etags.c 2936
+class_method ruby-src/test.rb /^ def ClassExample.class_method$/
+classifyLine php-src/lce_functions.php /^ function classifyLine($line)$/
+clean make-src/Makefile /^clean:$/
+clear cp-src/conway.hpp /^ void clear(void) { alive = 0; }$/
+clear-abbrev-table c-src/abbrev.c /^DEFUN ("clear-abbrev-table", Fclear_abbrev_table, /
+clear-this-command-keys c-src/emacs/src/keyboard.c /^DEFUN ("clear-this-command-keys", Fclear_this_comm/
+clearAllKey objcpp-src/SimpleCalc.M /^- clearAllKey:sender$/
+clearKey objcpp-src/SimpleCalc.M /^- clearKey:sender$/
+clear_event c-src/emacs/src/keyboard.c /^clear_event (struct input_event *event)$/
+clear_input_pending c-src/emacs/src/keyboard.c /^clear_input_pending (void)$/
+clear_neighbors cp-src/clheir.cpp /^void discrete_location::clear_neighbors(void)$/
+clear_screen cp-src/screen.cpp /^void clear_screen(void)$/
+clear_waiting_for_input c-src/emacs/src/keyboard.c /^clear_waiting_for_input (void)$/
+cmd_error c-src/emacs/src/keyboard.c /^cmd_error (Lisp_Object data)$/
+cmd_error_internal c-src/emacs/src/keyboard.c /^cmd_error_internal (Lisp_Object data, const char */
+cmpfn c-src/emacs/src/lisp.h /^ bool (*cmpfn) (struct hash_table_test *t, Lisp_O/
+cmt prol-src/natded.prolog /^cmt:-$/
+cname c-src/etags.c 2519
+cno c-src/etags.c 224
+colori cp-src/c.C 40
+commaargvals prol-src/natded.prolog /^commaargvals(Args) -->$/
+command c-src/etags.c 187
+command-error-default-function c-src/emacs/src/keyboard.c /^DEFUN ("command-error-default-function", Fcommand_/
+command_loop c-src/emacs/src/keyboard.c /^command_loop (void)$/
+command_loop_1 c-src/emacs/src/keyboard.c /^command_loop_1 (void)$/
+command_loop_2 c-src/emacs/src/keyboard.c /^command_loop_2 (Lisp_Object ignore)$/
+command_loop_level c-src/emacs/src/keyboard.c 195
+comment php-src/lce_functions.php /^ function comment($line, $class)$/
+commutativity_assertion merc-src/accumulator.m /^:- pred commutativity_assertion(module_info::in,li/
+compile_empty prol-src/natded.prolog /^compile_empty:-$/
+compile_lex prol-src/natded.prolog /^compile_lex(File):-$/
+complete prol-src/natded.prolog /^complete(Cat):-$/
+complete-tag el-src/emacs/lisp/progmodes/etags.el /^(defun complete-tag ()$/
+compressor c-src/etags.c 188
+compressors c-src/etags.c 457
+compute_next_state cp-src/clheir.hpp /^ virtual void compute_next_state(void) { }$/
+compute_next_state cp-src/conway.hpp /^ void compute_next_state(void)$/
+conalgorithm html-src/algrthms.html /^Convolutionally$/
+concat c-src/etags.c /^concat (const char *s1, const char *s2, const char/
+concatenatenamestrings pas-src/common.pas /^function concatenatenamestrings; (*($/
+consider_token c-src/etags.c /^consider_token (char *str, int len, int c, int *c_/
+constant c-src/emacs/src/lisp.h 668
+constant c-src/h.h 29
+constant y-src/cccp.y 112
+constant_args c-src/h.h 27
+constype c-src/emacs/src/lisp.h 3739
+consult_lex prol-src/natded.prolog /^consult_lex:-$/
+contents c-src/emacs/src/lisp.h 1372
+contents c-src/emacs/src/lisp.h 1600
+contents c-src/emacs/src/lisp.h 1624
+count c-src/emacs/src/lisp.h 1863
+count_layers lua-src/allegro.lua /^local function count_layers (layer)$/
+count_words c-src/tab.c /^static int count_words(char *str, char delim)$/
+counter cp-src/c.C 33
+counter cp-src/c.C 36
+cow cp-src/c.C 127
+cow cp-src/c.C 131
+cplpl c-src/etags.c 2935
+create-bar forth-src/test-forth.fth /^: create-bar foo ;$/
+createPOEntries php-src/lce_functions.php /^ function createPOEntries()$/
+createWidgets pyt-src/server.py /^ def createWidgets(self):$/
+createWidgets pyt-src/server.py /^ def createWidgets(self, host):$/
+create_acc_call merc-src/accumulator.m /^:- func create_acc_call(hlds_goal::in(goal_plain_c/
+create_acc_goal merc-src/accumulator.m /^:- pred create_acc_goal(hlds_goal::in, accu_substs/
+create_new_base_goals merc-src/accumulator.m /^:- func create_new_base_goals(set(accu_goal_id), a/
+create_new_orig_recursive_goals merc-src/accumulator.m /^:- func create_new_orig_recursive_goals(set(accu_g/
+create_new_recursive_goals merc-src/accumulator.m /^:- func create_new_recursive_goals(set(accu_goal_i/
+create_new_var merc-src/accumulator.m /^:- pred create_new_var(prog_var::in, string::in, p/
+create_orig_goal merc-src/accumulator.m /^:- pred create_orig_goal(hlds_goal::in, accu_subst/
+cscInitTime cp-src/c.C 7
+cscSegmentationTime cp-src/c.C 8
+cstack c-src/etags.c 2523
+ctags make-src/Makefile /^ctags: etags.c ${OBJS}$/
+curlb c-src/etags.c 2929
+curlinepos c-src/etags.c 2931
+current-idle-time c-src/emacs/src/keyboard.c /^DEFUN ("current-idle-time", Fcurrent_idle_time, Sc/
+current-input-mode c-src/emacs/src/keyboard.c /^DEFUN ("current-input-mode", Fcurrent_input_mode, /
+current_kboard c-src/emacs/src/keyboard.c 85
+current_lb_is_new c-src/etags.c 2926
+curry-test scm-src/test.scm /^(define (((((curry-test a) b) c) d) e)$/
+cursor_position cp-src/screen.cpp /^void cursor_position(void)$/
+cursor_x cp-src/screen.cpp 15
+cursor_y cp-src/screen.cpp 15
+d c-src/emacs/src/lisp.h 4673
+d c-src/emacs/src/lisp.h 4679
+d c.c 180
+data c-src/emacs/src/lisp.h 1395
+data c-src/emacs/src/lisp.h 2129
+data c-src/emacs/src/lisp.h 2395
+ddefineseen c-src/etags.c 2462
+debian-bug html-src/software.html /^debian-bug.el$/
+debug_on_exit c-src/emacs/src/lisp.h 2984
+decimalKey objcpp-src/SimpleCalc.M /^- decimalKey:sender$/
+declared_special c-src/emacs/src/lisp.h 676
+decode_timer c-src/emacs/src/keyboard.c /^decode_timer (Lisp_Object timer, struct timespec */
+def c-src/h.h 35
+def c-src/h.h 38
+defalt c-src/emacs/src/lisp.h 1585
+default-tags-table-function el-src/emacs/lisp/progmodes/etags.el /^(defvar default-tags-table-function nil$/
+default_C_entries c-src/etags.c /^default_C_entries (FILE *inf)$/
+default_C_help c-src/etags.c 515
+default_C_help c-src/etags.c 523
+default_C_suffixes c-src/etags.c 512
+defcell c-src/emacs/src/lisp.h 2351
+define-abbrev c-src/abbrev.c /^DEFUN ("define-abbrev", Fdefine_abbrev, Sdefine_ab/
+define-abbrev-table c-src/abbrev.c /^DEFUN ("define-abbrev-table", Fdefine_abbrev_table/
+define-global-abbrev c-src/abbrev.c /^DEFUN ("define-global-abbrev", Fdefine_global_abbr/
+define-mode-abbrev c-src/abbrev.c /^DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, /
+defined_GC_CHECK_STRING_BYTES c-src/emacs/src/lisp.h 4663
+defined_GC_CHECK_STRING_BYTES c-src/emacs/src/lisp.h 4665
+definedef c-src/etags.c 2464
+defun_func1 c.c /^defun_func1()$/
+delegate objc-src/Subprocess.m /^- delegate$/
+deleteItem pyt-src/server.py /^ def deleteItem(self):$/
+delete_kboard c-src/emacs/src/keyboard.c /^delete_kboard (KBOARD *kb)$/
+deliver_input_available_signal c-src/emacs/src/keyboard.c /^deliver_input_available_signal (int sig)$/
+deliver_interrupt_signal c-src/emacs/src/keyboard.c /^deliver_interrupt_signal (int sig)$/
+deliver_user_signal c-src/emacs/src/keyboard.c /^deliver_user_signal (int sig)$/
+depth c-src/emacs/src/lisp.h 1618
+derived_analyses prol-src/natded.prolog /^derived_analyses([],[]).$/
+describe_abbrev c-src/abbrev.c /^describe_abbrev (sym, stream)$/
+detect_input_pending c-src/emacs/src/keyboard.c /^detect_input_pending (void)$/
+detect_input_pending_ignore_squeezables c-src/emacs/src/keyboard.c /^detect_input_pending_ignore_squeezables (void)$/
+detect_input_pending_run_timers c-src/emacs/src/keyboard.c /^detect_input_pending_run_timers (bool do_display)$/
+dialog_loop erl-src/gs_dialog.erl /^dialog_loop(Module, Window, Frame, Extra, Args) ->/
+dignorerest c-src/etags.c 2463
+discard-input c-src/emacs/src/keyboard.c /^DEFUN ("discard-input", Fdiscard_input, Sdiscard_i/
+discard_mouse_events c-src/emacs/src/keyboard.c /^discard_mouse_events (void)$/
+discrete_location cp-src/clheir.hpp /^ discrete_location(int xi, int yi, int zi):$/
+discrete_location cp-src/clheir.hpp 56
+display cp-src/conway.cpp /^void display(void)$/
+disposetextstring pas-src/common.pas /^procedure disposetextstring;(*($/
+dnone c-src/etags.c 2460
+doc c-src/emacs/src/lisp.h 1689
+dog c-src/h.h 81
+dog cp-src/c.C 126
+dog cp-src/c.C 130
+dotfill tex-src/texinfo.tex /^ \\null\\nobreak\\indexdotfill % Have leaders before/
+dotfill tex-src/texinfo.tex /^\\noindent\\hskip\\secondaryindent\\hbox{#1}\\indexdotf/
+double_click_count c-src/emacs/src/keyboard.c 5222
+drag_n_drop_syms c-src/emacs/src/keyboard.c 4629
+dribble c-src/emacs/src/keyboard.c 236
+dsharpseen c-src/etags.c 2461
+dummies tex-src/texinfo.tex /^{\\indexdummies % Must do this here, since \\bf, etc/
+dummy1 cp-src/burton.cpp /^::dummy::dummy test::dummy1(void)$/
+dummy2 cp-src/burton.cpp /^::dummy::dummy test::dummy2(::CORBA::Long dummy)$/
+dummy3 cp-src/burton.cpp /^::dummy::dummy test::dummy3(char* name, ::CORBA::L/
+dummydots tex-src/texinfo.tex /^\\let\\dots=\\indexdummydots$/
+dummyfont tex-src/texinfo.tex /^\\let\\b=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\code=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\emph=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\file=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\i=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\kbd=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\key=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\r=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\samp=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\sc=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\strong=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\t=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\tclose=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\var=\\indexdummyfont$/
+dummyfont tex-src/texinfo.tex /^\\let\\w=\\indexdummyfont$/
+dummytex tex-src/texinfo.tex /^\\let\\TeX=\\indexdummytex$/
+dump pyt-src/server.py /^ def dump(self, folded):$/
+eabs c-src/emacs/src/lisp.h /^#define eabs(x) ((x) < 0 ? -(x) : (x))$/
+eassert c-src/emacs/src/lisp.h /^# define eassert(cond) \\$/
+eassert c-src/emacs/src/lisp.h /^# define eassert(cond) ((void) (false && (cond))) /
+eassume c-src/emacs/src/lisp.h /^# define eassume(cond) \\$/
+eassume c-src/emacs/src/lisp.h /^# define eassume(cond) assume (cond)$/
+eax c-src/sysdep.h 31
+eax c-src/sysdep.h 33
+echo_add_key c-src/emacs/src/keyboard.c /^echo_add_key (Lisp_Object c)$/
+echo_char c-src/emacs/src/keyboard.c /^echo_char (Lisp_Object c)$/
+echo_dash c-src/emacs/src/keyboard.c /^echo_dash (void)$/
+echo_kboard c-src/emacs/src/keyboard.c 166
+echo_keystrokes_p c-src/emacs/src/keyboard.c /^echo_keystrokes_p (void)$/
+echo_length c-src/emacs/src/keyboard.c /^echo_length (void)$/
+echo_message_buffer c-src/emacs/src/keyboard.c 171
+echo_now c-src/emacs/src/keyboard.c /^echo_now (void)$/
+echo_truncate c-src/emacs/src/keyboard.c /^echo_truncate (ptrdiff_t nchars)$/
+echoing c-src/emacs/src/keyboard.c 154
+editItem pyt-src/server.py /^ def editItem(self):$/
+editsite pyt-src/server.py /^ def editsite(self, site):$/
+edituser pyt-src/server.py /^ def edituser(self, user):$/
+egetenv c-src/emacs/src/lisp.h /^egetenv (const char *var)$/
+emacs_abort c-src/emacs/src/lisp.h /^extern _Noreturn void emacs_abort (void) NO_INLINE/
+end c-src/emacs/src/keyboard.c 8753
+end c-src/emacs/src/lisp.h 2039
+end c-src/emacs/src/regex.h 432
+endtoken c-src/etags.c /^#define endtoken(c) (_etk[CHAR (c)]) \/* c ends tok/
+enter_critical_section c-src/h.h 116
+entry perl-src/htlmify-cystic 218
+entry perl-src/htlmify-cystic 234
+entry perl-src/htlmify-cystic 245
+entry perl-src/htlmify-cystic 252
+entry perl-src/htlmify-cystic 268
+entry perl-src/htlmify-cystic 276
+entry perl-src/htlmify-cystic 281
+entry perl-src/htlmify-cystic 296
+equalsKey objcpp-src/SimpleCalc.M /^- equalsKey:sender$/
+erlang_atom c-src/etags.c /^erlang_atom (char *s)$/
+erlang_attribute c-src/etags.c /^erlang_attribute (char *s)$/
+erlang_func c-src/etags.c /^erlang_func (char *s, char *last)$/
+error c-src/emacs/src/lisp.h /^extern _Noreturn void error (const char *, ...) AT/
+error c-src/etags.c /^error (const char *format, ...)$/
+error c-src/etags.c /^static void error (const char *, ...) ATTRIBUTE_FO/
+error y-src/cccp.y /^error (msg)$/
+error_signaled c-src/etags.c 264
+etags el-src/emacs/lisp/progmodes/etags.el /^(defgroup etags nil "Tags tables."$/
+etags html-src/software.html /^Etags$/
+etags make-src/Makefile /^etags: etags.c ${OBJS}$/
+etags--xref-find-definitions el-src/emacs/lisp/progmodes/etags.el /^(defun etags--xref-find-definitions (pattern &opti/
+etags--xref-limit el-src/emacs/lisp/progmodes/etags.el /^(defconst etags--xref-limit 1000)$/
+etags-file-of-tag el-src/emacs/lisp/progmodes/etags.el /^(defun etags-file-of-tag (&optional relative) ; Do/
+etags-goto-tag-location el-src/emacs/lisp/progmodes/etags.el /^(defun etags-goto-tag-location (tag-info)$/
+etags-list-tags el-src/emacs/lisp/progmodes/etags.el /^(defun etags-list-tags (file) ; Doc string?$/
+etags-recognize-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun etags-recognize-tags-table ()$/
+etags-snarf-tag el-src/emacs/lisp/progmodes/etags.el /^(defun etags-snarf-tag (&optional use-explicit) ; /
+etags-tags-apropos el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-apropos (string) ; Doc string?$/
+etags-tags-apropos-additional el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-apropos-additional (regexp)$/
+etags-tags-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-completion-table () ; Doc string/
+etags-tags-included-tables el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-included-tables () ; Doc string?/
+etags-tags-table-files el-src/emacs/lisp/progmodes/etags.el /^(defun etags-tags-table-files () ; Doc string?$/
+etags-verify-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun etags-verify-tags-table ()$/
+etags-xref-find el-src/emacs/lisp/progmodes/etags.el /^(defun etags-xref-find (action id)$/
+etags-xref-find-definitions-tag-order el-src/emacs/lisp/progmodes/etags.el /^(defvar etags-xref-find-definitions-tag-order '(ta/
+etags.1.man make-src/Makefile /^etags.1.man: etags.1$/
+etags_getcwd c-src/etags.c /^etags_getcwd (void)$/
+eval_dyn c-src/emacs/src/keyboard.c /^eval_dyn (Lisp_Object form)$/
+event-convert-list c-src/emacs/src/keyboard.c /^DEFUN ("event-convert-list", Fevent_convert_list, /
+event-symbol-parse-modifiers c-src/emacs/src/keyboard.c /^DEFUN ("internal-event-symbol-parse-modifiers", Fe/
+event_head c-src/emacs/src/keyboard.c 11021
+event_to_kboard c-src/emacs/src/keyboard.c /^event_to_kboard (struct input_event *event)$/
+exact c-src/emacs/src/gmalloc.c 200
+execute cp-src/c.C /^ void execute(CPluginCSCState& p, int w, in/
+exit c-src/exit.c /^DEFUN(exit, (status), int status)$/
+exit c-src/exit.strange_suffix /^DEFUN(exit, (status), int status)$/
+exit-recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("exit-recursive-edit", Fexit_recursive_edit/
+exit_critical_to_previous c-src/h.h 117
+exp y-src/atest.y 2
+exp y-src/cccp.y 156
+exp y-src/cccp.y 185
+exp y-src/parse.y 95
+exp1 y-src/cccp.y 148
+exp_list y-src/parse.y 263
+expand-abbrev c-src/abbrev.c /^DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_ab/
+expandmng prol-src/natded.prolog /^expandmng(var(V),var(V)).$/
+expandmng_tree prol-src/natded.prolog /^expandmng_tree(tree(Rule,Syn:Sem,Trees),$/
+expandmng_trees prol-src/natded.prolog /^expandmng_trees([],[]).$/
+expandsyn prol-src/natded.prolog /^expandsyn(Syn,Syn):-$/
+explicitly-quoted-pending-delete-mode el-src/TAGTEST.EL /^(defalias (quote explicitly-quoted-pending-delete-/
+expression_value y-src/cccp.y 68
+extras c-src/emacs/src/lisp.h 1603
+extvar c-src/h.h 109
+f c-src/c.c /^T f(){if(x){}$/
+f c-src/h.h 89
+f c.c /^int f$/
+f c.c 145
+f c.c 156
+f c.c 168
+f cp-src/c.C /^ void f() {}$/
+f cp-src/c.C /^ int f(){return 0;}; \/\/ first comment$/
+f cp-src/c.C /^A<float,B<int> > A<B<float>,int>::f(A<int>* x) {}$/
+f cp-src/c.C /^A<int>* f() {}$/
+f cp-src/c.C /^class B<int> { void f() {} };$/
+f cp-src/c.C /^int A<int>::f(A<int>* x) {}$/
+f cp-src/c.C /^int f(A<int> x) {}$/
+f cp-src/fail.C /^ int f() { return 5; }$/
+f cp-src/fail.C /^int A::B::f() { return 2; }$/
+f1 c.c /^ f1 () { \/* Do something. *\/; }$/
+f1 perl-src/kai-test.pl /^sub f1 {$/
+f2 c.c /^void f2 () { \/* Do something. *\/; }$/
+f2 perl-src/kai-test.pl /^sub main::f2 {$/
+f3 perl-src/kai-test.pl /^sub f3 {$/
+f4 perl-src/kai-test.pl /^sub Bar::f4 {$/
+f5 perl-src/kai-test.pl /^sub f5 {$/
+f6 perl-src/kai-test.pl /^sub f6 {$/
+f7 perl-src/kai-test.pl /^sub f7 {$/
+fast_string_match_ignore_case c-src/emacs/src/lisp.h /^fast_string_match_ignore_case (Lisp_Object regexp,/
+fastctags make-src/Makefile /^fastctags:$/
+fastetags make-src/Makefile /^fastetags:$/
+fastmap c-src/emacs/src/regex.h 355
+fastmap_accurate c-src/emacs/src/regex.h 383
+fatal c-src/etags.c /^fatal (const char *s1, const char *s2)$/
+fatala c.c /^void fatala () __attribute__ ((noreturn));$/
+fconst forth-src/test-forth.fth /^3.1415e fconstant fconst$/
+fdHandler objc-src/Subprocess.m /^- fdHandler:(int)theFd$/
+fdHandler objc-src/Subprocess.m /^fdHandler (int theFd, id self)$/
+fdefunkey c-src/etags.c 2409
+fdefunname c-src/etags.c 2410
+fdesc c-src/etags.c 201
+fdesc c-src/etags.c 212
+fdp c-src/etags.c 217
+ff cp-src/c.C /^ int ff(){return 1;};$/
+field_of_play cp-src/conway.cpp 18
+fignore c-src/etags.c 2416
+file-of-tag el-src/emacs/lisp/progmodes/etags.el /^(defun file-of-tag (&optional relative)$/
+file-of-tag-function el-src/emacs/lisp/progmodes/etags.el /^(defvar file-of-tag-function nil$/
+fileJoin php-src/lce_functions.php /^ function fileJoin()$/
+file_end perl-src/htlmify-cystic /^sub file_end ()$/
+file_index perl-src/htlmify-cystic 33
+file_tocs perl-src/htlmify-cystic 30
+filename_is_absolute c-src/etags.c /^filename_is_absolute (char *fn)$/
+filenames c-src/etags.c 196
+find-tag el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag (tagname &optional next-p regexp-p/
+find-tag-default-function el-src/emacs/lisp/progmodes/etags.el /^(defcustom find-tag-default-function nil$/
+find-tag-history el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-history nil) ; Doc string?$/
+find-tag-hook el-src/emacs/lisp/progmodes/etags.el /^(defcustom find-tag-hook nil$/
+find-tag-in-order el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-in-order (pattern$/
+find-tag-interactive el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-interactive (prompt &optional no-d/
+find-tag-marker-ring el-src/emacs/lisp/progmodes/etags.el /^(defvaralias 'find-tag-marker-ring 'xref--marker-r/
+find-tag-marker-ring-length el-src/emacs/lisp/progmodes/etags.el /^(define-obsolete-variable-alias 'find-tag-marker-r/
+find-tag-next-line-after-failure-p el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-next-line-after-failure-p nil$/
+find-tag-noselect el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-noselect (tagname &optional next-p/
+find-tag-other-frame el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-other-frame (tagname &optional nex/
+find-tag-other-window el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-other-window (tagname &optional ne/
+find-tag-regexp el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-regexp (regexp &optional next-p ot/
+find-tag-regexp-next-line-after-failure-p el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-regexp-next-line-after-failure-p /
+find-tag-regexp-search-function el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-regexp-search-function nil$/
+find-tag-regexp-tag-order el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-regexp-tag-order nil$/
+find-tag-search-function el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-search-function nil$/
+find-tag-tag el-src/emacs/lisp/progmodes/etags.el /^(defun find-tag-tag (string)$/
+find-tag-tag-order el-src/emacs/lisp/progmodes/etags.el /^(defvar find-tag-tag-order nil$/
+find_entries c-src/etags.c /^find_entries (FILE *inf)$/
+find_user_signal_name c-src/emacs/src/keyboard.c /^find_user_signal_name (int sig)$/
+findcats prol-src/natded.prolog /^findcats([],Left,Left).$/
+finish_appendices perl-src/htlmify-cystic /^sub finish_appendices ()$/
+finish_sections perl-src/htlmify-cystic /^sub finish_sections ()$/
+finish_subsections perl-src/htlmify-cystic /^sub finish_subsections ()$/
+finish_subsubsections perl-src/htlmify-cystic /^sub finish_subsubsections ()$/
+finlist c-src/etags.c 2414
+first c-src/emacs/src/gmalloc.c 151
+fitchtreelist prol-src/natded.prolog /^fitchtreelist([]).$/
+fixup_locale c-src/emacs/src/lisp.h /^INLINE void fixup_locale (void) {}$/
+flag c-src/getopt.h 83
+flag2str pyt-src/server.py /^def flag2str(value, string):$/
+flistseen c-src/etags.c 2415
+fn c-src/exit.c /^ void EXFUN((*fn[1]), (NOARGS));$/
+fn c-src/exit.strange_suffix /^ void EXFUN((*fn[1]), (NOARGS));$/
+fnin y-src/parse.y 68
+focus_set pyt-src/server.py /^ def focus_set(self):$/
+follow_key c-src/emacs/src/keyboard.c /^follow_key (Lisp_Object keymap, Lisp_Object key)$/
+fonts tex-src/texinfo.tex /^\\obeyspaces \\obeylines \\ninett \\indexfonts \\rawbac/
+fonts\rm tex-src/texinfo.tex /^ \\indexfonts\\rm \\tolerance=9500 \\advance\\baseline/
+foo c-src/h.h 18
+foo c.c 150
+foo c.c 166
+foo c.c 167
+foo c.c 178
+foo c.c 189
+foo cp-src/c.C /^ foo() {$/
+foo cp-src/c.C 68
+foo cp-src/c.C 79
+foo cp-src/x.cc /^XX::foo()$/
+foo f-src/entry.for /^ character*(*) function foo()$/
+foo f-src/entry.strange /^ character*(*) function foo()$/
+foo f-src/entry.strange_suffix /^ character*(*) function foo()$/
+foo forth-src/test-forth.fth /^: foo (foo) ;$/
+foo php-src/ptest.php /^foo()$/
+foo ruby-src/test1.ru /^ attr_reader :foo$/
+foo! ruby-src/test1.ru /^ def foo!$/
+foo1 ruby-src/test1.ru /^ attr_reader(:foo1, :bar1, # comment$/
+foo2 ruby-src/test1.ru /^ alias_method ( :foo2, #cmmt$/
+foo==bar el-src/TAGTEST.EL /^(defun foo==bar () (message "hi")) ; Bug#5624$/
+foobar c-src/c.c /^int foobar() {;}$/
+foobar c.c /^extern void foobar (void) __attribute__ ((section /
+foobar2 c-src/h.h 20
+foobar2_ c-src/h.h 16
+foperator c-src/etags.c 2411
+force_auto_save_soon c-src/emacs/src/keyboard.c /^force_auto_save_soon (void)$/
+force_explicit_name c-src/etags.c 265
+force_quit_count c-src/emacs/src/keyboard.c 10387
+foreign_export merc-src/accumulator.m /^:- pragma foreign_export("C", unravel_univ(in, out/
+formatSize objc-src/PackInsp.m /^-(const char *)formatSize:(const char *)size inBuf/
+found c-src/emacs/src/lisp.h 2344
+fracas html-src/software.html /^Fracas$/
+frag c-src/emacs/src/gmalloc.c 152
+frame_local c-src/emacs/src/lisp.h 2341
+free c-src/emacs/src/gmalloc.c /^free (void *ptr)$/
+free c-src/emacs/src/gmalloc.c 166
+free c-src/emacs/src/gmalloc.c 1719
+free c-src/emacs/src/gmalloc.c 67
+free c-src/emacs/src/gmalloc.c 72
+free_fdesc c-src/etags.c /^free_fdesc (register fdesc *fdp)$/
+free_for prol-src/natded.prolog /^free_for(var(_),_,_).$/
+free_regexps c-src/etags.c /^free_regexps (void)$/
+free_tree c-src/etags.c /^free_tree (register node *np)$/
+free_var prol-src/natded.prolog /^free_var(var(V),var(V)).$/
+freehook c-src/emacs/src/gmalloc.c /^freehook (void *ptr)$/
+fresh_vars prol-src/natded.prolog /^fresh_vars(var(V),var(V)).$/
+fstartlist c-src/etags.c 2413
+func c-src/emacs/src/lisp.h /^ void (*func) (Lisp_Object);$/
+func c-src/emacs/src/lisp.h /^ void (*func) (int);$/
+func c-src/emacs/src/lisp.h /^ void (*func) (void *);$/
+func c-src/emacs/src/lisp.h /^ void (*func) (void);$/
+func1 c.c /^int func1$/
+func2 c.c /^int func2 (a,b$/
+func_key_syms c-src/emacs/src/keyboard.c 4626
+funcboo c.c /^bool funcboo ()$/
+funcpointer c-src/emacs/src/lisp.h 2126
+funcptr c-src/h.h /^ fu int (*funcptr) (void *ptr);$/
+function c-src/emacs/src/lisp.h 1685
+function c-src/emacs/src/lisp.h 2197
+function c-src/emacs/src/lisp.h 2985
+function c-src/emacs/src/lisp.h 694
+function c-src/etags.c 194
+functionp c-src/emacs/src/lisp.h /^functionp (Lisp_Object object)$/
+fval forth-src/test-forth.fth /^fconst fvalue fval$/
+fvar forth-src/test-forth.fth /^fvariable fvar$/
+fvdef c-src/etags.c 2418
+fvextern c-src/etags.c 2420
+fvnameseen c-src/etags.c 2412
+fvnone c-src/etags.c 2408
+fwd c-src/emacs/src/lisp.h 2346
+fwd c-src/emacs/src/lisp.h 690
+g cp-src/c.C /^ int g(){return 2;};$/
+galileo html-src/software.html /^GaliLEO$/
+gather pyt-src/server.py /^ def gather(self):$/
+gc_aset c-src/emacs/src/lisp.h /^gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Ob/
+gcmarkbit c-src/emacs/src/lisp.h 1974
+gcmarkbit c-src/emacs/src/lisp.h 1981
+gcmarkbit c-src/emacs/src/lisp.h 2035
+gcmarkbit c-src/emacs/src/lisp.h 2113
+gcmarkbit c-src/emacs/src/lisp.h 2204
+gcmarkbit c-src/emacs/src/lisp.h 656
+gcpro c-src/emacs/src/lisp.h 3042
+gcpro c-src/emacs/src/lisp.h 3132
+gen_help_event c-src/emacs/src/keyboard.c /^gen_help_event (Lisp_Object help, Lisp_Object fram/
+genalgorithm html-src/algrthms.html /^Generating the Data<\/font><\/i><\/b>$/
+generate_warning merc-src/accumulator.m /^:- pred generate_warning(module_info::in, prog_var/
+generate_warnings merc-src/accumulator.m /^:- pred generate_warnings(module_info::in, prog_va/
+generic_object cp-src/clheir.cpp /^generic_object::generic_object(void)$/
+generic_object cp-src/clheir.hpp 13
+getArchs objc-src/PackInsp.m /^-(void)getArchs$/
+getDomainNames php-src/lce_functions.php /^ function getDomainNames()$/
+getFoo lua-src/test.lua /^function Cube.data.getFoo ()$/
+getPOReader php-src/lce_functions.php /^ function &getPOReader($domain)$/
+getPath objc-src/PackInsp.m /^-(const char *)getPath:(char *)buf forType:(const /
+getPos lua-src/test.lua /^function Circle.getPos ()$/
+getPos lua-src/test.lua /^function Rectangle.getPos ()$/
+getTextDomains php-src/lce_functions.php /^ function getTextDomains($lines)$/
+get_compressor_from_suffix c-src/etags.c /^get_compressor_from_suffix (char *file, char **ext/
+get_contiguous_space c-src/emacs/src/gmalloc.c /^get_contiguous_space (ptrdiff_t size, void *positi/
+get_current_dir_name c-src/emacs/src/gmalloc.c 33
+get_input_pending c-src/emacs/src/keyboard.c /^get_input_pending (int flags)$/
+get_language_from_filename c-src/etags.c /^get_language_from_filename (char *file, int case_s/
+get_language_from_interpreter c-src/etags.c /^get_language_from_interpreter (char *interpreter)$/
+get_language_from_langname c-src/etags.c /^get_language_from_langname (const char *name)$/
+get_layer_by_name lua-src/allegro.lua /^local function get_layer_by_name (sprite, layer, n/
+get_tag c-src/etags.c /^get_tag (register char *bp, char **namepp)$/
+get_word c-src/tab.c /^static char *get_word(char **str, char delim)$/
+getcjmp c-src/emacs/src/keyboard.c 147
+getopt perl-src/yagrip.pl /^sub getopt {$/
+getopt.o make-src/Makefile /^getopt.o: emacs\/lib-src\/getopt.c$/
+getopt1.o make-src/Makefile /^getopt1.o: emacs\/lib-src\/getopt1.c$/
+getptys objc-src/Subprocess.m /^getptys (int *master, int *slave)$/
+gettext php-src/lce_functions.php /^ function gettext($msgid)$/
+ggg c-src/h.h 10
+ghi1 c-src/h.h 36
+ghi2 c-src/h.h 39
+giallo cp-src/c.C 40
+glider cp-src/conway.cpp /^void glider(int x, int y)$/
+gnu html-src/software.html /^Free software that I wrote for the GNU project or /
+gobble_input c-src/emacs/src/keyboard.c /^gobble_input (void)$/
+goto-tag-location-function el-src/emacs/lisp/progmodes/etags.el /^(defvar goto-tag-location-function nil$/
+goto_xy cp-src/screen.cpp /^void goto_xy(unsigned char x, unsigned char y)$/
+handleList pyt-src/server.py /^ def handleList(self, event):$/
+handleNew pyt-src/server.py /^ def handleNew(self, event):$/
+handle_async_input c-src/emacs/src/keyboard.c /^handle_async_input (void)$/
+handle_input_available_signal c-src/emacs/src/keyboard.c /^handle_input_available_signal (int sig)$/
+handle_interrupt c-src/emacs/src/keyboard.c /^handle_interrupt (bool in_signal_handler)$/
+handle_interrupt_signal c-src/emacs/src/keyboard.c /^handle_interrupt_signal (int sig)$/
+handle_user_signal c-src/emacs/src/keyboard.c /^handle_user_signal (int sig)$/
+handler c-src/emacs/src/lisp.h 3023
+handlertype c-src/emacs/src/lisp.h 3021
+has_arg c-src/getopt.h 82
+hash c-src/emacs/src/lisp.h 1843
+hash c-src/etags.c /^hash (const char *str, int len)$/
+hash_table_test c-src/emacs/src/lisp.h 1805
+hashfn c-src/emacs/src/lisp.h /^ EMACS_UINT (*hashfn) (struct hash_table_test *t,/
+hdr c-src/emacs/src/gmalloc.c 1860
+head_table c-src/emacs/src/keyboard.c 11027
+header c-src/emacs/src/lisp.h 1371
+header c-src/emacs/src/lisp.h 1388
+header c-src/emacs/src/lisp.h 1581
+header c-src/emacs/src/lisp.h 1610
+header c-src/emacs/src/lisp.h 1672
+header c-src/emacs/src/lisp.h 1826
+header_size c-src/emacs/src/lisp.h 1471
+heapsize c-src/emacs/src/gmalloc.c 361
+hello scm-src/test.scm /^(define hello "Hello, Emacs!")$/
+hello scm-src/test.scm /^(set! hello "Hello, world!")$/
+hello-world scm-src/test.scm /^(define (hello-world)$/
+help c-src/etags.c 193
+helpPanel objcpp-src/SimpleCalc.M /^- helpPanel:sender$/
+help_char_p c-src/emacs/src/keyboard.c /^help_char_p (Lisp_Object c)$/
+help_form_saved_window_configs c-src/emacs/src/keyboard.c 2156
+helpwin pyt-src/server.py /^def helpwin(helpdict):$/
+hide_cursor cp-src/screen.cpp /^void hide_cursor(void)$/
+hlds merc-src/accumulator.m /^:- import_module hlds.$/
+htmltreelist prol-src/natded.prolog /^htmltreelist([]).$/
+hybrid_aligned_alloc c-src/emacs/src/gmalloc.c /^hybrid_aligned_alloc (size_t alignment, size_t siz/
+hybrid_calloc c-src/emacs/src/gmalloc.c /^hybrid_calloc (size_t nmemb, size_t size)$/
+hybrid_free c-src/emacs/src/gmalloc.c /^hybrid_free (void *ptr)$/
+hybrid_get_current_dir_name c-src/emacs/src/gmalloc.c /^hybrid_get_current_dir_name (void)$/
+hybrid_malloc c-src/emacs/src/gmalloc.c /^hybrid_malloc (size_t size)$/
+hybrid_realloc c-src/emacs/src/gmalloc.c /^hybrid_realloc (void *ptr, size_t size)$/
+hypothetical_mem prol-src/natded.prolog /^hypothetical_mem(fi(N),Ass,_):-$/
+i c-src/c.c 2
+i c-src/emacs/src/lisp.h 4673
+i c-src/emacs/src/lisp.h 4679
+i c-src/emacs/src/lisp.h 567
+i c.c 169
+i cp-src/c.C 132
+ialpage tex-src/texinfo.tex /^ \\dimen@=\\pageheight \\advance\\dimen@ by-\\ht\\pa/
+ialpage tex-src/texinfo.tex /^ \\availdimen@=\\pageheight \\advance\\availdimen@ by/
+ialpage tex-src/texinfo.tex /^ \\dimen@=\\pageheight \\advance\\dimen@ by-\\ht\\parti/
+ialpage tex-src/texinfo.tex /^\\newbox\\partialpage$/
+ialpage= tex-src/texinfo.tex /^ \\output={\\global\\setbox\\partialpage=$/
+identify_goal_type merc-src/accumulator.m /^:- pred identify_goal_type(pred_id::in, proc_id::i/
+identify_out_and_out_prime merc-src/accumulator.m /^:- pred identify_out_and_out_prime(module_info::in/
+identify_recursive_calls merc-src/accumulator.m /^:- pred identify_recursive_calls(pred_id::in, proc/
+idx c-src/emacs/src/lisp.h 3150
+ignore_case c-src/etags.c 266
+ignore_mouse_drag_p c-src/emacs/src/keyboard.c 1256
+ill=\relax tex-src/texinfo.tex /^\\let\\refill=\\relax$/
+immediate_quit c-src/emacs/src/keyboard.c 174
+impatto html-src/softwarelibero.html /^Impatto pratico del software libero$/
+implementation merc-src/accumulator.m /^:- implementation.$/
+in_word_set c-src/etags.c /^in_word_set (register const char *str, register un/
+inattribute c-src/etags.c 2400
+inc cp-src/Range.h /^ double inc (void) const { return rng_inc; }$/
+index c-src/emacs/src/lisp.h 1856
+infabsdir c-src/etags.c 206
+infabsname c-src/etags.c 205
+infiles make-src/Makefile /^infiles = $(filter-out ${NONSRCS},${SRCS}) srclist/
+infname c-src/etags.c 204
+info c-src/emacs/src/gmalloc.c 157
+infoPanel objcpp-src/SimpleCalc.M /^- infoPanel:sender$/
+init c-src/etags.c /^init (void)$/
+init objc-src/Subprocess.m /^ andStdErr:(BOOL)wantsStdErr$/
+init objc-src/Subprocess.m /^- init:(const char *)subprocessString$/
+init objcpp-src/SimpleCalc.M /^- init$/
+init_control c.c 239
+init_kboard c-src/emacs/src/keyboard.c /^init_kboard (KBOARD *kb, Lisp_Object type)$/
+init_keyboard c-src/emacs/src/keyboard.c /^init_keyboard (void)$/
+init_registry cp-src/clheir.cpp /^void init_registry(void)$/
+init_tool_bar_items c-src/emacs/src/keyboard.c /^init_tool_bar_items (Lisp_Object reuse)$/
+inita c.c /^static void inita () {}$/
+initb c.c /^static void initb () {}$/
+initial_kboard c-src/emacs/src/keyboard.c 84
+initialize-new-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun initialize-new-tags-table ()$/
+initialize_goal_store merc-src/accumulator.m /^:- func initialize_goal_store(list(hlds_goal), ins/
+initialize_random_junk y-src/cccp.y /^initialize_random_junk ()$/
+input-pending-p c-src/emacs/src/keyboard.c /^DEFUN ("input-pending-p", Finput_pending_p, Sinput/
+input_available_clear_time c-src/emacs/src/keyboard.c 324
+input_pending c-src/emacs/src/keyboard.c 239
+input_polling_used c-src/emacs/src/keyboard.c /^input_polling_used (void)$/
+input_was_pending c-src/emacs/src/keyboard.c 287
+insert-abbrev-table-description c-src/abbrev.c /^DEFUN ("insert-abbrev-table-description", Finsert_/
+insertion_type c-src/emacs/src/lisp.h 1989
+insertname pas-src/common.pas /^function insertname;(*($/
+instance_method ruby-src/test.rb /^ def instance_method$/
+instance_method_equals= ruby-src/test.rb /^ def instance_method_equals=$/
+instance_method_exclamation! ruby-src/test.rb /^ def instance_method_exclamation!$/
+instance_method_question? ruby-src/test.rb /^ def instance_method_question?$/
+instr y-src/parse.y 81
+instruct c-src/etags.c 2527
+int merc-src/accumulator.m /^:- import_module int.$/
+intNumber go-src/test1.go 13
+integer c-src/emacs/src/lisp.h 2127
+integer y-src/cccp.y 112
+integer_overflow y-src/cccp.y /^integer_overflow ()$/
+integertonmstr pas-src/common.pas /^function integertonmstr; (* (TheInteger : integer)/
+intensity1 f-src/entry.for /^ & intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1 f-src/entry.strange /^ & intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+intensity1 f-src/entry.strange_suffix /^ & intensity1(efv,fv,svin,svquad,sfpv,maxp,val/
+interface merc-src/accumulator.m /^:- interface.$/
+interface_locate c-src/c.c /^interface_locate(void)$/
+intern c-src/emacs/src/lisp.h /^intern (const char *str)$/
+intern_c_string c-src/emacs/src/lisp.h /^intern_c_string (const char *str)$/
+internal_last_event_frame c-src/emacs/src/keyboard.c 228
+interned c-src/emacs/src/lisp.h 672
+interpreters c-src/etags.c 197
+interrupt_input c-src/emacs/src/keyboard.c 328
+interrupt_input_blocked c-src/emacs/src/keyboard.c 76
+interrupt_input_blocked c-src/emacs/src/lisp.h 3048
+interrupts_deferred c-src/emacs/src/keyboard.c 331
+intoken c-src/etags.c /^#define intoken(c) (_itk[CHAR (c)]) \/* c can be in/
+intspec c-src/emacs/src/lisp.h 1688
+intvar c-src/emacs/src/lisp.h 2277
+invalidate_nodes c-src/etags.c /^invalidate_nodes (fdesc *badfdp, node **npp)$/
+io merc-src/accumulator.m /^:- import_module io.$/
+ipc3dCSC19 cp-src/c.C 6
+ipc3dChannelType cp-src/c.C 1
+ipc3dIslandHierarchy cp-src/c.C 1
+ipc3dLinkControl cp-src/c.C 1
+irregular_location cp-src/clheir.hpp /^ irregular_location(double xi, double yi, doubl/
+irregular_location cp-src/clheir.hpp 47
+isComment php-src/lce_functions.php /^ function isComment($class)$/
+isHoliday cp-src/functions.cpp /^bool isHoliday ( Date d ){$/
+isLeap cp-src/functions.cpp /^bool isLeap ( int year ){$/
+is_associative_construction merc-src/accumulator.m /^:- pred is_associative_construction(module_info::i/
+is_curly_brace_form c-src/h.h 54
+is_explicit c-src/h.h 49
+is_func c-src/etags.c 221
+is_hor_space y-src/cccp.y 953
+is_idchar y-src/cccp.y 948
+is_idstart y-src/cccp.y 950
+is_muldiv_operation cp-src/c.C /^is_muldiv_operation(pc)$/
+is_ordset prol-src/ordsets.prolog /^is_ordset(X) :- var(X), !, fail.$/
+is_recursive_case merc-src/accumulator.m /^:- pred is_recursive_case(list(hlds_goal)::in, pre/
+iso_lispy_function_keys c-src/emacs/src/keyboard.c 5151
+isoperator prol-src/natded.prolog /^isoperator(Char):-$/
+isoptab prol-src/natded.prolog /^isoptab('%').$/
+iswhite c-src/etags.c /^#define iswhite(c) (_wht[CHAR (c)]) \/* c is white /
+item_properties c-src/emacs/src/keyboard.c 7568
+jmp c-src/emacs/src/lisp.h 3044
+just_read_file c-src/etags.c /^just_read_file (FILE *inf)$/
+kbd_buffer c-src/emacs/src/keyboard.c 291
+kbd_buffer_events_waiting c-src/emacs/src/keyboard.c /^kbd_buffer_events_waiting (void)$/
+kbd_buffer_get_event c-src/emacs/src/keyboard.c /^kbd_buffer_get_event (KBOARD **kbp,$/
+kbd_buffer_nr_stored c-src/emacs/src/keyboard.c /^kbd_buffer_nr_stored (void)$/
+kbd_buffer_store_event c-src/emacs/src/keyboard.c /^kbd_buffer_store_event (register struct input_even/
+kbd_buffer_store_event_hold c-src/emacs/src/keyboard.c /^kbd_buffer_store_event_hold (register struct input/
+kbd_buffer_store_help_event c-src/emacs/src/keyboard.c /^kbd_buffer_store_help_event (Lisp_Object frame, Li/
+kbd_buffer_unget_event c-src/emacs/src/keyboard.c /^kbd_buffer_unget_event (register struct input_even/
+kbd_fetch_ptr c-src/emacs/src/keyboard.c 297
+kbd_store_ptr c-src/emacs/src/keyboard.c 302
+kboard c-src/emacs/src/keyboard.c 860
+kboard_stack c-src/emacs/src/keyboard.c 858
+kboard_stack c-src/emacs/src/keyboard.c 864
+key_and_value c-src/emacs/src/lisp.h 1868
+keyremap c-src/emacs/src/keyboard.c 8742
+keyremap c-src/emacs/src/keyboard.c 8754
+keyremap_step c-src/emacs/src/keyboard.c /^keyremap_step (Lisp_Object *keybuf, int bufsize, v/
+keys_of_keyboard c-src/emacs/src/keyboard.c /^keys_of_keyboard (void)$/
+keyval prol-src/natded.prolog /^keyval(key(Key,Val)) --> [Key,'='], valseq(Val).$/
+keyvalcgi prol-src/natded.prolog /^keyvalcgi(Key,Val):-$/
+keyvalscgi prol-src/natded.prolog /^keyvalscgi(KeyVals),$/
+keyvalseq prol-src/natded.prolog /^keyvalseq([KeyVal|KeyVals]) --> $/
+keyword_parsing y-src/cccp.y 73
+keywords y-src/cccp.y 114
+keywords y-src/cccp.y 306
+kind c-src/emacs/src/keyboard.c 11024
+kind c-src/h.h 46
+kset_echo_string c-src/emacs/src/keyboard.c /^kset_echo_string (struct kboard *kb, Lisp_Object v/
+kset_kbd_queue c-src/emacs/src/keyboard.c /^kset_kbd_queue (struct kboard *kb, Lisp_Object val/
+kset_keyboard_translate_table c-src/emacs/src/keyboard.c /^kset_keyboard_translate_table (struct kboard *kb, /
+kset_last_prefix_arg c-src/emacs/src/keyboard.c /^kset_last_prefix_arg (struct kboard *kb, Lisp_Obje/
+kset_last_repeatable_command c-src/emacs/src/keyboard.c /^kset_last_repeatable_command (struct kboard *kb, L/
+kset_local_function_key_map c-src/emacs/src/keyboard.c /^kset_local_function_key_map (struct kboard *kb, Li/
+kset_overriding_terminal_local_map c-src/emacs/src/keyboard.c /^kset_overriding_terminal_local_map (struct kboard /
+kset_real_last_command c-src/emacs/src/keyboard.c /^kset_real_last_command (struct kboard *kb, Lisp_Ob/
+kset_system_key_syms c-src/emacs/src/keyboard.c /^kset_system_key_syms (struct kboard *kb, Lisp_Obje/
+lang c-src/etags.c 208
+lang c-src/etags.c 251
+lang c-src/etags.c 259
+lang_names c-src/etags.c 718
+language c-src/etags.c 199
+last-tag el-src/emacs/lisp/progmodes/etags.el /^(defvar last-tag nil$/
+last_abbrev_point c-src/abbrev.c 79
+last_auto_save c-src/emacs/src/keyboard.c 214
+last_heapinfo c-src/emacs/src/gmalloc.c 402
+last_mouse_button c-src/emacs/src/keyboard.c 5215
+last_mouse_x c-src/emacs/src/keyboard.c 5216
+last_mouse_y c-src/emacs/src/keyboard.c 5217
+last_non_minibuf_size c-src/emacs/src/keyboard.c 207
+last_point_position c-src/emacs/src/keyboard.c 217
+last_state_size c-src/emacs/src/gmalloc.c 401
+last_undo_boundary c-src/emacs/src/keyboard.c 1287
+lasta c.c 272
+lastargmargin tex-src/texinfo.tex /^\\newskip\\deflastargmargin \\deflastargmargin=18pt$/
+lastargmargin tex-src/texinfo.tex /^\\setbox0=\\hbox{\\hskip \\deflastargmargin{\\rm #2}\\hs/
+lastb c.c 278
+lb c-src/etags.c 2923
+lbs c-src/etags.c 2924
+lce php-src/lce_functions.php /^ function lce()$/
+lce_bindtextdomain php-src/lce_functions.php /^ function lce_bindtextdomain($d_name, $d_path/
+lce_bindtextdomain php-src/lce_functions.php /^ function lce_bindtextdomain($domain, $path)$/
+lce_dgettext php-src/lce_functions.php /^ function lce_dgettext($domain, $msgid)$/
+lce_geteditcode php-src/lce_functions.php /^ function lce_geteditcode($type, $name, $text, $r/
+lce_gettext php-src/lce_functions.php /^ function lce_gettext($msgid)$/
+lce_textdomain php-src/lce_functions.php /^ function lce_textdomain($domain)$/
+leasqr html-src/software.html /^Leasqr$/
+left c-src/etags.c 216
+left_shift y-src/cccp.y /^left_shift (a, b)$/
+len c-src/etags.c 237
+length c-src/etags.c 2495
+length y-src/cccp.y 113
+length y-src/cccp.y 44
+let c-src/emacs/src/lisp.h 2981
+letter tex-src/texinfo.tex /^ {#1}{Appendix \\appendixletter}{\\noexpand\\folio}}/
+letter tex-src/texinfo.tex /^ {\\appendixletter}$/
+letter tex-src/texinfo.tex /^ {\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\th/
+letter tex-src/texinfo.tex /^\\chapmacro {#1}{Appendix \\appendixletter}%$/
+letter tex-src/texinfo.tex /^\\gdef\\thissection{#1}\\secheading {#1}{\\appendixlet/
+letter tex-src/texinfo.tex /^\\subsecheading {#1}{\\appendixletter}{\\the\\secno}{\\/
+letter tex-src/texinfo.tex /^{#1}{\\appendixletter}{\\the\\secno}{\\noexpand\\folio}/
+letter tex-src/texinfo.tex /^{#1}{\\appendixletter}{\\the\\secno}{\\the\\subsecno}{\\/
+letter: tex-src/texinfo.tex /^\\xdef\\thischapter{Appendix \\appendixletter: \\noexp/
+level c-src/emacs/src/lisp.h 3153
+lex prol-src/natded.prolog /^lex(W,SynOut,Sem):-$/
+lexptr y-src/cccp.y 332
+libs merc-src/accumulator.m /^:- import_module libs.$/
+licenze html-src/softwarelibero.html /^Licenze d'uso di un programma$/
+limit cp-src/Range.h /^ double limit (void) const { return rng_limit; }$/
+line c-src/etags.c 2493
+line perl-src/htlmify-cystic 37
+line y-src/parse.y 87
+lineCount php-src/lce_functions.php /^ function lineCount($entry)$/
+linebuffer c-src/etags.c 239
+linebuffer_init c-src/etags.c /^linebuffer_init (linebuffer *lbp)$/
+linebuffer_setlen c-src/etags.c /^linebuffer_setlen (linebuffer *lbp, int toksize)$/
+lineno c-src/emacs/src/lisp.h 3147
+lineno c-src/etags.c 2506
+linepos c-src/etags.c 2507
+linepos c-src/etags.c 2922
+links html-src/software.html /^Links to interesting software$/
+lisp_eval_depth c-src/emacs/src/lisp.h 3045
+lisp_h_CHECK_LIST_CONS c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (C/
+lisp_h_CHECK_NUMBER c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGER/
+lisp_h_CHECK_SYMBOL c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP/
+lisp_h_CHECK_TYPE c-src/emacs/src/lisp.h /^#define lisp_h_CHECK_TYPE(ok, predicate, x) \\$/
+lisp_h_CONSP c-src/emacs/src/lisp.h /^#define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons)$/
+lisp_h_EQ c-src/emacs/src/lisp.h /^#define lisp_h_EQ(x, y) (XLI (x) == XLI (y))$/
+lisp_h_FLOATP c-src/emacs/src/lisp.h /^#define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float)/
+lisp_h_INTEGERP c-src/emacs/src/lisp.h /^#define lisp_h_INTEGERP(x) ((XTYPE (x) & (Lisp_Int/
+lisp_h_MARKERP c-src/emacs/src/lisp.h /^#define lisp_h_MARKERP(x) (MISCP (x) && XMISCTYPE /
+lisp_h_MISCP c-src/emacs/src/lisp.h /^#define lisp_h_MISCP(x) (XTYPE (x) == Lisp_Misc)$/
+lisp_h_NILP c-src/emacs/src/lisp.h /^#define lisp_h_NILP(x) EQ (x, Qnil)$/
+lisp_h_SET_SYMBOL_VAL c-src/emacs/src/lisp.h /^#define lisp_h_SET_SYMBOL_VAL(sym, v) \\$/
+lisp_h_SYMBOLP c-src/emacs/src/lisp.h /^#define lisp_h_SYMBOLP(x) (XTYPE (x) == Lisp_Symbo/
+lisp_h_SYMBOL_CONSTANT_P c-src/emacs/src/lisp.h /^#define lisp_h_SYMBOL_CONSTANT_P(sym) (XSYMBOL (sy/
+lisp_h_SYMBOL_VAL c-src/emacs/src/lisp.h /^#define lisp_h_SYMBOL_VAL(sym) \\$/
+lisp_h_VECTORLIKEP c-src/emacs/src/lisp.h /^#define lisp_h_VECTORLIKEP(x) (XTYPE (x) == Lisp_V/
+lisp_h_XCAR c-src/emacs/src/lisp.h /^#define lisp_h_XCAR(c) XCONS (c)->car$/
+lisp_h_XCDR c-src/emacs/src/lisp.h /^#define lisp_h_XCDR(c) XCONS (c)->u.cdr$/
+lisp_h_XCONS c-src/emacs/src/lisp.h /^#define lisp_h_XCONS(a) \\$/
+lisp_h_XFASTINT c-src/emacs/src/lisp.h /^# define lisp_h_XFASTINT(a) XINT (a)$/
+lisp_h_XHASH c-src/emacs/src/lisp.h /^#define lisp_h_XHASH(a) XUINT (a)$/
+lisp_h_XIL c-src/emacs/src/lisp.h /^# define lisp_h_XIL(i) ((Lisp_Object) { i })$/
+lisp_h_XIL c-src/emacs/src/lisp.h /^# define lisp_h_XIL(i) (i)$/
+lisp_h_XINT c-src/emacs/src/lisp.h /^# define lisp_h_XINT(a) (XLI (a) >> INTTYPEBITS)$/
+lisp_h_XLI c-src/emacs/src/lisp.h /^# define lisp_h_XLI(o) ((o).i)$/
+lisp_h_XLI c-src/emacs/src/lisp.h /^# define lisp_h_XLI(o) (o)$/
+lisp_h_XPNTR c-src/emacs/src/lisp.h /^#define lisp_h_XPNTR(a) \\$/
+lisp_h_XSYMBOL c-src/emacs/src/lisp.h /^# define lisp_h_XSYMBOL(a) \\$/
+lisp_h_XTYPE c-src/emacs/src/lisp.h /^# define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a/
+lisp_h_XUNTAG c-src/emacs/src/lisp.h /^# define lisp_h_XUNTAG(a, type) ((void *) (intptr_/
+lisp_h_check_cons_list c-src/emacs/src/lisp.h /^# define lisp_h_check_cons_list() ((void) 0)$/
+lisp_h_make_number c-src/emacs/src/lisp.h /^# define lisp_h_make_number(n) \\$/
+lispy_accent_codes c-src/emacs/src/keyboard.c 4634
+lispy_accent_keys c-src/emacs/src/keyboard.c 4741
+lispy_drag_n_drop_names c-src/emacs/src/keyboard.c 5181
+lispy_function_keys c-src/emacs/src/keyboard.c 4768
+lispy_function_keys c-src/emacs/src/keyboard.c 5065
+lispy_kana_keys c-src/emacs/src/keyboard.c 5026
+lispy_modifier_list c-src/emacs/src/keyboard.c /^lispy_modifier_list (int modifiers)$/
+lispy_multimedia_keys c-src/emacs/src/keyboard.c 4962
+lispy_wheel_names c-src/emacs/src/keyboard.c 5174
+list c-src/emacs/src/gmalloc.c 186
+list merc-src/accumulator.m /^:- import_module list.$/
+list-tags el-src/emacs/lisp/progmodes/etags.el /^(defun list-tags (file &optional _next-match)$/
+list-tags-function el-src/emacs/lisp/progmodes/etags.el /^(defvar list-tags-function nil$/
+list2i c-src/emacs/src/lisp.h /^list2i (EMACS_INT x, EMACS_INT y)$/
+list3i c-src/emacs/src/lisp.h /^list3i (EMACS_INT x, EMACS_INT y, EMACS_INT w)$/
+list4i c-src/emacs/src/lisp.h /^list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMA/
+list_to_ord_set prol-src/ordsets.prolog /^list_to_ord_set(List, Set) :-$/
+lno c-src/etags.c 223
+load objc-src/PackInsp.m /^-load$/
+loadContentsOf objc-src/PackInsp.m /^-loadContentsOf:(const char *)type inTable:(HashTa/
+loadImage objc-src/PackInsp.m /^-loadImage$/
+loadKeyValuesFrom objc-src/PackInsp.m /^-loadKeyValuesFrom:(const char *)type inTable:(Has/
+loadPORManager php-src/lce_functions.php /^ function &loadPORManager()$/
+local_if_set c-src/emacs/src/lisp.h 2338
+location cp-src/clheir.hpp /^ location() { }$/
+location cp-src/clheir.hpp 33
+lookup y-src/cccp.y /^lookup (name, len, hash)$/
+lookup_call merc-src/accumulator.m /^:- pred lookup_call(accu_goal_store::in, accu_goal/
+lowcase c-src/etags.c /^#define lowcase(c) tolower (CHAR (c))$/
+lucid_event_type_list_p c-src/emacs/src/keyboard.c /^lucid_event_type_list_p (Lisp_Object object)$/
+mabort c-src/emacs/src/gmalloc.c /^mabort (enum mcheck_status status)$/
+mach_host_self c-src/machsyscalls.h /^SYSCALL (mach_host_self, -29,$/
+mach_msg_trap c-src/machsyscalls.h /^SYSCALL (mach_msg_trap, -25,$/
+mach_reply_port c-src/machsyscalls.h /^SYSCALL (mach_reply_port, -26,$/
+mach_task_self c-src/machsyscalls.h /^SYSCALL (mach_task_self, -28,$/
+mach_thread_self c-src/machsyscalls.h /^SYSCALL (mach_thread_self, -27,$/
+magic c-src/emacs/src/gmalloc.c 1863
+maintaining.info make-src/Makefile /^maintaining.info: maintaining.texi$/
+make-abbrev-table c-src/abbrev.c /^DEFUN ("make-abbrev-table", Fmake_abbrev_table, Sm/
+make_C_tag c-src/etags.c /^make_C_tag (bool isfun)$/
+make_coor prol-src/natded.prolog /^make_coor(s(_),Alpha,Sem1,Sem2,Alpha@Sem1@Sem2).$/
+make_ctrl_char c-src/emacs/src/keyboard.c /^make_ctrl_char (int c)$/
+make_fixnum_or_float c-src/emacs/src/lisp.h /^#define make_fixnum_or_float(val) \\$/
+make_formatted_string c-src/emacs/src/lisp.h /^extern Lisp_Object make_formatted_string (char *, /
+make_lisp_ptr c-src/emacs/src/lisp.h /^make_lisp_ptr (void *ptr, enum Lisp_Type type)$/
+make_lisp_symbol c-src/emacs/src/lisp.h /^make_lisp_symbol (struct Lisp_Symbol *sym)$/
+make_lispy_event c-src/emacs/src/keyboard.c /^make_lispy_event (struct input_event *event)$/
+make_lispy_focus_in c-src/emacs/src/keyboard.c /^make_lispy_focus_in (Lisp_Object frame)$/
+make_lispy_focus_out c-src/emacs/src/keyboard.c /^make_lispy_focus_out (Lisp_Object frame)$/
+make_lispy_movement c-src/emacs/src/keyboard.c /^make_lispy_movement (struct frame *frame, Lisp_Obj/
+make_lispy_position c-src/emacs/src/keyboard.c /^make_lispy_position (struct frame *f, Lisp_Object /
+make_lispy_switch_frame c-src/emacs/src/keyboard.c /^make_lispy_switch_frame (Lisp_Object frame)$/
+make_number c-src/emacs/src/lisp.h /^# define make_number(n) lisp_h_make_number (n)$/
+make_pointer_integer c-src/emacs/src/lisp.h /^make_pointer_integer (void *p)$/
+make_scroll_bar_position c-src/emacs/src/keyboard.c /^make_scroll_bar_position (struct input_event *ev, /
+make_tag c-src/etags.c /^make_tag (const char *name, \/* tag name, or NULL /
+make_uninit_sub_char_table c-src/emacs/src/lisp.h /^make_uninit_sub_char_table (int depth, int min_cha/
+make_uninit_vector c-src/emacs/src/lisp.h /^make_uninit_vector (ptrdiff_t size)$/
+malloc c-src/emacs/src/gmalloc.c /^extern void *malloc (size_t size) ATTRIBUTE_MALLOC/
+malloc c-src/emacs/src/gmalloc.c /^malloc (size_t size)$/
+malloc c-src/emacs/src/gmalloc.c 1715
+malloc c-src/emacs/src/gmalloc.c 64
+malloc c-src/emacs/src/gmalloc.c 68
+malloc_atfork_handler_child c-src/emacs/src/gmalloc.c /^malloc_atfork_handler_child (void)$/
+malloc_atfork_handler_parent c-src/emacs/src/gmalloc.c /^malloc_atfork_handler_parent (void)$/
+malloc_atfork_handler_prepare c-src/emacs/src/gmalloc.c /^malloc_atfork_handler_prepare (void)$/
+malloc_enable_thread c-src/emacs/src/gmalloc.c /^malloc_enable_thread (void)$/
+malloc_info c-src/emacs/src/gmalloc.c 167
+malloc_initialize_1 c-src/emacs/src/gmalloc.c /^malloc_initialize_1 (void)$/
+mallochook c-src/emacs/src/gmalloc.c /^mallochook (size_t size)$/
+man manpage make-src/Makefile /^man manpage: etags.1.man$/
+mao c-src/h.h 101
+map c-src/emacs/src/keyboard.c 8748
+map merc-src/accumulator.m /^:- import_module map.$/
+map_word prol-src/natded.prolog /^map_word([[_]|Ws],Exp):-$/
+mapping html-src/algrthms.html /^Mapping the Channel Symbols$/
+mapsyn prol-src/natded.prolog /^mapsyn(A\/B,AM\/BM):-$/
+mark_kboards c-src/emacs/src/keyboard.c /^mark_kboards (void)$/
+max c-src/emacs/src/lisp.h /^#define max(a, b) ((a) > (b) ? (a) : (b))$/
+max c-src/emacs/src/lisp.h 58
+max c.c /^__attribute__ ((always_inline)) max (int a, int b)/
+max c.c /^max (int a, int b)$/
+max cp-src/conway.cpp /^#define max(x,y) ((x > y) ? x : y)$/
+max_args c-src/emacs/src/lisp.h 1686
+max_num_directions cp-src/clheir.hpp 31
+max_num_generic_objects cp-src/clheir.cpp 9
+maxargs c-src/emacs/src/lisp.h 2831
+maybe merc-src/accumulator.m /^:- import_module maybe.$/
+maybe_gc c-src/emacs/src/lisp.h /^maybe_gc (void)$/
+mcCSC cp-src/c.C 6
+mcheck c-src/emacs/src/gmalloc.c /^mcheck (void (*func) (enum mcheck_status))$/
+mcheck_status c-src/emacs/src/gmalloc.c 283
+mcheck_used c-src/emacs/src/gmalloc.c 2012
+mdbcomp merc-src/accumulator.m /^:- import_module mdbcomp.$/
+me22b lua-src/test.lua /^ local function test.me22b (one)$/
+me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/
+memalign c-src/emacs/src/gmalloc.c /^memalign (size_t alignment, size_t size)$/
+member prol-src/natded.prolog /^member(X,[X|_]).$/
+member_lessthan_goalid merc-src/accumulator.m /^:- pred member_lessthan_goalid(accu_goal_store::in/
+memclear c-src/emacs/src/lisp.h /^memclear (void *p, ptrdiff_t nbytes)$/
+menu_bar_item c-src/emacs/src/keyboard.c /^menu_bar_item (Lisp_Object key, Lisp_Object item, /
+menu_bar_items c-src/emacs/src/keyboard.c /^menu_bar_items (Lisp_Object old)$/
+menu_bar_items_index c-src/emacs/src/keyboard.c 7369
+menu_bar_items_vector c-src/emacs/src/keyboard.c 7368
+menu_bar_one_keymap_changed_items c-src/emacs/src/keyboard.c 7363
+menu_item_eval_property c-src/emacs/src/keyboard.c /^menu_item_eval_property (Lisp_Object sexpr)$/
+menu_item_eval_property_1 c-src/emacs/src/keyboard.c /^menu_item_eval_property_1 (Lisp_Object arg)$/
+menu_separator_name_p c-src/emacs/src/keyboard.c /^menu_separator_name_p (const char *label)$/
+metasource c-src/etags.c 198
+min c-src/emacs/src/gmalloc.c /^#define min(a, b) ((a) < (b) ? (a) : (b))$/
+min c-src/emacs/src/lisp.h /^#define min(a, b) ((a) < (b) ? (a) : (b))$/
+min c-src/emacs/src/lisp.h 57
+min cp-src/conway.cpp /^#define min(x,y) ((x > y) ? y : x)$/
+min_args c-src/emacs/src/lisp.h 1686
+min_char c-src/emacs/src/lisp.h 1621
+minus cp-src/functions.cpp /^void Date::minus ( int days , int month , int year/
+miti html-src/softwarelibero.html /^Sfatiamo alcuni miti$/
+modifier_names c-src/emacs/src/keyboard.c 6319
+modifier_symbols c-src/emacs/src/keyboard.c 6327
+modify_event_symbol c-src/emacs/src/keyboard.c /^modify_event_symbol (ptrdiff_t symbol_num, int mod/
+module_class_method ruby-src/test.rb /^ def ModuleExample.module_class_method$/
+module_instance_method ruby-src/test.rb /^ def module_instance_method$/
+more= ruby-src/test1.ru /^ :more$/
+more_aligned_int c.c 165
+morecore_nolock c-src/emacs/src/gmalloc.c /^morecore_nolock (size_t size)$/
+morecore_recursing c-src/emacs/src/gmalloc.c 604
+mouse_syms c-src/emacs/src/keyboard.c 4627
+move cp-src/clheir.cpp /^void agent::move(int direction)$/
+mprobe c-src/emacs/src/gmalloc.c /^mprobe (void *ptr)$/
+msgid php-src/lce_functions.php /^ function msgid($line, $class)$/
+msgstr php-src/lce_functions.php /^ function msgstr($line, $class)$/
+mstats c-src/emacs/src/gmalloc.c 308
+mt prol-src/natded.prolog /^mt:-$/
+mtg html-src/software.html /^MTG$/
+multi_line c-src/etags.c 267
+multibyte c-src/emacs/src/regex.h 403
+my_printf c.c /^my_printf (void *my_object, const char *my_format,/
+my_struct c-src/h.h 91
+my_struct c.c 226
+my_typedef c-src/h.h 93
+my_typedef c.c 228
+mypi forth-src/test-forth.fth /^synonym mypi fconst$/
+n c-src/exit.c 28
+n c-src/exit.strange_suffix 28
+name c-src/emacs/src/keyboard.c 7241
+name c-src/emacs/src/lisp.h 1808
+name c-src/emacs/src/lisp.h 3144
+name c-src/emacs/src/lisp.h 682
+name c-src/etags.c 192
+name c-src/etags.c 218
+name c-src/etags.c 2271
+name c-src/etags.c 261
+name c-src/getopt.h 76
+name c-src/getopt.h 78
+name perl-src/htlmify-cystic 357
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Function}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Macro}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Special Form}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{User Option}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{Variable}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{#1}\\deftpargs{#3}\\endgrou/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{#1}\\defunargs{#3}\\endgrou/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{#1}\\defvarargs{#3}\\endgro/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{Instance Variable of #1}%/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{Method on #1}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{\\defcvtype{} of #1}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{\\defoptype{} on #1}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#1} #2}{Function}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#1} #2}{Variable}%$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#2} #3}{#1}$/
+name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#2} #3}{#1}%$/
+name y-src/cccp.y 113
+name y-src/cccp.y 43
+named c-src/etags.c 2505
+namestringequal pas-src/common.pas /^function namestringequal;(*(var Name1,Name2 : Name/
+nargs c-src/emacs/src/lisp.h 2987
+need_adjustment c-src/emacs/src/lisp.h 1986
+neighbors cp-src/clheir.hpp 59
+nelem cp-src/Range.h /^ int nelem (void) const { return rng_nelem; }$/
+nestlev c-src/etags.c 2525
+new objc-src/PackInsp.m /^+new$/
+new perl-src/htlmify-cystic 163
+new_tag perl-src/htlmify-cystic 18
+newlb c-src/etags.c 2930
+newlinepos c-src/etags.c 2932
+newtextstring pas-src/common.pas /^function newtextstring; (*: TextString;*)$/
+next c-src/emacs/src/gmalloc.c 164
+next c-src/emacs/src/gmalloc.c 188
+next c-src/emacs/src/gmalloc.c 198
+next c-src/emacs/src/keyboard.c 7246
+next c-src/emacs/src/keyboard.c 861
+next c-src/emacs/src/lisp.h 1848
+next c-src/emacs/src/lisp.h 2009
+next c-src/emacs/src/lisp.h 2037
+next c-src/emacs/src/lisp.h 2192
+next c-src/emacs/src/lisp.h 3028
+next c-src/emacs/src/lisp.h 3134
+next c-src/emacs/src/lisp.h 700
+next c-src/etags.c 203
+next c.c 174
+next y-src/cccp.y 42
+next-file el-src/emacs/lisp/progmodes/etags.el /^(defun next-file (&optional initialize novisit)$/
+next-file-list el-src/emacs/lisp/progmodes/etags.el /^(defvar next-file-list nil$/
+next_alive cp-src/conway.hpp 7
+next_almost_prime c-src/emacs/src/lisp.h /^extern EMACS_INT next_almost_prime (EMACS_INT) ATT/
+next_free c-src/emacs/src/lisp.h 1851
+next_weak c-src/emacs/src/lisp.h 1875
+nextfree c-src/emacs/src/lisp.h 3029
+nfree c-src/emacs/src/gmalloc.c 150
+nl c-src/etags.c 2521
+no tex-src/texinfo.tex /^\\global\\advance \\appendixno by 1 \\message{Appendix/
+no tex-src/texinfo.tex /^\\ifnum\\secno=0 Appendix\\xreftie'char\\the\\appendixn/
+no tex-src/texinfo.tex /^\\newcount \\appendixno \\appendixno = `\\@$/
+no.\the\secno tex-src/texinfo.tex /^\\else \\ifnum \\subsecno=0 Section\\xreftie'char\\the\\/
+no.\the\secno.\the\subsecno tex-src/texinfo.tex /^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no.\the\secno.\the\subsecno.\the\subsubsecno tex-src/texinfo.tex /^Section\\xreftie'char\\the\\appendixno.\\the\\secno.\\th/
+no_argument c-src/getopt.h 89
+no_lang_help c-src/etags.c 707
+no_sub c-src/emacs/src/regex.h 387
+nocase_tail c-src/etags.c /^nocase_tail (const char *cp)$/
+node c-src/etags.c 225
+node_st c-src/etags.c 214
+noderef tex-src/texinfo.tex /^\\appendixnoderef %$/
+nofonts tex-src/texinfo.tex /^{\\indexnofonts$/
+nofonts% tex-src/texinfo.tex /^{\\chapternofonts%$/
+none_help c-src/etags.c 703
+normalize prol-src/natded.prolog /^normalize(M,MNorm):-$/
+normalize_fresh prol-src/natded.prolog /^normalize_fresh(M,N):-$/
+normalize_tree prol-src/natded.prolog /^normalize_tree(tree(Rule,Syn:Sem,Trees),$/
+normalize_trees prol-src/natded.prolog /^normalize_trees([],[]).$/
+nosave pyt-src/server.py /^ def nosave(self):$/
+not_bol c-src/emacs/src/regex.h 391
+not_eol c-src/emacs/src/regex.h 394
+not_single_kboard_state c-src/emacs/src/keyboard.c /^not_single_kboard_state (KBOARD *kboard)$/
+notag2 c-src/dostorture.c 26
+notag2 c-src/torture.c 26
+notag4 c-src/dostorture.c 45
+notag4 c-src/torture.c 45
+notinname c-src/etags.c /^#define notinname(c) (_nin[CHAR (c)]) \/* c is not /
+npending c-src/emacs/src/keyboard.c 7244
+ntool_bar_items c-src/emacs/src/keyboard.c 7974
+numOfChannels cp-src/c.C 1
+num_columns cp-src/conway.cpp 16
+num_input_events c-src/emacs/src/keyboard.c 210
+num_regs c-src/emacs/src/regex.h 430
+num_rows cp-src/conway.cpp 15
+numberKeys objcpp-src/SimpleCalc.M /^- numberKeys:sender$/
+number_len c-src/etags.c /^static int number_len (long) ATTRIBUTE_CONST;$/
+numbervars prol-src/natded.prolog /^numbervars(X):-$/
+nvars c-src/emacs/src/lisp.h 3140
+objdef c-src/etags.c 2484
+object c-src/emacs/src/lisp.h 2128
+object_registry cp-src/clheir.cpp 10
+objtag c-src/etags.c 2453
+objvar c-src/emacs/src/lisp.h 2297
+obstack_chunk_alloc y-src/parse.y 47
+obstack_chunk_free y-src/parse.y 48
+ocatseen c-src/etags.c 2477
+octave_MDiagArray2_h cp-src/MDiagArray2.h 29
+octave_Range_h cp-src/Range.h 24
+oediff make-src/Makefile /^oediff: OTAGS ETAGS ${infiles}$/
+offset c-src/emacs/src/lisp.h 2305
+offset c-src/emacs/src/lisp.h 2365
+offset c-src/etags.c 2494
+oignore c-src/etags.c 2483
+oimplementation c-src/etags.c 2474
+oinbody c-src/etags.c 2478
+ok objc-src/PackInsp.m /^-ok:sender$/
+ok_to_echo_at_next_pause c-src/emacs/src/keyboard.c 159
+old_value c-src/emacs/src/lisp.h 2980
+omethodcolon c-src/etags.c 2481
+omethodparm c-src/etags.c 2482
+omethodsign c-src/etags.c 2479
+omethodtag c-src/etags.c 2480
+onone c-src/etags.c 2472
+oparenseen c-src/etags.c 2476
+open objc-src/PackInsp.m /^-open:sender$/
+open-dribble-file c-src/emacs/src/keyboard.c /^DEFUN ("open-dribble-file", Fopen_dribble_file, So/
+openInWorkspace objc-src/PackInsp.m /^static void openInWorkspace(const char *filename)$/
+operationKeys objcpp-src/SimpleCalc.M /^- operationKeys:sender$/
+operator y-src/cccp.y 438
+operator ++ cp-src/functions.cpp /^Date & Date::operator ++ ( void ){$/
+operator += cp-src/functions.cpp /^Date & Date::operator += ( int days ){$/
+operator - cp-src/c.C /^void operator -(int, int) {}$/
+operator - cp-src/functions.cpp /^int Date::operator - ( Date d ){$/
+operator -- cp-src/functions.cpp /^Date & Date::operator -- ( void ){$/
+operator -= cp-src/functions.cpp /^Date & Date::operator -= ( int days ){$/
+operator < cp-src/functions.cpp /^int Date::operator < ( Date d ) {$/
+operator << cp-src/functions.cpp /^ostream& operator << ( ostream &c, Date d ) {$/
+operator = cp-src/MDiagArray2.h /^ MDiagArray2<T>& operator = (const MDiagArray2<T>/
+operator = cp-src/functions.cpp /^Date & Date::operator = ( Date d ){$/
+operator == cp-src/functions.cpp /^int Date::operator == ( Date d ) {$/
+operator > cp-src/functions.cpp /^int Date::operator > ( Date d ) {$/
+operator >> cp-src/functions.cpp /^istream& operator >> ( istream &i, Date & dd ){$/
+operator MArray2<T> cp-src/MDiagArray2.h /^ operator MArray2<T> () const$/
+operator int cp-src/c.C /^void operator int(int, int) {}$/
+operator int cp-src/fail.C /^ operator int() const {return x;}$/
+operator+ cp-src/c.C /^ A operator+(A& a) {};$/
+operator+ cp-src/c.C /^const A& A::operator+(const A&) { }$/
+operator+ cp-src/c.C /^void operator+(int, int) {}$/
+opparsebody\Edefop\defopx\defopheader\defoptype tex-src/texinfo.tex /^\\defopparsebody\\Edefop\\defopx\\defopheader\\defoptyp/
+oprotocol c-src/etags.c 2473
+option c-src/getopt.h 73
+optional_argument c-src/getopt.h 91
+opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype tex-src/texinfo.tex /^\\defopvarparsebody\\Edefcv\\defcvx\\defcvarheader\\def/
+ord_add_element prol-src/ordsets.prolog /^ord_add_element([], Element, [Element]).$/
+ord_del_element prol-src/ordsets.prolog /^ord_del_element([], _, []).$/
+ord_disjoint prol-src/ordsets.prolog /^ord_disjoint(Set1, Set2) :-$/
+ord_intersect prol-src/ordsets.prolog /^ord_intersect([Head1|Tail1], [Head2|Tail2]) :-$/
+ord_intersection prol-src/ordsets.prolog /^ord_intersection(Sets, Intersection) :- $/
+ord_intersection prol-src/ordsets.prolog /^ord_intersection([], Set2, [], Set2).$/
+ord_intersection prol-src/ordsets.prolog /^ord_intersection([], _, []).$/
+ord_intersection2 prol-src/ordsets.prolog /^ord_intersection2(1, [Set|Sets], Set0, Sets0) :- !/
+ord_intersection3 prol-src/ordsets.prolog /^ord_intersection3(<, _, Set1, Head2, Tail2, Inters/
+ord_intersection4 prol-src/ordsets.prolog /^ord_intersection4(<, _, Set1, Head2, Tail2, Inters/
+ord_member prol-src/ordsets.prolog /^ord_member(X, [E|Es]) :-$/
+ord_seteq prol-src/ordsets.prolog /^ord_seteq(Set1, Set2) :-$/
+ord_setproduct prol-src/ordsets.prolog /^ord_setproduct([], _, []).$/
+ord_subset prol-src/ordsets.prolog /^ord_subset([], _).$/
+ord_subtract prol-src/ordsets.prolog /^ord_subtract(Set1, Set2, Union) :-$/
+ord_symdiff prol-src/ordsets.prolog /^ord_symdiff([], Set2, Set2).$/
+ord_union prol-src/ordsets.prolog /^ord_union(Set1, Set2, Union) :-$/
+ord_union prol-src/ordsets.prolog /^ord_union([], Union) :- !, Union = [].$/
+ord_union4 prol-src/ordsets.prolog /^ord_union4(<, Head, Set1, Head2, Tail2, [Head|Unio/
+ord_union_all prol-src/ordsets.prolog /^ord_union_all(1, [Set|Sets], Set, Sets) :- !.$/
+oss html-src/softwarelibero.html /^Il movimento open source$/
+otagseen c-src/etags.c 2475
+outputTime cp-src/c.C 9
+output_file perl-src/htlmify-cystic 35
+output_files perl-src/htlmify-cystic 32
+outputtable html-src/algrthms.html /^Output$/
+outsyn prol-src/natded.prolog /^outsyn(['Any'],_).$/
+p c-src/emacs/src/lisp.h 4673
+p c-src/emacs/src/lisp.h 4679
+p.x forth-src/test-forth.fth /^ 1 CELLS +FIELD p.x \\ A single cell filed name/
+p.y forth-src/test-forth.fth /^ 1 CELLS +FIELD p.y \\ A single cell field name/
+p/f ada-src/etags-test-for.ada /^ function p pragma Import (C,$/
+p/f ada-src/etags-test-for.ada /^function p ("p");$/
+pD c-src/emacs/src/lisp.h 165
+pD c-src/emacs/src/lisp.h 167
+pD c-src/emacs/src/lisp.h 169
+pD c-src/emacs/src/lisp.h 171
+pI c-src/emacs/src/lisp.h 106
+pI c-src/emacs/src/lisp.h 94
+pI c-src/emacs/src/lisp.h 99
+pMd c-src/emacs/src/lisp.h 150
+pMd c-src/emacs/src/lisp.h 155
+pMu c-src/emacs/src/lisp.h 151
+pMu c-src/emacs/src/lisp.h 156
+p_next c-src/etags.c 258
+pagesize c-src/emacs/src/gmalloc.c 1703
+pair merc-src/accumulator.m /^:- import_module pair.$/
+parent c-src/emacs/src/keyboard.c 8745
+parent c-src/emacs/src/lisp.h 1590
+parse prol-src/natded.prolog /^parse(Ws,Cat):-$/
+parseFromVars php-src/lce_functions.php /^ function parseFromVars($prefix)$/
+parse_c_expression y-src/cccp.y /^parse_c_expression (string)$/
+parse_cgi prol-src/natded.prolog /^parse_cgi(TokenList,KeyVals):-$/
+parse_error y-src/parse.y 82
+parse_escape y-src/cccp.y /^parse_escape (string_ptr)$/
+parse_hash y-src/parse.y 64
+parse_menu_item c-src/emacs/src/keyboard.c /^parse_menu_item (Lisp_Object item, int inmenubar)$/
+parse_modifiers c-src/emacs/src/keyboard.c /^parse_modifiers (Lisp_Object symbol)$/
+parse_modifiers_uncached c-src/emacs/src/keyboard.c /^parse_modifiers_uncached (Lisp_Object symbol, ptrd/
+parse_number y-src/cccp.y /^parse_number (olen)$/
+parse_return y-src/parse.y 74
+parse_return_error y-src/cccp.y 70
+parse_solitary_modifier c-src/emacs/src/keyboard.c /^parse_solitary_modifier (Lisp_Object symbol)$/
+parse_tool_bar_item c-src/emacs/src/keyboard.c /^parse_tool_bar_item (Lisp_Object key, Lisp_Object /
+parse_tree merc-src/accumulator.m /^:- import_module parse_tree.$/
+pat c-src/etags.c 262
+pattern c-src/etags.c 260
+pdlcount c-src/emacs/src/lisp.h 3046
+pending-delete-mode el-src/TAGTEST.EL /^(defalias 'pending-delete-mode 'delete-selection-m/
+pending_funcalls c-src/emacs/src/keyboard.c 4377
+pending_signals c-src/emacs/src/keyboard.c 80
+pfatal c-src/etags.c /^pfatal (const char *s1)$/
+pfdset c-src/h.h 57
+pfnote c-src/etags.c /^pfnote (char *name, bool is_func, char *linestart,/
+pinned c-src/emacs/src/lisp.h 679
+plain_C_entries c-src/etags.c /^plain_C_entries (FILE *inf)$/
+plain_C_suffixes c-src/etags.c 643
+plainc c-src/etags.c 2934
+plist c-src/emacs/src/lisp.h 2040
+plist c-src/emacs/src/lisp.h 697
+plus cp-src/functions.cpp /^void Date::plus ( int days , int month , int year /
+plus go-src/test1.go 5
+plusvalseq prol-src/natded.prolog /^plusvalseq([]) --> [].$/
+point forth-src/test-forth.fth /^BEGIN-STRUCTURE point \\ create the named structure/
+pointer c-src/emacs/src/lisp.h 2125
+poll_for_input c-src/emacs/src/keyboard.c /^poll_for_input (struct atimer *timer)$/
+poll_for_input_1 c-src/emacs/src/keyboard.c /^poll_for_input_1 (void)$/
+poll_suppress_count c-src/emacs/src/keyboard.c 1908
+poll_suppress_count c-src/emacs/src/lisp.h 3047
+poll_timer c-src/emacs/src/keyboard.c 1915
+pop-tag-mark el-src/emacs/lisp/progmodes/etags.el /^(defalias 'pop-tag-mark 'xref-pop-marker-stack)$/
+pop_kboard c-src/emacs/src/keyboard.c /^pop_kboard (void)$/
+popclass_above c-src/etags.c /^popclass_above (int bracelev)$/
+position_to_Time c-src/emacs/src/keyboard.c /^position_to_Time (ptrdiff_t pos)$/
+posix_memalign c-src/emacs/src/gmalloc.c /^posix_memalign (void **memptr, size_t alignment, s/
+posn-at-point c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_p/
+posn-at-x-y c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, /
+possible_sum_sign y-src/cccp.y /^#define possible_sum_sign(a, b, sum) ((((a) ^ (b))/
+post pyt-src/server.py /^ def post(self):$/
+pot_etags_version c-src/etags.c 81
+pp1 c-src/dostorture.c /^int pp1($/
+pp1 c-src/torture.c /^int pp1($/
+pp2 c-src/dostorture.c /^pp2$/
+pp2 c-src/torture.c /^pp2$/
+pp3 c-src/dostorture.c /^pp3(int bar)$/
+pp3 c-src/torture.c /^pp3(int bar)$/
+pp_bas_cat prol-src/natded.prolog /^pp_bas_cat(Cat):-$/
+pp_cat prol-src/natded.prolog /^pp_cat(Syn:Sem):-$/
+pp_exp prol-src/natded.prolog /^pp_exp('NIL'):-$/
+pp_exps prol-src/natded.prolog /^pp_exps([]).$/
+pp_html_fitch_tree prol-src/natded.prolog /^pp_html_fitch_tree(tree(der,Root,[ders(Words)]),M,/
+pp_html_table_fitch_tree prol-src/natded.prolog /^pp_html_table_fitch_tree(T):-$/
+pp_html_table_tree prol-src/natded.prolog /^pp_html_table_tree(T):-$/
+pp_html_tree prol-src/natded.prolog /^pp_html_tree(ass(Syn,V,'$VAR'(N))):-$/
+pp_html_trees prol-src/natded.prolog /^pp_html_trees([T|Ts],N,M):-$/
+pp_lam prol-src/natded.prolog /^pp_lam(Var^Alpha):-$/
+pp_lam_bracket prol-src/natded.prolog /^pp_lam_bracket(A^B):-$/
+pp_lam_paren prol-src/natded.prolog /^pp_lam_paren(Var^Alpha):-$/
+pp_paren prol-src/natded.prolog /^pp_paren(C):-$/
+pp_rule prol-src/natded.prolog /^pp_rule(fe):-write('\/E').$/
+pp_syn prol-src/natded.prolog /^pp_syn(A\/B):-$/
+pp_syn_back prol-src/natded.prolog /^pp_syn_back(A\/B):-$/
+pp_syn_paren prol-src/natded.prolog /^pp_syn_paren(A\/B):-$/
+pp_tree prol-src/natded.prolog /^pp_tree(T):-$/
+pp_trees prol-src/natded.prolog /^pp_trees([T|Ts],Column):-$/
+pp_word prol-src/natded.prolog /^pp_word(W):-$/
+pp_word_list prol-src/natded.prolog /^pp_word_list([]).$/
+pp_word_list_rest prol-src/natded.prolog /^pp_word_list_rest([]).$/
+predicate c-src/emacs/src/lisp.h 2307
+prev c-src/emacs/src/gmalloc.c 165
+prev c-src/emacs/src/gmalloc.c 189
+prev c-src/emacs/src/lisp.h 2191
+prev c.c 175
+printClassification php-src/lce_functions.php /^ function printClassification()$/
+print_help c-src/etags.c /^print_help (argument *argbuffer)$/
+print_language_names c-src/etags.c /^print_language_names (void)$/
+print_version c-src/etags.c /^print_version (void)$/
+printmax_t c-src/emacs/src/lisp.h 148
+printmax_t c-src/emacs/src/lisp.h 153
+proc c-src/h.h 87
+process_file c-src/etags.c /^process_file (FILE *fh, char *fn, language *lang)$/
+process_file_name c-src/etags.c /^process_file_name (char *file, language *lang)$/
+process_pending_signals c-src/emacs/src/keyboard.c /^process_pending_signals (void)$/
+process_special_events c-src/emacs/src/keyboard.c /^process_special_events (void)$/
+process_tool_bar_item c-src/emacs/src/keyboard.c /^process_tool_bar_item (Lisp_Object key, Lisp_Objec/
+prof make-src/Makefile /^prof: ETAGS$/
+prolog_atom c-src/etags.c /^prolog_atom (char *s, size_t pos)$/
+prolog_pr c-src/etags.c /^prolog_pr (char *s, char *last)$/
+prolog_skip_comment c-src/etags.c /^prolog_skip_comment (linebuffer *plb, FILE *inf)$/
+prop c-src/etags.c 209
+protect_malloc_state c-src/emacs/src/gmalloc.c /^protect_malloc_state (int protect_p)$/
+pthread_mutexattr_setprio_ceiling/f ada-src/2ataspri.adb /^ function pthread_mutexattr_setprio_ceiling$/
+pthread_mutexattr_setprotocol/f ada-src/2ataspri.adb /^ function pthread_mutexattr_setprotocol$/
+purpose c-src/emacs/src/lisp.h 1594
+push_kboard c-src/emacs/src/keyboard.c /^push_kboard (struct kboard *k)$/
+pushclass_above c-src/etags.c /^pushclass_above (int bracelev, char *str, int len)/
+put_entries c-src/etags.c /^put_entries (register node *np)$/
+pvec_type c-src/emacs/src/lisp.h 780
+quantizing html-src/algrthms.html /^Quantizing the Received$/
+questo ../c/c.web 34
+quiettest make-src/Makefile /^quiettest:$/
+quit_char c-src/emacs/src/keyboard.c 192
+quit_throw_to_read_char c-src/emacs/src/keyboard.c /^quit_throw_to_read_char (bool from_signal)$/
+qux ruby-src/test1.ru /^ alias_method :qux, :tee, attr_accessor(:bogus)/
+qux1 ruby-src/test1.ru /^ :qux1)$/
+qux= ruby-src/test1.ru /^ def qux=(tee)$/
+r0 c-src/sysdep.h 54
+r1 c-src/sysdep.h 55
+r_alloc c-src/emacs/src/lisp.h /^extern void *r_alloc (void **, size_t) ATTRIBUTE_A/
+range_exp y-src/parse.y 269
+range_exp_list y-src/parse.y 273
+raw_keybuf c-src/emacs/src/keyboard.c 116
+raw_keybuf_count c-src/emacs/src/keyboard.c 117
+rbtp c.c 240
+re_iswctype c-src/emacs/src/regex.h 602
+re_nsub c-src/emacs/src/regex.h 364
+re_pattern_buffer c-src/emacs/src/regex.h 335
+re_pattern_buffer c-src/h.h 119
+re_registers c-src/emacs/src/regex.h 428
+re_wchar_t c-src/emacs/src/regex.h 600
+re_wchar_t c-src/emacs/src/regex.h 623
+re_wctype c-src/emacs/src/regex.h 601
+re_wctype_t c-src/emacs/src/regex.h 599
+re_wctype_t c-src/emacs/src/regex.h 618
+re_wctype_to_bit c-src/emacs/src/regex.h /^# define re_wctype_to_bit(cc) 0$/
+read cp-src/conway.hpp /^ char read() { return alive; }$/
+read php-src/lce_functions.php /^ function read()$/
+read-key-sequence c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence", Fread_key_sequence, Sr/
+read-key-sequence-vector c-src/emacs/src/keyboard.c /^DEFUN ("read-key-sequence-vector", Fread_key_seque/
+read1 ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+read2 ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+read_char c-src/emacs/src/keyboard.c /^read_char (int commandflag, Lisp_Object map,$/
+read_char_help_form_unwind c-src/emacs/src/keyboard.c /^read_char_help_form_unwind (void)$/
+read_char_minibuf_menu_prompt c-src/emacs/src/keyboard.c /^read_char_minibuf_menu_prompt (int commandflag,$/
+read_char_x_menu_prompt c-src/emacs/src/keyboard.c /^read_char_x_menu_prompt (Lisp_Object map,$/
+read_decoded_event_from_main_queue c-src/emacs/src/keyboard.c /^read_decoded_event_from_main_queue (struct timespe/
+read_event_from_main_queue c-src/emacs/src/keyboard.c /^read_event_from_main_queue (struct timespec *end_t/
+read_key_sequence c-src/emacs/src/keyboard.c /^read_key_sequence (Lisp_Object *keybuf, int bufsiz/
+read_key_sequence_cmd c-src/emacs/src/keyboard.c 232
+read_key_sequence_remapped c-src/emacs/src/keyboard.c 233
+read_key_sequence_vs c-src/emacs/src/keyboard.c /^read_key_sequence_vs (Lisp_Object prompt, Lisp_Obj/
+read_menu_command c-src/emacs/src/keyboard.c /^read_menu_command (void)$/
+read_toc perl-src/htlmify-cystic /^sub read_toc ()$/
+readable_events c-src/emacs/src/keyboard.c /^readable_events (int flags)$/
+readline c-src/etags.c /^readline (linebuffer *lbp, FILE *stream)$/
+readline_internal c-src/etags.c /^readline_internal (linebuffer *lbp, register FILE /
+realloc c-src/emacs/src/gmalloc.c /^realloc (void *ptr, size_t size)$/
+realloc c-src/emacs/src/gmalloc.c 1716
+realloc c-src/emacs/src/gmalloc.c 65
+realloc c-src/emacs/src/gmalloc.c 69
+reallochook c-src/emacs/src/gmalloc.c /^reallochook (void *ptr, size_t size)$/
+recent-keys c-src/emacs/src/keyboard.c /^DEFUN ("recent-keys", Frecent_keys, Srecent_keys, /
+recent_keys c-src/emacs/src/keyboard.c 100
+recent_keys_index c-src/emacs/src/keyboard.c 94
+record_asynch_buffer_change c-src/emacs/src/keyboard.c /^record_asynch_buffer_change (void)$/
+record_auto_save c-src/emacs/src/keyboard.c /^record_auto_save (void)$/
+record_char c-src/emacs/src/keyboard.c /^record_char (Lisp_Object c)$/
+record_menu_key c-src/emacs/src/keyboard.c /^record_menu_key (Lisp_Object c)$/
+record_single_kboard_state c-src/emacs/src/keyboard.c /^record_single_kboard_state ()$/
+record_xmalloc c-src/emacs/src/lisp.h /^extern void *record_xmalloc (size_t) ATTRIBUTE_ALL/
+recover_top_level_message c-src/emacs/src/keyboard.c 138
+recursion-depth c-src/emacs/src/keyboard.c /^DEFUN ("recursion-depth", Frecursion_depth, Srecur/
+recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("recursive-edit", Frecursive_edit, Srecursi/
+recursive_edit_1 c-src/emacs/src/keyboard.c /^recursive_edit_1 (void)$/
+recursive_edit_unwind c-src/emacs/src/keyboard.c /^recursive_edit_unwind (Lisp_Object buffer)$/
+redirect c-src/emacs/src/lisp.h 663
+reduce prol-src/natded.prolog /^reduce((X^M)@N,L):- % beta reduction$/
+reduce_subterm prol-src/natded.prolog /^reduce_subterm(M,M2):-$/
+refreshPort pyt-src/server.py /^ def refreshPort(self):$/
+reg_errcode_t c-src/emacs/src/regex.h 323
+reg_errcode_t c.c 279
+reg_syntax_t c-src/emacs/src/regex.h 43
+regex c-src/etags.c 219
+regex.o make-src/Makefile /^regex.o: emacs\/src\/regex.c$/
+regex_t c-src/emacs/src/regex.h 416
+regex_tag_multiline c-src/etags.c /^regex_tag_multiline (void)$/
+regexfile make-src/Makefile /^regexfile: Makefile$/
+regexp c-src/etags.c 256
+regexp c-src/etags.c 268
+registerAction objcpp-src/SimpleCalc.M /^- registerAction:(SEL)action$/
+register_heapinfo c-src/emacs/src/gmalloc.c /^register_heapinfo (void)$/
+regmatch_t c-src/emacs/src/regex.h 451
+regoff_t c-src/emacs/src/regex.h 423
+regs c-src/etags.c 263
+regs cp-src/screen.cpp 16
+regs_allocated c-src/emacs/src/regex.h 379
+regset c-src/h.h 31
+regular_top_level_message c-src/emacs/src/keyboard.c 143
+rehash_size c-src/emacs/src/lisp.h 1835
+rehash_threshold c-src/emacs/src/lisp.h 1839
+relative_filename c-src/etags.c /^relative_filename (char *file, char *dir)$/
+release distrib make-src/Makefile /^release distrib: web$/
+removeexp prol-src/natded.prolog /^removeexp(E,E,'NIL'):-!.$/
+reorder_modifiers c-src/emacs/src/keyboard.c /^reorder_modifiers (Lisp_Object symbol)$/
+request c.c /^request request (a, b)$/
+requeued_events_pending_p c-src/emacs/src/keyboard.c /^requeued_events_pending_p (void)$/
+require merc-src/accumulator.m /^:- import_module require.$/
+required_argument c-src/getopt.h 90
+reset-this-command-lengths c-src/emacs/src/keyboard.c /^DEFUN ("reset-this-command-lengths", Freset_this_c/
+restore_getcjmp c-src/emacs/src/keyboard.c /^restore_getcjmp (sys_jmp_buf temp)$/
+restore_kboard_configuration c-src/emacs/src/keyboard.c /^restore_kboard_configuration (int was_locked)$/
+return_to_command_loop c-src/emacs/src/keyboard.c 135
+reverse prol-src/natded.prolog /^reverse([],Ws,Ws).$/
+revert objc-src/PackInsp.m /^-revert:sender$/
+right c-src/etags.c 216
+right_shift y-src/cccp.y /^right_shift (a, b)$/
+ring1 c.c 241
+ring2 c.c 242
+rm_eo c-src/emacs/src/regex.h 450
+rm_so c-src/emacs/src/regex.h 449
+rng_base cp-src/Range.h 79
+rng_inc cp-src/Range.h 81
+rng_limit cp-src/Range.h 80
+rng_nelem cp-src/Range.h 83
+rosso cp-src/c.C 40
+rsyncfromfly make-src/Makefile /^rsyncfromfly:$/
+rsynctofly make-src/Makefile /^rsynctofly:$/
+rtint c-src/h.h 60
+rtint c-src/h.h 68
+rtstr c-src/h.h 61
+rtstr c-src/h.h 69
+rtunion_def c-src/h.h 58
+rtunion_def c-src/h.h 64
+rtx c-src/h.h 62
+rtxnp c-src/h.h 71
+rtxp c-src/h.h 70
+s c-src/emacs/src/lisp.h 4672
+s c-src/emacs/src/lisp.h 4678
+s1 cp-src/c.C 32
+s2 cp-src/c.C 35
+safe_run_hook_funcall c-src/emacs/src/keyboard.c /^safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Objec/
+safe_run_hooks c-src/emacs/src/keyboard.c /^safe_run_hooks (Lisp_Object hook)$/
+safe_run_hooks_1 c-src/emacs/src/keyboard.c /^safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *ar/
+safe_run_hooks_error c-src/emacs/src/keyboard.c /^safe_run_hooks_error (Lisp_Object error, ptrdiff_t/
+save pyt-src/server.py /^ def save(self):$/
+save_getcjmp c-src/emacs/src/keyboard.c /^save_getcjmp (sys_jmp_buf temp)$/
+save_type c-src/emacs/src/lisp.h /^save_type (struct Lisp_Save_Value *v, int n)$/
+savenstr c-src/etags.c /^savenstr (const char *cp, int len)$/
+savestr c-src/etags.c /^savestr (const char *cp)$/
+say go-src/test.go /^func say(msg string) {$/
+scan_separators c-src/etags.c /^scan_separators (char *name)$/
+scolonseen c-src/etags.c 2447
+scratch c-src/sysdep.h 56
+scroll_bar_parts c-src/emacs/src/keyboard.c 5189
+sec=\relax tex-src/texinfo.tex /^\\let\\appendixsec=\\relax$/
+section perl-src/htlmify-cystic 25
+section=\relax tex-src/texinfo.tex /^\\let\\appendixsection=\\relax$/
+section_href perl-src/htlmify-cystic /^sub section_href ($)$/
+section_name perl-src/htlmify-cystic /^sub section_name ($)$/
+section_name perl-src/htlmify-cystic 12
+section_toc perl-src/htlmify-cystic 15
+section_url perl-src/htlmify-cystic /^sub section_url ()$/
+section_url_base perl-src/htlmify-cystic /^sub section_url_base ()$/
+section_url_name perl-src/htlmify-cystic /^sub section_url_name ()$/
+select prol-src/natded.prolog /^select(X,[X|Xs],Xs).$/
+select-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun select-tags-table ()$/
+select-tags-table-mode el-src/emacs/lisp/progmodes/etags.el /^(define-derived-mode select-tags-table-mode specia/
+select-tags-table-mode-map el-src/emacs/lisp/progmodes/etags.el /^(defvar select-tags-table-mode-map ; Doc string?$/
+select-tags-table-quit el-src/emacs/lisp/progmodes/etags.el /^(defun select-tags-table-quit ()$/
+select-tags-table-select el-src/emacs/lisp/progmodes/etags.el /^(defun select-tags-table-select (button)$/
+select_last prol-src/natded.prolog /^select_last([X],X,[]).$/
+send objc-src/Subprocess.m /^- send:(const char *)string withNewline:(BOOL)want/
+send objc-src/Subprocess.m /^- send:(const char *)string$/
+separator_names c-src/emacs/src/keyboard.c 7372
+serializeToVars php-src/lce_functions.php /^ function serializeToVars($prefix)$/
+set cp-src/conway.hpp /^ void set(void) { alive = 1; }$/
+set merc-src/accumulator.m /^:- import_module set.$/
+set-input-interrupt-mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-interrupt-mode", Fset_input_inte/
+set-input-meta-mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-meta-mode", Fset_input_meta_mode/
+set-input-mode c-src/emacs/src/keyboard.c /^DEFUN ("set-input-mode", Fset_input_mode, Sset_inp/
+set-output-flow-control c-src/emacs/src/keyboard.c /^DEFUN ("set-output-flow-control", Fset_output_flow/
+set-quit-char c-src/emacs/src/keyboard.c /^DEFUN ("set-quit-char", Fset_quit_char, Sset_quit_/
+setDate cp-src/functions.cpp /^void Date::setDate ( int d , int m , int y ){$/
+setDelegate objc-src/Subprocess.m /^- setDelegate:anObject$/
+setRevertButtonTitle objc-src/PackInsp.m /^-setRevertButtonTitle$/
+set_base cp-src/Range.h /^ void set_base (double b) { rng_base = b; }$/
+set_char_table_contents c-src/emacs/src/lisp.h /^set_char_table_contents (Lisp_Object table, ptrdif/
+set_char_table_defalt c-src/emacs/src/lisp.h /^set_char_table_defalt (Lisp_Object table, Lisp_Obj/
+set_char_table_extras c-src/emacs/src/lisp.h /^set_char_table_extras (Lisp_Object table, ptrdiff_/
+set_char_table_purpose c-src/emacs/src/lisp.h /^set_char_table_purpose (Lisp_Object table, Lisp_Ob/
+set_hash_key_slot c-src/emacs/src/lisp.h /^set_hash_key_slot (struct Lisp_Hash_Table *h, ptrd/
+set_hash_value_slot c-src/emacs/src/lisp.h /^set_hash_value_slot (struct Lisp_Hash_Table *h, pt/
+set_inc cp-src/Range.h /^ void set_inc (double i) { rng_inc = i; }$/
+set_limit cp-src/Range.h /^ void set_limit (double l) { rng_limit = l; }$/
+set_overlay_plist c-src/emacs/src/lisp.h /^set_overlay_plist (Lisp_Object overlay, Lisp_Objec/
+set_poll_suppress_count c-src/emacs/src/keyboard.c /^set_poll_suppress_count (int count)$/
+set_prop c-src/emacs/src/keyboard.c /^set_prop (ptrdiff_t idx, Lisp_Object val)$/
+set_save_integer c-src/emacs/src/lisp.h /^set_save_integer (Lisp_Object obj, int n, ptrdiff_/
+set_save_pointer c-src/emacs/src/lisp.h /^set_save_pointer (Lisp_Object obj, int n, void *va/
+set_string_intervals c-src/emacs/src/lisp.h /^set_string_intervals (Lisp_Object s, INTERVAL i)$/
+set_sub_char_table_contents c-src/emacs/src/lisp.h /^set_sub_char_table_contents (Lisp_Object table, pt/
+set_symbol_function c-src/emacs/src/lisp.h /^set_symbol_function (Lisp_Object sym, Lisp_Object /
+set_symbol_next c-src/emacs/src/lisp.h /^set_symbol_next (Lisp_Object sym, struct Lisp_Symb/
+set_symbol_plist c-src/emacs/src/lisp.h /^set_symbol_plist (Lisp_Object sym, Lisp_Object pli/
+set_upto merc-src/accumulator.m /^:- func set_upto(accu_case, int) = set(accu_goal_i/
+set_waiting_for_input c-src/emacs/src/keyboard.c /^set_waiting_for_input (struct timespec *time_to_cl/
+setref tex-src/texinfo.tex /^\\expandafter\\expandafter\\expandafter\\appendixsetre/
+setup cp-src/c.C 5
+shift cp-src/functions.cpp /^void Date::shift ( void ){\/\/Shift this date to pre/
+shouldLoad objc-src/PackInsp.m /^-(BOOL)shouldLoad$/
+should_attempt_accu_transform merc-src/accumulator.m /^:- pred should_attempt_accu_transform(module_info:/
+should_attempt_accu_transform_2 merc-src/accumulator.m /^:- pred should_attempt_accu_transform_2(module_inf/
+should_see_this_array_type cp-src/c.C 156
+should_see_this_function_pointer cp-src/c.C 153
+should_see_this_one_enclosed_in_extern_C cp-src/c.C 149
+show erl-src/gs_dialog.erl /^show(Module, Title, Message, Args) ->$/
+showError objc-src/Subprocess.m /^showError (const char *errorString, id theDelegate/
+showInfo objc-src/PackInsp.m /^-showInfo:sender$/
+show_help_echo c-src/emacs/src/keyboard.c /^show_help_echo (Lisp_Object help, Lisp_Object wind/
+sig c-src/emacs/src/keyboard.c 7238
+signal_handler c-src/h.h 82
+signal_handler1 c-src/h.h 83
+signal_handler_t c-src/h.h 94
+simulation html-src/software.html /^Software that I wrote for supporting my research a/
+single_kboard c-src/emacs/src/keyboard.c 89
+single_kboard_state c-src/emacs/src/keyboard.c /^single_kboard_state ()$/
+site cp-src/conway.hpp /^ site(int xi, int yi): x(xi), y(yi), alive(0) {/
+site cp-src/conway.hpp 5
+size c-src/emacs/src/gmalloc.c 156
+size c-src/emacs/src/gmalloc.c 163
+size c-src/emacs/src/gmalloc.c 1862
+size c-src/emacs/src/lisp.h 1364
+size c-src/emacs/src/lisp.h 1390
+size c-src/etags.c 236
+size c-src/etags.c 2522
+skeyseen c-src/etags.c 2445
+skip_name c-src/etags.c /^skip_name (char *cp)$/
+skip_non_spaces c-src/etags.c /^skip_non_spaces (char *cp)$/
+skip_spaces c-src/etags.c /^skip_spaces (char *cp)$/
+snarf-tag-function el-src/emacs/lisp/progmodes/etags.el /^(defvar snarf-tag-function nil$/
+snone c-src/etags.c 2443
+solutions merc-src/accumulator.m /^:- import_module solutions.$/
+some_mouse_moved c-src/emacs/src/keyboard.c /^some_mouse_moved (void)$/
+space tex-src/texinfo.tex /^ {#2\\labelspace #1}\\dotfill\\doshortpageno{#3}}%/
+space tex-src/texinfo.tex /^ \\dosubsubsecentry{#2.#3.#4.#5\\labelspace#1}{#6}}/
+spacer c-src/emacs/src/lisp.h 1975
+spacer c-src/emacs/src/lisp.h 1982
+spacer c-src/emacs/src/lisp.h 2036
+spacer c-src/emacs/src/lisp.h 2205
+specbind_tag c-src/emacs/src/lisp.h 2943
+specbinding c-src/emacs/src/lisp.h 2955
+specialsymbol prol-src/natded.prolog /^specialsymbol(C1,C2,S):-$/
+splitexp prol-src/natded.prolog /^splitexp(E,E,('NIL','NIL')):-!.$/
+srclist make-src/Makefile /^srclist: Makefile$/
+ss3 c.c 255
+sss1 c.c 252
+sss2 c.c 253
+sstab prol-src/natded.prolog /^sstab(2,'C',',').$/
+st_C_attribute c-src/etags.c 2209
+st_C_class c-src/etags.c 2212
+st_C_define c-src/etags.c 2213
+st_C_enum c-src/etags.c 2213
+st_C_extern c-src/etags.c 2213
+st_C_gnumacro c-src/etags.c 2208
+st_C_ignore c-src/etags.c 2209
+st_C_javastruct c-src/etags.c 2210
+st_C_objend c-src/etags.c 2207
+st_C_objimpl c-src/etags.c 2207
+st_C_objprot c-src/etags.c 2207
+st_C_operator c-src/etags.c 2211
+st_C_struct c-src/etags.c 2213
+st_C_template c-src/etags.c 2212
+st_C_typedef c-src/etags.c 2213
+st_none c-src/etags.c 2206
+stack c.c 155
+stagseen c-src/etags.c 2446
+standalone make-src/Makefile /^standalone:$/
+start c-src/emacs/src/keyboard.c 8753
+start c-src/emacs/src/lisp.h 2038
+start c-src/emacs/src/regex.h 431
+start php-src/lce_functions.php /^ function start($line, $class)$/
+start y-src/cccp.y 143
+start_polling c-src/emacs/src/keyboard.c /^start_polling (void)$/
+start_up prol-src/natded.prolog /^start_up:-$/
+state_protected_p c-src/emacs/src/gmalloc.c 400
+statetable html-src/algrthms.html /^Next$/
+staticetags make-src/Makefile /^staticetags:$/
+step cp-src/clheir.hpp /^ virtual void step(void) { }$/
+step cp-src/conway.hpp /^ void step(void) { alive = next_alive; }$/
+step_everybody cp-src/clheir.cpp /^void step_everybody(void)$/
+stop_polling c-src/emacs/src/keyboard.c /^stop_polling (void)$/
+store_info merc-src/accumulator.m /^:- type store_info$/
+store_user_signal_events c-src/emacs/src/keyboard.c /^store_user_signal_events (void)$/
+stored_goal_plain_call merc-src/accumulator.m /^:- inst stored_goal_plain_call for goal_store.stor/
+str go-src/test1.go 9
+strcaseeq c-src/etags.c /^#define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=/
+streq c-src/etags.c /^#define streq(s,t) (assert ((s)!=NULL || (t)!=NULL/
+string merc-src/accumulator.m /^:- import_module string.$/
+string_intervals c-src/emacs/src/lisp.h /^string_intervals (Lisp_Object s)$/
+stripLine php-src/lce_functions.php /^ function stripLine($line, $class)$/
+stripname pas-src/common.pas /^function stripname; (* ($/
+strncaseeq c-src/etags.c /^#define strncaseeq(s,t,n) (assert ((s)!=NULL && (t/
+strneq c-src/etags.c /^#define strneq(s,t,n) (assert ((s)!=NULL || (t)!=N/
+structdef c-src/etags.c 2448
+stuff_buffered_input c-src/emacs/src/keyboard.c /^stuff_buffered_input (Lisp_Object stuffstring)$/
+subprocess objc-src/PackInsp.m /^-subprocess:(Subprocess *)sender output:(char *)bu/
+subprocessDone objc-src/PackInsp.m /^-subprocessDone:(Subprocess *)sender$/
+subsec=\relax tex-src/texinfo.tex /^\\let\\appendixsubsec=\\relax$/
+subsection perl-src/htlmify-cystic 26
+subsection=\relax tex-src/texinfo.tex /^\\let\\appendixsubsection=\\relax$/
+subsection_marker perl-src/htlmify-cystic 161
+subst prol-src/natded.prolog /^subst(var(Y),var(X),M,N):-$/
+substitute c-src/etags.c /^substitute (char *in, char *out, struct re_registe/
+subsubsec=\relax tex-src/texinfo.tex /^\\let\\appendixsubsubsec=\\relax$/
+subsubsection perl-src/htlmify-cystic 27
+subsubsection=\relax tex-src/texinfo.tex /^\\let\\appendixsubsubsection=\\relax$/
+subtle ruby-src/test1.ru /^ :tee ; attr_reader :subtle$/
+subtree prol-src/natded.prolog /^subtree(T,T).$/
+suffix c-src/etags.c 186
+suffixes c-src/etags.c 195
+suggest_asking_for_help c-src/etags.c /^suggest_asking_for_help (void)$/
+suspend-emacs c-src/emacs/src/keyboard.c /^DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_e/
+sval y-src/cccp.y 116
+swallow_events c-src/emacs/src/keyboard.c /^swallow_events (bool do_display)$/
+switch_line_buffers c-src/etags.c /^#define switch_line_buffers() (curndx = 1 - curndx/
+sxhash_combine c-src/emacs/src/lisp.h /^sxhash_combine (EMACS_UINT x, EMACS_UINT y)$/
+sym_type c-src/etags.c 2204
+symbol c-src/emacs/src/lisp.h 2980
+symbol_interned c-src/emacs/src/lisp.h 639
+symbol_name c-src/emacs/src/lisp.h 1687
+symbol_redirect c-src/emacs/src/lisp.h 646
+syms_of_abbrev c-src/abbrev.c /^syms_of_abbrev ()$/
+syms_of_keyboard c-src/emacs/src/keyboard.c /^syms_of_keyboard (void)$/
+synchronize_system_messages_locale c-src/emacs/src/lisp.h /^INLINE void synchronize_system_messages_locale (vo/
+synchronize_system_time_locale c-src/emacs/src/lisp.h /^INLINE void synchronize_system_time_locale (void) /
+syntax c-src/emacs/src/regex.h 350
+sys_jmp_buf c-src/emacs/src/lisp.h 2906
+sys_jmp_buf c-src/emacs/src/lisp.h 2910
+sys_jmp_buf c-src/emacs/src/lisp.h 2916
+sys_longjmp c-src/emacs/src/lisp.h /^# define sys_longjmp(j, v) _longjmp (j, v)$/
+sys_longjmp c-src/emacs/src/lisp.h /^# define sys_longjmp(j, v) longjmp (j, v)$/
+sys_longjmp c-src/emacs/src/lisp.h /^# define sys_longjmp(j, v) siglongjmp (j, v)$/
+sys_setjmp c-src/emacs/src/lisp.h /^# define sys_setjmp(j) _setjmp (j)$/
+sys_setjmp c-src/emacs/src/lisp.h /^# define sys_setjmp(j) setjmp (j)$/
+sys_setjmp c-src/emacs/src/lisp.h /^# define sys_setjmp(j) sigsetjmp (j, 0)$/
+syscall_error c-src/sysdep.h 34
+t cp-src/c.C 52
+t1 cp-src/c.C 34
+t2 cp-src/c.C 38
+tab_count_words c-src/tab.c /^int tab_count_words(char **tab)$/
+tab_delete_first c-src/tab.c /^int tab_delete_first(char **tab)$/
+tab_fill c-src/tab.c /^char **tab_fill(char *str, char delim)$/
+tab_free c-src/tab.c /^void tab_free(char **tab)$/
+tag-any-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-any-match-p (_tag)$/
+tag-exact-file-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-exact-file-name-match-p (tag)$/
+tag-exact-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-exact-match-p (tag)$/
+tag-file-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-file-name-match-p (tag)$/
+tag-find-file-of-tag el-src/emacs/lisp/progmodes/etags.el /^(defun tag-find-file-of-tag (file) ; Doc string?$/
+tag-find-file-of-tag-noselect el-src/emacs/lisp/progmodes/etags.el /^(defun tag-find-file-of-tag-noselect (file)$/
+tag-implicit-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-implicit-name-match-p (tag)$/
+tag-lines-already-matched el-src/emacs/lisp/progmodes/etags.el /^(defvar tag-lines-already-matched nil$/
+tag-partial-file-name-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-partial-file-name-match-p (_tag)$/
+tag-re-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-re-match-p (re)$/
+tag-symbol-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-symbol-match-p (tag)$/
+tag-word-match-p el-src/emacs/lisp/progmodes/etags.el /^(defun tag-word-match-p (tag)$/
+tag1 c-src/dostorture.c /^(*tag1 (sig, handler)) ()$/
+tag1 c-src/h.h 110
+tag1 c-src/torture.c /^(*tag1 (sig, handler)) ()$/
+tag2 c-src/dostorture.c /^(*tag2 (sig, handler)) ()$/
+tag2 c-src/torture.c /^(*tag2 (sig, handler)) ()$/
+tag3 c-src/dostorture.c /^(*tag3 (int sig, void (*handler) (int))) (int)$/
+tag3 c-src/torture.c /^(*tag3 (int sig, void (*handler) (int))) (int)$/
+tag4 c-src/dostorture.c /^(*tag4 (int sig, void (*handler) (int))) (int)$/
+tag4 c-src/torture.c /^(*tag4 (int sig, void (*handler) (int))) (int)$/
+tag5 c-src/dostorture.c /^tag5 (handler, arg)$/
+tag5 c-src/torture.c /^tag5 (handler, arg)$/
+tag6 c-src/dostorture.c /^tag6 (void (*handler) (void *), void *arg)$/
+tag6 c-src/torture.c /^tag6 (void (*handler) (void *), void *arg)$/
+tag_or_ch c-src/emacs/src/lisp.h 3026
+taggedfname c-src/etags.c 207
+tags make-src/Makefile /^tags: TAGS$/
+tags-add-tables el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-add-tables 'ask-user$/
+tags-apropos el-src/emacs/lisp/progmodes/etags.el /^(defun tags-apropos (regexp)$/
+tags-apropos-additional-actions el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-apropos-additional-actions nil$/
+tags-apropos-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-apropos-function nil$/
+tags-apropos-verbose el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-apropos-verbose nil$/
+tags-case-fold-search el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-case-fold-search 'default$/
+tags-complete-tags-table-file el-src/emacs/lisp/progmodes/etags.el /^(defun tags-complete-tags-table-file (string predi/
+tags-completion-at-point-function el-src/emacs/lisp/progmodes/etags.el /^(defun tags-completion-at-point-function ()$/
+tags-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-completion-table ()$/
+tags-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-completion-table nil$/
+tags-completion-table-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-completion-table-function nil$/
+tags-compression-info-list el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-compression-info-list$/
+tags-expand-table-name el-src/emacs/lisp/progmodes/etags.el /^(defun tags-expand-table-name (file)$/
+tags-file-name el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-file-name nil$/
+tags-included-tables el-src/emacs/lisp/progmodes/etags.el /^(defun tags-included-tables ()$/
+tags-included-tables el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-included-tables nil$/
+tags-included-tables-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-included-tables-function nil$/
+tags-lazy-completion-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-lazy-completion-table ()$/
+tags-location-ring el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-location-ring (make-ring xref-marker-/
+tags-loop-continue el-src/emacs/lisp/progmodes/etags.el /^(defun tags-loop-continue (&optional first-time)$/
+tags-loop-eval el-src/emacs/lisp/progmodes/etags.el /^(defun tags-loop-eval (form)$/
+tags-loop-operate el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-loop-operate nil$/
+tags-loop-revert-buffers el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-loop-revert-buffers nil$/
+tags-loop-scan el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-loop-scan$/
+tags-next-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-next-table ()$/
+tags-query-replace el-src/emacs/lisp/progmodes/etags.el /^(defun tags-query-replace (from to &optional delim/
+tags-recognize-empty-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-recognize-empty-tags-table ()$/
+tags-reset-tags-tables el-src/emacs/lisp/progmodes/etags.el /^(defun tags-reset-tags-tables ()$/
+tags-revert-without-query el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-revert-without-query nil$/
+tags-search el-src/emacs/lisp/progmodes/etags.el /^(defun tags-search (regexp &optional file-list-for/
+tags-select-tags-table el-src/emacs/lisp/progmodes/etags.el /^(define-button-type 'tags-select-tags-table$/
+tags-table-check-computed-list el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-check-computed-list ()$/
+tags-table-computed-list el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-computed-list nil$/
+tags-table-computed-list-for el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-computed-list-for nil$/
+tags-table-extend-computed-list el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-extend-computed-list ()$/
+tags-table-files el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-files ()$/
+tags-table-files el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-files nil$/
+tags-table-files-function el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-files-function nil$/
+tags-table-format-functions el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-format-functions '(etags-recogn/
+tags-table-including el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-including (this-file core-only)$/
+tags-table-list el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-table-list nil$/
+tags-table-list-member el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-list-member (file list)$/
+tags-table-list-pointer el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-list-pointer nil$/
+tags-table-list-started-at el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-list-started-at nil$/
+tags-table-mode el-src/emacs/lisp/progmodes/etags.el /^(defun tags-table-mode ()$/
+tags-table-set-list el-src/emacs/lisp/progmodes/etags.el /^(defvar tags-table-set-list nil$/
+tags-tag-face el-src/emacs/lisp/progmodes/etags.el /^(defcustom tags-tag-face 'default$/
+tags-verify-table el-src/emacs/lisp/progmodes/etags.el /^(defun tags-verify-table (file)$/
+tags-with-face el-src/emacs/lisp/progmodes/etags.el /^(defmacro tags-with-face (face &rest body)$/
+target_multibyte c-src/emacs/src/regex.h 407
+tcpdump html-src/software.html /^tcpdump$/
+teats cp-src/c.C 127
+tee ruby-src/test1.ru /^ attr_accessor :tee$/
+tee= ruby-src/test1.ru /^ attr_accessor :tee$/
+temporarily_switch_to_single_kboard c-src/emacs/src/keyboard.c /^temporarily_switch_to_single_kboard (struct frame /
+tend c-src/etags.c 2432
+term merc-src/accumulator.m /^:- import_module term.$/
+terminate objc-src/Subprocess.m /^- terminate:sender$/
+terminateInput objc-src/Subprocess.m /^- terminateInput$/
+test c-src/emacs/src/lisp.h 1871
+test cp-src/c.C 86
+test erl-src/gs_dialog.erl /^test() ->$/
+test go-src/test1.go /^func test(p plus) {$/
+test make-src/Makefile /^test:$/
+test php-src/ptest.php /^test $/
+test-begin scm-src/test.scm /^(define-syntax test-begin$/
+test.me22b lua-src/test.lua /^ local function test.me22b (one)$/
+test.me_22a lua-src/test.lua /^ function test.me_22a(one, two)$/
+test1 rs-src/test.rs /^fn test1() {$/
+test_undefined c-src/emacs/src/keyboard.c /^test_undefined (Lisp_Object binding)$/
+texttreelist prol-src/natded.prolog /^texttreelist([]).$/
+there-is-a-=-in-the-middle! scm-src/test.scm /^(define (there-is-a-=-in-the-middle!) #t)$/
+this c-src/a/b/b.c 1
+this-command-keys c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys", Fthis_command_keys, St/
+this-command-keys-vector c-src/emacs/src/keyboard.c /^DEFUN ("this-command-keys-vector", Fthis_command_k/
+this-single-command-keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-keys", Fthis_single_co/
+this-single-command-raw-keys c-src/emacs/src/keyboard.c /^DEFUN ("this-single-command-raw-keys", Fthis_singl/
+this_command_key_count c-src/emacs/src/keyboard.c 108
+this_command_key_count_reset c-src/emacs/src/keyboard.c 112
+this_command_keys c-src/emacs/src/keyboard.c 107
+this_file_toc perl-src/htlmify-cystic 29
+this_single_command_key_start c-src/emacs/src/keyboard.c 125
+tignore c-src/etags.c 2433
+timer_check c-src/emacs/src/keyboard.c /^timer_check (void)$/
+timer_check_2 c-src/emacs/src/keyboard.c /^timer_check_2 (Lisp_Object timers, Lisp_Object idl/
+timer_idleness_start_time c-src/emacs/src/keyboard.c 335
+timer_last_idleness_start_time c-src/emacs/src/keyboard.c 340
+timer_resume_idle c-src/emacs/src/keyboard.c /^timer_resume_idle (void)$/
+timer_start_idle c-src/emacs/src/keyboard.c /^timer_start_idle (void)$/
+timer_stop_idle c-src/emacs/src/keyboard.c /^timer_stop_idle (void)$/
+timers_run c-src/emacs/src/keyboard.c 320
+tinbody c-src/etags.c 2431
+tkeyseen c-src/etags.c 2429
+tnone c-src/etags.c 2428
+toc_line perl-src/htlmify-cystic /^sub toc_line ($)$/
+toggleDescription objc-src/PackInsp.m /^-toggleDescription$/
+tok c-src/etags.c 2491
+token c-src/etags.c 2508
+token y-src/cccp.y 437
+token y-src/cccp.y 439
+tokenize prol-src/natded.prolog /^tokenize([C1,C2,C3|Cs],Xs-Ys,TsResult):- % spe/
+tokenizeatom prol-src/natded.prolog /^tokenizeatom(Atom,Ws):-$/
+tokentab2 y-src/cccp.y 442
+tool_bar_item_properties c-src/emacs/src/keyboard.c 7970
+tool_bar_items c-src/emacs/src/keyboard.c /^tool_bar_items (Lisp_Object reuse, int *nitems)$/
+tool_bar_items_vector c-src/emacs/src/keyboard.c 7965
+toolkit_menubar_in_use c-src/emacs/src/keyboard.c /^toolkit_menubar_in_use (struct frame *f)$/
+top-level c-src/emacs/src/keyboard.c /^DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, /
+top_level merc-src/accumulator.m /^:- type top_level$/
+top_level_1 c-src/emacs/src/keyboard.c /^top_level_1 (Lisp_Object ignore)$/
+top_level_2 c-src/emacs/src/keyboard.c /^top_level_2 (void)$/
+total_keys c-src/emacs/src/keyboard.c 97
+total_size_of_entries c-src/etags.c /^total_size_of_entries (register node *np)$/
+total_surrounding cp-src/conway.cpp /^int site::total_surrounding(void)$/
+totally_unblock_input c-src/emacs/src/keyboard.c /^totally_unblock_input (void)$/
+tpcmd c-src/h.h 15
+tpcmd c-src/h.h 8
+track-mouse c-src/emacs/src/keyboard.c /^DEFUN ("internal--track-mouse", Ftrack_mouse, Stra/
+tracking_off c-src/emacs/src/keyboard.c /^tracking_off (Lisp_Object old_value)$/
+traffic_light cp-src/conway.cpp /^void traffic_light(int x, int y)$/
+translate c-src/emacs/src/regex.h 361
+treats cp-src/c.C 131
+tt prol-src/natded.prolog /^tt:-$/
+tt=cmtt10 tex-src/texinfo.tex /^\\font\\deftt=cmtt10 scaled \\magstep1$/
+tty_read_avail_input c-src/emacs/src/keyboard.c /^tty_read_avail_input (struct terminal *terminal,$/
+ttypeseen c-src/etags.c 2430
+typdef c-src/etags.c 2434
+type c-src/emacs/src/gmalloc.c 145
+type c-src/emacs/src/lisp.h 1973
+type c-src/emacs/src/lisp.h 1980
+type c-src/emacs/src/lisp.h 2034
+type c-src/emacs/src/lisp.h 2112
+type c-src/emacs/src/lisp.h 2203
+type c-src/emacs/src/lisp.h 2276
+type c-src/emacs/src/lisp.h 2286
+type c-src/emacs/src/lisp.h 2296
+type c-src/emacs/src/lisp.h 2304
+type c-src/emacs/src/lisp.h 2364
+type c-src/emacs/src/lisp.h 3025
+type c-src/etags.c 2271
+typefunargs tex-src/texinfo.tex /^\\deftypefunargs {#3}\\endgroup %$/
+typefunargs tex-src/texinfo.tex /^\\deftypefunargs {#4}\\endgroup %$/
+typemargin tex-src/texinfo.tex /^\\newskip\\deftypemargin \\deftypemargin=12pt$/
+typemargin tex-src/texinfo.tex /^\\rlap{\\rightline{{\\rm #2}\\hskip \\deftypemargin}}}%/
+u c-src/emacs/src/lisp.h 2397
+u_any c-src/emacs/src/lisp.h 2214
+u_boolfwd c-src/emacs/src/lisp.h 2371
+u_buffer_objfwd c-src/emacs/src/lisp.h 2373
+u_finalizer c-src/emacs/src/lisp.h 2219
+u_free c-src/emacs/src/lisp.h 2215
+u_intfwd c-src/emacs/src/lisp.h 2370
+u_kboard_objfwd c-src/emacs/src/lisp.h 2374
+u_marker c-src/emacs/src/lisp.h 2216
+u_objfwd c-src/emacs/src/lisp.h 2372
+u_overlay c-src/emacs/src/lisp.h 2217
+u_save_value c-src/emacs/src/lisp.h 2218
+unargs tex-src/texinfo.tex /^\\defunargs {#2}\\endgroup %$/
+unargs tex-src/texinfo.tex /^\\defunargs {#3}\\endgroup %$/
+unblock_input c-src/emacs/src/keyboard.c /^unblock_input (void)$/
+unblock_input_to c-src/emacs/src/keyboard.c /^unblock_input_to (int level)$/
+unchar c-src/h.h 99
+unexpand-abbrev c-src/abbrev.c /^DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexp/
+univ merc-src/accumulator.m /^:- import_module univ.$/
+unravel_univ merc-src/accumulator.m /^:- some [T] pred unravel_univ(univ::in, T::out) is/
+unread_switch_frame c-src/emacs/src/keyboard.c 204
+unsignedp y-src/cccp.y 112
+unwind c-src/emacs/src/lisp.h 2962
+unwind_int c-src/emacs/src/lisp.h 2972
+unwind_ptr c-src/emacs/src/lisp.h 2967
+unwind_void c-src/emacs/src/lisp.h 2976
+update_accumulator_pred merc-src/accumulator.m /^:- pred update_accumulator_pred(pred_id::in, proc_/
+uprintmax_t c-src/emacs/src/lisp.h 149
+uprintmax_t c-src/emacs/src/lisp.h 154
+usage perl-src/yagrip.pl /^sub usage {$/
+usecharno c-src/etags.c 210
+used c-src/emacs/src/regex.h 347
+used_syntax c-src/emacs/src/regex.h 398
+user_cmp_function c-src/emacs/src/lisp.h 1814
+user_error c-src/emacs/src/keyboard.c /^user_error (const char *msg)$/
+user_hash_function c-src/emacs/src/lisp.h 1811
+user_signal_info c-src/emacs/src/keyboard.c 7235
+user_signals c-src/emacs/src/keyboard.c 7250
+usfreelock_ptr/t ada-src/etags-test-for.ada /^ type usfreelock_ptr is access$/
+val c-src/emacs/src/lisp.h 3027
+val c-src/emacs/src/lisp.h 691
+val c-src/getopt.h 84
+val prol-src/natded.prolog /^val(X) --> ['['], valseq(X), [']'].$/
+valcell c-src/emacs/src/lisp.h 2357
+valid c-src/etags.c 220
+valid c-src/etags.c 2502
+validate php-src/lce_functions.php /^ function validate($value)$/
+valloc c-src/emacs/src/gmalloc.c /^valloc (size_t size)$/
+valseq prol-src/natded.prolog /^valseq([Val|Vals]) --> val(Val), plusvalseq(Vals)./
+value c-src/emacs/src/lisp.h 687
+value y-src/cccp.y 112
+var c-src/emacs/src/keyboard.c 11023
+var c-src/emacs/src/lisp.h 3137
+varargs tex-src/texinfo.tex /^\\defvarargs {#2}\\endgroup %$/
+varargs tex-src/texinfo.tex /^\\defvarargs {#3}\\endgroup %$/
+varset merc-src/accumulator.m /^:- import_module varset.$/
+vcopy c-src/emacs/src/lisp.h /^vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Objec/
+vectorlike_header c-src/emacs/src/lisp.h 1343
+verde cp-src/c.C 40
+verify-tags-table-function el-src/emacs/lisp/progmodes/etags.el /^(defvar verify-tags-table-function nil$/
+verify_ascii c-src/emacs/src/lisp.h /^# define verify_ascii(str) (str)$/
+vignore c-src/etags.c 2417
+visit-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun visit-tags-table (file &optional local)$/
+visit-tags-table-buffer el-src/emacs/lisp/progmodes/etags.el /^(defun visit-tags-table-buffer (&optional cont)$/
+void c-src/emacs/src/lisp.h /^INLINE void (check_cons_list) (void) { lisp_h_chec/
+voidfuncptr c-src/emacs/src/lisp.h 2108
+voidval y-src/cccp.y 115
+wait_status_ptr_t c.c 161
+waiting_for_input c-src/emacs/src/keyboard.c 150
+warning y-src/cccp.y /^warning (msg)$/
+weak c-src/emacs/src/lisp.h 1830
+weak_alias c-src/emacs/src/gmalloc.c /^weak_alias (free, cfree)$/
+web ftp publish make-src/Makefile /^web ftp publish:$/
+what c-src/etags.c 252
+wheel_syms c-src/emacs/src/keyboard.c 4628
+where c-src/emacs/src/lisp.h 2348
+where c-src/emacs/src/lisp.h 2980
+where cp-src/clheir.hpp 77
+where_in_registry cp-src/clheir.hpp 15
+windowWillClose objcpp-src/SimpleCalc.M /^- windowWillClose:sender$/
+wipe_kboard c-src/emacs/src/keyboard.c /^wipe_kboard (KBOARD *kb)$/
+womboid c-src/h.h 63
+womboid c-src/h.h 75
+word_size c-src/emacs/src/lisp.h 1473
+write php-src/lce_functions.php /^ function write($save="yes")$/
+write php-src/lce_functions.php /^ function write()$/
+write1= ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+write2= ruby-src/test1.ru /^ attr_reader :read1 , :read2; attr_writer :writ/
+write_abbrev c-src/abbrev.c /^write_abbrev (sym, stream)$/
+write_classname c-src/etags.c /^write_classname (linebuffer *cn, const char *quali/
+write_lex prol-src/natded.prolog /^write_lex(File):-$/
+write_lex_cat prol-src/natded.prolog /^write_lex_cat(File):-$/
+write_xyc cp-src/screen.cpp /^void write_xyc(int x, int y, char c)$/
+writebreak prol-src/natded.prolog /^writebreak([]).$/
+writebreaklex prol-src/natded.prolog /^writebreaklex([]).$/
+writecat prol-src/natded.prolog /^writecat(np(ind(sng),nm(_)),np,[],[]):-!.$/
+writelist prol-src/natded.prolog /^writelist([der(Ws)|Ws2]):-$/
+writelistsubs prol-src/natded.prolog /^writelistsubs([],X):-$/
+writenamestring pas-src/common.pas /^procedure writenamestring;(*($/
+writesubs prol-src/natded.prolog /^writesubs([]).$/
+writesups prol-src/natded.prolog /^writesups([]).$/
+written c-src/etags.c 211
+x c.c 153
+x c.c 179
+x c.c 188
+x c.c 189
+x cp-src/c.C 53
+x cp-src/c.C 80
+x cp-src/clheir.hpp 49
+x cp-src/clheir.hpp 58
+x cp-src/conway.hpp 7
+x cp-src/fail.C 10
+x cp-src/fail.C 44
+x tex-src/texinfo.tex /^\\refx{#1-snt}{} [\\printednodename], page\\tie\\refx{/
+x-get-selection-internal c.c /^ Fx_get_selection_internal, Sx_get_selection/
+x-get-selection-internal c.c /^DEFUN ("x-get-selection-internal", Fx_get_selectio/
+xcar_addr c-src/emacs/src/lisp.h /^xcar_addr (Lisp_Object c)$/
+xcdr_addr c-src/emacs/src/lisp.h /^xcdr_addr (Lisp_Object c)$/
+xdiff make-src/Makefile /^xdiff: ETAGS EXTAGS ${infiles}$/
+xmalloc c-src/etags.c /^xmalloc (size_t size)$/
+xnew c-src/etags.c /^#define xnew(n, Type) ((Type *) xmalloc ((n) /
+xrealloc c-src/etags.c /^xrealloc (void *ptr, size_t size)$/
+xref-etags-location el-src/emacs/lisp/progmodes/etags.el /^(defclass xref-etags-location (xref-location)$/
+xref-location-line el-src/emacs/lisp/progmodes/etags.el /^(cl-defmethod xref-location-line ((l xref-etags-lo/
+xref-location-marker el-src/emacs/lisp/progmodes/etags.el /^(cl-defmethod xref-location-marker ((l xref-etags-/
+xref-make-etags-location el-src/emacs/lisp/progmodes/etags.el /^(defun xref-make-etags-location (tag-info file)$/
+xrnew c-src/etags.c /^#define xrnew(op, n, Type) ((op) = (Type *) xreall/
+xx make-src/Makefile /^xx="this line is here because of a fontlock bug$/
+xyz ruby-src/test1.ru /^ alias_method :xyz,$/
+y cp-src/clheir.hpp 49
+y cp-src/clheir.hpp 58
+y cp-src/conway.hpp 7
+y-get-selection-internal c.c /^ Fy_get_selection_internal, Sy_get_selection_/
+yyalloc /usr/share/bison/bison.simple 83
+yyalloc /usr/share/bison/bison.simple 84
+yyclearin /usr/share/bison/bison.simple 149
+yyclearin /usr/share/bison/bison.simple 150
+yydebug /usr/share/bison/bison.simple 237
+yydebug /usr/share/bison/bison.simple 238
+yyerrhandle /usr/share/bison/bison.simple 848
+yyerrlab1 /usr/share/bison/bison.simple 823
+yyerrok /usr/share/bison/bison.simple 148
+yyerrok /usr/share/bison/bison.simple 149
+yyerror y-src/cccp.y /^yyerror (s)$/
+yyerrstatus /usr/share/bison/bison.simple 846
+yylex y-src/cccp.y /^yylex ()$/
+yyls /usr/share/bison/bison.simple 88
+yyls /usr/share/bison/bison.simple 89
+yylsp /usr/share/bison/bison.simple 748
+yylsp /usr/share/bison/bison.simple 921
+yymemcpy /usr/share/bison/bison.simple /^yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T/
+yymemcpy /usr/share/bison/bison.simple 264
+yymemcpy /usr/share/bison/bison.simple 265
+yyn /usr/share/bison/bison.simple 755
+yyn /usr/share/bison/bison.simple 861
+yyn /usr/share/bison/bison.simple 895
+yyn /usr/share/bison/bison.simple 903
+yynewstate /usr/share/bison/bison.simple 763
+yynewstate /usr/share/bison/bison.simple 925
+yyparse /usr/share/bison/bison.simple /^yyparse (YYPARSE_PARAM_ARG)$/
+yyresult /usr/share/bison/bison.simple 932
+yyresult /usr/share/bison/bison.simple 939
+yyresult /usr/share/bison/bison.simple 947
+yyreturn /usr/share/bison/bison.simple 933
+yyreturn /usr/share/bison/bison.simple 940
+yyss /usr/share/bison/bison.simple 85
+yyss /usr/share/bison/bison.simple 86
+yystate /usr/share/bison/bison.simple 757
+yystate /usr/share/bison/bison.simple 761
+yystate /usr/share/bison/bison.simple 875
+yystate /usr/share/bison/bison.simple 924
+yystpcpy /usr/share/bison/bison.simple /^yystpcpy (char *yydest, const char *yysrc)$/
+yystpcpy /usr/share/bison/bison.simple 316
+yystpcpy /usr/share/bison/bison.simple 317
+yystrlen /usr/share/bison/bison.simple /^yystrlen (const char *yystr)$/
+yystrlen /usr/share/bison/bison.simple 293
+yystrlen /usr/share/bison/bison.simple 294
+yyvs /usr/share/bison/bison.simple 86
+yyvs /usr/share/bison/bison.simple 87
+yyvsp /usr/share/bison/bison.simple 746
+yyvsp /usr/share/bison/bison.simple 919
+z c.c 144
+z c.c 164
+z cp-src/clheir.hpp 49
+z cp-src/clheir.hpp 58
+| tex-src/texinfo.tex /^\\def|{{\\tt \\char '174}}$/
+~ tex-src/texinfo.tex /^\\def~{{\\tt \\char '176}}$/
+~A cp-src/c.C /^A::~A() {}$/
+~B cp-src/c.C /^ ~B() {};$/
+~MDiagArray2 cp-src/MDiagArray2.h /^ ~MDiagArray2 (void) { }$/
+~generic_object cp-src/clheir.cpp /^generic_object::~generic_object(void)$/
diff --git a/test/manual/etags/Makefile b/test/manual/etags/Makefile
index b3a82fdba8d..81b5c3ca721 100644
--- a/test/manual/etags/Makefile
+++ b/test/manual/etags/Makefile
@@ -60,6 +60,7 @@ check:
@$(MAKE) OPTIONS='nonexistent --members --declarations --regex=@regexfile' ediff_5
@$(MAKE) OPTIONS='--class-qualify --members --declarations --regex=@regexfile' ediff_6
@$(MAKE) cdiff
+ @$(MAKE) ctags_update
ediff%: ETAGS.good% ETAGS ${infiles}
diff -u --suppress-common-lines --width=80 ETAGS.good$* ETAGS
@@ -67,6 +68,20 @@ ediff%: ETAGS.good% ETAGS ${infiles}
cdiff: CTAGS.good CTAGS ${infiles}
diff -u --suppress-common-lines --width=80 CTAGS.good CTAGS
+ctags_update: CTAGS.good_update ${infiles}
+ head -n 100 CTAGS.good_update > CTAGS
+ tail -n 100 CTAGS.good_update >> CTAGS
+ ${RUN} ${CTAGS_PROG} -o CTAGS -u ${ARGS}
+ sort CTAGS > CTAGS.sorted
+ sort CTAGS.good_update > CTAGS.good_update.sorted
+ diff -u --suppress-common-lines --width=80 CTAGS.good_update.sorted CTAGS.sorted
+
+ cp crlf CTAGS
+ ${RUN} ${CTAGS_PROG} -o CTAGS -u ${ARGS}
+ sort CTAGS > CTAGS.sorted
+ sort CTAGS.good_crlf > CTAGS.good_crlf.sorted
+ diff -u --suppress-common-lines --width=80 CTAGS.good_crlf.sorted CTAGS.sorted
+
ETAGS: ${infiles}
${RUN} ${ETAGS_PROG} ${OPTIONS} -o $@ ${ARGS}
diff --git a/test/manual/etags/crlf b/test/manual/etags/crlf
new file mode 100644
index 00000000000..d677595f010
--- /dev/null
+++ b/test/manual/etags/crlf
@@ -0,0 +1,2 @@
+test_crlf1 test_crlf.c /^void test_crlf1()$/
+test_crlf2 tset_crlf.c /^void test_crlf2()$/