diff options
author | Rasmus <rasmus@gmx.us> | 2018-03-27 23:34:41 +0200 |
---|---|---|
committer | Rasmus <rasmus@gmx.us> | 2018-03-27 23:34:41 +0200 |
commit | 613c9a5c1f3237fbdc3a3db2341c7c59353d2aa2 (patch) | |
tree | 7651699ebeb2a2a2d8d1081707d091fbc424e8fb /lisp/org | |
parent | 1b075a9e38ca6812417f95ed2272e61d875d9e86 (diff) | |
download | emacs-613c9a5c1f3237fbdc3a3db2341c7c59353d2aa2.tar.gz |
Update Org to v9.1.9
Please note this is a bugfix release. See etc/ORG-NEWS for details.
Diffstat (limited to 'lisp/org')
102 files changed, 589 insertions, 567 deletions
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el index 092354e9ca6..ff5be349676 100644 --- a/lisp/org/ob-C.el +++ b/lisp/org/ob-C.el @@ -5,7 +5,7 @@ ;; Author: Eric Schulte ;; Thierry Banel ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-J.el b/lisp/org/ob-J.el index 4aec293afca..87812213eee 100644 --- a/lisp/org/ob-J.el +++ b/lisp/org/ob-J.el @@ -4,7 +4,7 @@ ;; Author: Oleh Krehel ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el index 84bb89f6e00..d7e936eba0d 100644 --- a/lisp/org/ob-R.el +++ b/lisp/org/ob-R.el @@ -5,7 +5,7 @@ ;; Author: Eric Schulte ;; Dan Davison ;; Keywords: literate programming, reproducible research, R, statistics -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-asymptote.el b/lisp/org/ob-asymptote.el index 211eab7f29b..84e23648094 100644 --- a/lisp/org/ob-asymptote.el +++ b/lisp/org/ob-asymptote.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el index 474111f2637..1ee4552eb0f 100644 --- a/lisp/org/ob-awk.el +++ b/lisp/org/ob-awk.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el index 4ed5dd4be05..387cba210a9 100644 --- a/lisp/org/ob-calc.el +++ b/lisp/org/ob-calc.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el index 852fe08b934..890f60ada8a 100644 --- a/lisp/org/ob-clojure.el +++ b/lisp/org/ob-clojure.el @@ -5,7 +5,7 @@ ;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson ;; ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el index 32449753a62..e9c6f937b14 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-coq.el b/lisp/org/ob-coq.el index a52044e8ae0..875c794b19a 100644 --- a/lisp/org/ob-coq.el +++ b/lisp/org/ob-coq.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index 0e2e78a6710..5d5faaa6fd0 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. @@ -980,13 +980,24 @@ with a prefix argument then this is passed on to (defmacro org-babel-do-in-edit-buffer (&rest body) "Evaluate BODY in edit buffer if there is a code block at point. Return t if a code block was found at point, nil otherwise." - `(let ((org-src-window-setup 'switch-invisibly)) - (when (and (org-babel-where-is-src-block-head) + (declare (debug (body))) + `(let* ((element (org-element-at-point)) + ;; This function is not supposed to move point. However, + ;; `org-edit-src-code' always moves point back into the + ;; source block. It is problematic if the point was before + ;; the code, e.g., on block's opening line. In this case, + ;; we want to restore this location after executing BODY. + (outside-position + (and (<= (line-beginning-position) + (org-element-property :post-affiliated element)) + (point-marker))) + (org-src-window-setup 'switch-invisibly)) + (when (and (org-babel-where-is-src-block-head element) (org-edit-src-code)) (unwind-protect (progn ,@body) - (org-edit-src-exit)) + (org-edit-src-exit) + (when outside-position (goto-char outside-position))) t))) -(def-edebug-spec org-babel-do-in-edit-buffer (body)) (defun org-babel-do-key-sequence-in-edit-buffer (key) "Read key sequence and execute the command in edit buffer. diff --git a/lisp/org/ob-css.el b/lisp/org/ob-css.el index 8c0b8d75a0a..8cabf2bc789 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el index 82cc89d0221..9507630ba29 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el index e72dd3cada5..31e0a4f325e 100644 --- a/lisp/org/ob-dot.el +++ b/lisp/org/ob-dot.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-ebnf.el b/lisp/org/ob-ebnf.el index 4e96b211760..8c7c5415e6c 100644 --- a/lisp/org/ob-ebnf.el +++ b/lisp/org/ob-ebnf.el @@ -4,7 +4,7 @@ ;; Author: Michael Gauland ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; Version: 1.00 ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el index 2dc350629dd..8ea2ec127a6 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el index 44972f95636..2bfaa08a609 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index d2c32fac81a..264dc0ed067 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-forth.el b/lisp/org/ob-forth.el index ed14b1873d3..efd5759358c 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el index dad7eda0c72..49e960ff927 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el index 674627b8fa0..b2f491331e8 100644 --- a/lisp/org/ob-gnuplot.el +++ b/lisp/org/ob-gnuplot.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-groovy.el b/lisp/org/ob-groovy.el index 4e10ecd6b1d..565b09754ba 100644 --- a/lisp/org/ob-groovy.el +++ b/lisp/org/ob-groovy.el @@ -4,7 +4,7 @@ ;; Author: Miro Bezjak ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. @@ -84,12 +84,12 @@ in BODY as elisp." (when session (error "Sessions are not (yet) supported for Groovy")) (pcase result-type (`output - (let ((src-file (org-babel-temp-file "groovy-"))) + (let ((src-file (org-babel-temp-file "groovy_"))) (progn (with-temp-file src-file (insert body)) (org-babel-eval (concat org-babel-groovy-command " " src-file) "")))) (`value - (let* ((src-file (org-babel-temp-file "groovy-")) + (let* ((src-file (org-babel-temp-file "groovy_")) (wrapper (format org-babel-groovy-wrapper-method body))) (with-temp-file src-file (insert wrapper)) (let ((raw (org-babel-eval diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el index b19ee6d70fe..e607ee0c55b 100644 --- a/lisp/org/ob-haskell.el +++ b/lisp/org/ob-haskell.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-hledger.el b/lisp/org/ob-hledger.el index 71589034702..727fb1f162a 100644 --- a/lisp/org/ob-hledger.el +++ b/lisp/org/ob-hledger.el @@ -4,7 +4,7 @@ ;; Author: Simon Michael ;; Keywords: literate programming, reproducible research, plain text accounting -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-io.el b/lisp/org/ob-io.el index 7c7d9df25ad..4f407cc52c3 100644 --- a/lisp/org/ob-io.el +++ b/lisp/org/ob-io.el @@ -4,7 +4,7 @@ ;; Author: Andrzej Lichnerowicz ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el index 1f257531831..d6301bff2d5 100644 --- a/lisp/org/ob-java.el +++ b/lisp/org/ob-java.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-js.el b/lisp/org/ob-js.el index 5aa2ed791dc..38c8c39ac96 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-keys.el b/lisp/org/ob-keys.el index 3d8e865a029..fc96df47561 100644 --- a/lisp/org/ob-keys.el +++ b/lisp/org/ob-keys.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el index 4654ba5d3a8..6a963e52f26 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-ledger.el b/lisp/org/ob-ledger.el index 84f0599a417..2a1331441ae 100644 --- a/lisp/org/ob-ledger.el +++ b/lisp/org/ob-ledger.el @@ -4,7 +4,7 @@ ;; Author: Eric S Fraga ;; Keywords: literate programming, reproducible research, accounting -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el index b4c4b9a90e4..3d3cc07f135 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: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html +;; Homepage: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html ;; This file is part of GNU Emacs. @@ -24,7 +24,7 @@ ;;; Commentary: ;; Installation, ob-lilypond documentation, and examples are available at -;; http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html +;; https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html ;; ;; Lilypond documentation can be found at ;; http://lilypond.org/manuals.html diff --git a/lisp/org/ob-lisp.el b/lisp/org/ob-lisp.el index d4a7c37133d..b846138f7a3 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el index f103a811856..6af6bf07e84 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. @@ -79,44 +79,54 @@ if so then run the appropriate source block from the Library." (org-babel-execute-src-block nil info) t))) -(defun org-babel-lob--src-info (name) - "Return internal representation for Babel data named NAME. -NAME is a string. This function looks into the current document +(defun org-babel-lob--src-info (ref) + "Return internal representation for Babel data referenced as REF. +REF is a string. This function looks into the current document for a Babel call or source block. If none is found, it looks -after NAME in the Library of Babel. Eventually, if that also -fails, it returns nil." - ;; During export, look into the pristine copy of the document being - ;; exported instead of the current one, which could miss some data. - (with-current-buffer (or org-babel-exp-reference-buffer (current-buffer)) - (org-with-wide-buffer - (goto-char (point-min)) - (catch :found - (let ((case-fold-search t) - (regexp (org-babel-named-data-regexp-for-name name))) - (while (re-search-forward regexp nil t) - (let ((element (org-element-at-point))) - (when (equal name (org-element-property :name element)) - (throw :found - (pcase (org-element-type element) - (`src-block (org-babel-get-src-block-info t element)) - (`babel-call (org-babel-lob-get-info element)) - ;; Non-executable data found. Since names are - ;; supposed to be unique throughout a document, - ;; bail out. - (_ nil)))))) - ;; No element named NAME in buffer. Try Library of Babel. - (cdr (assoc-string name org-babel-library-of-babel))))))) +after REF in the Library of Babel." + (let ((name ref) + (file nil)) + ;; Extract the remote file, if specified in the reference. + (when (string-match "\\`\\(.+\\):\\(.+\\)\\'" ref) + (setq file (match-string 1 ref)) + (setq name (match-string 2 ref))) + ;; During export, look into the pristine copy of the document + ;; being exported instead of the current one, which could miss + ;; some data. + (with-current-buffer (cond (file (find-file-noselect file t)) + (org-babel-exp-reference-buffer) + (t (current-buffer))) + (org-with-point-at 1 + (catch :found + (let ((case-fold-search t) + (regexp (org-babel-named-data-regexp-for-name name))) + (while (re-search-forward regexp nil t) + (let ((element (org-element-at-point))) + (when (equal name (org-element-property :name element)) + (throw :found + (pcase (org-element-type element) + (`src-block (org-babel-get-src-block-info t element)) + (`babel-call (org-babel-lob-get-info element)) + ;; Non-executable data found. Since names + ;; are supposed to be unique throughout + ;; a document, bail out. + (_ nil)))))) + (cdr (assoc-string ref org-babel-library-of-babel)))))))) ;;;###autoload (defun org-babel-lob-get-info (&optional datum) "Return internal representation for Library of Babel function call. -Consider DATUM, when provided, or element at point. Return nil -when not on an appropriate location. Otherwise return a list -compatible with `org-babel-get-src-block-info', which see." + +Consider DATUM, when provided, or element at point otherwise. + +Return nil when not on an appropriate location. Otherwise return +a list compatible with `org-babel-get-src-block-info', which +see." (let* ((context (or datum (org-element-context))) - (type (org-element-type context))) + (type (org-element-type context)) + (reference (org-element-property :call context))) (when (memq type '(babel-call inline-babel-call)) - (pcase (org-babel-lob--src-info (org-element-property :call context)) + (pcase (org-babel-lob--src-info reference) (`(,language ,body ,header ,_ ,_ ,_ ,coderef) (let ((begin (org-element-property (if (eq type 'inline-babel-call) :begin diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el index ff9aae01fac..6ae72c7e565 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-makefile.el b/lisp/org/ob-makefile.el index 692ebb6c923..46870378295 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-matlab.el b/lisp/org/ob-matlab.el index da2eadc477c..5baac77742c 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el index fc2471761a0..b42a4b8afaf 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-mscgen.el b/lisp/org/ob-mscgen.el index 8f8c8c5dce9..b2c2443c8fc 100644 --- a/lisp/org/ob-mscgen.el +++ b/lisp/org/ob-mscgen.el @@ -4,7 +4,7 @@ ;; Author: Juan Pechiar ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-ocaml.el b/lisp/org/ob-ocaml.el index b8212b128bc..90926b5c35b 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el index 7d729055060..c7339cf992d 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-org.el b/lisp/org/ob-org.el index 310aaec3f39..7a495faaedf 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el index 2b96bf9cd56..85806fd5330 100644 --- a/lisp/org/ob-perl.el +++ b/lisp/org/ob-perl.el @@ -5,7 +5,7 @@ ;; Authors: Dan Davison ;; Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-picolisp.el b/lisp/org/ob-picolisp.el index fd129b899b2..cc2c8a8dff2 100644 --- a/lisp/org/ob-picolisp.el +++ b/lisp/org/ob-picolisp.el @@ -5,7 +5,7 @@ ;; Authors: Thorsten Jolitz ;; Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-plantuml.el b/lisp/org/ob-plantuml.el index 53ba42ec367..9a9313e7be9 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-processing.el b/lisp/org/ob-processing.el index 83fcadd2575..1a88930277f 100644 --- a/lisp/org/ob-processing.el +++ b/lisp/org/ob-processing.el @@ -4,7 +4,7 @@ ;; Author: Jarmo Hurri (adapted from ob-asymptote.el written by Eric Schulte) ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el index 951e4d2a4b4..9f1234bac52 100644 --- a/lisp/org/ob-python.el +++ b/lisp/org/ob-python.el @@ -5,7 +5,7 @@ ;; Authors: Eric Schulte ;; Dan Davison ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el index 872f7f98151..3efa17f9601 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el index 6daf52b0127..7686ac4e807 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-sass.el b/lisp/org/ob-sass.el index 5b179a6e8cb..af55d763e34 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el index cc78b574d07..0efe5f3467c 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el index 4fad849d024..fb7c8e2daa4 100644 --- a/lisp/org/ob-screen.el +++ b/lisp/org/ob-screen.el @@ -4,7 +4,7 @@ ;; Author: Benjamin Andresen ;; Keywords: literate programming, interactive shell -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-shell.el b/lisp/org/ob-shell.el index c53dd65e66e..362dfd520fb 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-shen.el b/lisp/org/ob-shen.el index 9308e5b38b1..d81e7d60df1 100644 --- a/lisp/org/ob-shen.el +++ b/lisp/org/ob-shen.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research, shen -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el index 524e9b73e1a..959ede3decc 100644 --- a/lisp/org/ob-sql.el +++ b/lisp/org/ob-sql.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el index 4799896f63b..42528a38712 100644 --- a/lisp/org/ob-sqlite.el +++ b/lisp/org/ob-sqlite.el @@ -4,7 +4,7 @@ ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-stan.el b/lisp/org/ob-stan.el index 6fa9fe5c94f..ffc26818841 100644 --- a/lisp/org/ob-stan.el +++ b/lisp/org/ob-stan.el @@ -4,7 +4,7 @@ ;; Author: Kyle Meyer ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. @@ -39,7 +39,7 @@ ;; that does not end in ".stan". ;; ;; For more information and usage examples, visit -;; http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-stan.html +;; https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-stan.html ;; ;; [1] http://mc-stan.org/ diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el index 9ee0bcc24b5..f6a5c88e479 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index 5fa59ac4d76..48eddb73a92 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ob-vala.el b/lisp/org/ob-vala.el index 02b3bab5b7f..96c37e3ad08 100644 --- a/lisp/org/ob-vala.el +++ b/lisp/org/ob-vala.el @@ -4,7 +4,7 @@ ;; Author: Christian Garbs <mitch@cgarbs.de> ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;;; License: diff --git a/lisp/org/ob.el b/lisp/org/ob.el index a029da861bd..35f65ffa828 100644 --- a/lisp/org/ob.el +++ b/lisp/org/ob.el @@ -4,7 +4,7 @@ ;; Authors: Eric Schulte ;; Keywords: literate programming, reproducible research -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 9aaec330708..5bbf5e34ee5 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -1644,9 +1644,10 @@ When nil, such items are sorted as 0 minutes effort." (tags . " %i %-12:c") (search . " %i %-12:c")) "Format specifications for the prefix of items in the agenda views. -An alist with five entries, each for the different agenda types. The -keys of the sublists are `agenda', `todo', `search' and `tags'. -The values are format strings. + +An alist with one entry per agenda type. The keys of the +sublists are `agenda', `todo', `search' and `tags'. The values +are format strings. This format works similar to a printf format, with the following meaning: @@ -2075,7 +2076,10 @@ works you probably want to add it to `org-agenda-custom-commands' for good." (defvar org-agenda-follow-mode nil) (defvar org-agenda-entry-text-mode nil) (defvar org-agenda-clockreport-mode nil) -(defvar org-agenda-show-log nil) +(defvar org-agenda-show-log nil + "When non-nil, show the log in the agenda. +Do not set this directly; instead use +`org-agenda-start-with-log-mode', which see.") (defvar org-agenda-redo-command nil) (defvar org-agenda-query-string nil) (defvar org-agenda-mode-hook nil @@ -2207,9 +2211,9 @@ The following commands are available: nil t) (unless org-agenda-keep-modes (setq org-agenda-follow-mode org-agenda-start-with-follow-mode - org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode)) - (setq org-agenda-show-log org-agenda-start-with-log-mode) - (setq org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode) + org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode + org-agenda-show-log org-agenda-start-with-log-mode + org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode)) (add-to-invisibility-spec '(org-filtered)) (add-to-invisibility-spec '(org-link)) (easy-menu-change @@ -6172,7 +6176,7 @@ scheduled items with an hour specification like [h]h:mm." ;; Nullify delay when a repeater triggered already ;; and the delay is of the form --Xd. ((and (string-match-p "--[0-9]+[hdwmy]" s) - (> current schedule)) + (> schedule (org-agenda--timestamp-to-absolute s))) 0) (suppress-delay (let ((org-scheduled-delay-days suppress-delay)) @@ -8177,7 +8181,6 @@ so that the date SD will be in that range." (interactive) (org-agenda-check-type t 'agenda) (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode)) - (setq org-agenda-start-with-clockreport-mode org-agenda-clockreport-mode) (org-agenda-set-mode-name) (org-agenda-redo) (message "Clocktable mode is %s" @@ -8201,7 +8204,6 @@ log items, nothing else." nil 'clockcheck)) (special '(closed clock state)) (t (not org-agenda-show-log)))) - (setq org-agenda-start-with-log-mode org-agenda-show-log) (org-agenda-set-mode-name) (org-agenda-redo) (message "Log mode is %s" (if org-agenda-show-log "on" "off"))) @@ -9895,32 +9897,33 @@ The prefix arg is passed through to the command if possible." (org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off)))))) - (?s - (let ((time - (and (not arg) - (org-read-date nil nil nil "(Re)Schedule to" - org-overriding-default-time)))) + ((and (or ?s ?d) c) + (let* ((schedule? (eq c ?s)) + (prompt (if schedule? "(Re)Schedule to" "(Re)Set Deadline to")) + (time + (and (not arg) + (let ((new (org-read-date + nil nil nil prompt org-overriding-default-time))) + ;; A "double plus" answer applies to every + ;; scheduled time. Do not turn it into + ;; a fixed date yet. + (if (string-match-p "\\`[ \t]*\\+\\+" + org-read-date-final-answer) + org-read-date-final-answer + new))))) ;; Make sure to not prompt for a note when bulk - ;; rescheduling as Org cannot cope with simultaneous notes. - ;; Besides, it could be annoying depending on the number of - ;; items re-scheduled. + ;; rescheduling/resetting deadline as Org cannot cope with + ;; simultaneous notes. Besides, it could be annoying + ;; depending on the number of marked items. (setq cmd - `(lambda () - (let ((org-log-reschedule (and org-log-reschedule 'time))) - (org-agenda-schedule arg ,time)))))) - (?d - (let ((time - (and (not arg) - (org-read-date nil nil nil "(Re)Set Deadline to" - org-overriding-default-time)))) - ;; Make sure to not prompt for a note when bulk - ;; rescheduling as Org cannot cope with simultaneous - ;; notes. Besides, it could be annoying depending on the - ;; number of items re-scheduled. - (setq cmd - `(lambda () - (let ((org-log-redeadline (and org-log-redeadline 'time))) - (org-agenda-deadline arg ,time)))))) + (if schedule? + `(lambda () + (let ((org-log-reschedule + (and org-log-reschedule 'time))) + (org-agenda-schedule arg ,time))) + `(lambda () + (let ((org-log-redeadline (and org-log-redeadline 'time))) + (org-agenda-deadline arg ,time))))))) (?S (unless (org-agenda-check-type nil 'agenda 'todo) diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el index 755de7fdac2..e020ec21409 100644 --- a/lisp/org/org-archive.el +++ b/lisp/org/org-archive.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el index 1d39efb88c4..5d36379b5eb 100644 --- a/lisp/org/org-bbdb.el +++ b/lisp/org/org-bbdb.el @@ -5,7 +5,7 @@ ;; Authors: Carsten Dominik <carsten at orgmode dot org> ;; Thomas Baumann <thomas dot baumann at ch dot tum dot de> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index cb1741f2f91..3de386c69d6 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -51,8 +51,8 @@ (require 'org) (declare-function org-at-encrypted-entry-p "org-crypt" ()) -(declare-function org-datetree-find-date-create "org-datetree" - (date &optional keep-restriction)) +(declare-function org-clock-update-mode-line "org-clock" (&optional refresh)) +(declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction)) (declare-function org-decrypt-entry "org-crypt" ()) (declare-function org-encrypt-entry "org-crypt" ()) (declare-function org-table-analyze "org-table" ()) @@ -541,8 +541,8 @@ not-in-buffer: command not displayed in matching buffers If you define several checks, the agenda command will be accessible if there is at least one valid check. -You can also bind a key to another agenda custom command -depending on contextual rules. +You can also bind a key to another capture template depending on +contextual rules. \\='((\"c\" \"d\" ((in-mode . \"message-mode\")))) @@ -724,21 +724,24 @@ captured item after finalizing." ;; Did we start the clock in this capture buffer? (when (and org-capture-clock-was-started - org-clock-marker (marker-buffer org-clock-marker) - (equal (marker-buffer org-clock-marker) (buffer-base-buffer)) - (> org-clock-marker (point-min)) + org-clock-marker + (eq (marker-buffer org-clock-marker) (buffer-base-buffer)) + (>= org-clock-marker (point-min)) (< org-clock-marker (point-max))) - ;; Looks like the clock we started is still running. Clock out. - (when (not org-capture-clock-keep) (let (org-log-note-clock-out) (org-clock-out))) - (when (and (not org-capture-clock-keep) - (org-capture-get :clock-resume 'local) - (markerp (org-capture-get :interrupted-clock 'local)) - (buffer-live-p (marker-buffer - (org-capture-get :interrupted-clock 'local)))) - (let ((clock-in-task (org-capture-get :interrupted-clock 'local))) - (org-with-point-at clock-in-task - (org-clock-in))) - (message "Interrupted clock has been resumed"))) + ;; Looks like the clock we started is still running. + (if org-capture-clock-keep + ;; User may have completed clocked heading from the template. + ;; Refresh clock mode line. + (org-clock-update-mode-line t) + ;; Clock out. Possibly resume interrupted clock. + (let (org-log-note-clock-out) (org-clock-out)) + (when (and (org-capture-get :clock-resume 'local) + (markerp (org-capture-get :interrupted-clock 'local)) + (buffer-live-p (marker-buffer + (org-capture-get :interrupted-clock 'local)))) + (let ((clock-in-task (org-capture-get :interrupted-clock 'local))) + (org-with-point-at clock-in-task (org-clock-in))) + (message "Interrupted clock has been resumed")))) (let ((beg (point-min)) (end (point-max)) @@ -1118,7 +1121,7 @@ may have been stored before." (setq level (org-get-valid-level (if (org-at-heading-p) (org-outline-level) 1) 1)) - (if reversed? (outline-next-heading) (org-end-of-subtree t))) + (if reversed? (outline-next-heading) (org-end-of-subtree t t))) ;; Insert as a top-level entry at the beginning of the file. (reversed? (goto-char (point-min)) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 4c5fcc64b0f..ff32e28d1e8 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -430,7 +430,9 @@ This applies when using `org-clock-goto'." :type 'integer) (defcustom org-clock-display-default-range 'thisyear - "Default range when displaying clocks with `org-clock-display'." + "Default range when displaying clocks with `org-clock-display'. +Valid values are: `today', `yesterday', `thisweek', `lastweek', +`thismonth', `lastmonth', `thisyear', `lastyear' and `untilnow'." :group 'org-clock :type '(choice (const today) (const yesterday) @@ -441,7 +443,8 @@ This applies when using `org-clock-goto'." (const thisyear) (const lastyear) (const untilnow) - (const :tag "Select range interactively" interactive))) + (const :tag "Select range interactively" interactive)) + :safe #'symbolp) (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. @@ -465,38 +468,6 @@ to add an effort property.") (defvar org-clock-stored-resume-clock nil "Clock to resume, saved by `org-clock-load'") -(defconst org-clock--oldest-date - (let* ((dichotomy - (lambda (min max pred) - (if (funcall pred min) min - (cl-incf min) - (while (> (- max min) 1) - (let ((mean (+ (ash min -1) (ash max -1) (logand min max 1)))) - (if (funcall pred mean) (setq max mean) (setq min mean))))) - max)) - (high - (funcall dichotomy - most-negative-fixnum - 0 - (lambda (m) - ;; libc in macOS 10.6 hangs when decoding times - ;; around year -2**31. Limit `high' not to go - ;; any earlier than that. - (unless (and (eq system-type 'darwin) - (string-match-p - "10\\.6\\.[[:digit:]]" - (shell-command-to-string - "sw_vers -productVersion")) - (<= m -1034058203135)) - (ignore-errors (decode-time (list m 0))))))) - (low - (funcall dichotomy - most-negative-fixnum - 0 - (lambda (m) (ignore-errors (decode-time (list high m))))))) - (list high low)) - "Internal time for oldest date representable on the system.") - ;;; The clock for measuring work time. (defvar org-mode-line-string "") @@ -542,6 +513,15 @@ cannot be translated." (assoc-string language org-clock-clocktable-language-setup t)) s)) +(defun org-clock--mode-line-heading () + "Return currently clocked heading, formatted for mode line." + (cond ((functionp org-clock-heading-function) + (funcall org-clock-heading-function)) + ((org-before-first-heading-p) "???") + (t (replace-regexp-in-string + org-bracket-link-analytic-regexp "\\5" + (org-no-properties (org-get-heading t t t t)))))) + (defun org-clock-menu () (interactive) (popup-menu @@ -690,19 +670,18 @@ If not, show simply the clocked time like 01:50." (if org-clock-effort (let* ((effort-in-minutes (org-duration-to-minutes org-clock-effort)) (work-done-str - (propertize - (org-duration-from-minutes clocked-time) - 'face (if (and org-clock-task-overrun (not org-clock-task-overrun-text)) - 'org-mode-line-clock-overrun 'org-mode-line-clock))) - (effort-str (org-duration-from-minutes effort-in-minutes)) - (clockstr (propertize - (concat " [%s/" effort-str - "] (" (replace-regexp-in-string "%" "%%" org-clock-heading) ")") - 'face 'org-mode-line-clock))) - (format clockstr work-done-str)) - (propertize (concat " [" (org-duration-from-minutes clocked-time) - "]" (format " (%s)" org-clock-heading)) - 'face 'org-mode-line-clock)))) + (propertize (org-duration-from-minutes clocked-time) + 'face + (if (and org-clock-task-overrun + (not org-clock-task-overrun-text)) + 'org-mode-line-clock-overrun + 'org-mode-line-clock))) + (effort-str (org-duration-from-minutes effort-in-minutes))) + (format (propertize " [%s/%s] (%s)" 'face 'org-mode-line-clock) + work-done-str effort-str org-clock-heading)) + (format (propertize " [%s] (%s)" 'face 'org-mode-line-clock) + (org-duration-from-minutes clocked-time) + org-clock-heading)))) (defun org-clock-get-last-clock-out-time () "Get the last clock-out time for the current subtree." @@ -712,10 +691,13 @@ If not, show simply the clocked time like 01:50." ".*\\]--\\(\\[[^]]+\\]\\)") end t) (org-time-string-to-time (match-string 1)))))) -(defun org-clock-update-mode-line () +(defun org-clock-update-mode-line (&optional refresh) + "Update mode line with clock information. +When optional argument is non-nil, refresh cached heading." (if org-clock-effort (org-clock-notify-once-if-expired) (setq org-clock-task-overrun nil)) + (when refresh (setq org-clock-heading (org-clock--mode-line-heading))) (setq org-mode-line-string (propertize (let ((clock-string (org-clock-get-clock-string)) @@ -1232,7 +1214,8 @@ the default behavior." (when (equal select '(64)) ;; Set start-time to `org-clock-out-time' (let ((org-clock-continuously t)) - (org-clock-in nil org-clock-out-time))) + (org-clock-in nil org-clock-out-time) + (throw 'abort nil))) (when (equal select '(4)) (setq selected-task (org-clock-select-task "Clock-in on task: ")) @@ -1298,15 +1281,7 @@ the default behavior." org-clock-in-switch-to-state "\\>")))) (org-todo org-clock-in-switch-to-state))) - (setq org-clock-heading - (cond ((and org-clock-heading-function - (functionp org-clock-heading-function)) - (funcall org-clock-heading-function)) - ((nth 4 (org-heading-components)) - (replace-regexp-in-string - "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1" - (match-string-no-properties 4))) - (t "???"))) + (setq org-clock-heading (org-clock--mode-line-heading)) (org-clock-find-position org-clock-in-resume) (cond ((and org-clock-in-resume @@ -1442,7 +1417,7 @@ in particular CLOCK_MODELINE_TOTAL and the corresponding variable `org-clock-mode-line-total' and then decides which time to use. The time is always returned as UTC." - (let ((cmt (or (org-entry-get nil "CLOCK_MODELINE_TOTAL") + (let ((cmt (or (org-entry-get nil "CLOCK_MODELINE_TOTAL" 'selective) (symbol-name org-clock-mode-line-total))) (lr (org-entry-get nil "LAST_REPEAT"))) (cond @@ -1451,7 +1426,7 @@ The time is always returned as UTC." (current-time)) ((equal cmt "today") (setq org--msg-extra "showing today's task time.") - (let* ((dt (org-decode-time nil t)) + (let* ((dt (decode-time)) (hour (nth 2 dt)) (day (nth 3 dt))) (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day))) @@ -1784,6 +1759,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection." (defvar-local org-clock-file-total-minutes nil "Holds the file total time in minutes, after a call to `org-clock-sum'.") +;;;###autoload (defun org-clock-sum-today (&optional headline-filter) "Sum the times for each subtree for today." (let ((range (org-clock-special-range 'today))) @@ -1929,37 +1905,36 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times." (prop (cond ((not arg) :org-clock-minutes-default) (todayp :org-clock-minutes-today) (customp :org-clock-minutes-custom) - (t :org-clock-minutes))) - time h m p) + (t :org-clock-minutes)))) (cond ((not arg) (org-clock-sum-custom nil org-clock-display-default-range prop)) (todayp (org-clock-sum-today)) (customp (org-clock-sum-custom nil arg)) (t (org-clock-sum))) - (unless (eq arg '(64)) + (unless (equal arg '(64)) (save-excursion (goto-char (point-min)) - (while (or (and (equal (setq p (point)) (point-min)) - (get-text-property p prop)) - (setq p (next-single-property-change - (point) prop))) - (goto-char p) - (when (setq time (get-text-property p prop)) - (org-clock-put-overlay time))) - (setq h (/ org-clock-file-total-minutes 60) - m (- org-clock-file-total-minutes (* 60 h))) + (let ((p nil)) + (while (or (and (equal (setq p (point)) (point-min)) + (get-text-property p prop)) + (setq p (next-single-property-change (point) prop))) + (goto-char p) + (let ((time (get-text-property p prop))) + (when time (org-clock-put-overlay time))))) ;; Arrange to remove the overlays upon next change. (when org-remove-highlights-with-change (add-hook 'before-change-functions 'org-clock-remove-overlays - nil 'local)))) - (message (concat (format "Total file time%s: " - (cond (todayp " for today") - (customp " (custom)") - (t ""))) - (org-duration-from-minutes - org-clock-file-total-minutes) - " (%d hours and %d minutes)") - h m))) + nil 'local)))) + (let* ((h (/ org-clock-file-total-minutes 60)) + (m (- org-clock-file-total-minutes (* 60 h)))) + (message (concat (format "Total file time%s: " + (cond (todayp " for today") + (customp " (custom)") + (t ""))) + (org-duration-from-minutes + org-clock-file-total-minutes) + " (%d hours and %d minutes)") + h m)))) (defvar-local org-clock-overlays nil) @@ -2051,27 +2026,32 @@ fontified, and then returned." ;;;###autoload (defun org-clock-report (&optional arg) - "Create a table containing a report about clocked time. -If the cursor is inside an existing clocktable block, then the table -will be updated. If not, a new clocktable will be inserted. The scope -of the new clock will be subtree when called from within a subtree, and -file elsewhere. - -When called with a prefix argument, move to the first clock table in the -buffer and update it." + "Update or create a table containing a report about clocked time. + +If point is inside an existing clocktable block, update it. +Otherwise, insert a new one. + +The new table inherits its properties from the variable +`org-clock-clocktable-default-properties'. The scope of the +clocktable, when not specified in the previous variable, is +`subtree' when the function is called from within a subtree, and +`file' elsewhere. + +When called with a prefix argument, move to the first clock table +in the buffer and update it." (interactive "P") (org-clock-remove-overlays) (when arg (org-find-dblock "clocktable") (org-show-entry)) - (if (org-in-clocktable-p) - (goto-char (org-in-clocktable-p)) - (let ((props (if (ignore-errors - (save-excursion (org-back-to-heading))) - (list :name "clocktable" :scope 'subtree) - (list :name "clocktable")))) - (org-create-dblock - (org-combine-plists org-clock-clocktable-default-properties props)))) + (pcase (org-in-clocktable-p) + (`nil + (org-create-dblock + (org-combine-plists + (list :scope (if (org-before-first-heading-p) 'file 'subtree)) + org-clock-clocktable-default-properties + '(:name "clocktable")))) + (start (goto-char start))) (org-update-dblock)) (defun org-day-of-week (day month year) @@ -2258,7 +2238,9 @@ have priority." ;; Format start and end times according to AS-STRINGS. (let* ((start (pcase key (`interactive (org-read-date nil t nil "Range start? ")) - (`untilnow org-clock--oldest-date) + ;; In theory, all clocks started after the dawn of + ;; humanity. + (`untilnow (encode-time 0 0 0 0 0 -50000)) (_ (encode-time 0 m h d month y)))) (end (pcase key (`interactive (org-read-date nil t nil "Range end? ")) @@ -2692,16 +2674,15 @@ LEVEL is an integer. Indent by two spaces per level above 1." (defun org-clocktable-steps (params) "Step through the range to make a number of clock tables." - (let* ((p1 (copy-sequence params)) - (ts (plist-get p1 :tstart)) - (te (plist-get p1 :tend)) - (ws (plist-get p1 :wstart)) - (ms (plist-get p1 :mstart)) - (step0 (plist-get p1 :step)) - (step (cdr (assoc step0 '((day . 86400) (week . 604800))))) - (stepskip0 (plist-get p1 :stepskip0)) - (block (plist-get p1 :block)) - cc step-time tsb) + (let* ((ts (plist-get params :tstart)) + (te (plist-get params :tend)) + (ws (plist-get params :wstart)) + (ms (plist-get params :mstart)) + (step0 (plist-get params :step)) + (step (cdr (assq step0 '((day . 86400) (week . 604800))))) + (stepskip0 (plist-get params :stepskip0)) + (block (plist-get params :block)) + cc tsb) (when block (setq cc (org-clock-special-range block nil t ws ms) ts (car cc) @@ -2724,37 +2705,37 @@ LEVEL is an integer. Indent by two spaces per level above 1." (setq tsb (if (eq step0 'week) (let ((dow (nth 6 (decode-time (seconds-to-time ts))))) - (if (< dow ws) ts + (if (<= dow ws) ts (- ts (* 86400 (- dow ws))))) ts)) - (setq p1 (plist-put p1 :header "")) - (setq p1 (plist-put p1 :step nil)) - (setq p1 (plist-put p1 :block nil)) (while (< tsb te) - (or (bolp) (insert "\n")) - (setq p1 (plist-put p1 :tstart (format-time-string - (org-time-stamp-format nil t) - (seconds-to-time (max tsb ts))))) - (cl-incf tsb (let ((dow (nth 6 (decode-time (seconds-to-time tsb))))) - (if (or (eq step0 'day) - (= dow ws)) - step - (* 86400 (- ws dow))))) - (setq p1 (plist-put p1 :tend (format-time-string - (org-time-stamp-format nil t) - (seconds-to-time (min te tsb))))) - (insert "\n" (if (eq step0 'day) "Daily report: " - "Weekly report starting on: ") - (plist-get p1 :tstart) "\n") - (setq step-time (org-dblock-write:clocktable p1)) - (re-search-forward "^[ \t]*#\\+END:") - (when (and (equal step-time 0) stepskip0) - ;; Remove the empty table - (delete-region (point-at-bol) - (save-excursion - (re-search-backward "^\\(Daily\\|Weekly\\) report" - nil t) - (point)))) + (unless (bolp) (insert "\n")) + (let ((start-time (seconds-to-time (max tsb ts)))) + (cl-incf tsb (let ((dow (nth 6 (decode-time (seconds-to-time tsb))))) + (if (or (eq step0 'day) + (= dow ws)) + step + (* 86400 (- ws dow))))) + (insert "\n" + (if (eq step0 'day) "Daily report: " + "Weekly report starting on: ") + (format-time-string (org-time-stamp-format nil t) start-time) + "\n") + (let ((table-begin (line-beginning-position 0)) + (step-time + (org-dblock-write:clocktable + (org-combine-plists + params + (list + :header "" :step nil :block nil + :tstart (format-time-string (org-time-stamp-format t t) + start-time) + :tend (format-time-string (org-time-stamp-format t t) + (seconds-to-time (min te tsb)))))))) + (re-search-forward "^[ \t]*#\\+END:") + (when (and stepskip0 (equal step-time 0)) + ;; Remove the empty table + (delete-region (line-beginning-position) table-begin)))) (end-of-line 0)))) (defun org-clock-get-table-data (file params) diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 0d5a9827d59..cb5c091d0a3 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index f32fcd1783e..1fd408de9e5 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -61,12 +61,6 @@ (defalias 'format-message 'format) (defalias 'gui-get-selection 'x-get-selection)) -(defun org-decode-time (&optional time zone) - "Backward-compatible function for `decode-time'." - (if (< emacs-major-version 25) - (decode-time time) - (decode-time time zone))) - (unless (fboundp 'directory-name-p) (defun directory-name-p (name) "Return non-nil if NAME ends with a directory separator character." @@ -78,37 +72,6 @@ (and (memq system-type '(windows-nt ms-dos)) (= lastc ?\\)))))) -(unless (fboundp 'directory-files-recursively) - (defun directory-files-recursively (dir regexp &optional include-directories) - "Return list of all files under DIR that have file names matching REGEXP. -This function works recursively. Files are returned in \"depth first\" -order, and files from each directory are sorted in alphabetical order. -Each file name appears in the returned list in its absolute form. -Optional argument INCLUDE-DIRECTORIES non-nil means also include in the -output directories whose names match REGEXP." - (let ((result nil) - (files nil) - ;; When DIR is "/", remote file names like "/method:" could - ;; also be offered. We shall suppress them. - (tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir))))) - (dolist (file (sort (file-name-all-completions "" dir) - 'string<)) - (unless (member file '("./" "../")) - (if (directory-name-p file) - (let* ((leaf (substring file 0 (1- (length file)))) - (full-file (expand-file-name leaf dir))) - ;; Don't follow symlinks to other directories. - (unless (file-symlink-p full-file) - (setq result - (nconc result (directory-files-recursively - full-file regexp include-directories)))) - (when (and include-directories - (string-match regexp leaf)) - (setq result (nconc result (list full-file))))) - (when (string-match regexp file) - (push (expand-file-name file dir) files))))) - (nconc result (nreverse files))))) - ;;; Obsolete aliases (remove them after the next major release). diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el index a8162fe9382..d00bad222cb 100644 --- a/lisp/org/org-datetree.el +++ b/lisp/org/org-datetree.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-docview.el b/lisp/org/org-docview.el index 57069b32aee..a467212d012 100644 --- a/lisp/org/org-docview.el +++ b/lisp/org/org-docview.el @@ -4,7 +4,7 @@ ;; Author: Jan Böcker <jan.boecker at jboecker dot de> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index 9e5c4007bd7..d9c6522e2f0 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -22,7 +22,7 @@ ;;; Commentary: ;; -;; See <http://orgmode.org/worg/dev/org-syntax.html> for details about +;; See <https://orgmode.org/worg/dev/org-syntax.html> for details about ;; Org syntax. ;; ;; Lisp-wise, a syntax object can be represented as a list. @@ -3065,7 +3065,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. [[http://orgmode.org][homepage]] + ;; Type 2: Standard link, i.e. [[https://orgmode.org][homepage]] ((looking-at org-bracket-link-regexp) (setq format 'bracket) (setq contents-begin (match-beginning 3)) @@ -3114,14 +3114,14 @@ Assume point is at the beginning of the link." (t (setq type "fuzzy") (setq path raw-link)))) - ;; Type 3: Plain link, e.g., http://orgmode.org + ;; Type 3: Plain link, e.g., https://orgmode.org ((looking-at org-plain-link-re) (setq format 'plain) (setq raw-link (match-string-no-properties 0)) (setq type (match-string-no-properties 1)) (setq link-end (match-end 0)) (setq path (match-string-no-properties 2))) - ;; Type 4: Angular link, e.g., <http://orgmode.org>. Unlike to + ;; Type 4: Angular link, e.g., <https://orgmode.org>. Unlike to ;; bracket links, follow RFC 3986 and remove any extra ;; whitespace in URI. ((looking-at org-angle-link-re) diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el index 65c7d055e08..e291b521f90 100644 --- a/lisp/org/org-entities.el +++ b/lisp/org/org-entities.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org>, ;; Ulf Stegemann <ulf at zeitform dot de> ;; Keywords: outlines, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-eww.el b/lisp/org/org-eww.el index 3d9dddcac03..1b6112adbb9 100644 --- a/lisp/org/org-eww.el +++ b/lisp/org/org-eww.el @@ -4,7 +4,7 @@ ;; Author: Marco Wahl <marcowahlsoft>a<gmailcom> ;; Keywords: link, eww -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el index 83871fb4454..750ada1e9c3 100644 --- a/lisp/org/org-faces.el +++ b/lisp/org/org-faces.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el index c3491d5df70..fde19e632c7 100644 --- a/lisp/org/org-feed.el +++ b/lisp/org/org-feed.el @@ -4,7 +4,7 @@ ;; ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -276,14 +276,21 @@ have been saved." (defun org-feed-update-all () "Get inbox items from all feeds in `org-feed-alist'." (interactive) - (let ((nfeeds (length org-feed-alist)) - (nnew (apply '+ (mapcar 'org-feed-update org-feed-alist)))) - (message "%s from %d %s" - (cond ((= nnew 0) "No new entries") - ((= nnew 1) "1 new entry") - (t (format "%d new entries" nnew))) - nfeeds - (if (= nfeeds 1) "feed" "feeds")))) + (let ((entries 0) + (errors 0) + (total-feeds (length org-feed-alist))) + (dolist (feed org-feed-alist) + (let ((items (ignore-errors (org-feed-update feed)))) + (if items (cl-incf entries items) + (cl-incf errors)))) + (message "%s from %d %s%s" + (pcase entries + (0 "No new entries") + (1 "1 new entry") + (_ (format "%d new entries" entries))) + total-feeds + (if (= total-feeds 1) "feed" "feeds") + (if (= 0 errors) "" (format " (unavailable feeds: %d)" errors))))) ;;;###autoload (defun org-feed-update (feed &optional retrieve-only) diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el index 4d3f154c257..c6376ca5dc0 100644 --- a/lisp/org/org-footnote.el +++ b/lisp/org/org-footnote.el @@ -4,7 +4,7 @@ ;; ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el index 0f2cdc28fbf..a53b343efb4 100644 --- a/lisp/org/org-gnus.el +++ b/lisp/org/org-gnus.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Tassilo Horn <tassilo at member dot fsf dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -42,6 +42,7 @@ (declare-function gnus-activate-group "gnus-start" (group &optional scan dont-check method dont-sub-check)) (declare-function gnus-find-method-for-group "gnus" (group &optional info)) +(declare-function gnus-article-show-summary "gnus-art" ()) (declare-function gnus-group-group-name "gnus-group") (declare-function gnus-group-jump-to-group "gnus-group" (group &optional prompt)) (declare-function gnus-group-read-group "gnus-group" (&optional all no-article group select-articles)) @@ -142,7 +143,14 @@ If `org-store-link' was called with a prefix arg the meaning of (save-excursion (nnir-article-group (gnus-summary-article-number)))) (_ gnus-newsgroup-name))) - (header (with-current-buffer gnus-summary-buffer + (header (if (eq major-mode 'gnus-article-mode) + ;; When in an article, first move to summary + ;; buffer, with point on the summary of the + ;; current article before extracting headers. + (save-window-excursion + (save-excursion + (gnus-article-show-summary) + (gnus-summary-article-header))) (gnus-summary-article-header))) (from (mail-header-from header)) (message-id (org-unbracket-string "<" ">" (mail-header-id header))) diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el index 09f13129e1b..375714e35ea 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index a230947c78a..26b203ff06d 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -4,7 +4,7 @@ ;; ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index ef68c3c4fa7..84bac2aa799 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -4,7 +4,7 @@ ;; ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el index db5d66ce761..6dde36ceba1 100644 --- a/lisp/org/org-info.el +++ b/lisp/org/org-info.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el index 1825b88cdf6..08fc268d0d7 100644 --- a/lisp/org/org-inlinetask.el +++ b/lisp/org/org-inlinetask.el @@ -4,7 +4,7 @@ ;; ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index ad0030ffdf8..1f51809f1ce 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Bastien Guerry <bzg@gnu.org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -121,6 +121,7 @@ (declare-function org-element-set-element "org-element" (old new)) (declare-function org-element-type "org-element" (element)) (declare-function org-element-update-syntax "org-element" ()) +(declare-function org-end-of-meta-data "org" (&optional full)) (declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) (declare-function org-export-create-backend "ox" (&rest rest) t) @@ -2356,27 +2357,23 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is (defun org-toggle-checkbox (&optional toggle-presence) "Toggle the checkbox in the current line. -With prefix arg TOGGLE-PRESENCE, add or remove checkboxes. With -double prefix, set checkbox to [-]. + +With prefix argument TOGGLE-PRESENCE, add or remove checkboxes. +With a double prefix argument, set the checkbox to \"[-]\". When there is an active region, toggle status or presence of the first checkbox there, and make every item inside have the same status or presence, respectively. -If the cursor is in a headline, apply this to all checkbox items -in the text below the heading, taking as reference the first item -in subtree, ignoring drawers." +If point is on a headline, apply this to all checkbox items in +the text below the heading, taking as reference the first item in +subtree, ignoring planning line and any drawer following it." (interactive "P") (save-excursion (let* (singlep block-item lim-up lim-down - (keyword-re (concat "^[ \t]*\\<\\(" org-scheduled-string - "\\|" org-deadline-string - "\\|" org-closed-string - "\\|" org-clock-string "\\)" - " *[[<]\\([^]>]+\\)[]>]")) (orderedp (org-entry-get nil "ORDERED")) (_bounds ;; In a region, start at first item in region. @@ -2389,15 +2386,10 @@ in subtree, ignoring drawers." (error "No item in region")) (setq lim-down (copy-marker limit)))) ((org-at-heading-p) - ;; On an heading, start at first item after drawers and + ;; On a heading, start at first item after drawers and ;; time-stamps (scheduled, etc.). (let ((limit (save-excursion (outline-next-heading) (point)))) - (forward-line 1) - (while (or (looking-at org-drawer-regexp) - (looking-at keyword-re)) - (if (looking-at keyword-re) - (forward-line 1) - (re-search-forward "^[ \t]*:END:" limit nil))) + (org-end-of-meta-data t) (if (org-list-search-forward (org-item-beginning-re) limit t) (setq lim-up (point-at-bol)) (error "No item in subtree")) @@ -2656,8 +2648,8 @@ Return t if successful." (= top (point-at-bol)) (cdr (assq 'indent org-list-automatic-rules)) (if no-subtree - (error - "First item of list cannot move without its subtree") + (user-error + "At first item: use S-M-<left/right> to move the whole list") t)))) ;; Determine begin and end points of zone to indent. If moving ;; more than one item, save them for subsequent moves. diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el index 0fb0b8ad175..1033db2af46 100644 --- a/lisp/org/org-macro.el +++ b/lisp/org/org-macro.el @@ -130,7 +130,7 @@ Templates are stored in buffer-local variable function installs the following ones: \"property\", \"time\". and, if the buffer is associated to a file, \"input-file\" and \"modification-time\"." - (let* ((templates (org-macro--collect-macros)) + (let* ((templates nil) (update-templates (lambda (cell) (let ((old-template (assoc (car cell) templates))) @@ -164,7 +164,7 @@ function installs the following ones: \"property\", (org-macro--counter-initialize) (funcall update-templates (cons "n" "(eval (org-macro--counter-increment \"$1\" \"$2\"))")) - (setq org-macro-templates templates))) + (setq org-macro-templates (nconc (org-macro--collect-macros) templates)))) (defun org-macro-expand (macro templates) "Return expanded MACRO, as a string. diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 79d09e37970..510ece1cb19 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el index 32a6ff11b91..e74a9ee59d6 100644 --- a/lisp/org/org-mhe.el +++ b/lisp/org/org-mhe.el @@ -4,7 +4,7 @@ ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el index 71914750f0b..cbf169f4078 100644 --- a/lisp/org/org-mobile.el +++ b/lisp/org/org-mobile.el @@ -3,7 +3,7 @@ ;; ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index ba38c058dd0..5a10b59b1eb 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el @@ -24,7 +24,7 @@ ;; ;; Org-mouse provides mouse support for org-mode. ;; -;; http://orgmode.org +;; https://orgmode.org ;; ;; Org mouse implements the following features: ;; * following links with the left mouse button diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el index a7cc09def4b..88a2e10d854 100644 --- a/lisp/org/org-pcomplete.el +++ b/lisp/org/org-pcomplete.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; John Wiegley <johnw at gnu dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index 6c74f3e6581..ebd7af42a85 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -4,7 +4,7 @@ ;; ;; Author: Eric Schulte <schulte dot eric at gmail dot com> ;; Keywords: tables, plotting -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index 27c2bb28d0f..33957ee3269 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el @@ -184,10 +184,10 @@ Possible properties are: Example: (setq org-protocol-project-alist - \\='((\"http://orgmode.org/worg/\" + \\='((\"https://orgmode.org/worg/\" :online-suffix \".php\" :working-suffix \".org\" - :base-url \"http://orgmode.org/worg/\" + :base-url \"https://orgmode.org/worg/\" :working-directory \"/home/user/org/Worg/\") (\"http://localhost/org-notes/\" :online-suffix \".html\" @@ -688,7 +688,7 @@ the cdr of an element in `org-publish-project-alist', reuse (let ((working-dir (expand-file-name (or (plist-get project-plist :base-directory) default-directory))) - (base-url "http://orgmode.org/worg/") + (base-url "https://orgmode.org/worg/") (strip-suffix (or (plist-get project-plist :html-extension) ".html")) (working-suffix (if (plist-get project-plist :base-extension) (concat "." (plist-get project-plist :base-extension)) diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index be433f66d1f..d50fd648b60 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 7c28acf9d85..829354c0d56 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 4bb5c91ce87..dcf74303637 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; @@ -135,7 +135,7 @@ the fixed string \"#+ORGTBL: SEND\", followed by instruction on how to convert the table into a data structure useful in the language of the buffer. Check the manual for the section on \"Translator functions\", and more generally check out -http://orgmode.org/manual/Tables-in-arbitrary-syntax.html#Tables-in-arbitrary-syntax +the Info node `(org)Tables in arbitrary syntax'. All occurrences of %n in a template will be replaced with the name of the table, obtained by prompting the user." @@ -387,16 +387,19 @@ portability of tables." (const :tag "Error on attempt to cross" error))) (defcustom org-table-formula-create-columns nil - "Non-nil means that evaluation of a field formula can add new -columns if an out-of-bounds field is being set." + "Non-nil means evaluation of formula can add new columns. +When non-nil, evaluating an out-of-bounds field can insert as +many columns as needed. When set to `warn', issue a warning when +doing so. When set to `prompt', ask user before creating a new +column. Otherwise, throw an error." :group 'org-table-calculation :version "26.1" :package-version '(Org . "8.3") :type '(choice - (const :tag "Setting an out-of-bounds field generates an error (default)" nil) - (const :tag "Setting an out-of-bounds field silently adds columns as needed" t) - (const :tag "Setting an out-of-bounds field adds columns as needed, but issues a warning message" warn) - (const :tag "When setting an out-of-bounds field, the user is prompted" prompt))) + (const :tag "Out-of-bounds field generates an error (default)" nil) + (const :tag "Out-of-bounds field silently adds columns as needed" t) + (const :tag "Out-of-bounds field adds columns, but issues a warning" warn) + (const :tag "Prompt user when setting an out-of-bounds field" prompt))) (defgroup org-table-import-export nil "Options concerning table import and export in Org mode." @@ -3327,7 +3330,9 @@ existing formula for column %s" t)) (and (eq org-table-formula-create-columns 'prompt) (yes-or-no-p - "Out-of-bounds formula. Add columns? "))))))) + "Out-of-bounds formula. Add columns? ")) + (user-error + "Missing columns in the table. Aborting")))))) (org-table-eval-formula nil formula t t t t)))) ;; Clean up markers and internal text property. (remove-text-properties (point-min) (point-max) '(org-untouchable t)) diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index 65e777b63ef..d840944ef17 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 8ec120e9b2f..132ad2b3035 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.1.6")) + (let ((org-release "9.1.9")) 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.1.6-50-g96b33f")) + (let ((org-git-version "release_9.1.9-65-g5e4542")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org-w3m.el b/lisp/org/org-w3m.el index 706619c5d2b..9690c8e90c6 100644 --- a/lisp/org/org-w3m.el +++ b/lisp/org/org-w3m.el @@ -4,7 +4,7 @@ ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org.el b/lisp/org/org.el index a53553bfd8b..1373861ad1b 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -6,8 +6,8 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Maintainer: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org -;; Version: 9.1.6 +;; Homepage: https://orgmode.org +;; Version: 9.1.9 ;; ;; This file is part of GNU Emacs. ;; @@ -49,7 +49,7 @@ ;; --------------------------- ;; See the corresponding sections in the manual at ;; -;; http://orgmode.org/org.html#Installation +;; https://orgmode.org/org.html#Installation ;; ;; Documentation ;; ------------- @@ -60,7 +60,7 @@ ;; in the doc/ directory. ;; ;; A list of recent changes can be found at -;; http://orgmode.org/Changes.html +;; https://orgmode.org/Changes.html ;; ;;; Code: @@ -1866,7 +1866,7 @@ See the manual for examples." (defcustom org-descriptive-links t "Non-nil means Org will display descriptive links. -E.g. [[http://orgmode.org][Org website]] will be displayed as +E.g. [[https://orgmode.org][Org website]] will be displayed as \"Org Website\", hiding the link itself and just displaying its description. When set to nil, Org will display the full links literally. @@ -3758,7 +3758,7 @@ This variable is populated from #+PROPERTY lines.") :group 'org) (defvar-local org-category nil - "Variable used by org files to set a category for agenda display. + "Variable used by Org files to set a category for agenda display. Such files should use a file variable to set it, for example # -*- mode: org; org-category: \"ELisp\" @@ -4040,7 +4040,7 @@ Place-holders only used by `:image-converter': (defcustom org-preview-latex-image-directory "ltximg/" "Path to store latex preview images. A relative path here creates many directories relative to the -processed org files paths. An absolute path puts all preview +processed Org files paths. An absolute path puts all preview images at the same place." :group 'org-latex :version "26.1" @@ -4238,9 +4238,9 @@ lines to the buffer: :type 'boolean) (defcustom org-hidden-keywords nil - "List of symbols corresponding to keywords to be hidden the org buffer. -For example, a value \\='(title) for this list will make the document's title -appear in the buffer without the initial #+TITLE: keyword." + "List of symbols corresponding to keywords to be hidden in the Org buffer. +For example, a value \\='(title) for this list makes the document's title +appear in the buffer without the initial \"#+TITLE:\" part." :group 'org-appearance :version "24.1" :type '(set (const :tag "#+AUTHOR" author) @@ -4903,6 +4903,18 @@ Support for group tags is controlled by the option (message "Groups tags support has been turned %s" (if org-group-tags "on" "off"))) +(defun org-tag-add-to-alist (alist1 alist2) + "Append ALIST1 elements to ALIST2 if they are not there yet." + (cond + ((null alist2) alist1) + ((null alist1) alist2) + (t (let ((alist2-cars (mapcar (lambda (x) (car-safe x)) alist2)) + to-add) + (dolist (i alist1) + (unless (member (car-safe i) alist2-cars) + (push i to-add))) + (append to-add alist2))))) + (defun org-set-regexps-and-options (&optional tags-only) "Precompute regular expressions used in the current buffer. When optional argument TAGS-ONLY is non-nil, only compute tags @@ -4931,10 +4943,11 @@ related expressions." (mapcar #'org-add-prop-inherited (cdr (assq 'filetags alist)))) (setq org-current-tag-alist - (append org-tag-persistent-alist - (let ((tags (cdr (assq 'tags alist)))) - (if tags (org-tag-string-to-alist tags) - org-tag-alist)))) + (org-tag-add-to-alist + org-tag-persistent-alist + (let ((tags (cdr (assq 'tags alist)))) + (if tags (org-tag-string-to-alist tags) + org-tag-alist)))) (setq org-tag-groups-alist (org-tag-alist-to-groups org-current-tag-alist)) (unless tags-only @@ -5249,7 +5262,7 @@ a string, summarizing TAGS, as a list of strings." (`(,(or :endgroup :endgrouptag)) (when (eq group-status 'append) (push (nreverse current-group) groups)) - (setq group-status nil)) + (setq group-status nil current-group nil)) (`(:grouptags) (setq group-status 'append)) ((and `(,tag . ,_) (guard group-status)) (if (eq group-status 'append) (push tag current-group) @@ -6052,17 +6065,21 @@ by a #." (defun org-fontify-macros (limit) "Fontify macros." - (when (re-search-forward "\\({{{\\).+?\\(}}}\\)" limit t) - (add-text-properties - (match-beginning 0) (match-end 0) - '(font-lock-fontified t face org-macro)) - (when org-hide-macro-markers - (add-text-properties (match-end 2) (match-beginning 2) - '(invisible t)) - (add-text-properties (match-beginning 1) (match-end 1) - '(invisible t))) - (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) - t)) + (when (re-search-forward "{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)" limit t) + (let ((begin (match-beginning 0)) + (opening-end (match-beginning 1))) + (when (and (re-search-forward "\n[ \t]*\n\\|\\(}}}\\)" limit t) + (match-string 1)) + (let ((end (match-end 1)) + (closing-start (match-beginning 1))) + (add-text-properties + begin end + '(font-lock-multiline t font-lock-fontified t face org-macro)) + (org-remove-flyspell-overlays-in begin end) + (when org-hide-macro-markers + (add-text-properties begin opening-end '(invisible t)) + (add-text-properties closing-start end '(invisible t))) + t))))) (defun org-activate-footnote-links (limit) "Add text properties for footnotes." @@ -8459,7 +8476,7 @@ This is a short-hand for marking the subtree and then cutting it." (org-copy-subtree n 'cut)) (defun org-copy-subtree (&optional n cut force-store-markers nosubtrees) - "Copy the current subtree it in the clipboard. + "Copy the current subtree into the clipboard. With prefix arg N, copy this many sequential subtrees. This is a short-hand for marking the subtree and then copying it. If CUT is non-nil, actually cut the subtree. @@ -8532,7 +8549,6 @@ When REMOVE is non-nil, remove the subtree from the clipboard." (org-with-limited-levels (let* ((visp (not (org-invisible-p))) (txt tree) - (^re_ "\\(\\*+\\)[ \t]*") (old-level (if (string-match org-outline-regexp-bol txt) (- (match-end 0) (match-beginning 0) 1) -1)) @@ -8549,7 +8565,7 @@ When REMOVE is non-nil, remove the subtree from the clipboard." (condition-case nil (progn (outline-previous-visible-heading 1) - (if (looking-at ^re_) + (if (looking-at org-outline-regexp-bol) (- (match-end 0) (match-beginning 0) 1) 1)) (error 1)))) @@ -8558,7 +8574,7 @@ When REMOVE is non-nil, remove the subtree from the clipboard." (progn (or (looking-at org-outline-regexp) (outline-next-visible-heading 1)) - (if (looking-at ^re_) + (if (looking-at org-outline-regexp-bol) (- (match-end 0) (match-beginning 0) 1) 1)) (error 1)))) @@ -9680,7 +9696,8 @@ active region." (cdr (assoc-string (completing-read "Which function for creating the link? " - (mapcar #'car results-alist) nil t name) + (mapcar #'car results-alist) + nil t (symbol-name name)) results-alist))) t)))) (setq link (plist-get org-store-link-plist :link)) @@ -14124,7 +14141,7 @@ headlines matching this string." 'org-todo-regexp org-todo-regexp 'org-complex-heading-regexp org-complex-heading-regexp 'help-echo - (format "mouse-2 or RET jump to org file %s" + (format "mouse-2 or RET jump to Org file %S" (abbreviate-file-name (or (buffer-file-name (buffer-base-buffer)) (buffer-name (buffer-base-buffer))))))) @@ -14320,10 +14337,12 @@ instead of the agenda files." (mapcar (lambda (file) (set-buffer (find-file-noselect file)) - (mapcar (lambda (x) - (and (stringp (car-safe x)) - (list (car-safe x)))) - (or org-current-tag-alist (org-get-buffer-tags)))) + (org-tag-add-to-alist + (org-get-buffer-tags) + (mapcar (lambda (x) + (and (stringp (car-safe x)) + (list (car-safe x)))) + org-current-tag-alist))) (if (car-safe files) files (org-agenda-files)))))))) @@ -14350,9 +14369,9 @@ See also `org-scan-tags'." ;; Get a new match request, with completion against the global ;; tags table and the local tags in current buffer. (let ((org-last-tags-completion-table - (org-uniquify - (delq nil (append (org-get-buffer-tags) - (org-global-tags-completion-table)))))) + (org-tag-add-to-alist + (org-get-buffer-tags) + (org-global-tags-completion-table)))) (setq match (completing-read "Match: " @@ -14534,7 +14553,7 @@ When DOWNCASE is non-nil, expand downcased TAGS." (tag (match-string 2 return-match)) (tag (if downcased (downcase tag) tag))) (unless (or (get-text-property 0 'grouptag (match-string 2 return-match)) - (member tag work-already-expanded)) + (member tag tags-already-expanded)) (setq tags-in-group (assoc tag taggroups)) (push tag work-already-expanded) ;; Recursively expand each tag in the group, if the tag hasn't @@ -14802,36 +14821,28 @@ Assume point is on a headline." (org-set-tags arg just-align)))) (defun org-set-tags-to (data) - "Set the tags of the current entry to DATA, replacing the current tags. -DATA may be a tags string like :aa:bb:cc:, or a list of tags. -If DATA is nil or the empty string, any tags will be removed." + "Set the tags of the current entry to DATA, replacing current tags. +DATA may be a tags string like \":aa:bb:cc:\", or a list of tags. +If DATA is nil or the empty string, all tags are removed." (interactive "sTags: ") - (setq data - (cond - ((eq data nil) "") - ((equal data "") "") - ((stringp data) - (concat ":" (mapconcat 'identity (org-split-string data ":+") ":") - ":")) - ((listp data) - (concat ":" (mapconcat 'identity data ":") ":")))) - (when data - (save-excursion - (org-back-to-heading t) - (when (let ((case-fold-search nil)) - (looking-at org-complex-heading-regexp)) - (if (match-end 5) - (progn - (goto-char (match-beginning 5)) - (insert data) - (delete-region (point) (point-at-eol)) - (org-set-tags nil 'align)) - (goto-char (point-at-eol)) - (insert " " data) - (org-set-tags nil 'align))) - (beginning-of-line 1) - (when (looking-at ".*?\\([ \t]+\\)$") - (delete-region (match-beginning 1) (match-end 1)))))) + (let ((data + (pcase (if (stringp data) (org-trim data) data) + ((or `nil "") nil) + ((pred listp) (format ":%s:" (mapconcat #'identity data ":"))) + ((pred stringp) + (format ":%s:" + (mapconcat #'identity (org-split-string data ":+") ":"))) + (_ (error "Invalid tag specification: %S" data))))) + (org-with-wide-buffer + (org-back-to-heading t) + (let ((case-fold-search nil)) (looking-at org-complex-heading-regexp)) + (when (or (match-end 5) data) + (goto-char (or (match-beginning 5) (line-end-position))) + (skip-chars-backward " \t") + (delete-region (point) (line-end-position)) + (when data + (insert " " data) + (org-set-tags nil 'align)))))) (defun org-align-all-tags () "Align the tags in all headings." @@ -14874,27 +14885,16 @@ When JUST-ALIGN is non-nil, only align tags." (if just-align current ;; Get a new set of tags from the user. (save-excursion - (let* ((seen) - (table + (let* ((table (setq org-last-tags-completion-table - ;; Uniquify tags in alists, yet preserve - ;; structure (i.e., keywords). - (delq nil - (mapcar - (lambda (pair) - (let ((head (car pair))) - (cond ((symbolp head) pair) - ((member head seen) nil) - (t (push head seen) - pair)))) - (append - (or org-current-tag-alist - (org-get-buffer-tags)) - (and - org-complete-tags-always-offer-all-agenda-tags - (org-global-tags-completion-table - (org-agenda-files)))))))) + (org-tag-add-to-alist + (and + org-complete-tags-always-offer-all-agenda-tags + (org-global-tags-completion-table + (org-agenda-files))) + (or org-current-tag-alist + (org-get-buffer-tags))))) (current-tags (org-split-string current ":")) (inherited-tags (nreverse (nthcdr (length current-tags) @@ -14973,9 +14973,9 @@ This works in the agenda, and also in an Org buffer." (list (region-beginning) (region-end) (let ((org-last-tags-completion-table (if (derived-mode-p 'org-mode) - (org-uniquify - (delq nil (append (org-get-buffer-tags) - (org-global-tags-completion-table)))) + (org-tag-add-to-alist + (org-get-buffer-tags) + (org-global-tags-completion-table)) (org-global-tags-completion-table)))) (completing-read "Tag: " 'org-tags-completion-function nil nil nil @@ -16510,7 +16510,7 @@ a priority cookie and tags in the standard locations." (move-marker (make-marker) (match-beginning 0)))))))) (defun org-find-exact-heading-in-directory (heading &optional dir) - "Find Org node headline HEADING in all .org files in directory DIR. + "Find Org node headline HEADING in all \".org\" files in directory DIR. When the target headline is found, return a marker to this location." (let ((files (directory-files (or dir default-directory) t "\\`[^.#].*\\.org\\'")) @@ -16633,10 +16633,18 @@ non-nil." (defun org-time-stamp-inactive (&optional arg) "Insert an inactive time stamp. + An inactive time stamp is enclosed in square brackets instead of angle brackets. It is inactive in the sense that it does not trigger agenda entries, does not link to the calendar and cannot be changed with the S-cursor keys. -So these are more for recording a certain time/date." +So these are more for recording a certain time/date. + +If the user specifies a time like HH:MM or if this command is called with +at least one prefix argument, the time stamp contains the date and the time. +Otherwise, only the date is included. + +When called with two universal prefix arguments, insert an active time stamp +with the current time without prompting the user." (interactive "P") (org-time-stamp arg 'inactive)) @@ -18230,7 +18238,7 @@ Prompt for confirmation when there are unsaved changes. Be sure you know what you are doing before letting this function overwrite your changes. -This function is useful in a setup where one tracks org files +This function is useful in a setup where one tracks Org files with a version control system, to revert on one machine after pulling changes from another. I believe the procedure must be like this: @@ -18552,9 +18560,9 @@ When a buffer is unmodified, it is just killed. When modified, it is saved (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-uniquify - (append org-tag-alist-for-agenda - org-current-tag-alist))) + (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 @@ -20988,9 +20996,12 @@ Use `\\[org-edit-special]' to edit table.el tables")) "Abort storing current note, or call `outline-show-branches'." (interactive) (if (not org-finish-function) - (progn - (outline-hide-subtree) - (call-interactively 'outline-show-branches)) + (save-excursion + (save-restriction + (org-narrow-to-subtree) + (org-flag-subtree t) + (call-interactively 'outline-show-branches) + (org-hide-archived-subtrees (point-min) (point-max)))) (let ((org-note-abort t)) (funcall org-finish-function)))) @@ -21104,7 +21115,13 @@ object (e.g., within a comment). In these case, you need to use (delete-and-extract-region (point) (line-end-position)))) (newline-and-indent) (save-excursion (insert trailing-data)))) - (t (if indent (newline-and-indent) (newline)))))) + (t + ;; Do not auto-fill when point is in an Org property drawer. + (let ((auto-fill-function (and (not (org-at-property-p)) + auto-fill-function))) + (if indent + (newline-and-indent) + (newline))))))) (defun org-return-indent () "Goto next table row or insert a newline and indent. @@ -21573,7 +21590,7 @@ such private information before sending the email.") "Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See - http://orgmode.org/manual/Feedback.html#Feedback + https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------") @@ -21613,7 +21630,7 @@ Your bug report will be posted to the Org mailing list. ;;;###autoload (defun org-reload (&optional uncompiled) - "Reload all org lisp files. + "Reload all Org Lisp files. With prefix arg UNCOMPILED, load the uncompiled versions." (interactive "P") (require 'loadhist) diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 83f6479bd4a..39f7d83e14a 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -465,7 +465,7 @@ customize `org-html-head-include-default-style'.") ;;;; Handle infojs (defvar org-html-infojs-opts-table - '((path PATH "http://orgmode.org/org-info.js") + '((path PATH "https://orgmode.org/org-info.js") (view VIEW "info") (toc TOC :with-toc) (ftoc FIXED_TOC "0") @@ -1324,7 +1324,7 @@ like that: \"%%\"." :type 'string) (defcustom org-html-creator-string - (format "<a href=\"https://www.gnu.org/software/emacs/\">Emacs</a> %s (<a href=\"http://orgmode.org\">Org</a> mode %s)" + (format "<a href=\"https://www.gnu.org/software/emacs/\">Emacs</a> %s (<a href=\"https://orgmode.org\">Org</a> mode %s)" emacs-version (if (fboundp 'org-version) (org-version) "unknown version")) "Information about the creator of the HTML document. @@ -1452,13 +1452,13 @@ done, timestamp, timestamp-kwd, tag, target. For example, a valid value would be: <style type=\"text/css\"> - <![CDATA[ - p { font-weight: normal; color: gray; } - h1 { color: black; } + /*<![CDATA[*/ + p { font-weight: normal; color: gray; } + h1 { color: black; } .title { text-align: center; } .todo, .timestamp-kwd { color: red; } .done { color: green; } - ]]> + /*]]>*/ </style> If you want to refer to an external style, use something like diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el index a87970eb3fd..7d7c8500472 100644 --- a/lisp/org/ox-icalendar.el +++ b/lisp/org/ox-icalendar.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Nicolas Goaziou <n dot goaziou at gmail dot com> ;; Keywords: outlines, hypermedia, calendar, wp -;; Homepage: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el index c32aa298047..5aaaf991fde 100644 --- a/lisp/org/ox-latex.el +++ b/lisp/org/ox-latex.el @@ -920,15 +920,14 @@ using customize, or with (add-to-list \\='org-latex-packages-alist \\='(\"newfloat\" \"minted\")) In addition, it is necessary to install pygments -\(http://pygments.org), and to configure the variable +\(URL `http://pygments.org>'), and to configure the variable `org-latex-pdf-process' so that the -shell-escape option is passed to pdflatex. The minted choice has possible repercussions on the preview of latex fragments (see `org-preview-latex-fragment'). If you run into previewing problems, please consult - - http://orgmode.org/worg/org-tutorials/org-latex-preview.html" +URL `https://orgmode.org/worg/org-tutorials/org-latex-preview.html'." :group 'org-export-latex :type '(choice (const :tag "Use listings" t) @@ -1719,7 +1718,7 @@ holding export options." ;; Table of contents. (let ((depth (plist-get info :with-toc))) (when depth - (concat (when (wholenump depth) + (concat (when (integerp depth) (format "\\setcounter{tocdepth}{%d}\n" depth)) (plist-get info :latex-toc-command)))) ;; Document's body. diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index cdee568fc81..a1145a9821c 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: http://orgmode.org +;; Homepage: https://orgmode.org ;; This file is part of GNU Emacs. diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el index 5deb7c54e71..8901dba34cf 100644 --- a/lisp/org/ox-publish.el +++ b/lisp/org/ox-publish.el @@ -405,11 +405,9 @@ definition." (defun org-publish--expand-file-name (file project) "Return full file name for FILE in PROJECT. When FILE is a relative file name, it is expanded according to -project base directory. Always return the true name of the file, -ignoring symlinks." - (file-truename - (if (file-name-absolute-p file) file - (expand-file-name file (org-publish-property :base-directory project))))) +project base directory." + (if (file-name-absolute-p file) file + (expand-file-name file (org-publish-property :base-directory project)))) (defun org-publish-expand-projects (projects-alist) "Expand projects in PROJECTS-ALIST. @@ -436,10 +434,32 @@ This splices all the components into the list." (match (if (eq extension 'any) "" (format "^[^\\.].*\\.\\(%s\\)$" extension))) (base-files - (cl-remove-if #'file-directory-p - (if (org-publish-property :recursive project) - (directory-files-recursively base-dir match) - (directory-files base-dir t match t))))) + (cond ((not (file-exists-p base-dir)) nil) + ((not (org-publish-property :recursive project)) + (cl-remove-if #'file-directory-p + (directory-files base-dir t match t))) + (t + ;; Find all files recursively. Unlike to + ;; `directory-files-recursively', we follow symlinks + ;; to other directories. + (letrec ((files nil) + (walk-tree + (lambda (dir depth) + (when (> depth 100) + (error "Apparent cycle of symbolic links for %S" + base-dir)) + (dolist (f (file-name-all-completions "" dir)) + (pcase f + ((or "./" "../") nil) + ((pred directory-name-p) + (funcall walk-tree + (expand-file-name f dir) + (1+ depth))) + ((pred (string-match match)) + (push (expand-file-name f dir) files)) + (_ nil))) + files))) + (funcall walk-tree base-dir 0)))))) (org-uniquify (append ;; Files from BASE-DIR. Apply exclusion filter before adding @@ -468,13 +488,13 @@ This splices all the components into the list." "Return a project that FILENAME belongs to. When UP is non-nil, return a meta-project (i.e., with a :components part) publishing FILENAME." - (let* ((filename (file-truename filename)) + (let* ((filename (expand-file-name filename)) (project (cl-some (lambda (p) ;; Ignore meta-projects. (unless (org-publish-property :components p) - (let ((base (file-truename + (let ((base (expand-file-name (org-publish-property :base-directory p)))) (cond ;; Check if FILENAME is explicitly included in one @@ -499,9 +519,7 @@ publishing FILENAME." ;; Check if FILENAME belong to project's base ;; directory, or some of its sub-directories ;; if :recursive in non-nil. - ((org-publish-property :recursive p) - (and (file-in-directory-p filename base) p)) - ((file-equal-p base (file-name-directory filename)) p) + ((member filename (org-publish-get-base-files p)) p) (t nil))))) org-publish-project-alist))) (cond @@ -1260,25 +1278,21 @@ the file including them will be republished as well." (with-current-buffer buf (goto-char (point-min)) (while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t) - (let* ((element (org-element-at-point)) - (included-file - (and (eq (org-element-type element) 'keyword) - (let ((value (org-element-property :value element))) - (and value - (string-match - "\\`\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)" - value) - (let ((m (match-string 1 value))) - (org-unbracket-string - "\"" "\"" - ;; Ignore search suffix. - (if (string-match "::.*?\"?\\'" m) - (substring m 0 (match-beginning 0)) - m)))))))) - (when included-file - (push (org-publish-cache-ctime-of-src - (expand-file-name included-file)) - included-files-ctime))))) + (let ((element (org-element-at-point))) + (when (eq 'keyword (org-element-type element)) + (let* ((value (org-element-property :value element)) + (filename + (and (string-match "\\`\\(\".+?\"\\|\\S-+\\)" value) + (let ((m (org-unbracket-string + "\"" "\"" (match-string 1 value)))) + ;; Ignore search suffix. + (if (string-match "::.*?\\'" m) + (substring m 0 (match-beginning 0)) + m))))) + (when filename + (push (org-publish-cache-ctime-of-src + (expand-file-name filename)) + included-files-ctime))))))) (unless visiting (kill-buffer buf))))) (or (null pstamp) (let ((ctime (org-publish-cache-ctime-of-src filename))) diff --git a/lisp/org/ox.el b/lisp/org/ox.el index 7bdac4f290d..ea7d1dc81f0 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -66,7 +66,7 @@ ;; Eventually, a dispatcher (`org-export-dispatch') is provided in the ;; last one. ;; -;; See <http://orgmode.org/worg/dev/org-export-reference.html> for +;; See <https://orgmode.org/worg/dev/org-export-reference.html> for ;; more information. ;;; Code: @@ -714,12 +714,15 @@ frequently in plain text." (defcustom org-export-with-toc t "Non-nil means create a table of contents in exported files. -The TOC contains headlines with levels up -to`org-export-headline-levels'. When an integer, include levels -up to N in the toc, this may then be different from -`org-export-headline-levels', but it will not be allowed to be -larger than the number of headline levels. When nil, no table of -contents is made. +The table of contents contains headlines with levels up to +`org-export-headline-levels'. + +When this variable is set to an integer N, include levels up to +N in the table of contents. Although it may then be different +from `org-export-headline-levels', it is cannot be larger than +the number of headline levels. + +When nil, no table of contents is created. This option can also be set with the OPTIONS keyword, e.g. \"toc:nil\" or \"toc:3\"." @@ -728,8 +731,9 @@ e.g. \"toc:nil\" or \"toc:3\"." (const :tag "No Table of Contents" nil) (const :tag "Full Table of Contents" t) (integer :tag "TOC to level")) - :safe (lambda (x) (or (booleanp x) - (integerp x)))) + :safe (lambda (x) + (or (booleanp x) + (integerp x)))) (defcustom org-export-with-tables t "Non-nil means export tables. @@ -1777,7 +1781,8 @@ for a footnotes section." "List headlines and inlinetasks with a select tag in their tree. DATA is parsed data as returned by `org-element-parse-buffer'. INFO is a plist holding export options." - (let ((select (plist-get info :select-tags))) + (let ((select (cl-mapcan (lambda (tag) (org-tags-expand tag t)) + (plist-get info :select-tags)))) (if (cl-some (lambda (tag) (member tag select)) (plist-get info :filetags)) ;; If FILETAGS contains a select tag, every headline or ;; inlinetask is returned. @@ -1811,11 +1816,13 @@ INFO is a plist holding export options." (funcall walk-data data nil) selected-trees)))) -(defun org-export--skip-p (datum options selected) +(defun org-export--skip-p (datum options selected excluded) "Non-nil when element or object DATUM should be skipped during export. OPTIONS is the plist holding export options. SELECTED, when non-nil, is a list of headlines or inlinetasks belonging to -a tree with a select tag." +a tree with a select tag. EXCLUDED is a list of tags, as +strings. Any headline or inlinetask marked with one of those is +not exported." (cl-case (org-element-type datum) ((comment comment-block) ;; Skip all comments and comment blocks. Make to keep maximum @@ -1854,8 +1861,7 @@ a tree with a select tag." (and (eq (org-element-type datum) 'inlinetask) (not (plist-get options :with-inlinetasks))) ;; Ignore subtrees with an exclude tag. - (cl-loop for k in (plist-get options :exclude-tags) - thereis (member k tags)) + (cl-some (lambda (tag) (member tag excluded)) tags) ;; When a select tag is present in the buffer, ignore any tree ;; without it. (and selected (not (memq datum selected))) @@ -2709,6 +2715,9 @@ from tree." (letrec ((ignore nil) ;; First find trees containing a select tag, if any. (selected (org-export--selected-trees data info)) + ;; List tags that prevent export of headlines. + (excluded (cl-mapcan (lambda (tag) (org-tags-expand tag t)) + (plist-get info :exclude-tags))) (walk-data (lambda (data) ;; Prune non-exportable elements and objects from tree. @@ -2717,7 +2726,7 @@ from tree." ;; accessed during export. (when data (let ((type (org-element-type data))) - (if (org-export--skip-p data info selected) + (if (org-export--skip-p data info selected excluded) (if (memq type '(table-cell table-row)) (push data ignore) (org-element-extract-element data)) (if (and (eq type 'headline) @@ -4264,7 +4273,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 is TYPE is `other'. + - NAME 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." |