summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2019-01-06 11:35:33 -0500
committerKyle Meyer <kyle@kyleam.com>2019-01-13 12:53:04 -0500
commit3b7293a86b8d47e689b0205e28e16470a77eb790 (patch)
tree1cd9ede3cac8637dcfaf65d0b36562268f5dd54f
parentc11b147d1d034a5559576c83f5eced768b2b2b77 (diff)
parent5a958f3fae2e7c75e973c6366c77e59bba56c148 (diff)
downloadorg-mode-3b7293a86b8d47e689b0205e28e16470a77eb790.tar.gz
Merge branch 'backports-emacs-master' into maint
With this merge, the next release from maint targets the Emacs master branch (27.1).
-rw-r--r--doc/org-manual.org6
-rw-r--r--lisp/ob-core.el5
-rw-r--r--lisp/ob-eval.el2
-rw-r--r--lisp/org-agenda.el36
-rw-r--r--lisp/org-attach.el2
-rw-r--r--lisp/org-clock.el12
-rw-r--r--lisp/org-colview.el9
-rw-r--r--lisp/org-compat.el30
-rw-r--r--lisp/org-ctags.el5
-rw-r--r--lisp/org-element.el6
-rw-r--r--lisp/org-footnote.el2
-rw-r--r--lisp/org-habit.el4
-rw-r--r--lisp/org-id.el4
-rw-r--r--lisp/org-indent.el29
-rw-r--r--lisp/org-macro.el3
-rw-r--r--lisp/org-macs.el1
-rw-r--r--lisp/org-protocol.el15
-rw-r--r--lisp/org-timer.el10
-rw-r--r--lisp/org.el50
-rw-r--r--lisp/ox-html.el9
-rw-r--r--lisp/ox-odt.el4
-rw-r--r--lisp/ox-publish.el13
-rw-r--r--lisp/ox.el2
23 files changed, 158 insertions, 101 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org
index d432086..5a3f119 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -102,10 +102,8 @@ visited, i.e., where no Org built-in function have been loaded.
Otherwise autoload Org functions will mess up the installation.
#+end_quote
-Then, to make sure your Org configuration is taken into account,
-initialize the package system with =(package-initialize)= in your
-Emacs init file before setting any Org option. If you want to use
-Org's package repository, check out the [[https://orgmode.org/elpa.html][Org ELPA page]].
+If you want to use Org's package repository, check out the [[https://orgmode.org/elpa.html][Org ELPA
+page]].
*** Downloading Org as an archive
:PROPERTIES:
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index ca29fee..3992686 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2320,10 +2320,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
diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el
index 0587851..8d5b7ed 100644
--- a/lisp/ob-eval.el
+++ b/lisp/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-agenda.el b/lisp/org-agenda.el
index b25a8e9..489ecec 100644
--- a/lisp/org-agenda.el
+++ b/lisp/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.
@@ -2084,9 +2084,9 @@ evaluate to a string."
;;; 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.
@@ -2229,10 +2229,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
@@ -7014,15 +7018,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."
@@ -10201,7 +10205,7 @@ to override `appt-message-warning-time'."
;; time and without date as argument, so it may pass wrong
;; information otherwise
(today (org-date-to-gregorian
- (time-to-days (current-time))))
+ (time-to-days nil)))
(org-agenda-restrict nil)
(files (org-agenda-files 'unrestricted)) entries file
(org-agenda-buffer nil))
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index df06292..15ce65e 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -354,7 +354,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-clock.el b/lisp/org-clock.el
index 2c1bf02..c21451b 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -943,7 +943,7 @@ CLOCK is a cons cell of the form (MARKER START-TIME)."
(org-clock-clock-out clock fail-quietly))
((org-is-active-clock clock) nil)
(t (org-clock-clock-in clock t))))
- ((pred (time-less-p (current-time)))
+ ((pred (time-less-p nil))
(error "RESOLVE-TO must refer to a time in the past"))
(_
(when restart (error "RESTART is not valid here"))
@@ -1043,7 +1043,7 @@ to be CLOCKED OUT."))))
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
(default
(floor (/ (float-time
- (time-subtract (current-time) last-valid)) 60)))
+ (time-subtract nil last-valid)) 60)))
(keep
(and (memq ch '(?k ?K))
(read-number "Keep how many minutes? " default)))
@@ -1080,8 +1080,7 @@ to be CLOCKED OUT."))))
(keep
(time-add last-valid (seconds-to-time (* 60 keep))))
(gotback
- (time-subtract (current-time)
- (seconds-to-time (* 60 gotback))))
+ (time-subtract nil (seconds-to-time (* 60 gotback))))
(t
(error "Unexpected, please report this as a bug")))
(and gotback last-valid)
@@ -1163,7 +1162,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)
+ (time-subtract nil
(seconds-to-time org-clock-user-idle-seconds)))
(org-clock-resolving-clocks-due-to-idleness t))
(if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
@@ -1173,8 +1172,7 @@ so long."
(lambda (_)
(format "Clocked in & idle for %.1f mins"
(/ (float-time
- (time-subtract (current-time)
- org-clock-user-idle-start))
+ (time-subtract nil org-clock-user-idle-start))
60.0)))
org-clock-user-idle-start)))))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index a0209a4..5676f38 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -579,7 +579,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"
@@ -830,7 +830,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-restriction
@@ -1224,6 +1224,9 @@ column specification."
"Compute all columns that have operators defined."
(with-silent-modifications
(remove-text-properties (point-min) (point-max) '(org-summaries t)))
+ ;; Pass `current-time' result to `float-time' (instead of calling
+ ;; without arguments) so that only `current-time' has to be
+ ;; overridden in tests.
(let ((org-columns--time (float-time (current-time)))
seen)
(dolist (spec org-columns-current-fmt-compiled)
@@ -1560,7 +1563,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-compat.el b/lisp/org-compat.el
index b47b4cc..e3fbed7 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -74,6 +74,13 @@
;; The misspelled variant was made obsolete in Emacs 27.1
(defalias 'pcomplete-uniquify-list 'pcomplete-uniqify-list))
+(defun org-current-time-as-list ()
+ "Compatibility wrapper for `current-time'.
+As of Emacs 27.1, `current-time' callers should not assume a list
+return value."
+ (or (ignore-errors (encode-time nil 'list))
+ (current-time)))
+
;;; Emacs < 26.1 compatibility
@@ -81,6 +88,20 @@
(defalias 'org-line-number-display-width 'line-number-display-width)
(defun org-line-number-display-width (&rest _) 0))
+(unless (fboundp 'file-attribute-modification-time)
+ (defsubst file-attribute-modification-time (attributes)
+ "The modification time in ATTRIBUTES returned by `file-attributes'.
+This is the time of the last change to the file's contents, and
+is a list of integers (HIGH LOW USEC PSEC) in the same style
+as (current-time)."
+ (nth 5 attributes)))
+
+(unless (fboundp 'file-attribute-size)
+ (defsubst file-attribute-size (attributes)
+ "The size (in bytes) in ATTRIBUTES returned by `file-attributes'.
+This is a floating point number if the size is too large for an integer."
+ (nth 7 attributes)))
+
;;; Emacs < 25.1 compatibility
@@ -598,6 +619,15 @@ attention to case differences."
(eq t (compare-strings suffix nil nil
string start-pos nil ignore-case))))))
+(unless (fboundp 'proper-list-p)
+ ;; `proper-list-p' was added in Emacs 27.1. The function below is
+ ;; taken from Emacs subr.el 200195e824b^.
+ (defun proper-list-p (object)
+ "Return OBJECT's length if it is a proper list, nil otherwise.
+A proper list is neither circular nor dotted (i.e., its last cdr
+is nil)."
+ (and (listp object) (ignore-errors (length object)))))
+
;;; Integration with and fixes for other packages
diff --git a/lisp/org-ctags.el b/lisp/org-ctags.el
index 7dc8dd5..111be37 100644
--- a/lisp/org-ctags.el
+++ b/lisp/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-element.el b/lisp/org-element.el
index 0a11570..8d16aa5 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4906,7 +4906,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
@@ -5114,7 +5114,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.
@@ -5168,7 +5168,7 @@ updated before current modification are actually submitted."
(and next (aref next 0))
threshold
(and (not threshold)
- (time-add (current-time)
+ (time-add nil
org-element-cache-sync-duration))
future-change)
;; Request processed. Merge current and next offsets and
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 7147a31..4a296b1 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -654,7 +654,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-habit.el b/lisp/org-habit.el
index 06429d7..d19075d 100644
--- a/lisp/org-habit.el
+++ b/lisp/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,7 +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)
+ (moment (time-subtract nil
(list 0 (* 3600 org-extend-today-until) 0))))
(save-excursion
(goto-char (if line (point-at-bol) (point-min)))
diff --git a/lisp/org-id.el b/lisp/org-id.el
index bbf761c..f4c737f 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -358,7 +358,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)
+ (org-current-time-as-list)
(user-uid)
(emacs-pid)
(user-full-name)
@@ -417,7 +417,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 (or time (org-current-time-as-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-indent.el b/lisp/org-indent.el
index ecdac54..650a62f 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -184,11 +184,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)
@@ -212,10 +216,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)
@@ -326,7 +333,7 @@ stopped."
(let* ((case-fold-search t)
(limited-re (org-get-limited-outline-regexp))
(level (or (org-current-level) 0))
- (time-limit (and delay (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).
@@ -339,7 +346,7 @@ stopped."
;; In asynchronous mode, take a break of
;; `org-indent-agent-resume-delay' every DELAY to avoid
;; blocking any other idle timer or process output.
- ((and delay (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-macro.el b/lisp/org-macro.el
index 164a415..c14703c 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -158,7 +158,8 @@ a file, \"input-file\" and \"modification-time\"."
'%s)))"
(prin1-to-string visited-file)
(prin1-to-string
- (nth 5 (file-attributes visited-file))))))))
+ (file-attribute-modification-time
+ (file-attributes visited-file))))))))
;; Install built-in macros.
(list
'("n" . "(eval (org-macro--counter-increment $1 $2))")
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 0653f6a..d3e5932 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -31,6 +31,7 @@
;;; Code:
+(require 'cl-lib)
(require 'format-spec)
(declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index d20c66f..9245aa0 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -350,17 +350,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-timer.el b/lisp/org-timer.el
index 400ff02..d0e6257 100644
--- a/lisp/org-timer.el
+++ b/lisp/org-timer.el
@@ -163,6 +163,9 @@ With prefix arg STOP, stop it entirely."
(org-timer-pause-time
(let ((start-secs (float-time org-timer-start-time))
(pause-secs (float-time org-timer-pause-time)))
+ ;; Note: We pass the result of `current-time' to `time-add' and
+ ;; `float-time' below so that we can easily override the value
+ ;; in tests.
(if org-timer-countdown-timer
(let ((new-secs (- start-secs pause-secs)))
(setq org-timer-countdown-timer
@@ -171,9 +174,6 @@ With prefix arg STOP, stop it entirely."
(setq org-timer-start-time
(time-add (current-time) (seconds-to-time 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)))))
(setq org-timer-pause-time nil)
@@ -402,7 +402,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"
@@ -465,6 +465,8 @@ using three `C-u' prefix arguments."
(org-timer--run-countdown-timer
secs org-timer-countdown-timer-title))
(run-hooks 'org-timer-set-hook)
+ ;; Pass `current-time' result to `add-time' (instead nil) so
+ ;; that only `current-time' has to be overridden in tests.
(setq org-timer-start-time
(time-add (current-time) (seconds-to-time secs)))
(setq org-timer-pause-time nil)
diff --git a/lisp/org.el b/lisp/org.el
index 5be3953..354f437 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -252,9 +252,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-subtract nil
+ (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
@@ -1119,6 +1120,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.
@@ -1143,8 +1146,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)])
@@ -1538,6 +1539,8 @@ time in Emacs."
:type 'boolean
:safe #'booleanp)
+(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.
@@ -1575,7 +1578,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.
@@ -3019,6 +3021,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
@@ -3050,8 +3054,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
@@ -3360,6 +3362,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
@@ -3367,8 +3372,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.
@@ -3816,6 +3819,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
@@ -3833,9 +3839,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."
@@ -5637,15 +5640,14 @@ the rounding returns a past time."
(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))
+ (if (and past (< (float-time (time-subtract nil res)) 0))
(seconds-to-time (- (float-time res) (* r 60)))
res))))
(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-subtract nil (list 0 (* 3600 org-extend-today-until) 0))))
;;;; Font-Lock stuff, including the activators
@@ -9642,7 +9644,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
@@ -12792,8 +12794,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))
@@ -12848,7 +12849,7 @@ This function is run automatically after each state change to a DONE state."
(let ((nshiftmax 10)
(nshift 0))
(while (or (= nshift 0)
- (not (time-less-p (current-time) time)))
+ (not (time-less-p nil time)))
(when (= nshiftmax (cl-incf nshift))
(or (y-or-n-p
(format "%d repeater intervals were not \
@@ -16567,7 +16568,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
@@ -17055,7 +17056,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))
@@ -17552,7 +17553,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)
@@ -18730,6 +18731,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.
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 7c056e8..bea03e4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -234,7 +234,7 @@ property on the headline itself.")
@licstart The following is the entire license notice for the
JavaScript code in this tag.
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
@@ -537,7 +537,7 @@ means to use the maximum value consistent with other options."
* @licstart The following is the entire license notice for the
* JavaScript code in %SCRIPT_PATH.
*
- * Copyright (C) 2012-2018 Free Software Foundation, Inc.
+ * Copyright (C) 2012-2019 Free Software Foundation, Inc.
*
*
* The JavaScript code in this tag is free software: you can
@@ -566,7 +566,7 @@ means to use the maximum value consistent with other options."
@licstart The following is the entire license notice for the
JavaScript code in this tag.
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
@@ -1953,7 +1953,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/ox-odt.el b/lisp/ox-odt.el
index f52b590..c14ee0b 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2194,6 +2194,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/ox-publish.el b/lisp/ox-publish.el
index 1ef9031..d9fc8d2 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -794,8 +794,8 @@ Default for SITEMAP-FILENAME is `sitemap.org'."
((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))))
+ (A (+ (ash (car adate) 16) (cadr adate)))
+ (B (+ (ash (car bdate) 16) (cadr bdate))))
(setq retval
(if (eq sort-files 'chronologically)
(<= A B)
@@ -881,7 +881,8 @@ time in `current-time' format."
(or (org-publish-cache-get-file-property file :date nil t)
(org-publish-cache-set-file-property
file :date
- (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.
@@ -891,7 +892,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)
@@ -1364,8 +1366,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))))))
+ (floor (float-time (file-attribute-modification-time attr))))))
(provide 'ox-publish)
diff --git a/lisp/ox.el b/lisp/ox.el
index 9706cb8..6a0e480 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3230,7 +3230,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))))