summaryrefslogtreecommitdiff
path: root/lisp/org
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/org')
-rw-r--r--lisp/org/ob-abc.el4
-rw-r--r--lisp/org/ob-core.el7
-rw-r--r--lisp/org/ob-eval.el2
-rw-r--r--lisp/org/ob-forth.el2
-rw-r--r--lisp/org/org-agenda.el74
-rw-r--r--lisp/org/org-attach.el2
-rw-r--r--lisp/org/org-capture.el8
-rw-r--r--lisp/org/org-clock.el136
-rw-r--r--lisp/org/org-colview.el10
-rw-r--r--lisp/org/org-ctags.el5
-rw-r--r--lisp/org/org-datetree.el9
-rw-r--r--lisp/org/org-duration.el9
-rw-r--r--lisp/org/org-element.el15
-rw-r--r--lisp/org/org-eshell.el2
-rw-r--r--lisp/org/org-footnote.el2
-rw-r--r--lisp/org/org-habit.el5
-rw-r--r--lisp/org/org-id.el7
-rw-r--r--lisp/org/org-indent.el29
-rw-r--r--lisp/org/org-list.el4
-rw-r--r--lisp/org/org-macro.el5
-rw-r--r--lisp/org/org-macs.el2
-rw-r--r--lisp/org/org-mhe.el2
-rw-r--r--lisp/org/org-mobile.el4
-rw-r--r--lisp/org/org-mouse.el2
-rw-r--r--lisp/org/org-pcomplete.el26
-rw-r--r--lisp/org/org-plot.el2
-rw-r--r--lisp/org/org-protocol.el17
-rw-r--r--lisp/org/org-table.el23
-rw-r--r--lisp/org/org-timer.el32
-rw-r--r--lisp/org/org.el182
-rw-r--r--lisp/org/ox-ascii.el4
-rw-r--r--lisp/org/ox-html.el3
-rw-r--r--lisp/org/ox-latex.el2
-rw-r--r--lisp/org/ox-odt.el4
-rw-r--r--lisp/org/ox-publish.el21
-rw-r--r--lisp/org/ox.el4
36 files changed, 334 insertions, 333 deletions
diff --git a/lisp/org/ob-abc.el b/lisp/org/ob-abc.el
index cefbe716e15..43ee1d9921b 100644
--- a/lisp/org/ob-abc.el
+++ b/lisp/org/ob-abc.el
@@ -47,7 +47,7 @@
(value (cdr pair)))
(setq body
(replace-regexp-in-string
- (concat "\$" (regexp-quote name))
+ (concat "\\$" (regexp-quote name))
(if (stringp value) value (format "%S" value))
body))))
vars)
@@ -59,7 +59,7 @@
(message "executing Abc source code block")
(let* ((cmdline (cdr (assq :cmdline params)))
(out-file (let ((file (cdr (assq :file params))))
- (if file (replace-regexp-in-string "\.pdf$" ".ps" file)
+ (if file (replace-regexp-in-string "\\.pdf$" ".ps" file)
(error "abc code block requires :file header argument"))))
(in-file (org-babel-temp-file "abc-"))
(render (concat "abcm2ps" " " cmdline
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 3649d6666c8..b6c54a92ab6 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -2310,10 +2310,9 @@ INFO may provide the values of these header arguments (in the
(lambda (r)
;; Non-nil when result R can be turned into
;; a table.
- (and (listp r)
- (null (cdr (last r)))
+ (and (proper-list-p r)
(cl-every
- (lambda (e) (or (atom e) (null (cdr (last e)))))
+ (lambda (e) (or (atom e) (proper-list-p e)))
result)))))
;; insert results based on type
(cond
@@ -2956,7 +2955,7 @@ If the table is trivial, then return it as a scalar."
(defun org-babel-string-read (cell)
"Strip nested \"s from around strings."
(org-babel-read (or (and (stringp cell)
- (string-match "\\\"\\(.+\\)\\\"" cell)
+ (string-match "\"\\(.+\\)\"" cell)
(match-string 1 cell))
cell) t))
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index 0587851e8bd..8d5b7ed2674 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -120,7 +120,7 @@ function in various versions of Emacs.
(delete-file input-file))
(when (and error-file (file-exists-p error-file))
- (when (< 0 (nth 7 (file-attributes error-file)))
+ (when (< 0 (file-attribute-size (file-attributes error-file)))
(with-current-buffer (get-buffer-create error-buffer)
(let ((pos-from-end (- (point-max) (point))))
(or (bobp)
diff --git a/lisp/org/ob-forth.el b/lisp/org/ob-forth.el
index 8ca292656a2..88ed964fd77 100644
--- a/lisp/org/ob-forth.el
+++ b/lisp/org/ob-forth.el
@@ -53,7 +53,7 @@ This function is called by `org-babel-execute-src-block'"
(defun org-babel-forth-session-execute (body params)
(require 'forth-mode)
(let ((proc (forth-proc))
- (rx " \\(\n:\\|compiled\n\\\|ok\n\\)")
+ (rx " \\(\n:\\|compiled\n\\|ok\n\\)")
(result-start))
(with-current-buffer (process-buffer (forth-proc))
(mapcar (lambda (line)
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index f1335a50668..23ee8d71e66 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -1401,6 +1401,9 @@ current display in the agenda."
:group 'org-agenda-daily/weekly
:type 'plist)
+(defvaralias 'org-agenda-search-view-search-words-only
+ 'org-agenda-search-view-always-boolean)
+
(defcustom org-agenda-search-view-always-boolean nil
"Non-nil means the search string is interpreted as individual parts.
@@ -1429,9 +1432,6 @@ boolean search."
:version "24.1"
:type 'boolean)
-(defvaralias 'org-agenda-search-view-search-words-only
- 'org-agenda-search-view-always-boolean)
-
(defcustom org-agenda-search-view-force-full-words nil
"Non-nil means, search words must be matches as complete words.
When nil, they may also match part of a word."
@@ -1873,6 +1873,9 @@ Nil means don't hide any tags."
(const :tag "Hide none" nil)
(string :tag "Regexp ")))
+(defvaralias 'org-agenda-remove-tags-when-in-prefix
+ 'org-agenda-remove-tags)
+
(defcustom org-agenda-remove-tags nil
"Non-nil means remove the tags from the headline copy in the agenda.
When this is the symbol `prefix', only remove tags when
@@ -1883,8 +1886,7 @@ When this is the symbol `prefix', only remove tags when
(const :tag "Never" nil)
(const :tag "When prefix format contains %T" prefix)))
-(defvaralias 'org-agenda-remove-tags-when-in-prefix
- 'org-agenda-remove-tags)
+(defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)
(defcustom org-agenda-tags-column 'auto
"Shift tags in agenda items to this column.
@@ -1902,8 +1904,6 @@ character screen."
:package-version '(Org . "9.1")
:version "26.1")
-(defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)
-
(defcustom org-agenda-fontify-priorities 'cookies
"Non-nil means highlight low and high priorities in agenda.
When t, the highest priority entries are bold, lowest priority italic.
@@ -2067,9 +2067,9 @@ works you probably want to add it to `org-agenda-custom-commands' for good."
;;; Define the org-agenda-mode
+(defvaralias 'org-agenda-keymap 'org-agenda-mode-map)
(defvar org-agenda-mode-map (make-sparse-keymap)
"Keymap for `org-agenda-mode'.")
-(defvaralias 'org-agenda-keymap 'org-agenda-mode-map)
(defvar org-agenda-menu) ; defined later in this file.
(defvar org-agenda-restrict nil) ; defined later in this file.
@@ -2205,10 +2205,14 @@ The following commands are available:
(add-hook 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
(add-hook 'pre-command-hook 'org-unhighlight nil 'local)
;; Make sure properties are removed when copying text
- (add-hook 'filter-buffer-substring-functions
- (lambda (fun start end delete)
- (substring-no-properties (funcall fun start end delete)))
- nil t)
+ (if (boundp 'filter-buffer-substring-functions)
+ (add-hook 'filter-buffer-substring-functions
+ (lambda (fun start end delete)
+ (substring-no-properties (funcall fun start end delete)))
+ nil t)
+ ;; Emacs >= 24.4.
+ (add-function :filter-return (local 'filter-buffer-substring-function)
+ #'substring-no-properties))
(unless org-agenda-keep-modes
(setq org-agenda-follow-mode org-agenda-start-with-follow-mode
org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode
@@ -2878,13 +2882,12 @@ Pressing `<' twice means to restrict to the current subtree or region
(let* ((m (org-agenda-get-any-marker))
(note (and m (org-entry-get m "THEFLAGGINGNOTE"))))
(when note
- (message (concat
- "FLAGGING-NOTE ([?] for more info): "
- (org-add-props
- (replace-regexp-in-string
- "\\\\n" "//"
- (copy-sequence note))
- nil 'face 'org-warning)))))))
+ (message "FLAGGING-NOTE ([?] for more info): %s"
+ (org-add-props
+ (replace-regexp-in-string
+ "\\\\n" "//"
+ (copy-sequence note))
+ nil 'face 'org-warning))))))
t t))
((equal org-keys "#") (call-interactively 'org-agenda-list-stuck-projects))
((equal org-keys "/") (call-interactively 'org-occur-in-agenda-files))
@@ -5487,8 +5490,8 @@ displayed in agenda view."
(substring
(format-time-string
(car org-time-stamp-formats)
- (apply #'encode-time ; DATE bound by calendar
- (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+ (encode-time ; DATE bound by calendar
+ 0 0 0 (nth 1 date) (car date) (nth 2 date)))
1 11))
"\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
"\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
@@ -5738,8 +5741,8 @@ then those holidays will be skipped."
(substring
(format-time-string
(car org-time-stamp-formats)
- (apply 'encode-time ; DATE bound by calendar
- (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+ (encode-time ; DATE bound by calendar
+ 0 0 0 (nth 1 date) (car date) (nth 2 date)))
1 11))))
(org-agenda-search-headline-for-time nil)
marker hdmarker priority category level tags closedp
@@ -5856,21 +5859,19 @@ See also the user option `org-agenda-clock-consistency-checks'."
(throw 'next t))
(setq ts (match-string 1)
te (match-string 3)
- ts (float-time
- (apply #'encode-time (org-parse-time-string ts)))
- te (float-time
- (apply #'encode-time (org-parse-time-string te)))
+ ts (float-time (org-time-string-to-time ts))
+ te (float-time (org-time-string-to-time te))
dt (- te ts))))
(cond
((> dt (* 60 maxtime))
;; a very long clocking chunk
(setq issue (format "Clocking interval is very long: %s"
- (org-duration-from-minutes (floor (/ dt 60.))))
+ (org-duration-from-minutes (floor dt 60)))
face (or (plist-get pl :long-face) face)))
((< dt (* 60 mintime))
;; a very short clocking chunk
(setq issue (format "Clocking interval is very short: %s"
- (org-duration-from-minutes (floor (/ dt 60.))))
+ (org-duration-from-minutes (floor dt 60)))
face (or (plist-get pl :short-face) face)))
((and (> tlend 0) (< ts tlend))
;; Two clock entries are overlapping
@@ -5910,8 +5911,8 @@ See also the user option `org-agenda-clock-consistency-checks'."
(throw 'exit t))
;; We have a shorter gap.
;; Now we have to get the minute of the day when these times are
- (let* ((t1dec (decode-time (seconds-to-time t1)))
- (t2dec (decode-time (seconds-to-time t2)))
+ (let* ((t1dec (decode-time t1))
+ (t2dec (decode-time t2))
;; compute the minute on the day
(min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec))))
(min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec)))))
@@ -7005,15 +7006,15 @@ When TYPE is \"scheduled\", \"deadline\", \"timestamp\" or
\"timestamp_ia\", compare within each of these type. When TYPE
is the empty string, compare all timestamps without respect of
their type."
- (let* ((def (if org-sort-agenda-notime-is-late most-positive-fixnum -1))
+ (let* ((def (and (not org-sort-agenda-notime-is-late) -1))
(ta (or (and (string-match type (or (get-text-property 1 'type a) ""))
(get-text-property 1 'ts-date a))
def))
(tb (or (and (string-match type (or (get-text-property 1 'type b) ""))
(get-text-property 1 'ts-date b))
def)))
- (cond ((< ta tb) -1)
- ((< tb ta) +1))))
+ (cond ((if ta (and tb (< ta tb)) tb) -1)
+ ((if tb (and ta (< tb ta)) ta) +1))))
(defsubst org-cmp-habit-p (a b)
"Compare the todo states of strings A and B."
@@ -9444,7 +9445,7 @@ the resulting entry will not be shown. When TEXT is empty, switch to
(goto-char (point-min))
(cond
((eq type 'anniversary)
- (or (re-search-forward "^*[ \t]+Anniversaries" nil t)
+ (or (re-search-forward "^\\*[ \t]+Anniversaries" nil t)
(progn
(or (org-at-heading-p t)
(progn
@@ -10155,8 +10156,7 @@ to override `appt-message-warning-time'."
;; Do not use `org-today' here because appt only takes
;; time and without date as argument, so it may pass wrong
;; information otherwise
- (today (org-date-to-gregorian
- (time-to-days (current-time))))
+ (today (org-date-to-gregorian (time-to-days nil)))
(org-agenda-restrict nil)
(files (org-agenda-files 'unrestricted)) entries file
(org-agenda-buffer nil))
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index db8b61b3d51..f430cd5ed3e 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -352,7 +352,7 @@ This checks for the existence of a \".git\" directory in that directory."
(shell-command-to-string
"git ls-files -zmo --exclude-standard") "\0" t))
(if (and use-annex
- (>= (nth 7 (file-attributes new-or-modified))
+ (>= (file-attribute-size (file-attributes new-or-modified))
org-attach-git-annex-cutoff))
(call-process "git" nil nil nil "annex" "add" new-or-modified)
(call-process "git" nil nil nil "add" new-or-modified))
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index a699d2e28fc..dbba33b50d0 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1000,8 +1000,7 @@ Store them in the capture property list."
(equal current-prefix-arg 1))
;; Prompt for date.
(let ((prompt-time (org-read-date
- nil t nil "Date for tree entry:"
- (current-time))))
+ nil t nil "Date for tree entry:" nil)))
(org-capture-put
:default-time
(cond ((and (or (not (boundp 'org-time-was-given))
@@ -1009,9 +1008,8 @@ Store them in the capture property list."
(not (= (time-to-days prompt-time) (org-today))))
;; Use 00:00 when no time is given for another
;; date than today?
- (apply #'encode-time
- (append '(0 0 0)
- (cl-cdddr (decode-time prompt-time)))))
+ (apply #'encode-time 0 0 0
+ (cl-cdddr (decode-time prompt-time))))
((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)"
org-read-date-final-answer)
;; Replace any time range by its start.
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index a9b933c8e37..62c7cd92d12 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -723,8 +723,8 @@ menu\nmouse-2 will jump to task"))
The time returned includes the time spent on this task in
previous clocking intervals."
(let ((currently-clocked-time
- (floor (- (float-time)
- (float-time org-clock-start-time)) 60)))
+ (floor (encode-time (time-since org-clock-start-time) 'integer)
+ 60)))
(+ currently-clocked-time (or org-clock-total-time 0))))
(defun org-clock-modify-effort-estimate (&optional value)
@@ -932,7 +932,7 @@ If necessary, clock-out of the currently active clock."
(unless (org-is-active-clock clock)
(org-clock-clock-in clock t))))
- ((not (time-less-p resolve-to (current-time)))
+ ((not (time-less-p resolve-to nil))
(error "RESOLVE-TO must refer to a time in the past"))
(t
@@ -1033,8 +1033,8 @@ to be CLOCKED OUT."))))
nil 45)))
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
(default
- (floor (/ (float-time
- (time-subtract (current-time) last-valid)) 60)))
+ (floor (encode-time (time-since last-valid) 'integer)
+ 60))
(keep
(and (memq ch '(?k ?K))
(read-number "Keep how many minutes? " default)))
@@ -1042,8 +1042,9 @@ to be CLOCKED OUT."))))
(and (memq ch '(?g ?G))
(read-number "Got back how many minutes ago? " default)))
(subtractp (memq ch '(?s ?S)))
- (barely-started-p (< (- (float-time last-valid)
- (float-time (cdr clock))) 45))
+ (barely-started-p (time-less-p
+ (time-subtract last-valid (cdr clock))
+ 45))
(start-over (and subtractp barely-started-p)))
(cond
((memq ch '(?j ?J))
@@ -1069,10 +1070,9 @@ to be CLOCKED OUT."))))
(and gotback (= gotback default)))
'now)
(keep
- (time-add last-valid (seconds-to-time (* 60 keep))))
+ (time-add last-valid (* 60 keep)))
(gotback
- (time-subtract (current-time)
- (seconds-to-time (* 60 gotback))))
+ (time-since (* 60 gotback)))
(t
(error "Unexpected, please report this as a bug")))
(and gotback last-valid)
@@ -1102,8 +1102,8 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
(lambda (clock)
(format
"Dangling clock started %d mins ago"
- (floor (- (float-time)
- (float-time (cdr clock)))
+ (floor (encode-time (time-since (cdr clock))
+ 'integer)
60)))))
(or last-valid
(cdr clock)))))))))))
@@ -1154,8 +1154,7 @@ so long."
org-clock-marker (marker-buffer org-clock-marker))
(let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
(org-clock-user-idle-start
- (time-subtract (current-time)
- (seconds-to-time org-clock-user-idle-seconds)))
+ (time-since org-clock-user-idle-seconds))
(org-clock-resolving-clocks-due-to-idleness t))
(if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
(org-clock-resolve
@@ -1164,9 +1163,8 @@ so long."
(lambda (_)
(format "Clocked in & idle for %.1f mins"
(/ (float-time
- (time-subtract (current-time)
- org-clock-user-idle-start))
- 60.0)))
+ (time-since org-clock-user-idle-start))
+ 60)))
org-clock-user-idle-start)))))
(defvar org-clock-current-task nil "Task currently clocked in.")
@@ -1293,8 +1291,7 @@ the default behavior."
(setq ts (concat "[" (match-string 1) "]"))
(goto-char (match-end 1))
(setq org-clock-start-time
- (apply 'encode-time
- (org-parse-time-string (match-string 1))))
+ (org-time-string-to-time (match-string 1)))
(setq org-clock-effort (org-entry-get (point) org-effort-property))
(setq org-clock-total-time (org-clock-sum-current-item
(org-clock-get-sum-start))))
@@ -1324,9 +1321,11 @@ the default behavior."
(y-or-n-p
(format
"You stopped another clock %d mins ago; start this one from then? "
- (/ (- (float-time
- (org-current-time org-clock-rounding-minutes t))
- (float-time leftover))
+ (/ (encode-time
+ (time-subtract
+ (org-current-time org-clock-rounding-minutes t)
+ leftover)
+ 'integer)
60)))
leftover)
start-time
@@ -1431,7 +1430,7 @@ The time is always returned as UTC."
(day (nth 3 dt)))
(if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day)))
(setf (nth 2 dt) org-extend-today-until)
- (apply #'encode-time (append (list 0 0) (nthcdr 2 dt)))))
+ (apply #'encode-time 0 0 (nthcdr 2 dt))))
((or (equal cmt "all")
(and (or (not cmt) (equal cmt "auto"))
(not lr)))
@@ -1577,21 +1576,19 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(delete-region (point) (point-at-eol))
(insert "--")
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
- (setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te)))
- (float-time
- (apply #'encode-time (org-parse-time-string ts))))
- h (floor (/ s 3600))
- s (- s (* 3600 h))
- m (floor (/ s 60))
- s (- s (* 60 s)))
+ (setq s (encode-time (time-subtract
+ (org-time-string-to-time te)
+ (org-time-string-to-time ts))
+ 'integer)
+ h (floor s 3600)
+ m (floor (mod s 3600) 60))
(insert " => " (format "%2d:%02d" h m))
(move-marker org-clock-marker nil)
(move-marker org-clock-hd-marker nil)
;; Possibly remove zero time clocks. However, do not add
;; a note associated to the CLOCK line in this case.
(cond ((and org-clock-out-remove-zero-time-clocks
- (= (+ h m) 0))
+ (= 0 h m))
(setq remove t)
(delete-region (line-beginning-position)
(line-beginning-position 2)))
@@ -1625,9 +1622,10 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
"\\>"))))
(org-todo org-clock-out-switch-to-state))))))
(force-mode-line-update)
- (message (concat "Clock stopped at %s after "
- (org-duration-from-minutes (+ (* 60 h) m)) "%s")
- te (if remove " => LINE REMOVED" ""))
+ (message (if remove
+ "Clock stopped at %s after %s => LINE REMOVED"
+ "Clock stopped at %s after %s")
+ te (org-duration-from-minutes (+ (* 60 h) m)))
(run-hooks 'org-clock-out-hook)
(unless (org-clocking-p)
(setq org-clock-current-task nil)))))))
@@ -1813,15 +1811,15 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
((match-end 2)
;; Two time stamps.
(let* ((ts (float-time
- (apply #'encode-time
- (save-match-data
- (org-parse-time-string (match-string 2))))))
+ (encode-time
+ (save-match-data
+ (org-parse-time-string (match-string 2))))))
(te (float-time
- (apply #'encode-time
- (org-parse-time-string (match-string 3)))))
+ (encode-time
+ (org-parse-time-string (match-string 3)))))
(dt (- (if tend (min te tend) te)
(if tstart (max ts tstart) ts))))
- (when (> dt 0) (cl-incf t1 (floor (/ dt 60))))))
+ (when (> dt 0) (cl-incf t1 (floor dt 60)))))
((match-end 4)
;; A naked time.
(setq t1 (+ t1 (string-to-number (match-string 5))
@@ -1835,8 +1833,9 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
tend
(>= (float-time org-clock-start-time) tstart)
(<= (float-time org-clock-start-time) tend))
- (let ((time (floor (- (float-time)
- (float-time org-clock-start-time))
+ (let ((time (floor (encode-time
+ (time-since org-clock-start-time)
+ 'integer)
60)))
(setq t1 (+ t1 time))))
(let* ((headline-forced
@@ -1927,13 +1926,14 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times."
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)")
+ (message (cond
+ (todayp
+ "Total file time for today: %s (%d hours and %d minutes)")
+ (customp
+ "Total file time (custom): %s (%d hours and %d minutes)")
+ (t
+ "Total file time: %s (%d hours and %d minutes)"))
+ (org-duration-from-minutes org-clock-file-total-minutes)
h m))))
(defvar-local org-clock-overlays nil)
@@ -2239,8 +2239,18 @@ have priority."
(let* ((start (pcase key
(`interactive (org-read-date nil t nil "Range start? "))
;; In theory, all clocks started after the dawn of
- ;; humanity.
- (`untilnow (encode-time 0 0 0 0 0 -50000))
+ ;; humanity. However, the platform's clock
+ ;; support might not go back that far. Choose the
+ ;; POSIX timestamp -2**41 (approximately 68,000
+ ;; BCE) if that works, otherwise -2**31 (1901) if
+ ;; that works, otherwise 0 (1970). Going back
+ ;; billions of years would loop forever on Mac OS
+ ;; X 10.6 with Emacs 26 and earlier (Bug#27736).
+ (`untilnow
+ (let ((old 0))
+ (dolist (older '((-32768 0) (-33554432 0)) old)
+ (when (ignore-errors (decode-time older))
+ (setq old older)))))
(_ (encode-time 0 m h d month y))))
(end (pcase key
(`interactive (org-read-date nil t nil "Range end? "))
@@ -2694,24 +2704,24 @@ LEVEL is an integer. Indent by two spaces per level above 1."
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts)))
(setq ts (float-time (encode-time 0 0 0 day month year)))))
(ts
- (setq ts (float-time (apply #'encode-time (org-parse-time-string ts))))))
+ (setq ts (float-time (org-time-string-to-time ts)))))
(cond
((numberp te)
;; Likewise for te.
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te)))
(setq te (float-time (encode-time 0 0 0 day month year)))))
(te
- (setq te (float-time (apply #'encode-time (org-parse-time-string te))))))
+ (setq te (float-time (org-time-string-to-time te)))))
(setq tsb
(if (eq step0 'week)
- (let ((dow (nth 6 (decode-time (seconds-to-time ts)))))
+ (let ((dow (nth 6 (decode-time ts))))
(if (<= dow ws) ts
(- ts (* 86400 (- dow ws)))))
ts))
(while (< tsb te)
(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)))))
+ (let ((start-time (max tsb ts)))
+ (cl-incf tsb (let ((dow (nth 6 (decode-time tsb))))
(if (or (eq step0 'day)
(= dow ws))
step
@@ -2731,7 +2741,7 @@ LEVEL is an integer. Indent by two spaces per level above 1."
: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))))))))
+ (min te tsb)))))))
(re-search-forward "^[ \t]*#\\+END:")
(when (and stepskip0 (equal step-time 0))
;; Remove the empty table
@@ -2872,18 +2882,16 @@ Otherwise, return nil."
(<= org-clock-marker (point-at-eol)))
;; The clock is running here
(setq org-clock-start-time
- (apply 'encode-time
- (org-parse-time-string (match-string 1))))
+ (org-time-string-to-time (match-string 1)))
(org-clock-update-mode-line)))
(t
(and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
(end-of-line 1)
(setq ts (match-string 1)
te (match-string 3))
- (setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te)))
- (float-time
- (apply #'encode-time (org-parse-time-string ts))))
+ (setq s (float-time
+ (time-subtract (org-time-string-to-time te)
+ (org-time-string-to-time ts)))
neg (< s 0)
s (abs s)
h (floor (/ s 3600))
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 2c34eddcf6b..799cc608bfa 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -540,7 +540,7 @@ Where possible, use the standard interface for changing this line."
(eol (line-end-position))
(pom (or (get-text-property bol 'org-hd-marker) (point)))
(key (or key (get-char-property (point) 'org-columns-key)))
- (org-columns--time (float-time (current-time)))
+ (org-columns--time (float-time))
(action
(pcase key
("CLOCKSUM"
@@ -719,7 +719,7 @@ around it."
(setq time-after (copy-sequence time))
(setf (nth 3 time-before) (1- (nth 3 time)))
(setf (nth 3 time-after) (1+ (nth 3 time)))
- (mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x)))
+ (mapcar (lambda (x) (format-time-string fmt (encode-time x)))
(list time-before time time-after)))))
(defun org-columns-open-link (&optional arg)
@@ -790,7 +790,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
(org-columns-goto-top-level)
;; Initialize `org-columns-current-fmt' and
;; `org-columns-current-fmt-compiled'.
- (let ((org-columns--time (float-time (current-time))))
+ (let ((org-columns--time (float-time)))
(org-columns-get-format columns-fmt-string)
(unless org-columns-inhibit-recalculation (org-columns-compute-all))
(save-excursion
@@ -1070,7 +1070,7 @@ as a canonical duration, i.e., using units defined in
(cond
((string-match-p org-ts-regexp s)
(/ (- org-columns--time
- (float-time (apply #'encode-time (org-parse-time-string s))))
+ (float-time (org-time-string-to-time s)))
60))
((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units
(t (user-error "Invalid age: %S" s))))
@@ -1494,7 +1494,7 @@ PARAMS is a property list of parameters:
(if (markerp org-columns-begin-marker)
(move-marker org-columns-begin-marker (point))
(setq org-columns-begin-marker (point-marker)))
- (let* ((org-columns--time (float-time (current-time)))
+ (let* ((org-columns--time (float-time))
(fmt
(cond
((bound-and-true-p org-agenda-overriding-columns-format))
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index 7dc8dd5b16a..111be379fd4 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -137,6 +137,7 @@
;;; Code:
+(eval-when-compile (require 'cl-lib))
(require 'org)
(defgroup org-ctags nil
@@ -235,7 +236,7 @@ buffer position where the tag is found."
(with-current-buffer (get-file-buffer tags-file-name)
(goto-char (point-min))
(cond
- ((re-search-forward (format "^.*%s\\([0-9]+\\),\\([0-9]+\\)$"
+ ((re-search-forward (format "^.*\^?%s\^A\\([0-9]+\\),\\([0-9]+\\)$"
(regexp-quote tag)) nil t)
(let ((line (string-to-number (match-string 1)))
(pos (string-to-number (match-string 2))))
@@ -260,7 +261,7 @@ Return the list."
(visit-tags-table-buffer 'same)
(with-current-buffer (get-file-buffer tags-file-name)
(goto-char (point-min))
- (while (re-search-forward "^.*\\(.*\\)\\([0-9]+\\),\\([0-9]+\\)$"
+ (while (re-search-forward "^.*\^?\\(.*\\)\^A\\([0-9]+\\),\\([0-9]+\\)$"
nil t)
(push (substring-no-properties (match-string 1)) taglist)))
taglist)))
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el
index aea2c8d3d61..b4797de1e58 100644
--- a/lisp/org/org-datetree.el
+++ b/lisp/org/org-datetree.el
@@ -138,15 +138,16 @@ will be built under the headline at point."
"^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
year month day))))
-(defun org-datetree--find-create (regex year &optional month day insert)
- "Find the datetree matched by REGEX for YEAR, MONTH, or DAY.
-REGEX is passed to `format' with YEAR, MONTH, and DAY as
+(defun org-datetree--find-create
+ (regex-template year &optional month day insert)
+ "Find the datetree matched by REGEX-TEMPLATE for YEAR, MONTH, or DAY.
+REGEX-TEMPLATE is passed to `format' with YEAR, MONTH, and DAY as
arguments. Match group 1 is compared against the specified date
component. If INSERT is non-nil and there is no match then it is
inserted into the buffer."
(when (or month day)
(org-narrow-to-subtree))
- (let ((re (format regex year month day))
+ (let ((re (format regex-template year month day))
match)
(goto-char (point-min))
(while (and (setq match (re-search-forward re nil t))
diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el
index f115082243b..770c72fd676 100644
--- a/lisp/org/org-duration.el
+++ b/lisp/org/org-duration.el
@@ -317,11 +317,10 @@ When optional argument CANONICAL is non-nil, ignore
Raise an error if expected format is unknown."
(pcase (or fmt org-duration-format)
(`h:mm
- (let ((minutes (floor minutes)))
- (format "%d:%02d" (/ minutes 60) (mod minutes 60))))
+ (format "%d:%02d" (/ minutes 60) (mod minutes 60)))
(`h:mm:ss
(let* ((whole-minutes (floor minutes))
- (seconds (floor (* 60 (- minutes whole-minutes)))))
+ (seconds (mod (* 60 minutes) 60)))
(format "%s:%02d"
(org-duration-from-minutes whole-minutes 'h:mm)
seconds)))
@@ -402,9 +401,7 @@ Raise an error if expected format is unknown."
(pcase-let* ((`(,unit . ,required?) units)
(modifier (org-duration--modifier unit canonical)))
(cond ((<= modifier minutes)
- (let ((value (if (integerp modifier)
- (/ (floor minutes) modifier)
- (floor (/ minutes modifier)))))
+ (let ((value (floor minutes modifier)))
(cl-decf minutes (* value modifier))
(format " %d%s" value unit)))
(required? (concat " 0" unit))
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 6458335704e..04e2fda55e3 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -2119,7 +2119,7 @@ containing `:key', `:value', `:begin', `:end', `:post-blank' and
;; this corner case.
(let ((begin (or (car affiliated) (point)))
(post-affiliated (point))
- (key (progn (looking-at "[ \t]*#\\+\\(\\S-+*\\):")
+ (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):")
(upcase (match-string-no-properties 1))))
(value (org-trim (buffer-substring-no-properties
(match-end 0) (point-at-eol))))
@@ -4765,13 +4765,13 @@ you want to help debugging the issue.")
(defvar org-element-cache-sync-idle-time 0.6
"Length, in seconds, of idle time before syncing cache.")
-(defvar org-element-cache-sync-duration (seconds-to-time 0.04)
+(defvar org-element-cache-sync-duration 0.04
"Maximum duration, as a time value, for a cache synchronization.
If the synchronization is not over after this delay, the process
pauses and resumes after `org-element-cache-sync-break'
seconds.")
-(defvar org-element-cache-sync-break (seconds-to-time 0.3)
+(defvar org-element-cache-sync-break 0.3
"Duration, as a time value, of the pause between synchronizations.
See `org-element-cache-sync-duration' for more information.")
@@ -4856,7 +4856,7 @@ table is cleared once the synchronization is complete."
(defun org-element--cache-generate-key (lower upper)
"Generate a key between LOWER and UPPER.
-LOWER and UPPER are integers or lists, possibly empty.
+LOWER and UPPER are fixnums or lists of same, possibly empty.
If LOWER and UPPER are equals, return LOWER. Otherwise, return
a unique key, as an integer or a list of integers, according to
@@ -4950,6 +4950,7 @@ A and B are either integers or lists of integers, as returned by
(defsubst org-element--cache-root ()
"Return root value in cache.
This function assumes `org-element--cache' is a valid AVL tree."
+ ;; FIXME: Why use internal functions of avl-tree?
(avl-tree--node-left (avl-tree--dummyroot org-element--cache)))
@@ -4978,6 +4979,7 @@ the cache."
(aref (car org-element--cache-sync-requests) 0)))
(node (org-element--cache-root))
lower upper)
+ ;; FIXME: Why use internal functions of avl-tree?
(while node
(let* ((element (avl-tree--node-data node))
(begin (org-element-property :begin element)))
@@ -5064,7 +5066,7 @@ Assume ELEMENT belongs to cache and that a cache is active."
TIME-LIMIT is a time value or nil."
(and time-limit
(or (input-pending-p)
- (time-less-p time-limit (current-time)))))
+ (time-less-p time-limit nil))))
(defsubst org-element--cache-shift-positions (element offset &optional props)
"Shift ELEMENT properties relative to buffer positions by OFFSET.
@@ -5118,8 +5120,7 @@ updated before current modification are actually submitted."
(and next (aref next 0))
threshold
(and (not threshold)
- (time-add (current-time)
- org-element-cache-sync-duration))
+ (time-add nil org-element-cache-sync-duration))
future-change)
;; Request processed. Merge current and next offsets and
;; transfer ending position.
diff --git a/lisp/org/org-eshell.el b/lisp/org/org-eshell.el
index bb27d92e12d..2251a1b892f 100644
--- a/lisp/org/org-eshell.el
+++ b/lisp/org/org-eshell.el
@@ -37,7 +37,7 @@
eshell buffer) or a command line prefixed by a buffer name
followed by a colon."
(let* ((buffer-and-command
- (if (string-match "\\([A-Za-z0-9-+*]+\\):\\(.*\\)" link)
+ (if (string-match "\\([A-Za-z0-9+*-]+\\):\\(.*\\)" link)
(list (match-string 1 link)
(match-string 2 link))
(list eshell-buffer-name link)))
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index dee127a78ab..f8963184654 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -636,7 +636,7 @@ or new, let the user edit the definition of the footnote."
(let* ((all (org-footnote-all-labels))
(label
(if (eq org-footnote-auto-label 'random)
- (format "%x" (random most-positive-fixnum))
+ (format "%x" (abs (random)))
(org-footnote-normalize-label
(let ((propose (org-footnote-unique-label all)))
(if (eq org-footnote-auto-label t) propose
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 06429d7ff37..6234d0251e9 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -288,7 +288,7 @@ Habits are assigned colors on the following basis:
(deadline (if scheduled-days
(+ scheduled-days (- d-repeat s-repeat))
(org-habit-deadline habit)))
- (m-days (or now-days (time-to-days (current-time)))))
+ (m-days (or now-days (time-to-days nil))))
(cond
((< m-days scheduled)
'(org-habit-clear-face . org-habit-clear-future-face))
@@ -406,8 +406,7 @@ current time."
"Insert consistency graph for any habitual tasks."
(let ((inhibit-read-only t)
(buffer-invisibility-spec '(org-link))
- (moment (time-subtract (current-time)
- (list 0 (* 3600 org-extend-today-until) 0))))
+ (moment (time-since (* 3600 org-extend-today-until))))
(save-excursion
(goto-char (if line (point-at-bol) (point-min)))
(while (not (eobp))
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index 994aa7e3e83..44cc7b2f14d 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -83,8 +83,7 @@
(defcustom org-id-link-to-org-use-id nil
"Non-nil means storing a link to an Org file will use entry IDs.
-\\<org-mode-map>\
-
+\\<org-mode-map>
The variable can have the following values:
t Create an ID if needed to make a link to the current entry.
@@ -357,7 +356,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
"Return string with random (version 4) UUID."
(let ((rnd (md5 (format "%s%s%s%s%s%s%s"
(random)
- (current-time)
+ (encode-time nil 'list)
(user-uid)
(emacs-pid)
(user-full-name)
@@ -416,7 +415,7 @@ The input I may be a character, or a single-letter string."
"Encode TIME as a 10-digit string.
This string holds the time to micro-second accuracy, and can be decoded
using `org-id-decode'."
- (setq time (or time (current-time)))
+ (setq time (encode-time time 'list))
(concat (org-id-int-to-b36 (nth 0 time) 4)
(org-id-int-to-b36 (nth 1 time) 4)
(org-id-int-to-b36 (or (nth 2 time) 0) 4)))
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index 71d6658a56f..97cf8786566 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -183,11 +183,15 @@ during idle time."
org-hide-leading-stars)
(setq-local org-hide-leading-stars t))
(org-indent--compute-prefixes)
- (add-hook 'filter-buffer-substring-functions
- (lambda (fun start end delete)
- (org-indent-remove-properties-from-string
- (funcall fun start end delete)))
- nil t)
+ (if (boundp 'filter-buffer-substring-functions)
+ (add-hook 'filter-buffer-substring-functions
+ (lambda (fun start end delete)
+ (org-indent-remove-properties-from-string
+ (funcall fun start end delete)))
+ nil t)
+ ;; Emacs >= 24.4.
+ (add-function :filter-return (local 'filter-buffer-substring-function)
+ #'org-indent-remove-properties-from-string))
(add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local)
(add-hook 'before-change-functions
'org-indent-notify-modified-headline nil 'local)
@@ -211,10 +215,13 @@ during idle time."
(when (boundp 'org-hide-leading-stars-before-indent-mode)
(setq-local org-hide-leading-stars
org-hide-leading-stars-before-indent-mode))
- (remove-hook 'filter-buffer-substring-functions
- (lambda (fun start end delete)
- (org-indent-remove-properties-from-string
- (funcall fun start end delete))))
+ (if (boundp 'filter-buffer-substring-functions)
+ (remove-hook 'filter-buffer-substring-functions
+ (lambda (fun start end delete)
+ (org-indent-remove-properties-from-string
+ (funcall fun start end delete))))
+ (remove-function (local 'filter-buffer-substring-function)
+ #'org-indent-remove-properties-from-string))
(remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local)
(remove-hook 'before-change-functions
'org-indent-notify-modified-headline 'local)
@@ -325,7 +332,7 @@ stopped."
(let* ((case-fold-search t)
(limited-re (org-get-limited-outline-regexp))
(level (or (org-current-level) 0))
- (time-limit (and delay (time-add (current-time) delay))))
+ (time-limit (and delay (time-add nil delay))))
;; For each line, set `line-prefix' and `wrap-prefix'
;; properties depending on the type of line (headline, inline
;; task, item or other).
@@ -338,7 +345,7 @@ stopped."
;; In asynchronous mode, take a break of
;; `org-indent-agent-resume-delay' every DELAY to avoid
;; blocking any other idle timer or process output.
- ((and delay (time-less-p time-limit (current-time)))
+ ((and delay (time-less-p time-limit nil))
(setq org-indent-agent-resume-timer
(run-with-idle-timer
(time-add (current-idle-time) org-indent-agent-resume-delay)
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index 96c8f55d3a5..22692d224a8 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -236,7 +236,7 @@ into
(defcustom org-plain-list-ordered-item-terminator t
"The character that makes a line with leading number an ordered list item.
-Valid values are ?. and ?\). To get both terminators, use t.
+Valid values are ?. and ?\\). To get both terminators, use t.
This variable needs to be set before org.el is loaded. If you
need to make a change while Emacs is running, use the customize
@@ -2678,7 +2678,7 @@ Return t if successful."
(error "Cannot outdent beyond margin")
;; Change bullet if necessary.
(when (and (= (+ top-ind offset) 0)
- (string-match "*"
+ (string-match "\\*"
(org-list-get-bullet beg struct)))
(org-list-set-bullet beg struct
(org-list-bullet-string "-")))
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index b2399966dc7..a151e1e8469 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -159,7 +159,8 @@ function installs the following ones: \"property\",
(format "(eval (format-time-string \"$1\" (or (and (org-string-nw-p \"$2\") (org-macro--vc-modified-time %s)) '%s)))"
(prin1-to-string visited-file)
(prin1-to-string
- (nth 5 (file-attributes visited-file)))))))))
+ (file-attribute-modification-time
+ (file-attributes visited-file)))))))))
;; Initialize and install "n" macro.
(org-macro--counter-initialize)
(funcall update-templates
@@ -312,7 +313,7 @@ Return a list of arguments, as strings. This is the opposite of
(buffer-substring
(point) (line-end-position)))))
(when (cl-some #'identity time)
- (setq date (apply #'encode-time time))))))))
+ (setq date (encode-time time))))))))
(let ((proc (get-buffer-process buf)))
(while (and proc (accept-process-output proc .5 nil t)))))
(kill-buffer buf))
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 9851168e970..3c768244331 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -31,6 +31,8 @@
;;; Code:
+(require 'cl-lib)
+
(defmacro org-with-gensyms (symbols &rest body)
(declare (debug (sexp body)) (indent 1))
`(let ,(mapcar (lambda (s)
diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el
index 969bff3cc64..a37c41ad06e 100644
--- a/lisp/org/org-mhe.el
+++ b/lisp/org/org-mhe.el
@@ -142,7 +142,7 @@ So if you use sequences, it will now work."
"Return the name of the message folder in an index folder buffer."
(save-excursion
(mh-index-previous-folder)
- (if (re-search-forward "^\\(+.*\\)$" nil t)
+ (if (re-search-forward "^\\(\\+.*\\)$" nil t)
(message "%s" (match-string 1)))))
(defun org-mhe-get-message-folder ()
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index 1ff6358403c..8b4e8953889 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -845,11 +845,11 @@ If BEG and END are given, only do this in that region."
(cl-incf cnt-error)
(throw 'next t))
(move-marker bos-marker (point))
- (if (re-search-forward "^** Old value[ \t]*$" eos t)
+ (if (re-search-forward "^\\** Old value[ \t]*$" eos t)
(setq old (buffer-substring
(1+ (match-end 0))
(progn (outline-next-heading) (point)))))
- (if (re-search-forward "^** New value[ \t]*$" eos t)
+ (if (re-search-forward "^\\** New value[ \t]*$" eos t)
(setq new (buffer-substring
(1+ (match-end 0))
(progn (outline-next-heading)
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index ac75decb925..a3dcb77554c 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -643,7 +643,7 @@ This means, between the beginning of line and the point."
,@(org-mouse-list-options-menu (mapcar 'car org-startup-options)
'org-mode-restart))))
((or (eolp)
- (and (looking-at "\\( \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$")
+ (and (looking-at "\\( \\|\t\\)\\(\\+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$")
(looking-back " \\|\t" (- (point) 2)
(line-beginning-position))))
(org-mouse-popup-global-menu))
diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el
index 7f944c5a765..cf272de90a8 100644
--- a/lisp/org/org-pcomplete.el
+++ b/lisp/org/org-pcomplete.el
@@ -49,10 +49,10 @@
"Examine the thing at point and let the caller know what it is.
The return value is a string naming the thing at point."
(let ((beg1 (save-excursion
- (skip-chars-backward "[:alnum:]-_@")
+ (skip-chars-backward "-[:alnum:]_@")
(point)))
(beg (save-excursion
- (skip-chars-backward "a-zA-Z0-9-_:$")
+ (skip-chars-backward "-a-zA-Z0-9_:$")
(point)))
(line-to-here (buffer-substring (point-at-bol) (point))))
(cond
@@ -82,7 +82,7 @@ The return value is a string naming the thing at point."
(not (equal (char-after (point-at-bol)) ?*))
(save-excursion
(move-beginning-of-line 1)
- (skip-chars-backward "[ \t\n]")
+ (skip-chars-backward " \t\n")
;; org-drawer-regexp matches a whole line but while
;; looking-back, we just ignore trailing whitespaces
(or (looking-back (substring org-drawer-regexp 0 -1)
@@ -194,7 +194,7 @@ When completing for #+STARTUP, for example, this function returns
"Complete arguments for the #+LANGUAGE file option."
(require 'ox)
(pcomplete-here
- (pcomplete-uniqify-list
+ (pcomplete-uniquify-list
(list org-export-default-language "en"))))
(defvar org-default-priority)
@@ -219,7 +219,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/file-option/startup ()
"Complete arguments for the #+STARTUP file option."
(while (pcomplete-here
- (let ((opts (pcomplete-uniqify-list
+ (let ((opts (pcomplete-uniquify-list
(mapcar 'car org-startup-options))))
;; Some options are mutually exclusive, and shouldn't be completed
;; against if certain other options have already been seen.
@@ -248,7 +248,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/file-option/options ()
"Complete arguments for the #+OPTIONS file option."
(while (pcomplete-here
- (pcomplete-uniqify-list
+ (pcomplete-uniquify-list
(append
;; Hard-coded OPTION items always available.
'("H:" "\\n:" "num:" "timestamp:" "arch:" "author:" "c:"
@@ -267,7 +267,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/file-option/infojs_opt ()
"Complete arguments for the #+INFOJS_OPT file option."
(while (pcomplete-here
- (pcomplete-uniqify-list
+ (pcomplete-uniquify-list
(mapcar (lambda (item) (format "%s:" (car item)))
(bound-and-true-p org-html-infojs-opts-table))))))
@@ -283,7 +283,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/link ()
"Complete against defined #+LINK patterns."
(pcomplete-here
- (pcomplete-uniqify-list
+ (pcomplete-uniquify-list
(copy-sequence
(append (mapcar 'car org-link-abbrev-alist-local)
(mapcar 'car org-link-abbrev-alist))))))
@@ -293,13 +293,13 @@ When completing for #+STARTUP, for example, this function returns
"Complete against TeX-style HTML entity names."
(require 'org-entities)
(while (pcomplete-here
- (pcomplete-uniqify-list (remove nil (mapcar 'car-safe org-entities)))
+ (pcomplete-uniquify-list (remove nil (mapcar 'car-safe org-entities)))
(substring pcomplete-stub 1))))
(defvar org-todo-keywords-1)
(defun pcomplete/org-mode/todo ()
"Complete against known TODO keywords."
- (pcomplete-here (pcomplete-uniqify-list (copy-sequence org-todo-keywords-1))))
+ (pcomplete-here (pcomplete-uniquify-list (copy-sequence org-todo-keywords-1))))
(defvar org-todo-line-regexp)
(defun pcomplete/org-mode/searchhead ()
@@ -315,14 +315,14 @@ This needs more work, to handle headings with lots of spaces in them."
(push (org-make-org-heading-search-string
(match-string-no-properties 3))
tbl)))
- (pcomplete-uniqify-list tbl)))
+ (pcomplete-uniquify-list tbl)))
(substring pcomplete-stub 1))))
(defun pcomplete/org-mode/tag ()
"Complete a tag name. Omit tags already set."
(while (pcomplete-here
(mapcar (lambda (x) (concat x ":"))
- (let ((lst (pcomplete-uniqify-list
+ (let ((lst (pcomplete-uniquify-list
(or (remq
nil
(mapcar (lambda (x) (org-string-nw-p (car x)))
@@ -339,7 +339,7 @@ This needs more work, to handle headings with lots of spaces in them."
(pcomplete-here
(mapcar (lambda (x)
(concat x ": "))
- (let ((lst (pcomplete-uniqify-list
+ (let ((lst (pcomplete-uniquify-list
(copy-sequence
(org-buffer-property-keys nil t t t)))))
(dolist (prop (org-entry-properties))
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index aa34e4011ae..a5635e326d4 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -336,7 +336,7 @@ line directly before or after the table."
(insert "\n")
(insert-file-contents (plist-get params :script))
(goto-char (point-min))
- (while (re-search-forward "$datafile" nil t)
+ (while (re-search-forward "\\$datafile" nil t)
(replace-match data-file nil nil)))
(insert (org-plot/gnuplot-script data-file num-cols params)))
;; Graph table.
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index 3959a17cf4a..016105ef53b 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -331,7 +331,7 @@ returned list."
(len 0)
dir
ret)
- (when (string-match "^\\(.*\\)\\(org-protocol:/+[a-zA-z0-9][-_a-zA-z0-9]*:/+\\)\\(.*\\)" trigger)
+ (when (string-match "^\\(.*\\)\\(org-protocol:/+[a-zA-Z0-9][-_a-zA-Z0-9]*:/+\\)\\(.*\\)" trigger)
(setq dir (match-string 1 trigger))
(setq len (length dir))
(setcar l (concat dir (match-string 3 trigger))))
@@ -349,17 +349,20 @@ returned list."
ret)
l)))
-(defun org-protocol-flatten (list)
- "Transform LIST into a flat list.
+(defalias 'org-protocol-flatten
+ (if (fboundp 'flatten-tree) 'flatten-tree
+ (lambda (list)
+ "Transform LIST into a flat list.
Greedy handlers might receive a list like this from emacsclient:
\((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\"))
where \"/dir/\" is the absolute path to emacsclients working directory.
This function transforms it into a flat list."
- (if (null list) ()
- (if (listp list)
- (append (org-protocol-flatten (car list)) (org-protocol-flatten (cdr list)))
- (list list))))
+ (if list
+ (if (consp list)
+ (append (org-protocol-flatten (car list))
+ (org-protocol-flatten (cdr list)))
+ (list list))))))
(defun org-protocol-parse-parameters (info &optional new-style default-order)
"Return a property list of parameters from INFO.
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 0a8382c8b56..147527da1d3 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -484,8 +484,8 @@ Line numbers are counted from the beginning of the table. This
variable is initialized with `org-table-analyze'.")
(defconst org-table-range-regexp
- "@\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\)?"
- ;; 1 2 3 4 5
+ "@\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\)?"
+ ;; 1 2 3 4 5
"Regular expression for matching ranges in formulas.")
(defconst org-table-range-regexp2
@@ -1182,7 +1182,7 @@ to a number. In the case of a timestamp, increment by days."
(- (org-time-string-to-absolute txt)
(org-time-string-to-absolute txt-up)))
((string-match org-ts-regexp3 txt) 1)
- ((string-match "\\([-+]\\)?\\(?:[0-9]+\\)?\\(?:\.[0-9]+\\)?" txt-up)
+ ((string-match "\\([-+]\\)?[0-9]*\\(?:\\.[0-9]+\\)?" txt-up)
(- (string-to-number txt)
(string-to-number (match-string 0 txt-up))))
(t 1)))
@@ -2175,8 +2175,8 @@ If NLAST is a number, only the NLAST fields will actually be summed."
(sres (if (= org-timecnt 0)
(number-to-string res)
(setq diff (* 3600 res)
- h (floor (/ diff 3600)) diff (mod diff 3600)
- m (floor (/ diff 60)) diff (mod diff 60)
+ h (floor diff 3600) diff (mod diff 3600)
+ m (floor diff 60) diff (mod diff 60)
s diff)
(format "%.0f:%02.0f:%02.0f" h m s))))
(kill-new sres)
@@ -2307,7 +2307,7 @@ LOCATION instead."
"\n"))))
(defsubst org-table-formula-make-cmp-string (a)
- (when (string-match "\\`$[<>]" a)
+ (when (string-match "\\`\\$[<>]" a)
(let ((arrow (string-to-char (substring a 1))))
;; Fake a high number to make sure this is sorted at the end.
(setq a (org-table-formula-handle-first/last-rc a))
@@ -2355,7 +2355,7 @@ LOCATION is a buffer position, consider the formulas there."
(cond
((not (match-end 2)) m)
;; Is it a column reference?
- ((string-match-p "\\`$\\([0-9]+\\|[<>]+\\)\\'" m) m)
+ ((string-match-p "\\`\\$\\([0-9]+\\|[<>]+\\)\\'" m) m)
;; Since named columns are not possible in
;; LHS, assume this is a named field.
(t (match-string 2 string)))))
@@ -2909,8 +2909,8 @@ location of point."
(format-time-string
(org-time-stamp-format
(string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))
- (apply #'encode-time
- (save-match-data (org-parse-time-string ts))))))
+ (encode-time
+ (save-match-data (org-parse-time-string ts))))))
form t t))
(setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form))
@@ -3216,7 +3216,7 @@ known that the table will be realigned a little later anyway."
(cond
((string-match "\\`@-?I+" old-lhs)
(user-error "Can't assign to hline relative reference"))
- ((string-match "\\`$[<>]" old-lhs)
+ ((string-match "\\`\\$[<>]" old-lhs)
(let ((new (org-table-formula-handle-first/last-rc
old-lhs)))
(when (assoc new eqlist)
@@ -3639,7 +3639,8 @@ Parameters get priority."
(setq startline (org-current-line))
(dolist (entry eql)
(let* ((type (cond
- ((string-match "\\`$\\([0-9]+\\|[<>]+\\)\\'" (car entry))
+ ((string-match "\\`\\$\\([0-9]+\\|[<>]+\\)\\'"
+ (car entry))
'column)
((equal (string-to-char (car entry)) ?@) 'field)
(t 'named)))
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index bf17de4b03e..6529a8b0ddf 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -139,12 +139,7 @@ the region 0:00:00."
(format "Restart timer with offset [%s]: " def)))
(unless (string-match "\\S-" s) (setq s def))
(setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
- (setq org-timer-start-time
- (seconds-to-time
- ;; Pass `current-time' result to `float-time' (instead
- ;; of calling without arguments) so that only
- ;; `current-time' has to be overridden in tests.
- (- (float-time (current-time)) delta))))
+ (setq org-timer-start-time (time-since delta)))
(setq org-timer-pause-time nil)
(org-timer-set-mode-line 'on)
(message "Timer start time set to %s, current value is %s"
@@ -167,14 +162,9 @@ With prefix arg STOP, stop it entirely."
(setq org-timer-countdown-timer
(org-timer--run-countdown-timer
new-secs org-timer-countdown-timer-title))
- (setq org-timer-start-time
- (time-add (current-time) (seconds-to-time new-secs))))
+ (setq org-timer-start-time (time-add nil new-secs)))
(setq org-timer-start-time
- ;; Pass `current-time' result to `float-time' (instead
- ;; of calling without arguments) so that only
- ;; `current-time' has to be overridden in tests.
- (seconds-to-time (- (float-time (current-time))
- (- pause-secs start-secs)))))
+ (time-since (- pause-secs start-secs))))
(setq org-timer-pause-time nil)
(org-timer-set-mode-line 'on)
(run-hooks 'org-timer-continue-hook)
@@ -233,14 +223,9 @@ it in the buffer."
(abs (floor (org-timer-seconds))))))
(defun org-timer-seconds ()
- ;; Pass `current-time' result to `float-time' (instead of calling
- ;; without arguments) so that only `current-time' has to be
- ;; overridden in tests.
- (if org-timer-countdown-timer
- (- (float-time org-timer-start-time)
- (float-time (or org-timer-pause-time (current-time))))
- (- (float-time (or org-timer-pause-time (current-time)))
- (float-time org-timer-start-time))))
+ (let ((s (float-time (time-subtract org-timer-pause-time
+ org-timer-start-time))))
+ (if org-timer-countdown-timer (- s) s)))
;;;###autoload
(defun org-timer-change-times-in-region (beg end delta)
@@ -400,7 +385,7 @@ VALUE can be `on', `off', or `paused'."
(message "No timer set")
(let* ((rtime (decode-time
(time-subtract (timer--time org-timer-countdown-timer)
- (current-time))))
+ nil)))
(rsecs (nth 0 rtime))
(rmins (nth 1 rtime)))
(message "%d minute(s) %d seconds left before next time out"
@@ -463,8 +448,7 @@ using three `C-u' prefix arguments."
(org-timer--run-countdown-timer
secs org-timer-countdown-timer-title))
(run-hooks 'org-timer-set-hook)
- (setq org-timer-start-time
- (time-add (current-time) (seconds-to-time secs)))
+ (setq org-timer-start-time (time-add nil secs))
(setq org-timer-pause-time nil)
(org-timer-set-mode-line 'on))))))
diff --git a/lisp/org/org.el b/lisp/org/org.el
index bce12956e23..5aa49b29d6f 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -4,7 +4,6 @@
;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
;;
;; Author: Carsten Dominik <carsten at orgmode dot org>
-;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: https://orgmode.org
;; Version: 9.1.9
@@ -229,9 +228,10 @@ file to byte-code before it is loaded."
(interactive "fFile to load: \nP")
(let* ((age (lambda (file)
(float-time
- (time-subtract (current-time)
- (nth 5 (or (file-attributes (file-truename file))
- (file-attributes file)))))))
+ (time-since
+ (file-attribute-modification-time
+ (or (file-attributes (file-truename file))
+ (file-attributes file)))))))
(base-name (file-name-sans-extension file))
(exported-file (concat base-name ".el")))
;; tangle if the Org file is newer than the elisp file
@@ -429,7 +429,7 @@ Matched keyword is in group 1.")
(defconst org-deadline-time-hour-regexp
(concat "\\<" org-deadline-string
- " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>")
+ " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy \t.-]*\\)>")
"Matches the DEADLINE keyword together with a time-and-hour stamp.")
(defconst org-deadline-line-regexp
@@ -445,7 +445,7 @@ Matched keyword is in group 1.")
(defconst org-scheduled-time-hour-regexp
(concat "\\<" org-scheduled-string
- " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>")
+ " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy \t.-]*\\)>")
"Matches the SCHEDULED keyword together with a time-and-hour stamp.")
(defconst org-closed-time-regexp
@@ -862,8 +862,7 @@ depends on, if any."
(defcustom org-support-shift-select nil
"Non-nil means make shift-cursor commands select text when possible.
-\\<org-mode-map>\
-
+\\<org-mode-map>
In Emacs 23, when `shift-select-mode' is on, shifted cursor keys
start selecting a region, or enlarge regions started in this way.
In Org mode, in special contexts, these same keys are used for
@@ -1071,6 +1070,8 @@ has been set."
:group 'org-startup
:type 'boolean)
+(defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
+
(defcustom org-replace-disputed-keys nil
"Non-nil means use alternative key bindings for some keys.
Org mode uses S-<cursor> keys for changing timestamps and priorities.
@@ -1095,8 +1096,6 @@ loading Org."
:group 'org-startup
:type 'boolean)
-(defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
-
(defcustom org-disputed-keys
'(([(shift up)] . [(meta p)])
([(shift down)] . [(meta n)])
@@ -1490,6 +1489,8 @@ time in Emacs."
:group 'org-edit-structure
:type 'boolean)
+(defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
+
(defcustom org-special-ctrl-a/e nil
"Non-nil means `C-a' and `C-e' behave specially in headlines and items.
@@ -1527,7 +1528,6 @@ This may also be a cons cell where the behavior for `C-a' and
(const :tag "off" nil)
(const :tag "on: before tags first" t)
(const :tag "reversed: after tags first" reversed)))))
-(defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
(defcustom org-special-ctrl-k nil
"Non-nil means `C-k' will behave specially in headlines.
@@ -2257,8 +2257,7 @@ See `org-file-apps'.")
("\\.x?html?\\'" . default)
("\\.pdf\\'" . default))
"External applications for opening `file:path' items in a document.
-\\<org-mode-map>\
-
+\\<org-mode-map>
Org mode uses system defaults for different file types, but
you can use this variable to set the application for a given file
extension. The entries in this list are cons cells where the car identifies
@@ -3005,6 +3004,8 @@ because Agenda Log mode depends on the format of these entries."
(unless (assq 'note org-log-note-headings)
(push '(note . "%t") org-log-note-headings))
+(defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
+
(defcustom org-log-into-drawer nil
"Non-nil means insert state change notes and time stamps into a drawer.
When nil, state changes notes will be inserted after the headline and
@@ -3036,8 +3037,6 @@ function `org-log-into-drawer' instead."
(const :tag "LOGBOOK" t)
(string :tag "Other")))
-(defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
-
(defun org-log-into-drawer ()
"Name of the log drawer, as a string, or nil.
This is the value of `org-log-into-drawer'. However, if the
@@ -3342,6 +3341,9 @@ This display will be in an overlay, in the minibuffer."
:group 'org-time
:type 'boolean)
+(defvaralias 'org-popup-calendar-for-date-prompt
+ 'org-read-date-popup-calendar)
+
(defcustom org-read-date-popup-calendar t
"Non-nil means pop up a calendar when prompting for a date.
In the calendar, the date can be selected with mouse-1. However, the
@@ -3349,8 +3351,6 @@ minibuffer will also be active, and you can simply enter the date as well.
When nil, only the minibuffer will be available."
:group 'org-time
:type 'boolean)
-(defvaralias 'org-popup-calendar-for-date-prompt
- 'org-read-date-popup-calendar)
(defcustom org-extend-today-until 0
"The hour when your day really ends. Must be an integer.
@@ -3798,6 +3798,9 @@ regular expression will be included."
:group 'org-agenda
:type 'regexp)
+(defvaralias 'org-agenda-multi-occur-extra-files
+ 'org-agenda-text-search-extra-files)
+
(defcustom org-agenda-text-search-extra-files nil
"List of extra files to be searched by text search commands.
These files will be searched in addition to the agenda files by the
@@ -3815,9 +3818,6 @@ scope."
(const :tag "Agenda Archives" agenda-archives)
(repeat :inline t (file))))
-(defvaralias 'org-agenda-multi-occur-extra-files
- 'org-agenda-text-search-extra-files)
-
(defcustom org-agenda-skip-unavailable-files nil
"Non-nil means to just skip non-reachable files in `org-agenda-files'.
A nil value means to remove them, after a query, from the list."
@@ -5610,22 +5610,20 @@ When ROUNDING-MINUTES is not an integer, fall back on the car of
the rounding returns a past time."
(let ((r (or (and (integerp rounding-minutes) rounding-minutes)
(car org-time-stamp-rounding-minutes)))
- (time (decode-time)) res)
+ (now (current-time)))
(if (< r 1)
- (current-time)
- (setq res
- (apply 'encode-time
- (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
- (nthcdr 2 time))))
- (if (and past (< (float-time (time-subtract (current-time) res)) 0))
- (seconds-to-time (- (float-time res) (* r 60)))
- res))))
+ now
+ (let* ((time (decode-time now))
+ (res (apply #'encode-time 0 (* r (round (nth 1 time) r))
+ (nthcdr 2 time))))
+ (if (or (not past) (time-less-p res now))
+ res
+ (time-subtract res (* r 60)))))))
(defun org-today ()
"Return today date, considering `org-extend-today-until'."
(time-to-days
- (time-subtract (current-time)
- (list 0 (* 3600 org-extend-today-until) 0))))
+ (time-since (* 3600 org-extend-today-until))))
;;;; Font-Lock stuff, including the activators
@@ -9740,9 +9738,7 @@ active region."
(setq link
(format-time-string
(car org-time-stamp-formats)
- (apply 'encode-time
- (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
- nil nil nil))))
+ (encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
(org-store-link-props :type "calendar" :date cd)))
((eq major-mode 'help-mode)
@@ -10056,7 +10052,7 @@ Note: this function also decodes single byte encodings like
(cons 6 128))))
(when (>= val 192) (setq eat (car shift-xor)))
(setq val (logxor val (cdr shift-xor)))
- (setq sum (+ (lsh sum (car shift-xor)) val))
+ (setq sum (+ (ash sum (car shift-xor)) val))
(when (> eat 0) (setq eat (- eat 1)))
(cond
((= 0 eat) ;multi byte
@@ -10468,7 +10464,7 @@ This is still an experimental function, your mileage may vary."
((and (equal type "lisp") (string-match "^/" path))
;; Planner has a slash, we do not.
(setq type "elisp" path (substring path 1)))
- ((string-match "^//\\(.?*\\)/\\(<.*>\\)$" path)
+ ((string-match "^//\\(.*\\)/\\(<.*>\\)$" path)
;; A typical message link. Planner has the id after the final slash,
;; we separate it with a hash mark
(setq path (concat (match-string 1 path) "#"
@@ -11879,7 +11875,8 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(when (featurep 'org-inlinetask)
(org-inlinetask-remove-END-maybe))
(setq org-markers-to-move nil)
- (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file)))))))
+ (message "%s to \"%s\" in file %s: done" actionmsg
+ (car it) file)))))))
(defun org-refile-goto-last-stored ()
"Go to the location where the last refile was stored."
@@ -13110,8 +13107,7 @@ This function is run automatically after each state change to a DONE state."
(while (re-search-forward org-clock-line-re end t)
(when (org-at-clock-log-p) (throw :clock t))))))
(org-entry-put nil "LAST_REPEAT" (format-time-string
- (org-time-stamp-format t t)
- (current-time))))
+ (org-time-stamp-format t t))))
(when org-log-repeat
(if (or (memq 'org-add-log-note (default-value 'post-command-hook))
(memq 'org-add-log-note post-command-hook))
@@ -13170,7 +13166,7 @@ has been set"
(let ((nshiftmax 10)
(nshift 0))
(while (or (= nshift 0)
- (not (time-less-p (current-time) time)))
+ (not (time-less-p nil time)))
(when (= (cl-incf nshift) nshiftmax)
(or (y-or-n-p
(format "%d repeater intervals were not \
@@ -13341,7 +13337,7 @@ for calling org-schedule with, or if there is no scheduling,
returns nil."
(let ((time (org-entry-get pom "SCHEDULED" inherit)))
(when time
- (apply 'encode-time (org-parse-time-string time)))))
+ (org-time-string-to-time time))))
(defun org-get-deadline-time (pom &optional inherit)
"Get the deadline as a time tuple, of a format suitable for
@@ -13349,7 +13345,7 @@ calling org-deadline with, or if there is no scheduling, returns
nil."
(let ((time (org-entry-get pom "DEADLINE" inherit)))
(when time
- (apply 'encode-time (org-parse-time-string time)))))
+ (org-time-string-to-time time))))
(defun org-remove-timestamp-with-keyword (keyword)
"Remove all time stamps with KEYWORD in the current entry."
@@ -13408,7 +13404,7 @@ WHAT entry will also be removed."
org-deadline-time-regexp)
end t)
(setq ts (match-string 1)
- default-time (apply 'encode-time (org-parse-time-string ts))
+ default-time (org-time-string-to-time ts)
default-input (and ts (org-get-compact-tod ts)))))))
(when what
(setq time
@@ -14665,16 +14661,15 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0."
((numberp s) s)
((stringp s)
(condition-case nil
- (float-time (apply #'encode-time (org-parse-time-string s)))
- (error 0.)))
- (t 0.)))
+ (float-time (org-time-string-to-time s))
+ (error 0)))
+ (t 0)))
(defun org-time-today ()
"Time in seconds today at 0:00.
Returns the float number of seconds since the beginning of the
epoch to the beginning of today (00:00)."
- (float-time (apply 'encode-time
- (append '(0 0 0) (nthcdr 3 (decode-time))))))
+ (float-time (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time)))))
(defun org-matcher-time (s)
"Interpret a time comparison value."
@@ -14955,7 +14950,7 @@ When JUST-ALIGN is non-nil, only align tags."
(unless (equal tags "")
(let* ((level (save-excursion
(beginning-of-line)
- (skip-chars-forward "\\*")))
+ (skip-chars-forward "*")))
(offset (if (bound-and-true-p org-indent-mode)
(* (1- org-indent-indentation-per-level)
(1- level))
@@ -16569,22 +16564,20 @@ non-nil."
((org-at-timestamp-p 'lax) (match-string 0))))
;; Default time is either the timestamp at point or today.
;; When entering a range, only the range start is considered.
- (default-time (if (not ts) (current-time)
- (apply #'encode-time (org-parse-time-string ts))))
+ (default-time (and ts (org-time-string-to-time ts)))
(default-input (and ts (org-get-compact-tod ts)))
(repeater (and ts
(string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts)
(match-string 0 ts)))
org-time-was-given
org-end-time-was-given
- (time
- (and (if (equal arg '(16)) (current-time)
+ (time (if (equal arg '(16)) (current-time)
;; Preserve `this-command' and `last-command'.
(let ((this-command this-command)
(last-command last-command))
(org-read-date
arg 'totime nil nil default-time default-input
- inactive))))))
+ inactive)))))
(cond
((and ts
(memq last-command '(org-time-stamp org-time-stamp-inactive))
@@ -16817,7 +16810,7 @@ user."
(when (< (nth 2 org-defdecode) org-extend-today-until)
(setf (nth 2 org-defdecode) -1)
(setf (nth 1 org-defdecode) 59)
- (setq org-def (apply #'encode-time org-defdecode))
+ (setq org-def (encode-time org-defdecode))
(setq org-defdecode (decode-time org-def)))
(let* ((timestr (format-time-string
(if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d")
@@ -16890,13 +16883,14 @@ user."
"range representable on this machine"))
(ding))
- ;; One round trip to get rid of 34th of August and stuff like that....
- (setq final (decode-time (apply 'encode-time final)))
+ (setq final (apply #'encode-time final))
(setq org-read-date-final-answer ans)
(if to-time
- (apply 'encode-time final)
+ final
+ ;; This round-trip gets rid of 34th of August and stuff like that....
+ (setq final (decode-time final))
(if (and (boundp 'org-time-was-given) org-time-was-given)
(format "%04d-%02d-%02d %02d:%02d"
(nth 5 final) (nth 4 final) (nth 3 final)
@@ -16926,7 +16920,7 @@ user."
(and (boundp 'org-time-was-given) org-time-was-given))
(cdr fmts)
(car fmts)))
- (txt (format-time-string fmt (apply 'encode-time f)))
+ (txt (format-time-string fmt (apply #'encode-time f)))
(txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt))
(txt (concat "=> " txt)))
(when (and org-end-time-was-given
@@ -16957,7 +16951,7 @@ user."
(when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
(setq ans "+0"))
- (when (setq delta (org-read-date-get-relative ans (current-time) org-def))
+ (when (setq delta (org-read-date-get-relative ans nil org-def))
(setq ans (replace-match "" t t ans)
deltan (car delta)
deltaw (nth 1 delta)
@@ -17114,7 +17108,7 @@ user."
; (when (and org-read-date-prefer-future
; (not iso-year)
; (< (calendar-absolute-from-gregorian iso-date)
- ; (time-to-days (current-time))))
+ ; (time-to-days nil)))
; (setq year (1+ year)
; iso-date (calendar-gregorian-from-absolute
; (calendar-iso-to-absolute
@@ -17293,7 +17287,7 @@ The command returns the inserted time stamp."
time (org-fix-decoded-time t1)
str (org-add-props
(format-time-string
- (substring tf 1 -1) (apply 'encode-time time))
+ (substring tf 1 -1) (encode-time time))
nil 'mouse-face 'highlight))
(put-text-property beg end 'display str)))
@@ -17308,7 +17302,7 @@ Don't touch the rest."
If SECONDS is non-nil, return the difference in seconds."
(let ((fdiff (if seconds #'float-time #'time-to-days)))
(- (funcall fdiff (org-time-string-to-time timestamp-string))
- (funcall fdiff (current-time)))))
+ (funcall fdiff nil))))
(defun org-deadline-close-p (timestamp-string &optional ndays)
"Is the time in TIMESTAMP-STRING close to the current date?"
@@ -17490,10 +17484,8 @@ days in order to avoid rounding problems."
(match-end (match-end 0))
(time1 (org-time-string-to-time ts1))
(time2 (org-time-string-to-time ts2))
- (t1 (float-time time1))
- (t2 (float-time time2))
- (diff (abs (- t2 t1)))
- (negative (< (- t2 t1) 0))
+ (diff (abs (float-time (time-subtract time2 time1))))
+ (negative (time-less-p time2 time1))
;; (ys (floor (* 365 24 60 60)))
(ds (* 24 60 60))
(hs (* 60 60))
@@ -17504,14 +17496,14 @@ days in order to avoid rounding problems."
(fh "%02d:%02d")
y d h m align)
(if havetime
- (setq ; y (floor (/ diff ys)) diff (mod diff ys)
+ (setq ; y (floor diff ys) diff (mod diff ys)
y 0
- d (floor (/ diff ds)) diff (mod diff ds)
- h (floor (/ diff hs)) diff (mod diff hs)
- m (floor (/ diff 60)))
- (setq ; y (floor (/ diff ys)) diff (mod diff ys)
+ d (floor diff ds) diff (mod diff ds)
+ h (floor diff hs) diff (mod diff hs)
+ m (floor diff 60))
+ (setq ; y (floor diff ys) diff (mod diff ys)
y 0
- d (floor (+ (/ diff ds) 0.5))
+ d (round diff ds)
h 0 m 0))
(if (not to-buffer)
(message "%s" (org-make-tdiff-string y d h m))
@@ -17550,7 +17542,7 @@ days in order to avoid rounding problems."
(defun org-time-string-to-time (s)
"Convert timestamp string S into internal time."
- (apply #'encode-time (org-parse-time-string s)))
+ (encode-time (org-parse-time-string s)))
(defun org-time-string-to-seconds (s)
"Convert a timestamp string S into a number of seconds."
@@ -17585,7 +17577,7 @@ signaled."
(daynr (org-closest-date s daynr prefer))
(t (time-to-days
(condition-case errdata
- (apply #'encode-time (org-parse-time-string s))
+ (org-time-string-to-time s)
(error (error "Bad timestamp `%s'%s\nError was: %s"
s
(if (not (and buffer pos)) ""
@@ -17602,7 +17594,7 @@ signaled."
YEAR is expanded into one of the 30 next years, if possible, or
into a past one. Any year larger than 99 is returned unchanged."
(if (>= year 100) year
- (let* ((current (string-to-number (format-time-string "%Y" (current-time))))
+ (let* ((current (string-to-number (format-time-string "%Y")))
(century (/ current 100))
(offset (- year (% current 100))))
(cond ((> offset 30) (+ (* (1- century) 100) year))
@@ -17683,12 +17675,12 @@ stamp stay unchanged. In any case, return value is an absolute
day number."
(if (not (string-match "\\+\\([0-9]+\\)\\([hdwmy]\\)" start))
;; No repeater. Do not shift time stamp.
- (time-to-days (apply #'encode-time (org-parse-time-string start)))
+ (time-to-days (org-time-string-to-time start))
(let ((value (string-to-number (match-string 1 start)))
(type (match-string 2 start)))
(if (= 0 value)
;; Repeater with a 0-value is considered as void.
- (time-to-days (apply #'encode-time (org-parse-time-string start)))
+ (time-to-days (org-time-string-to-time start))
(let* ((base (org-date-to-gregorian start))
(target (org-date-to-gregorian current))
(sday (calendar-absolute-from-gregorian base))
@@ -17793,7 +17785,7 @@ NODEFAULT, hour and minute fields will be nil if not given."
;; second argument. However, this requires at least Emacs
;; 25.1. We can do it when we switch to this version as our
;; minimal requirement.
- (decode-time (seconds-to-time (org-matcher-time s))))
+ (decode-time (encode-time (org-matcher-time s))))
(t (error "Not a standard Org time string: %s" s))))
(defun org-timestamp-up (&optional arg)
@@ -17997,7 +17989,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like \"--2d\"."
(setcar time0 (or (car time0) 0))
(setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
(setcar (nthcdr 2 time0) (or (nth 2 time0) 0))
- (setq time (apply 'encode-time time0))))
+ (setq time (encode-time time0))))
;; Insert the new time-stamp, and ensure point stays in the same
;; category as before (i.e. not after the last position in that
;; category).
@@ -18122,7 +18114,7 @@ A prefix ARG can be used to force the current date."
diff)
(when (or (org-at-timestamp-p 'lax)
(org-match-line (concat ".*" org-ts-regexp)))
- (let ((d1 (time-to-days (current-time)))
+ (let ((d1 (time-to-days nil))
(d2 (time-to-days (org-time-string-to-time (match-string 1)))))
(setq diff (- d2 d1))))
(calendar)
@@ -19324,6 +19316,9 @@ INCLUDE-LINKED is passed to `org-display-inline-images'."
(org-toggle-inline-images)
(org-toggle-inline-images)))
+;; For without-x builds.
+(declare-function image-refresh "image" (spec &optional frame))
+
(defun org-display-inline-images (&optional include-linked refresh beg end)
"Display inline images.
@@ -20617,7 +20612,7 @@ this numeric value."
(unless inc (setq inc 1))
(let ((pos (point))
(beg (skip-chars-backward "-+^/*0-9eE."))
- (end (skip-chars-forward "-+^/*0-9eE^.")) nap)
+ (end (skip-chars-forward "-+^/*0-9eE.")) nap)
(setq nap (buffer-substring-no-properties
(+ pos beg) (+ pos beg end)))
(delete-region (+ pos beg) (+ pos beg end))
@@ -22376,7 +22371,9 @@ returned by, e.g., `current-time'."
;; (e.g. HFS+) do not retain any finer granularity. As
;; a consequence, make sure we return non-nil when the two
;; times are equal.
- (not (time-less-p (cl-subseq (nth 5 (file-attributes file)) 0 2)
+ (not (time-less-p (cl-subseq (file-attribute-modification-time
+ (file-attributes file))
+ 0 2)
(cl-subseq time 0 2)))))
(defun org-compile-file (source process ext &optional err-msg log-buf spec)
@@ -22837,9 +22834,9 @@ assumed to be significant there."
(defun org-fill-line-break-nobreak-p ()
"Non-nil when a new line at point would create an Org line break."
(save-excursion
- (skip-chars-backward "[ \t]")
+ (skip-chars-backward " \t")
(skip-chars-backward "\\\\")
- (looking-at "\\\\\\\\\\($\\|[^\\\\]\\)")))
+ (looking-at "\\\\\\\\\\($\\|[^\\]\\)")))
(defun org-fill-paragraph-with-timestamp-nobreak-p ()
"Non-nil when a new line at point would split a timestamp."
@@ -22922,7 +22919,7 @@ matches in paragraphs or comments, use it."
(match-string 0)
"")))))))))))
-(declare-function message-goto-body "message" ())
+(declare-function message-goto-body "message" (&optional interactive))
(defvar message-cite-prefix-regexp) ; From message.el
(defun org-fill-element (&optional justify)
@@ -23381,13 +23378,12 @@ strictly within a source block, use appropriate comment syntax."
(defun org-timestamp--to-internal-time (timestamp &optional end)
"Encode TIMESTAMP object into Emacs internal time.
Use end of date range or time range when END is non-nil."
- (apply #'encode-time
- (cons 0
- (mapcar
- (lambda (prop) (or (org-element-property prop timestamp) 0))
- (if end '(:minute-end :hour-end :day-end :month-end :year-end)
- '(:minute-start :hour-start :day-start :month-start
- :year-start))))))
+ (apply #'encode-time 0
+ (mapcar
+ (lambda (prop) (or (org-element-property prop timestamp) 0))
+ (if end '(:minute-end :hour-end :day-end :month-end :year-end)
+ '(:minute-start :hour-start :day-start :month-start
+ :year-start)))))
(defun org-timestamp-has-time-p (timestamp)
"Non-nil when TIMESTAMP has a time specified."
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el
index c20536184ea..7c9920f64c5 100644
--- a/lisp/org/ox-ascii.el
+++ b/lisp/org/ox-ascii.el
@@ -1474,8 +1474,8 @@ contextual information."
(replace-regexp-in-string
"-" "•"
(replace-regexp-in-string
- "+" "⁃"
- (replace-regexp-in-string "*" "‣" bul))))))))
+ "\\+" "⁃"
+ (replace-regexp-in-string "\\*" "‣" bul))))))))
(indentation (if (eq list-type 'descriptive) org-ascii-quote-margin
(string-width bullet))))
(concat
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index b547c2181a5..1f98fcdd5cf 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -1935,7 +1935,8 @@ INFO is a plist used as a communication channel."
(?c . ,(plist-get info :creator))
(?C . ,(let ((file (plist-get info :input-file)))
(format-time-string timestamp-format
- (and file (nth 5 (file-attributes file))))))
+ (and file (file-attribute-modification-time
+ (file-attributes file))))))
(?v . ,(or (plist-get info :html-validation-link) "")))))
(defun org-html--build-pre/postamble (type info)
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index d3e62861499..d711530bf71 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -1613,7 +1613,7 @@ INFO is a plist used as a communication channel."
(defun org-latex-clean-invalid-line-breaks (data _backend _info)
(replace-regexp-in-string
- "\\(\\end{[A-Za-z0-9*]+}\\|^\\)[ \t]*\\\\\\\\[ \t]*$" "\\1"
+ "\\(\\\\end{[A-Za-z0-9*]+}\\|^\\)[ \t]*\\\\\\\\[ \t]*$" "\\1"
data))
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
index 71fd02541a7..8deb6bd51ab 100644
--- a/lisp/org/ox-odt.el
+++ b/lisp/org/ox-odt.el
@@ -2192,6 +2192,10 @@ SHORT-CAPTION are strings."
(org-odt-create-manifest-file-entry media-type target-file)
target-file))
+;; For --without-x builds.
+(declare-function clear-image-cache "image.c" (&optional filter))
+(declare-function image-size "image.c" (spec &optional pixels frame))
+
(defun org-odt--image-size
(file info &optional user-width user-height scale dpi embed-as)
(let* ((--pixels-to-cms
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index 9af50fdac44..9126647e7c3 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
;; Author: David O'Toole <dto@gnu.org>
-;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
+;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: hypermedia, outlines, wp
;; This file is part of GNU Emacs.
@@ -793,13 +793,11 @@ Default for SITEMAP-FILENAME is `sitemap.org'."
(not (string-lessp B A))))))
((or `anti-chronologically `chronologically)
(let* ((adate (org-publish-find-date a project))
- (bdate (org-publish-find-date b project))
- (A (+ (lsh (car adate) 16) (cadr adate)))
- (B (+ (lsh (car bdate) 16) (cadr bdate))))
+ (bdate (org-publish-find-date b project)))
(setq retval
- (if (eq sort-files 'chronologically)
- (<= A B)
- (>= A B)))))
+ (not (if (eq sort-files 'chronologically)
+ (time-less-p bdate adate)
+ (time-less-p adate bdate))))))
(`nil nil)
(_ (user-error "Invalid sort value %s" sort-files)))
;; Directory-wise wins:
@@ -879,7 +877,8 @@ If FILE is an Org file and provides a DATE keyword use it. In
any other case use the file system's modification time. Return
time in `current-time' format."
(let ((file (org-publish--expand-file-name file project)))
- (if (file-directory-p file) (nth 5 (file-attributes file))
+ (if (file-directory-p file) (file-attribute-modification-time
+ (file-attributes file))
(let ((date (org-publish-find-property file :date project)))
;; DATE is a secondary string. If it contains a time-stamp,
;; convert it to internal format. Otherwise, use FILE
@@ -889,7 +888,8 @@ time in `current-time' format."
(let ((value (org-element-interpret-data ts)))
(and (org-string-nw-p value)
(org-time-string-to-time value))))))
- ((file-exists-p file) (nth 5 (file-attributes file)))
+ ((file-exists-p file) (file-attribute-modification-time
+ (file-attributes file)))
(t (error "No such file: \"%s\"" file)))))))
(defun org-publish-sitemap-default-entry (entry style project)
@@ -1348,8 +1348,7 @@ does not exist."
(expand-file-name (or (file-symlink-p file) file)
(file-name-directory file)))))
(if (not attr) (error "No such file: \"%s\"" file)
- (+ (lsh (car (nth 5 attr)) 16)
- (cadr (nth 5 attr))))))
+ (encode-time (file-attribute-modification-time attr) 'integer))))
(provide 'ox-publish)
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index 6c278a1b7cf..58bc9b0ffb0 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -3252,7 +3252,7 @@ locally for the subtree through node properties."
(let ((val (cond ((equal (car key) "DATE")
(or (cdr key)
(with-temp-buffer
- (org-insert-time-stamp (current-time)))))
+ (org-insert-time-stamp nil))))
((equal (car key) "TITLE")
(or (let ((visited-file
(buffer-file-name (buffer-base-buffer))))
@@ -3322,7 +3322,7 @@ storing and resolving footnotes. It is created automatically."
(setq value (replace-match "" nil nil value)))))
(lines
(and (string-match
- ":lines +\"\\(\\(?:[0-9]+\\)?-\\(?:[0-9]+\\)?\\)\""
+ ":lines +\"\\([0-9]*-[0-9]*\\)\""
value)
(prog1 (match-string 1 value)
(setq value (replace-match "" nil nil value)))))