Przeglądaj źródła

Merge branch 'maint'

Nicolas Goaziou 7 lat temu
rodzic
commit
259656a76e

+ 0 - 3
etc/ORG-NEWS

@@ -672,9 +672,6 @@ It used to be ~@samp~ but ~@asis~ is neutral and, therefore, more
 suitable as a default value.
 *** Texinfo default process includes ~--no-split~ option
 *** New entities : ~\dollar~ and ~\USD~
-*** ~org-parse-time-string~ accepts a new optional argument
-=ZONE= specifies the current time zone.
-*** ~org-time-string-to-seconds~ now accepts an optional =ZONE= argument
 *** Support for date style URLs in =org-protocol://open-source=
     URLs like =https://cool-blog.com/2017/05/20/cool-post/= are
     covered by rewrite rules.

+ 1 - 1
lisp/ob-gnuplot.el

@@ -40,7 +40,7 @@
 ;;; Code:
 (require 'ob)
 
-(declare-function org-time-string-to-time "org" (s &optional zone))
+(declare-function org-time-string-to-time "org" (s))
 (declare-function org-combine-plists "org" (&rest plists))
 (declare-function orgtbl-to-generic "org-table" (table params))
 (declare-function gnuplot-mode "ext:gnuplot-mode" ())

+ 11 - 12
lisp/org-clock.el

@@ -1467,7 +1467,7 @@ The time is always returned as UTC."
 	  (and (or (not cmt) (equal cmt "auto"))
 	       lr))
       (setq org--msg-extra "showing task time since last repeat.")
-      (and lr (org-time-string-to-time lr t)))
+      (and lr (org-time-string-to-time lr)))
      (t nil))))
 
 (defun org-clock-find-position (find-unclosed)
@@ -1604,9 +1604,9 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
 	  (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 nil t)))
+		      (apply #'encode-time (org-parse-time-string te)))
 		     (float-time
-		      (apply #'encode-time (org-parse-time-string ts nil t))))
+		      (apply #'encode-time (org-parse-time-string ts))))
 		h (floor (/ s 3600))
 		s (- s (* 3600 h))
 		m (floor (/ s 60))
@@ -1711,8 +1711,8 @@ Optional argument N tells to change by that many units."
 	      (begts (if updatets1 begts1 begts2)))
 	  (setq tdiff
 		(time-subtract
-		 (org-time-string-to-time org-last-changed-timestamp t)
-		 (org-time-string-to-time ts t)))
+		 (org-time-string-to-time org-last-changed-timestamp)
+		 (org-time-string-to-time ts)))
 	  (save-excursion
 	    (goto-char begts)
 	    (org-timestamp-change
@@ -1820,10 +1820,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
 	  (lmax 30)
 	  (ltimes (make-vector lmax 0))
 	  (level 0)
-	  (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart t))
+	  (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart))
 			((consp tstart) (float-time tstart))
 			(t tstart)))
-	  (tend (cond ((stringp tend) (org-time-string-to-seconds tend t))
+	  (tend (cond ((stringp tend) (org-time-string-to-seconds tend))
 		      ((consp tend) (float-time tend))
 		      (t tend)))
 	  (t1 0)
@@ -1840,11 +1840,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
 	   (let* ((ts (float-time
 		       (apply #'encode-time
 			      (save-match-data
-				(org-parse-time-string
-				 (match-string 2) nil t)))))
+				(org-parse-time-string (match-string 2))))))
 		  (te (float-time
 		       (apply #'encode-time
-			      (org-parse-time-string (match-string 3) nil t))))
+			      (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))))))
@@ -2902,9 +2901,9 @@ Otherwise, return nil."
 	  (setq ts (match-string 1)
 		te (match-string 3))
 	  (setq s (- (float-time
-		      (apply #'encode-time (org-parse-time-string te nil t)))
+		      (apply #'encode-time (org-parse-time-string te)))
 		     (float-time
-		      (apply #'encode-time (org-parse-time-string ts nil t))))
+		      (apply #'encode-time (org-parse-time-string ts))))
 		neg (< s 0)
 		s (abs s)
 		h (floor (/ s 3600))

+ 1 - 1
lisp/org-colview.el

@@ -1094,7 +1094,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 nil t))))
+	  (float-time (apply #'encode-time (org-parse-time-string s))))
        60))
    ((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units
    (t (user-error "Invalid age: %S" s))))

+ 1 - 1
lisp/org-list.el

@@ -149,7 +149,7 @@
 (declare-function org-remove-indentation "org" (code &optional n))
 (declare-function org-show-subtree "org" ())
 (declare-function org-sort-remove-invisible "org" (S))
-(declare-function org-time-string-to-seconds "org" (s &optional zone))
+(declare-function org-time-string-to-seconds "org" (s))
 (declare-function org-timer-hms-to-secs "org-timer" (hms))
 (declare-function org-timer-item "org-timer" (&optional arg))
 (declare-function org-trim "org" (s &optional keep-lead))

+ 27 - 29
lisp/org.el

@@ -5710,11 +5710,19 @@ This should be called after the variable `org-link-parameters' has changed."
 		   (not (and (equal marker "+")
 			     (org-match-line
 			      "[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$")))
+		   ;; Do not match headline stars.  Do not consider
+		   ;; stars of a headline as closing marker for bold
+		   ;; markup either.
+		   (not (and (equal marker "*")
+			     (save-excursion
+			       (forward-char)
+			       (skip-chars-backward "*")
+			       (looking-at-p org-outline-regexp-bol))))
 		   ;; Match full emphasis markup regexp.
 		   (looking-at (if verbatim? org-verbatim-re org-emph-re))
 		   ;; Do not span over paragraph boundaries.
 		   (not (string-match-p org-element-paragraph-separate
-					(match-string 0)))
+					(match-string 2)))
 		   ;; Do not span over cells in table rows.
 		   (not (and (save-match-data (org-match-line "[ \t]*|"))
 			     (string-match-p "|" (match-string 4))))))
@@ -14330,7 +14338,7 @@ 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 nil t)))
+	(float-time (apply #'encode-time (org-parse-time-string s)))
       (error 0.)))
    (t 0.)))
 
@@ -17079,8 +17087,8 @@ both scheduled and deadline timestamps."
 			   'timestamp)
 		     (org-at-planning-p))
 		   (time-less-p
-		    (org-time-string-to-time match t)
-		    (org-time-string-to-time d t)))))))
+		    (org-time-string-to-time match)
+		    (org-time-string-to-time d)))))))
     (message "%d entries before %s"
 	     (org-occur regexp nil callback)
 	     d)))
@@ -17101,8 +17109,8 @@ both scheduled and deadline timestamps."
 			   'timestamp)
 		     (org-at-planning-p))
 		   (not (time-less-p
-			 (org-time-string-to-time match t)
-			 (org-time-string-to-time d t))))))))
+			 (org-time-string-to-time match)
+			 (org-time-string-to-time d))))))))
     (message "%d entries after %s"
 	     (org-occur regexp nil callback)
 	     d)))
@@ -17125,11 +17133,11 @@ both scheduled and deadline timestamps."
 			'timestamp)
 		  (org-at-planning-p))
 		(not (time-less-p
-		      (org-time-string-to-time match t)
-		      (org-time-string-to-time start-date t)))
+		      (org-time-string-to-time match)
+		      (org-time-string-to-time start-date)))
 		(time-less-p
-		 (org-time-string-to-time match t)
-		 (org-time-string-to-time end-date t))))))))
+		 (org-time-string-to-time match)
+		 (org-time-string-to-time end-date))))))))
     (message "%d entries between %s and %s"
 	     (org-occur regexp nil callback) start-date end-date)))
 
@@ -17214,19 +17222,13 @@ days in order to avoid rounding problems."
       (push m l))
     (apply 'format fmt (nreverse l))))
 
-(defun org-time-string-to-time (s &optional zone)
-  "Convert timestamp string S into internal time.
-The optional ZONE is omitted or nil for Emacs local time, t for
-Universal Time, ‘wall’ for system wall clock time, or a string as
-in the TZ environment variable."
-  (apply #'encode-time (org-parse-time-string s nil zone)))
+(defun org-time-string-to-time (s)
+  "Convert timestamp string S into internal time."
+  (apply #'encode-time (org-parse-time-string s)))
 
-(defun org-time-string-to-seconds (s &optional zone)
-  "Convert a timestamp string S into a number of seconds.
-The optional ZONE is omitted or nil for Emacs local time, t for
-Universal Time, ‘wall’ for system wall clock time, or a string as
-in the TZ environment variable."
-  (float-time (org-time-string-to-time s zone)))
+(defun org-time-string-to-seconds (s)
+  "Convert a timestamp string S into a number of seconds."
+  (float-time (org-time-string-to-time s)))
 
 (org-define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
 
@@ -17443,17 +17445,13 @@ day number."
 	   (list (nth 4 d) (nth 3 d) (nth 5 d))))
 	((listp d) (list (nth 4 d) (nth 3 d) (nth 5 d)))))
 
-(defun org-parse-time-string (s &optional nodefault zone)
+(defun org-parse-time-string (s &optional nodefault)
   "Parse the standard Org time string.
 
 This should be a lot faster than the normal `parse-time-string'.
 
 If time is not given, defaults to 0:00.  However, with optional
-NODEFAULT, hour and minute fields will be nil if not given.
-
-The optional ZONE is omitted or nil for Emacs local time, t for
-Universal Time, ‘wall’ for system wall clock time, or a string as
-in the TZ environment variable."
+NODEFAULT, hour and minute fields will be nil if not given."
   (cond ((string-match org-ts-regexp0 s)
 	 (list 0
 	       (when (or (match-beginning 8) (not nodefault))
@@ -17463,7 +17461,7 @@ in the TZ environment variable."
 	       (string-to-number (match-string 4 s))
 	       (string-to-number (match-string 3 s))
 	       (string-to-number (match-string 2 s))
-	       nil nil zone))
+	       nil nil nil))
 	((string-match "^<[^>]+>$" s)
 	 ;; FIXME: `decode-time' needs to be called with ZONE as its
 	 ;; second argument.  However, this requires at least Emacs

+ 8 - 8
testing/lisp/test-org-clock.el

@@ -49,8 +49,8 @@ Return the clock line as a string."
   (let* ((beg (org-test-clock-create-timestamp input1 t t))
          (end (and input2 (org-test-clock-create-timestamp input2 t t)))
          (sec-diff (and input2
-			(floor (- (org-time-string-to-seconds end t)
-				  (org-time-string-to-seconds beg t))))))
+			(floor (- (org-time-string-to-seconds end)
+				  (org-time-string-to-seconds beg))))))
     (concat org-clock-string " " beg
             (when end
               (concat "--" end " => "
@@ -344,15 +344,15 @@ the buffer."
   ;; line, and ignore "file" column.
   (should
    (equal
-    "| Headline     | Time       |     |
-|--------------+------------+-----|
-| *Total time* | *16904:01* | foo |
-|--------------+------------+-----|
-| Test         | 16904:01   | foo |
+    "| Headline     | Time   |     |
+|--------------+--------+-----|
+| *Total time* | *8:40* | foo |
+|--------------+--------+-----|
+| Test         | 8:40   | foo |
 #+TBLFM: $3=string(\"foo\")"
     (org-test-with-temp-text-in-file
         "* Test
-CLOCK: [2012-03-29 Thu 16:40]--[2014-03-04 Thu 00:41] => 16904:01"
+CLOCK: [2012-03-29 Thu 8:00]--[2012-03-29 Thu 16:40] => 8:40"
       (test-org-clock-clocktable-contents ":scope file-with-archives"
 	  "#+TBLFM: $3=string(\"foo\")"))))
   ;; Test "function" scope.

+ 9 - 9
testing/lisp/test-org-colview.el

@@ -513,7 +513,7 @@
     (cl-letf (((symbol-function 'current-time)
 	       (lambda ()
 		 (apply #'encode-time
-			(org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+			(org-parse-time-string "<2014-03-04 Tue>")))))
       (org-test-with-temp-text
 	  "* H
 ** S1
@@ -528,39 +528,39 @@
 	(get-char-property (point) 'org-columns-value-modified)))))
   (should
    (equal
-    "705d"
+    "2d"
     (cl-letf (((symbol-function 'current-time)
 	       (lambda ()
 		 (apply #'encode-time
-			(org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+			(org-parse-time-string "<2014-03-04 Tue>")))))
       (org-test-with-temp-text
 	  "* H
 ** S1
 :PROPERTIES:
-:A: <2012-03-29 Thu>
+:A: <2014-03-03 Mon>
 :END:
 ** S1
 :PROPERTIES:
-:A: <2014-03-04 Tue>
+:A: <2014-03-02 Sun>
 :END:"
 	(let ((org-columns-default-format "%A{@max}")) (org-columns))
 	(get-char-property (point) 'org-columns-value-modified)))))
   (should
    (equal
-    "352d 12h"
+    "1d 12h"
     (cl-letf (((symbol-function 'current-time)
 	       (lambda ()
 		 (apply #'encode-time
-			(org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+			(org-parse-time-string "<2014-03-04 Tue>")))))
       (org-test-with-temp-text
 	  "* H
 ** S1
 :PROPERTIES:
-:A: <2012-03-29 Thu>
+:A: <2014-03-03 Mon>
 :END:
 ** S1
 :PROPERTIES:
-:A: <2014-03-04 Tue>
+:A: <2014-03-02 Sun>
 :END:"
 	(let ((org-columns-default-format "%A{@mean}")) (org-columns))
 	(get-char-property (point) 'org-columns-value-modified)))))