Browse Source

Merge branch 'maint'

Kyle Meyer 6 years ago
parent
commit
ba321d0e44

File diff suppressed because it is too large
+ 149 - 148
doc/org-manual.org


+ 2 - 3
lisp/ob-core.el

@@ -2308,10 +2308,9 @@ INFO may provide the values of these header arguments (in the
 		       (lambda (r)
 		       (lambda (r)
 			 ;; Non-nil when result R can be turned into
 			 ;; Non-nil when result R can be turned into
 			 ;; a table.
 			 ;; a table.
-			 (and (listp r)
-			      (null (cdr (last r)))
+                         (and (proper-list-p r)
 			      (cl-every
 			      (cl-every
-			       (lambda (e) (or (atom e) (null (cdr (last e)))))
+                               (lambda (e) (or (atom e) (proper-list-p e)))
 			       result)))))
 			       result)))))
 		  ;; insert results based on type
 		  ;; insert results based on type
 		  (cond
 		  (cond

+ 1 - 1
lisp/ob-eval.el

@@ -120,7 +120,7 @@ function in various versions of Emacs.
       (delete-file input-file))
       (delete-file input-file))
 
 
     (when (and error-file (file-exists-p error-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)
 	(with-current-buffer (get-buffer-create error-buffer)
 	  (let ((pos-from-end (- (point-max) (point))))
 	  (let ((pos-from-end (- (point-max) (point))))
 	    (or (bobp)
 	    (or (bobp)

+ 20 - 16
lisp/org-agenda.el

@@ -1401,6 +1401,9 @@ current display in the agenda."
   :group 'org-agenda-daily/weekly
   :group 'org-agenda-daily/weekly
   :type 'plist)
   :type 'plist)
 
 
+(defvaralias 'org-agenda-search-view-search-words-only
+  'org-agenda-search-view-always-boolean)
+
 (defcustom org-agenda-search-view-always-boolean nil
 (defcustom org-agenda-search-view-always-boolean nil
   "Non-nil means the search string is interpreted as individual parts.
   "Non-nil means the search string is interpreted as individual parts.
 
 
@@ -1429,9 +1432,6 @@ boolean search."
   :version "24.1"
   :version "24.1"
   :type 'boolean)
   :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
 (defcustom org-agenda-search-view-force-full-words nil
   "Non-nil means, search words must be matches as complete words.
   "Non-nil means, search words must be matches as complete words.
 When nil, they may also match part of a word."
 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)
 	  (const  :tag "Hide none" nil)
 	  (string :tag "Regexp   ")))
 	  (string :tag "Regexp   ")))
 
 
+(defvaralias 'org-agenda-remove-tags-when-in-prefix
+  'org-agenda-remove-tags)
+
 (defcustom org-agenda-remove-tags nil
 (defcustom org-agenda-remove-tags nil
   "Non-nil means remove the tags from the headline copy in the agenda.
   "Non-nil means remove the tags from the headline copy in the agenda.
 When this is the symbol `prefix', only remove tags when
 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 "Never" nil)
 	  (const :tag "When prefix format contains %T" prefix)))
 	  (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
 (defcustom org-agenda-tags-column 'auto
   "Shift tags in agenda items to this column.
   "Shift tags in agenda items to this column.
@@ -1902,8 +1904,6 @@ character screen."
   :package-version '(Org . "9.1")
   :package-version '(Org . "9.1")
   :version "26.1")
   :version "26.1")
 
 
-(defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)
-
 (defcustom org-agenda-fontify-priorities 'cookies
 (defcustom org-agenda-fontify-priorities 'cookies
   "Non-nil means highlight low and high priorities in agenda.
   "Non-nil means highlight low and high priorities in agenda.
 When t, the highest priority entries are bold, lowest priority italic.
 When t, the highest priority entries are bold, lowest priority italic.
@@ -2084,9 +2084,9 @@ evaluate to a string."
 
 
 ;;; Define the org-agenda-mode
 ;;; Define the org-agenda-mode
 
 
+(defvaralias 'org-agenda-keymap 'org-agenda-mode-map)
 (defvar org-agenda-mode-map (make-sparse-keymap)
 (defvar org-agenda-mode-map (make-sparse-keymap)
   "Keymap for `org-agenda-mode'.")
   "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-menu) ; defined later in this file.
 (defvar org-agenda-restrict nil) ; 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 'post-command-hook 'org-agenda-update-agenda-type nil 'local)
   (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   ;; Make sure properties are removed when copying text
   ;; 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
   (unless org-agenda-keep-modes
     (setq org-agenda-follow-mode org-agenda-start-with-follow-mode
     (setq org-agenda-follow-mode org-agenda-start-with-follow-mode
 	  org-agenda-entry-text-mode org-agenda-start-with-entry-text-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
 \"timestamp_ia\", compare within each of these type.  When TYPE
 is the empty string, compare all timestamps without respect of
 is the empty string, compare all timestamps without respect of
 their type."
 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) ""))
 	 (ta (or (and (string-match type (or (get-text-property 1 'type a) ""))
 		      (get-text-property 1 'ts-date a))
 		      (get-text-property 1 'ts-date a))
 		 def))
 		 def))
 	 (tb (or (and (string-match type (or (get-text-property 1 'type b) ""))
 	 (tb (or (and (string-match type (or (get-text-property 1 'type b) ""))
 		      (get-text-property 1 'ts-date b))
 		      (get-text-property 1 'ts-date b))
 		 def)))
 		 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)
 (defsubst org-cmp-habit-p (a b)
   "Compare the todo states of strings A and 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
          ;; time and without date as argument, so it may pass wrong
          ;; information otherwise
          ;; information otherwise
          (today (org-date-to-gregorian
          (today (org-date-to-gregorian
-                 (time-to-days (current-time))))
+                 (time-to-days nil)))
          (org-agenda-restrict nil)
          (org-agenda-restrict nil)
          (files (org-agenda-files 'unrestricted)) entries file
          (files (org-agenda-files 'unrestricted)) entries file
          (org-agenda-buffer nil))
          (org-agenda-buffer nil))

+ 1 - 1
lisp/org-attach.el

@@ -356,7 +356,7 @@ This checks for the existence of a \".git\" directory in that directory."
                   (shell-command-to-string
                   (shell-command-to-string
                    "git ls-files -zmo --exclude-standard") "\0" t))
                    "git ls-files -zmo --exclude-standard") "\0" t))
           (if (and use-annex
           (if (and use-annex
-                   (>= (nth 7 (file-attributes new-or-modified))
+                   (>= (file-attribute-size (file-attributes new-or-modified))
                        org-attach-git-annex-cutoff))
                        org-attach-git-annex-cutoff))
               (call-process "git" nil nil nil "annex" "add" new-or-modified)
               (call-process "git" nil nil nil "annex" "add" new-or-modified)
             (call-process "git" nil nil nil "add" new-or-modified))
             (call-process "git" nil nil nil "add" new-or-modified))

+ 14 - 13
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-clock-clock-out clock fail-quietly))
 	((org-is-active-clock clock) nil)
 	((org-is-active-clock clock) nil)
 	(t (org-clock-clock-in clock t))))
 	(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"))
        (error "RESOLVE-TO must refer to a time in the past"))
       (_
       (_
        (when restart (error "RESTART is not valid here"))
        (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)))))
 		(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
 	 (default
 	 (default
 	   (floor (/ (float-time
 	   (floor (/ (float-time
-		      (time-subtract (current-time) last-valid)) 60)))
+		      (time-subtract nil last-valid)) 60)))
 	 (keep
 	 (keep
 	  (and (memq ch '(?k ?K))
 	  (and (memq ch '(?k ?K))
 	       (read-number "Keep how many minutes? " default)))
 	       (read-number "Keep how many minutes? " default)))
@@ -1080,8 +1080,7 @@ to be CLOCKED OUT."))))
 	      (keep
 	      (keep
 	       (time-add last-valid (seconds-to-time (* 60 keep))))
 	       (time-add last-valid (seconds-to-time (* 60 keep))))
 	      (gotback
 	      (gotback
-	       (time-subtract (current-time)
-			      (seconds-to-time (* 60 gotback))))
+	       (time-subtract nil (seconds-to-time (* 60 gotback))))
 	      (t
 	      (t
 	       (error "Unexpected, please report this as a bug")))
 	       (error "Unexpected, please report this as a bug")))
        (and gotback last-valid)
        (and gotback last-valid)
@@ -1163,7 +1162,7 @@ so long."
 	     org-clock-marker (marker-buffer org-clock-marker))
 	     org-clock-marker (marker-buffer org-clock-marker))
     (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
     (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
 	   (org-clock-user-idle-start
 	   (org-clock-user-idle-start
-	    (time-subtract (current-time)
+	    (time-subtract nil
 			   (seconds-to-time org-clock-user-idle-seconds)))
 			   (seconds-to-time org-clock-user-idle-seconds)))
 	   (org-clock-resolving-clocks-due-to-idleness t))
 	   (org-clock-resolving-clocks-due-to-idleness t))
       (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
       (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
@@ -1173,8 +1172,7 @@ so long."
 	   (lambda (_)
 	   (lambda (_)
 	     (format "Clocked in & idle for %.1f mins"
 	     (format "Clocked in & idle for %.1f mins"
 		     (/ (float-time
 		     (/ (float-time
-			 (time-subtract (current-time)
-					org-clock-user-idle-start))
+			 (time-subtract nil org-clock-user-idle-start))
 			60.0)))
 			60.0)))
 	   org-clock-user-idle-start)))))
 	   org-clock-user-idle-start)))))
 
 
@@ -2130,7 +2128,8 @@ The return value is a list containing two internal times, one for
 the beginning of the range and one for its end, like the ones
 the beginning of the range and one for its end, like the ones
 returned by `current-time' or `encode-time' and a string used to
 returned by `current-time' or `encode-time' and a string used to
 display information.  If AS-STRINGS is non-nil, the returned
 display information.  If AS-STRINGS is non-nil, the returned
-times will be formatted strings.
+times will be formatted strings.  Note that the first element is
+always nil when KEY is `untilnow'.
 
 
 If WSTART is non-nil, use this number to specify the starting day
 If WSTART is non-nil, use this number to specify the starting day
 of a week (monday is 1).  If MSTART is non-nil, use this number
 of a week (monday is 1).  If MSTART is non-nil, use this number
@@ -2247,9 +2246,7 @@ have priority."
     ;; Format start and end times according to AS-STRINGS.
     ;; Format start and end times according to AS-STRINGS.
     (let* ((start (pcase key
     (let* ((start (pcase key
 		    (`interactive (org-read-date nil t nil "Range start? "))
 		    (`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))
+		    (`untilnow nil)
 		    (_ (encode-time 0 m h d month y))))
 		    (_ (encode-time 0 m h d month y))))
 	   (end (pcase key
 	   (end (pcase key
 		  (`interactive (org-read-date nil t nil "Range end? "))
 		  (`interactive (org-read-date nil t nil "Range end? "))
@@ -2273,7 +2270,7 @@ have priority."
 	      (`untilnow "now"))))
 	      (`untilnow "now"))))
       (if (not as-strings) (list start end text)
       (if (not as-strings) (list start end text)
 	(let ((f (cdr org-time-stamp-formats)))
 	(let ((f (cdr org-time-stamp-formats)))
-	  (list (format-time-string f start)
+	  (list (and start (format-time-string f start))
 		(format-time-string f end)
 		(format-time-string f end)
 		text))))))
 		text))))))
 
 
@@ -2717,7 +2714,11 @@ a number of clock tables."
             ((and (pred numberp) n)
             ((and (pred numberp) n)
              (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
              (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
                (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
                (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
-            (timestamp (seconds-to-time (org-matcher-time timestamp)))))
+            (timestamp
+	     (seconds-to-time
+	      (org-matcher-time (or timestamp
+				    ;; The year Org was born.
+				    "<2003-01-01 Thu 00:00>"))))))
          (end
          (end
           (pcase (if range (nth 1 range) (plist-get params :tend))
           (pcase (if range (nth 1 range) (plist-get params :tend))
             ((and (pred numberp) n)
             ((and (pred numberp) n)

+ 6 - 3
lisp/org-colview.el

@@ -572,7 +572,7 @@ Where possible, use the standard interface for changing this line."
 	 (eol (line-end-position))
 	 (eol (line-end-position))
 	 (pom (or (get-text-property bol 'org-hd-marker) (point)))
 	 (pom (or (get-text-property bol 'org-hd-marker) (point)))
 	 (key (or key (get-char-property (point) 'org-columns-key)))
 	 (key (or key (get-char-property (point) 'org-columns-key)))
-	 (org-columns--time (float-time (current-time)))
+	 (org-columns--time (float-time))
 	 (action
 	 (action
 	  (pcase key
 	  (pcase key
 	    ("CLOCKSUM"
 	    ("CLOCKSUM"
@@ -823,7 +823,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
     (org-columns-goto-top-level)
     (org-columns-goto-top-level)
     ;; Initialize `org-columns-current-fmt' and
     ;; Initialize `org-columns-current-fmt' and
     ;; `org-columns-current-fmt-compiled'.
     ;; `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)
       (org-columns-get-format columns-fmt-string)
       (unless org-columns-inhibit-recalculation (org-columns-compute-all))
       (unless org-columns-inhibit-recalculation (org-columns-compute-all))
       (save-restriction
       (save-restriction
@@ -1208,6 +1208,9 @@ column specification."
   "Compute all columns that have operators defined."
   "Compute all columns that have operators defined."
   (with-silent-modifications
   (with-silent-modifications
     (remove-text-properties (point-min) (point-max) '(org-summaries t)))
     (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)))
   (let ((org-columns--time (float-time (current-time)))
 	seen)
 	seen)
     (dolist (spec org-columns-current-fmt-compiled)
     (dolist (spec org-columns-current-fmt-compiled)
@@ -1551,7 +1554,7 @@ PARAMS is a property list of parameters:
   (if (markerp org-columns-begin-marker)
   (if (markerp org-columns-begin-marker)
       (move-marker org-columns-begin-marker (point))
       (move-marker org-columns-begin-marker (point))
     (setq org-columns-begin-marker (point-marker)))
     (setq org-columns-begin-marker (point-marker)))
-  (let* ((org-columns--time (float-time (current-time)))
+  (let* ((org-columns--time (float-time))
 	 (fmt
 	 (fmt
 	  (cond
 	  (cond
 	   ((bound-and-true-p org-agenda-overriding-columns-format))
 	   ((bound-and-true-p org-agenda-overriding-columns-format))

+ 30 - 0
lisp/org-compat.el

@@ -74,6 +74,13 @@
   ;; The misspelled variant was made obsolete in Emacs 27.1
   ;; The misspelled variant was made obsolete in Emacs 27.1
   (defalias 'pcomplete-uniquify-list 'pcomplete-uniqify-list))
   (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
 ;;; Emacs < 26.1 compatibility
 
 
@@ -85,6 +92,20 @@
     (defalias 'org-buffer-hash 'buffer-hash)
     (defalias 'org-buffer-hash 'buffer-hash)
   (defun org-buffer-hash () (md5 (current-buffer))))
   (defun org-buffer-hash () (md5 (current-buffer))))
 
 
+(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
 ;;; Emacs < 25.1 compatibility
 
 
@@ -602,6 +623,15 @@ attention to case differences."
            (eq t (compare-strings suffix nil nil
            (eq t (compare-strings suffix nil nil
                                   string start-pos nil ignore-case))))))
                                   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
 ;;; Integration with and fixes for other packages
 
 

+ 3 - 2
lisp/org-ctags.el

@@ -137,6 +137,7 @@
 
 
 ;;; Code:
 ;;; Code:
 
 
+(eval-when-compile (require 'cl-lib))
 (require 'org)
 (require 'org)
 
 
 (defgroup org-ctags nil
 (defgroup org-ctags nil
@@ -235,7 +236,7 @@ buffer position where the tag is found."
       (with-current-buffer (get-file-buffer tags-file-name)
       (with-current-buffer (get-file-buffer tags-file-name)
         (goto-char (point-min))
         (goto-char (point-min))
         (cond
         (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)
                                      (regexp-quote tag)) nil t)
           (let ((line (string-to-number (match-string 1)))
           (let ((line (string-to-number (match-string 1)))
                 (pos (string-to-number (match-string 2))))
                 (pos (string-to-number (match-string 2))))
@@ -260,7 +261,7 @@ Return the list."
       (visit-tags-table-buffer 'same)
       (visit-tags-table-buffer 'same)
       (with-current-buffer (get-file-buffer tags-file-name)
       (with-current-buffer (get-file-buffer tags-file-name)
         (goto-char (point-min))
         (goto-char (point-min))
-        (while (re-search-forward "^.*\\(.*\\)\\([0-9]+\\),\\([0-9]+\\)$"
+        (while (re-search-forward "^.*\^?\\(.*\\)\^A\\([0-9]+\\),\\([0-9]+\\)$"
                                   nil t)
                                   nil t)
           (push (substring-no-properties (match-string 1)) taglist)))
           (push (substring-no-properties (match-string 1)) taglist)))
       taglist)))
       taglist)))

+ 3 - 3
lisp/org-element.el

@@ -4906,7 +4906,7 @@ table is cleared once the synchronization is complete."
 (defun org-element--cache-generate-key (lower upper)
 (defun org-element--cache-generate-key (lower upper)
   "Generate a key between LOWER and 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
 If LOWER and UPPER are equals, return LOWER.  Otherwise, return
 a unique key, as an integer or a list of integers, according to
 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."
 TIME-LIMIT is a time value or nil."
   (and time-limit
   (and time-limit
        (or (input-pending-p)
        (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)
 (defsubst org-element--cache-shift-positions (element offset &optional props)
   "Shift ELEMENT properties relative to buffer positions by OFFSET.
   "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))
 	     (and next (aref next 0))
 	     threshold
 	     threshold
 	     (and (not threshold)
 	     (and (not threshold)
-		  (time-add (current-time)
+		  (time-add nil
 			    org-element-cache-sync-duration))
 			    org-element-cache-sync-duration))
 	     future-change)
 	     future-change)
 	    ;; Request processed.  Merge current and next offsets and
 	    ;; Request processed.  Merge current and next offsets and

+ 1 - 1
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))
   (let* ((all (org-footnote-all-labels))
 	 (label
 	 (label
 	  (if (eq org-footnote-auto-label 'random)
 	  (if (eq org-footnote-auto-label 'random)
-	      (format "%x" (random most-positive-fixnum))
+	      (format "%x" (abs (random)))
 	    (org-footnote-normalize-label
 	    (org-footnote-normalize-label
 	     (let ((propose (org-footnote-unique-label all)))
 	     (let ((propose (org-footnote-unique-label all)))
 	       (if (eq org-footnote-auto-label t) propose
 	       (if (eq org-footnote-auto-label t) propose

+ 2 - 2
lisp/org-habit.el

@@ -288,7 +288,7 @@ Habits are assigned colors on the following basis:
 	 (deadline (if scheduled-days
 	 (deadline (if scheduled-days
 		       (+ scheduled-days (- d-repeat s-repeat))
 		       (+ scheduled-days (- d-repeat s-repeat))
 		     (org-habit-deadline habit)))
 		     (org-habit-deadline habit)))
-	 (m-days (or now-days (time-to-days (current-time)))))
+	 (m-days (or now-days (time-to-days nil))))
     (cond
     (cond
      ((< m-days scheduled)
      ((< m-days scheduled)
       '(org-habit-clear-face . org-habit-clear-future-face))
       '(org-habit-clear-face . org-habit-clear-future-face))
@@ -406,7 +406,7 @@ current time."
   "Insert consistency graph for any habitual tasks."
   "Insert consistency graph for any habitual tasks."
   (let ((inhibit-read-only t)
   (let ((inhibit-read-only t)
 	(buffer-invisibility-spec '(org-link))
 	(buffer-invisibility-spec '(org-link))
-	(moment (time-subtract (current-time)
+	(moment (time-subtract nil
 			       (list 0 (* 3600 org-extend-today-until) 0))))
 			       (list 0 (* 3600 org-extend-today-until) 0))))
     (save-excursion
     (save-excursion
       (goto-char (if line (point-at-bol) (point-min)))
       (goto-char (if line (point-at-bol) (point-min)))

+ 2 - 2
lisp/org-id.el

@@ -358,7 +358,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
   "Return string with random (version 4) UUID."
   "Return string with random (version 4) UUID."
   (let ((rnd (md5 (format "%s%s%s%s%s%s%s"
   (let ((rnd (md5 (format "%s%s%s%s%s%s%s"
 			  (random)
 			  (random)
-			  (current-time)
+			  (org-current-time-as-list)
 			  (user-uid)
 			  (user-uid)
 			  (emacs-pid)
 			  (emacs-pid)
 			  (user-full-name)
 			  (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.
   "Encode TIME as a 10-digit string.
 This string holds the time to micro-second accuracy, and can be decoded
 This string holds the time to micro-second accuracy, and can be decoded
 using `org-id-decode'."
 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)
   (concat (org-id-int-to-b36 (nth 0 time) 4)
 	  (org-id-int-to-b36 (nth 1 time) 4)
 	  (org-id-int-to-b36 (nth 1 time) 4)
 	  (org-id-int-to-b36 (or (nth 2 time) 0) 4)))
 	  (org-id-int-to-b36 (or (nth 2 time) 0) 4)))

+ 18 - 11
lisp/org-indent.el

@@ -184,11 +184,15 @@ during idle time."
 		  org-hide-leading-stars)
 		  org-hide-leading-stars)
       (setq-local org-hide-leading-stars t))
       (setq-local org-hide-leading-stars t))
     (org-indent--compute-prefixes)
     (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 'after-change-functions 'org-indent-refresh-maybe nil 'local)
     (add-hook 'before-change-functions
     (add-hook 'before-change-functions
 	      'org-indent-notify-modified-headline nil 'local)
 	      'org-indent-notify-modified-headline nil 'local)
@@ -212,10 +216,13 @@ during idle time."
     (when (boundp 'org-hide-leading-stars-before-indent-mode)
     (when (boundp 'org-hide-leading-stars-before-indent-mode)
       (setq-local org-hide-leading-stars
       (setq-local org-hide-leading-stars
 		  org-hide-leading-stars-before-indent-mode))
 		  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 'after-change-functions 'org-indent-refresh-maybe 'local)
     (remove-hook 'before-change-functions
     (remove-hook 'before-change-functions
 		 'org-indent-notify-modified-headline 'local)
 		 'org-indent-notify-modified-headline 'local)
@@ -326,7 +333,7 @@ stopped."
      (let* ((case-fold-search t)
      (let* ((case-fold-search t)
 	    (limited-re (org-get-limited-outline-regexp))
 	    (limited-re (org-get-limited-outline-regexp))
 	    (level (or (org-current-level) 0))
 	    (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'
        ;; For each line, set `line-prefix' and `wrap-prefix'
        ;; properties depending on the type of line (headline, inline
        ;; properties depending on the type of line (headline, inline
        ;; task, item or other).
        ;; task, item or other).
@@ -339,7 +346,7 @@ stopped."
 	    ;; In asynchronous mode, take a break of
 	    ;; In asynchronous mode, take a break of
 	    ;; `org-indent-agent-resume-delay' every DELAY to avoid
 	    ;; `org-indent-agent-resume-delay' every DELAY to avoid
 	    ;; blocking any other idle timer or process output.
 	    ;; 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
 	     (setq org-indent-agent-resume-timer
 		   (run-with-idle-timer
 		   (run-with-idle-timer
 		    (time-add (current-idle-time) org-indent-agent-resume-delay)
 		    (time-add (current-idle-time) org-indent-agent-resume-delay)

+ 2 - 1
lisp/org-macro.el

@@ -158,7 +158,8 @@ a file, \"input-file\" and \"modification-time\"."
                      '%s)))"
                      '%s)))"
 			    (prin1-to-string visited-file)
 			    (prin1-to-string visited-file)
 			    (prin1-to-string
 			    (prin1-to-string
-			     (nth 5 (file-attributes visited-file))))))))
+			     (file-attribute-modification-time
+			      (file-attributes visited-file))))))))
 	 ;; Install built-in macros.
 	 ;; Install built-in macros.
 	 (list
 	 (list
 	  '("n" . "(eval (org-macro--counter-increment $1 $2))")
 	  '("n" . "(eval (org-macro--counter-increment $1 $2))")

+ 4 - 1
lisp/org-macs.el

@@ -31,6 +31,7 @@
 
 
 ;;; Code:
 ;;; Code:
 
 
+(require 'cl-lib)
 (require 'format-spec)
 (require 'format-spec)
 
 
 (declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
 (declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
@@ -1112,7 +1113,9 @@ nil, just return 0."
 If time is not given, defaults to 0:00.  However, with optional
 If time is not given, defaults to 0:00.  However, with optional
 NODEFAULT, hour and minute fields are nil if not given.
 NODEFAULT, hour and minute fields are nil if not given.
 
 
-Throw an error if S in not a valid Org time string.
+Throw an error if S does not contain a valid Org time string.
+Note that the first match for YYYY-MM-DD will be used (e.g.,
+\"-52000-02-03\" will be taken as \"2000-02-03\").
 
 
 This should be a lot faster than the `parse-time-string'."
 This should be a lot faster than the `parse-time-string'."
   (unless (string-match org-ts-regexp0 s)
   (unless (string-match org-ts-regexp0 s)

+ 9 - 6
lisp/org-protocol.el

@@ -350,17 +350,20 @@ returned list."
 	  ret)
 	  ret)
       l)))
       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:
 Greedy handlers might receive a list like this from emacsclient:
 \((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\"))
 \((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\"))
 where \"/dir/\" is the absolute path to emacsclients working directory.
 where \"/dir/\" is the absolute path to emacsclients working directory.
 This function transforms it into a flat list."
 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)
 (defun org-protocol-parse-parameters (info &optional new-style default-order)
   "Return a property list of parameters from INFO.
   "Return a property list of parameters from INFO.

+ 6 - 4
lisp/org-timer.el

@@ -163,6 +163,9 @@ With prefix arg STOP, stop it entirely."
    (org-timer-pause-time
    (org-timer-pause-time
     (let ((start-secs (float-time org-timer-start-time))
     (let ((start-secs (float-time org-timer-start-time))
 	  (pause-secs (float-time org-timer-pause-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
       (if org-timer-countdown-timer
 	  (let ((new-secs (- start-secs pause-secs)))
 	  (let ((new-secs (- start-secs pause-secs)))
 	    (setq org-timer-countdown-timer
 	    (setq org-timer-countdown-timer
@@ -171,9 +174,6 @@ With prefix arg STOP, stop it entirely."
 	    (setq org-timer-start-time
 	    (setq org-timer-start-time
 		  (time-add (current-time) (seconds-to-time new-secs))))
 		  (time-add (current-time) (seconds-to-time new-secs))))
 	(setq org-timer-start-time
 	(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))
 	      (seconds-to-time (- (float-time (current-time))
 				  (- pause-secs start-secs)))))
 				  (- pause-secs start-secs)))))
       (setq org-timer-pause-time nil)
       (setq org-timer-pause-time nil)
@@ -402,7 +402,7 @@ VALUE can be `on', `off', or `paused'."
       (message "No timer set")
       (message "No timer set")
     (let* ((rtime (decode-time
     (let* ((rtime (decode-time
 		   (time-subtract (timer--time org-timer-countdown-timer)
 		   (time-subtract (timer--time org-timer-countdown-timer)
-				  (current-time))))
+				  nil)))
 	   (rsecs (nth 0 rtime))
 	   (rsecs (nth 0 rtime))
 	   (rmins (nth 1 rtime)))
 	   (rmins (nth 1 rtime)))
       (message "%d minute(s) %d seconds left before next time out"
       (message "%d minute(s) %d seconds left before next time out"
@@ -467,6 +467,8 @@ using three `C-u' prefix arguments."
 		(org-timer--run-countdown-timer
 		(org-timer--run-countdown-timer
 		 secs org-timer-countdown-timer-title))
 		 secs org-timer-countdown-timer-title))
 	  (run-hooks 'org-timer-set-hook)
 	  (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
 	  (setq org-timer-start-time
 		(time-add (current-time) (seconds-to-time secs)))
 		(time-add (current-time) (seconds-to-time secs)))
 	  (setq org-timer-pause-time nil)
 	  (setq org-timer-pause-time nil)

+ 23 - 19
lisp/org.el

@@ -258,7 +258,8 @@ byte-compiled before it is loaded."
   (interactive "fFile to load: \nP")
   (interactive "fFile to load: \nP")
   (let* ((tangled-file (concat (file-name-sans-extension file) ".el")))
   (let* ((tangled-file (concat (file-name-sans-extension file) ".el")))
     ;; Tangle only if the Org file is newer than the Elisp file.
     ;; Tangle only if the Org file is newer than the Elisp file.
-    (unless (org-file-newer-than-p tangled-file (nth 5 (file-attributes file)))
+    (unless (org-file-newer-than-p tangled-file
+				   (file-attribute-modification-time file))
       (org-babel-tangle-file file tangled-file "emacs-lisp"))
       (org-babel-tangle-file file tangled-file "emacs-lisp"))
     (if compile
     (if compile
 	(progn
 	(progn
@@ -1439,6 +1440,8 @@ time in Emacs."
   :type 'boolean
   :type 'boolean
   :safe #'booleanp)
   :safe #'booleanp)
 
 
+(defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
+
 (defcustom org-special-ctrl-a/e nil
 (defcustom org-special-ctrl-a/e nil
   "Non-nil means `C-a' and `C-e' behave specially in headlines and items.
   "Non-nil means `C-a' and `C-e' behave specially in headlines and items.
 
 
@@ -1476,7 +1479,6 @@ This may also be a cons cell where the behavior for `C-a' and
 			(const :tag "off" nil)
 			(const :tag "off" nil)
 			(const :tag "on: before tags first" t)
 			(const :tag "on: before tags first" t)
 			(const :tag "reversed: after tags first" reversed)))))
 			(const :tag "reversed: after tags first" reversed)))))
-(defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
 
 
 (defcustom org-special-ctrl-k nil
 (defcustom org-special-ctrl-k nil
   "Non-nil means `C-k' will behave specially in headlines.
   "Non-nil means `C-k' will behave specially in headlines.
@@ -2890,6 +2892,8 @@ because Agenda Log mode depends on the format of these entries."
 (unless (assq 'note org-log-note-headings)
 (unless (assq 'note org-log-note-headings)
   (push '(note . "%t") 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
 (defcustom org-log-into-drawer nil
   "Non-nil means insert state change notes and time stamps into a drawer.
   "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
 When nil, state changes notes will be inserted after the headline and
@@ -2921,8 +2925,6 @@ function `org-log-into-drawer' instead."
 	  (const :tag "LOGBOOK" t)
 	  (const :tag "LOGBOOK" t)
 	  (string :tag "Other")))
 	  (string :tag "Other")))
 
 
-(defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
-
 (defun org-log-into-drawer ()
 (defun org-log-into-drawer ()
   "Name of the log drawer, as a string, or nil.
   "Name of the log drawer, as a string, or nil.
 This is the value of `org-log-into-drawer'.  However, if the
 This is the value of `org-log-into-drawer'.  However, if the
@@ -3231,6 +3233,9 @@ This display will be in an overlay, in the minibuffer."
   :group 'org-time
   :group 'org-time
   :type 'boolean)
   :type 'boolean)
 
 
+(defvaralias 'org-popup-calendar-for-date-prompt
+  'org-read-date-popup-calendar)
+
 (defcustom org-read-date-popup-calendar t
 (defcustom org-read-date-popup-calendar t
   "Non-nil means pop up a calendar when prompting for a date.
   "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
 In the calendar, the date can be selected with mouse-1.  However, the
@@ -3238,8 +3243,6 @@ minibuffer will also be active, and you can simply enter the date as well.
 When nil, only the minibuffer will be available."
 When nil, only the minibuffer will be available."
   :group 'org-time
   :group 'org-time
   :type 'boolean)
   :type 'boolean)
-(defvaralias 'org-popup-calendar-for-date-prompt
-  'org-read-date-popup-calendar)
 
 
 (defcustom org-extend-today-until 0
 (defcustom org-extend-today-until 0
   "The hour when your day really ends.  Must be an integer.
   "The hour when your day really ends.  Must be an integer.
@@ -3687,6 +3690,9 @@ regular expression will be included."
   :group 'org-agenda
   :group 'org-agenda
   :type 'regexp)
   :type 'regexp)
 
 
+(defvaralias 'org-agenda-multi-occur-extra-files
+  'org-agenda-text-search-extra-files)
+
 (defcustom org-agenda-text-search-extra-files nil
 (defcustom org-agenda-text-search-extra-files nil
   "List of extra files to be searched by text search commands.
   "List of extra files to be searched by text search commands.
 These files will be searched in addition to the agenda files by the
 These files will be searched in addition to the agenda files by the
@@ -3704,9 +3710,6 @@ scope."
 	      (const :tag "Agenda Archives" agenda-archives)
 	      (const :tag "Agenda Archives" agenda-archives)
 	      (repeat :inline t (file))))
 	      (repeat :inline t (file))))
 
 
-(defvaralias 'org-agenda-multi-occur-extra-files
-  'org-agenda-text-search-extra-files)
-
 (defcustom org-agenda-skip-unavailable-files nil
 (defcustom org-agenda-skip-unavailable-files nil
   "Non-nil means to just skip non-reachable files in `org-agenda-files'.
   "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."
 A nil value means to remove them, after a query, from the list."
@@ -5491,15 +5494,14 @@ the rounding returns a past time."
 	    (apply 'encode-time
 	    (apply 'encode-time
 		   (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
 		   (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
 			   (nthcdr 2 time))))
 			   (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)))
 	  (seconds-to-time (- (float-time res) (* r 60)))
 	res))))
 	res))))
 
 
 (defun org-today ()
 (defun org-today ()
   "Return today date, considering `org-extend-today-until'."
   "Return today date, considering `org-extend-today-until'."
   (time-to-days
   (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
 ;;;; Font-Lock stuff, including the activators
 
 
@@ -9488,7 +9490,7 @@ Note: this function also decodes single byte encodings like
 		  (cons 6 128))))
 		  (cons 6 128))))
 	  (when (>= val 192) (setq eat (car shift-xor)))
 	  (when (>= val 192) (setq eat (car shift-xor)))
 	  (setq val (logxor val (cdr 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)))
 	  (when (> eat 0) (setq eat (- eat 1)))
 	  (cond
 	  (cond
 	   ((= 0 eat)			;multi byte
 	   ((= 0 eat)			;multi byte
@@ -12673,8 +12675,7 @@ This function is run automatically after each state change to a DONE state."
 		    (while (re-search-forward org-clock-line-re end t)
 		    (while (re-search-forward org-clock-line-re end t)
 		      (when (org-at-clock-log-p) (throw :clock t))))))
 		      (when (org-at-clock-log-p) (throw :clock t))))))
 	(org-entry-put nil "LAST_REPEAT" (format-time-string
 	(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
       (when org-log-repeat
 	(if (or (memq 'org-add-log-note (default-value 'post-command-hook))
 	(if (or (memq 'org-add-log-note (default-value 'post-command-hook))
 		(memq 'org-add-log-note post-command-hook))
 		(memq 'org-add-log-note post-command-hook))
@@ -12729,7 +12730,7 @@ This function is run automatically after each state change to a DONE state."
 		      (let ((nshiftmax 10)
 		      (let ((nshiftmax 10)
 			    (nshift 0))
 			    (nshift 0))
 			(while (or (= nshift 0)
 			(while (or (= nshift 0)
-				   (not (time-less-p (current-time) time)))
+				   (not (time-less-p nil time)))
 			  (when (= nshiftmax (cl-incf nshift))
 			  (when (= nshiftmax (cl-incf nshift))
 			    (or (y-or-n-p
 			    (or (y-or-n-p
 				 (format "%d repeater intervals were not \
 				 (format "%d repeater intervals were not \
@@ -16382,7 +16383,7 @@ user."
 					;      (when (and org-read-date-prefer-future
 					;      (when (and org-read-date-prefer-future
 					;		 (not iso-year)
 					;		 (not iso-year)
 					;		 (< (calendar-absolute-from-gregorian iso-date)
 					;		 (< (calendar-absolute-from-gregorian iso-date)
-					;		    (time-to-days (current-time))))
+					;		    (time-to-days nil)))
 					;	(setq year (1+ year)
 					;	(setq year (1+ year)
 					;	      iso-date (calendar-gregorian-from-absolute
 					;	      iso-date (calendar-gregorian-from-absolute
 					;			(calendar-iso-to-absolute
 					;			(calendar-iso-to-absolute
@@ -16870,7 +16871,7 @@ signaled."
 YEAR is expanded into one of the 30 next years, if possible, or
 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."
 into a past one.  Any year larger than 99 is returned unchanged."
   (if (>= year 100) year
   (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))
 	   (century (/ current 100))
 	   (offset (- year (% current 100))))
 	   (offset (- year (% current 100))))
       (cond ((> offset 30) (+ (* (1- century) 100) year))
       (cond ((> offset 30) (+ (* (1- century) 100) year))
@@ -17367,7 +17368,7 @@ A prefix ARG can be used to force the current date."
 	diff)
 	diff)
     (when (or (org-at-timestamp-p 'lax)
     (when (or (org-at-timestamp-p 'lax)
 	      (org-match-line (concat ".*" org-ts-regexp)))
 	      (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)))))
 	    (d2 (time-to-days (org-time-string-to-time (match-string 1)))))
 	(setq diff (- d2 d1))))
 	(setq diff (- d2 d1))))
     (calendar)
     (calendar)
@@ -18529,6 +18530,9 @@ INCLUDE-LINKED is passed to `org-display-inline-images'."
     (org-toggle-inline-images)
     (org-toggle-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)
 (defun org-display-inline-images (&optional include-linked refresh beg end)
   "Display inline images.
   "Display inline images.
 
 

+ 5 - 4
lisp/ox-html.el

@@ -235,7 +235,7 @@ property on the headline itself.")
 @licstart  The following is the entire license notice for the
 @licstart  The following is the entire license notice for the
 JavaScript code in this tag.
 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
 The JavaScript code in this tag is free software: you can
 redistribute it and/or modify it under the terms of the GNU
 redistribute it and/or modify it under the terms of the GNU
@@ -538,7 +538,7 @@ means to use the maximum value consistent with other options."
  * @licstart  The following is the entire license notice for the
  * @licstart  The following is the entire license notice for the
  *  JavaScript code in %SCRIPT_PATH.
  *  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
  * The JavaScript code in this tag is free software: you can
@@ -567,7 +567,7 @@ means to use the maximum value consistent with other options."
 @licstart  The following is the entire license notice for the
 @licstart  The following is the entire license notice for the
 JavaScript code in this tag.
 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
 The JavaScript code in this tag is free software: you can
 redistribute it and/or modify it under the terms of the GNU
 redistribute it and/or modify it under the terms of the GNU
@@ -1961,7 +1961,8 @@ INFO is a plist used as a communication channel."
       (?c . ,(plist-get info :creator))
       (?c . ,(plist-get info :creator))
       (?C . ,(let ((file (plist-get info :input-file)))
       (?C . ,(let ((file (plist-get info :input-file)))
 	       (format-time-string timestamp-format
 	       (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) "")))))
       (?v . ,(or (plist-get info :html-validation-link) "")))))
 
 
 (defun org-html--build-pre/postamble (type info)
 (defun org-html--build-pre/postamble (type info)

+ 4 - 0
lisp/ox-odt.el

@@ -2196,6 +2196,10 @@ SHORT-CAPTION are strings."
     (org-odt-create-manifest-file-entry media-type target-file)
     (org-odt-create-manifest-file-entry media-type target-file)
     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
 (defun org-odt--image-size
   (file info &optional user-width user-height scale dpi embed-as)
   (file info &optional user-width user-height scale dpi embed-as)
   (let* ((--pixels-to-cms
   (let* ((--pixels-to-cms

+ 7 - 6
lisp/ox-publish.el

@@ -794,8 +794,8 @@ Default for SITEMAP-FILENAME is `sitemap.org'."
 		((or `anti-chronologically `chronologically)
 		((or `anti-chronologically `chronologically)
 		 (let* ((adate (org-publish-find-date a project))
 		 (let* ((adate (org-publish-find-date a project))
 			(bdate (org-publish-find-date b 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
 		   (setq retval
 			 (if (eq sort-files 'chronologically)
 			 (if (eq sort-files 'chronologically)
 			     (<= A B)
 			     (<= A B)
@@ -881,7 +881,8 @@ time in `current-time' format."
     (or (org-publish-cache-get-file-property file :date nil t)
     (or (org-publish-cache-get-file-property file :date nil t)
 	(org-publish-cache-set-file-property
 	(org-publish-cache-set-file-property
 	 file :date
 	 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)))
 	   (let ((date (org-publish-find-property file :date project)))
 	     ;; DATE is a secondary string.  If it contains
 	     ;; DATE is a secondary string.  If it contains
 	     ;; a time-stamp, convert it to internal format.
 	     ;; a time-stamp, convert it to internal format.
@@ -891,7 +892,8 @@ time in `current-time' format."
 			   (let ((value (org-element-interpret-data ts)))
 			   (let ((value (org-element-interpret-data ts)))
 			     (and (org-string-nw-p value)
 			     (and (org-string-nw-p value)
 				  (org-time-string-to-time 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)))))))))
 		   (t (error "No such file: \"%s\"" file)))))))))
 
 
 (defun org-publish-sitemap-default-entry (entry style project)
 (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)
 	       (expand-file-name (or (file-symlink-p file) file)
 				 (file-name-directory file)))))
 				 (file-name-directory file)))))
     (if (not attr) (error "No such file: \"%s\"" 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)
 (provide 'ox-publish)

+ 1 - 1
lisp/ox.el

@@ -3230,7 +3230,7 @@ locally for the subtree through node properties."
       (let ((val (cond ((equal (car key) "DATE")
       (let ((val (cond ((equal (car key) "DATE")
 			(or (cdr key)
 			(or (cdr key)
 			    (with-temp-buffer
 			    (with-temp-buffer
-			      (org-insert-time-stamp (current-time)))))
+			      (org-insert-time-stamp nil))))
 		       ((equal (car key) "TITLE")
 		       ((equal (car key) "TITLE")
 			(or (let ((visited-file
 			(or (let ((visited-file
 				   (buffer-file-name (buffer-base-buffer))))
 				   (buffer-file-name (buffer-base-buffer))))

Some files were not shown because too many files changed in this diff