Merge branch 'bugfix' into emacs-sync

This commit is contained in:
Kyle Meyer 2022-04-17 15:29:17 -04:00
commit 5ef858c254
11 changed files with 144 additions and 53 deletions

37
README
View File

@ -3,7 +3,8 @@
This is a distribution of Org, a plain text notes and project planning
tool for Emacs.
Check the [[https://orgmode.org][homepage of Org]] and the [[https://orgmode.org/org.html#Installation][installations instructions]].
Check the Org Mode website at https://orgmode.org and the installation
instructions at https://orgmode.org/org.html#Installation.
* Contents of this distribution
@ -11,9 +12,10 @@ Check the [[https://orgmode.org][homepage of Org]] and the [[https://orgmode.org
- COPYING :: The GNU General Public License.
- Makefile :: The makefile to compile and install Org. For
installation instructions, see [[https://orgmode.org/org.html#Installation][the manual]] or [[https://orgmode.org/worg/dev/org-build-system.html][this more detailed
procedure on Worg]].
- Makefile :: The makefile to compile and install Org. See the
installation instructions https://orgmode.org/org.html#Installation
or this more detailed procedure on Worg:
https://orgmode.org/worg/dev/org-build-system.html.
- mk/ :: Files needed for building Org.
@ -44,23 +46,24 @@ this are here http://www.gnu.org/help/evaluation
Don't have a program to contribute? Look at all the other ways to
help: https://www.gnu.org/help/help.html
And to learn more about Free (libre) Software in general, please
read and share this page: https://gnu.org/philosophy/free-sw.html
And to learn more about Free (libre) Software in general, please read
and share this page: https://gnu.org/philosophy/free-sw.html
* License
Org-mode is published under [[https://www.gnu.org/licenses/gpl-3.0.html][the GNU GPLv3 license]] or any later
version, the same as GNU Emacs.
Org-mode is published under the GNU GPLv3 license or any later
version, the same as GNU Emacs:
https://www.gnu.org/licenses/gpl-3.0.html
Org-mode is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Org-mode is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Emacs is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with Org mode. If not, see <https://www.gnu.org/licenses/>.
along with Org mode. If not, see https://www.gnu.org/licenses/.

View File

@ -6405,7 +6405,7 @@ special repeaters =++= and =.+=. For example:
Marking this DONE shifts the date to one month after today.
,** TODO Wash my hands
DEADLINE: <2019-04-05 08:00 Sun .+1h>
DEADLINE: <2019-04-05 08:00 Fri .+1h>
Marking this DONE shifts the date to exactly one hour from now.
#+end_example

View File

@ -233,6 +233,8 @@ Return a hash table with citation references as keys and fields alist as values.
entries)))
entries))
(defvar org-cite-basic--file-id-cache nil
"Hash table linking files to their hash.")
(defun org-cite-basic--parse-bibliography (&optional info)
"List all entries available in the buffer.
@ -245,14 +247,19 @@ table where keys are references and values are association lists between fields,
as symbols, and values as strings or nil.
Optional argument INFO is the export state, as a property list."
(unless (hash-table-p org-cite-basic--file-id-cache)
(setq org-cite-basic--file-id-cache (make-hash-table :test #'equal)))
(if (plist-member info :cite-basic/bibliography)
(plist-get info :cite-basic/bibliography)
(let ((results nil))
(dolist (file (org-cite-list-bibliography-files))
(when (file-readable-p file)
(with-temp-buffer
(insert-file-contents file)
(let* ((file-id (cons file (org-buffer-hash)))
(when (or (org-file-has-changed-p file)
(not (gethash file org-cite-basic--file-id-cache)))
(insert-file-contents file)
(puthash file (org-buffer-hash) org-cite-basic--file-id-cache))
(let* ((file-id (cons file (gethash file org-cite-basic--file-id-cache)))
(entries
(or (cdr (assoc file-id org-cite-basic--bibliography-cache))
(let ((table
@ -727,19 +734,24 @@ Return nil if there are no bibliography files or no entries."
(t
(clrhash org-cite-basic--completion-cache)
(dolist (key (org-cite-basic--all-keys))
(let ((completion
(concat
(let ((author (org-cite-basic--get-field 'author key nil t)))
(if author
(truncate-string-to-width
(replace-regexp-in-string " and " "; " author)
org-cite-basic-author-column-end nil ?\s)
(make-string org-cite-basic-author-column-end ?\s)))
org-cite-basic-column-separator
(let ((date (org-cite-basic--get-year key nil 'no-suffix)))
(format "%4s" (or date "")))
org-cite-basic-column-separator
(org-cite-basic--get-field 'title key nil t))))
(let* ((entry (org-cite-basic--get-entry
key
;; Supply pre-calculated bibliography to avoid
;; performance degradation.
(list :cite-basic/bibliography entries)))
(completion
(concat
(let ((author (org-cite-basic--get-field 'author entry nil 'raw)))
(if author
(truncate-string-to-width
(replace-regexp-in-string " and " "; " author)
org-cite-basic-author-column-end nil ?\s)
(make-string org-cite-basic-author-column-end ?\s)))
org-cite-basic-column-separator
(let ((date (org-cite-basic--get-year entry nil 'no-suffix)))
(format "%4s" (or date "")))
org-cite-basic-column-separator
(org-cite-basic--get-field 'title entry nil t))))
(puthash completion key org-cite-basic--completion-cache)))
(unless (map-empty-p org-cite-basic--completion-cache) ;no key
(puthash entries t org-cite-basic--completion-cache)

View File

@ -164,12 +164,7 @@ INFO is the export state, as a property list."
(mapconcat (lambda (r)
(org-cite-biblatex--atomic-arguments (list r) info))
(org-cite-get-references citation)
"")
;; According to BibLaTeX manual, left braces or brackets
;; following a multicite command could be parsed as other
;; arguments. So we stop any further parsing by inserting
;; a \relax unconditionally.
"\\relax")))
""))))
(defun org-cite-biblatex--command (citation info base &optional multi no-opt)
"Return biblatex command using BASE name for CITATION object.

View File

@ -4859,7 +4859,7 @@ Press `\\[org-agenda-manipulate-query-add]', \
;;;###autoload
(defun org-todo-list (&optional arg)
"Show all (not done) TODO entries from all agenda file in a single list.
"Show all (not done) TODO entries from all agenda files in a single list.
The prefix arg can be used to select a specific TODO keyword and limit
the list to these. When using `\\[universal-argument]', you will be prompted
for a keyword. A numeric prefix directly selects the Nth keyword in
@ -5732,7 +5732,7 @@ displayed in agenda view."
(org-before-first-heading-p)
(and org-agenda-include-inactive-timestamps
(org-at-clock-log-p))
(not (eq 'timestamp (org-element-type (org-element-context)))))
(not (org-at-timestamp-p 'agenda)))
(throw :skip nil))
(org-agenda-skip))
(let* ((pos (match-beginning 0))
@ -7180,12 +7180,13 @@ The optional argument TYPE tells the agenda type."
(concat
(substring x 0 (match-end 1))
(unless (string= org-agenda-todo-keyword-format "")
(format org-agenda-todo-keyword-format
(match-string 2 x)))
;; Remove `display' property as the icon could leak
;; on the white space.
(org-add-props " " (org-plist-delete (text-properties-at 0 x)
'display))
(format org-agenda-todo-keyword-format
(match-string 2 x)))
(unless (string= org-agenda-todo-keyword-format "")
;; Remove `display' property as the icon could leak
;; on the white space.
(org-add-props " " (org-plist-delete (text-properties-at 0 x)
'display)))
(substring x (match-end 3)))))))
x)))

View File

@ -71,6 +71,35 @@
(defvar org-table-tab-recognizes-table.el)
(defvar org-table1-hline-regexp)
;;; Emacs < 29 compatibility
(defvar org-file-has-changed-p--hash-table (make-hash-table :test #'equal)
"Internal variable used by `org-file-has-changed-p'.")
(if (fboundp 'file-has-changed-p)
(defalias 'org-file-has-changed-p #'file-has-changed-p)
(defun org-file-has-changed-p (file &optional tag)
"Return non-nil if FILE has changed.
The size and modification time of FILE are compared to the size
and modification time of the same FILE during a previous
invocation of `org-file-has-changed-p'. Thus, the first invocation
of `org-file-has-changed-p' always returns non-nil when FILE exists.
The optional argument TAG, which must be a symbol, can be used to
limit the comparison to invocations with identical tags; it can be
the symbol of the calling function, for example."
(let* ((file (directory-file-name (expand-file-name file)))
(remote-file-name-inhibit-cache t)
(fileattr (file-attributes file 'integer))
(attr (and fileattr
(cons (file-attribute-size fileattr)
(file-attribute-modification-time fileattr))))
(sym (concat (symbol-name tag) "@" file))
(cachedattr (gethash sym org-file-has-changed-p--hash-table)))
(when (not (equal attr cachedattr))
(puthash sym attr org-file-has-changed-p--hash-table)))))
;;; Emacs < 28.1 compatibility

View File

@ -462,14 +462,14 @@ This may be useful when columns have been shrunk."
(when pos (goto-char pos))
(goto-char (line-beginning-position))
(let ((end (line-end-position)) str)
(backward-char)
(goto-char (1- pos))
(while (progn (forward-char 1) (< (point) end))
(let ((ov (car (overlays-at (point)))))
(if (not ov)
(push (char-to-string (char-after)) str)
(push (overlay-get ov 'display) str)
(goto-char (1- (overlay-end ov))))))
(format "%s" (mapconcat #'identity (reverse str) "")))))
(format "|%s" (mapconcat #'identity (reverse str) "")))))
(defvar-local org-table-header-overlay nil)
(defun org-table-header-set-header ()

View File

@ -199,6 +199,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
(declare-function org-update-radio-target-regexp "ol" ())
(defvar org-element-paragraph-separate)
(defvar org-element--timestamp-regexp)
(defvar org-indent-indentation-per-level)
(defvar org-radio-target-regexp)
(defvar org-target-link-regexp)
@ -15020,7 +15021,11 @@ When matching, the match groups are the following:
group 4: day name
group 5: hours, if any
group 6: minutes, if any"
(let* ((regexp (if extended org-ts-regexp3 org-ts-regexp2))
(let* ((regexp (if extended
(if (eq extended 'agenda)
org-element--timestamp-regexp
org-ts-regexp3)
org-ts-regexp2))
(pos (point))
(match?
(let ((boundaries (org-in-regexp regexp)))
@ -15051,7 +15056,8 @@ When matching, the match groups are the following:
((org-pos-in-match-range pos 8) 'minute)
((or (org-pos-in-match-range pos 4)
(org-pos-in-match-range pos 5)) 'day)
((and (> pos (or (match-end 8) (match-end 5)))
((and (or (match-end 8) (match-end 5))
(> pos (or (match-end 8) (match-end 5)))
(< pos (match-end 0)))
(- pos (or (match-end 8) (match-end 5))))
(t 'day))))

View File

@ -442,7 +442,7 @@ property on the headline itself.")
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
.org-svg { }
</style>"
"The default style specification for exported HTML files.
You can use `org-html-head' and `org-html-head-extra' to add to

View File

@ -16,3 +16,11 @@ SCHEDULED: <2022-01-03 Mon>
#+begin_example
SCHEDULED: <2022-01-03 Mon>
#+end_example
* test timestamp inside properties
:PROPERTIES:
:CREATED: <2022-03-22 Tue>
:END:
* test sexp timestamp inside properties
:PROPERTIES:
:CREATED: <%%(diary-date 03 25 2022)>
:END:

View File

@ -72,6 +72,9 @@
(let ((org-agenda-span 'day)
(org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
org-test-dir))))
;; NOTE: Be aware that `org-agenda-list' may or may not display
;; past scheduled items depending whether the date is today
;; `org-today' or not.
(org-agenda-list nil "<2017-03-10 Fri>")
(set-buffer org-agenda-buffer-name)
(should (= 3 (count-lines (point-min) (point-max)))))
@ -85,6 +88,9 @@
(let ((org-agenda-span 'day)
(org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
org-test-dir))))
;; NOTE: Be aware that `org-agenda-list' may or may not display
;; past scheduled items depending whether the date is today
;; `org-today' or not.
(org-agenda-list nil "<2017-07-19 Wed>")
(set-buffer org-agenda-buffer-name)
(should
@ -101,11 +107,37 @@ See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t."
(let ((org-agenda-span 'day)
(org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
org-test-dir))))
;; NOTE: Be aware that `org-agenda-list' may or may not display
;; past scheduled items depending whether the date is today
;; `org-today' or not.
(org-agenda-list nil "<2022-01-03 Mon>")
(set-buffer org-agenda-buffer-name)
(should (= 2 (count-lines (point-min) (point-max)))))
(org-test-agenda--kill-all-agendas))
(ert-deftest test-org-agenda/property-timestamp ()
"Match timestamps inside property drawer.
See https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com"
(cl-assert (not org-agenda-sticky) nil "precondition violation")
(cl-assert (not (org-test-agenda--agenda-buffers))
nil "precondition violation")
(let ((org-agenda-span 'day)
(org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
org-test-dir))))
;; NOTE: Be aware that `org-agenda-list' may or may not display
;; past scheduled items depending whether the date is today
;; `org-today' or not.
(org-agenda-list nil "<2022-03-22 Tue>")
(set-buffer org-agenda-buffer-name)
(should (= 3 (count-lines (point-min) (point-max))))
;; NOTE: Be aware that `org-agenda-list' may or may not display
;; past scheduled items depending whether the date is today
;; `org-today' or not.
(org-agenda-list nil "<2022-03-25 Fri>")
(set-buffer org-agenda-buffer-name)
(should (= 3 (count-lines (point-min) (point-max)))))
(org-test-agenda--kill-all-agendas))
(ert-deftest test-org-agenda/set-priority ()
"One informative line in the agenda. Check that org-agenda-priority updates the agenda."
(cl-assert (not org-agenda-sticky) nil "precondition violation")
@ -114,9 +146,11 @@ See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t."
(let ((org-agenda-span 'day)
(org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
org-test-dir))))
;; NOTE: Be aware that `org-agenda-list' may or may not display
;; past scheduled items depending whether the date is today
;; `org-today' or not.
(org-agenda-list nil "<2017-07-19 Wed>")
(set-buffer org-agenda-buffer-name)
(should
(progn (goto-line 3)
(org-agenda-priority ?B)
@ -209,6 +243,9 @@ See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t."
(dayname "\\W")))
(org-agenda-span 'day)
(org-agenda-include-diary t))
;; NOTE: Be aware that `org-agenda-list' may or may not display
;; past scheduled items depending whether the date is today
;; `org-today' or not.
(org-agenda-list nil "<2019-01-08>")
(should (search-forward "f0bcf0cd8bad93c1451bb6e1b2aaedef5cce7cbb" nil t))
(org-test-agenda--kill-all-agendas)))