]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-clock.el
Fix byte-compiler warnings about looking-back.
[gnu-emacs] / lisp / org / org-clock.el
index b4f44035fbadb3671c661e58c458d17de353d528..c0a45b3ad13bab5b547c9763686f2024aebb13de 100644 (file)
@@ -1046,9 +1046,9 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
                        (lambda (clock)
                          (format
                           "Dangling clock started %d mins ago"
-                          (floor
-                           (/ (- (org-float-time (current-time))
-                                 (org-float-time (cdr clock))) 60))))))
+                          (floor (- (org-float-time)
+                                    (org-float-time (cdr clock)))
+                                 60)))))
                   (or last-valid
                       (cdr clock)))))))))))
 
@@ -1066,9 +1066,11 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
 (defvar org-x11idle-exists-p
   ;; Check that x11idle exists
   (and (eq window-system 'x)
-       (eq (call-process-shell-command "command" nil nil nil "-v" org-clock-x11idle-program-name) 0)
+       (eq 0 (call-process-shell-command
+              (format "command -v %s" org-clock-x11idle-program-name)))
        ;; Check that x11idle can retrieve the idle time
-       (eq (call-process-shell-command org-clock-x11idle-program-name nil nil nil) 0)))
+       ;; FIXME: Why "..-shell-command" rather than just `call-process'?
+       (eq 0 (call-process-shell-command org-clock-x11idle-program-name))))
 
 (defun org-x11-idle-seconds ()
   "Return the current X11 idle time in seconds."
@@ -1368,7 +1370,7 @@ decides which time to use."
       (current-time))
      ((equal cmt "today")
       (setq org--msg-extra "showing today's task time.")
-      (let* ((dt (decode-time (current-time))))
+      (let* ((dt (decode-time)))
        (setq dt (append (list 0 0 0) (nthcdr 3 dt)))
        (if org-extend-today-until
            (setf (nth 2 dt) org-extend-today-until))
@@ -1654,7 +1656,8 @@ Optional argument N tells to change by that many units."
   (save-excursion ; Do not replace this with `with-current-buffer'.
     (org-no-warnings (set-buffer (org-clocking-buffer)))
     (goto-char org-clock-marker)
-    (if (org-looking-back (concat "^[ \t]*" org-clock-string ".*"))
+    (if (org-looking-back (concat "^[ \t]*" org-clock-string ".*")
+                          (line-beginning-position))
        (progn (delete-region (1- (point-at-bol)) (point-at-eol))
               (org-remove-empty-drawer-at "LOGBOOK" (point)))
       (message "Clock gone, cancel the timer anyway")
@@ -1927,7 +1930,7 @@ fontified, and then returned."
     (org-mode)
     (org-create-dblock props)
     (org-update-dblock)
-    (font-lock-fontify-buffer)
+    (org-font-lock-ensure)
     (forward-line 2)
     (buffer-substring (point) (progn
                                (re-search-forward "^[ \t]*#\\+END" nil t)
@@ -2029,7 +2032,7 @@ If MSTART is non-nil, use this number to specify the starting day of a
 month (1 is the first day of the month).
 If you can combine both, the month starting day will have priority."
   (if (integerp key) (setq key (intern (number-to-string key))))
-  (let* ((tm (decode-time (or time (current-time))))
+  (let* ((tm (decode-time time))
         (s 0) (m (nth 1 tm)) (h (nth 2 tm))
         (d (nth 3 tm)) (month (nth 4 tm)) (y (nth 5 tm))
         (dow (nth 6 tm))
@@ -2670,10 +2673,8 @@ TIME:      The sum of all time spend in this tree, in minutes.  This time
     (when (and te (listp te))
       (setq te (format "%4d-%02d-%02d" (nth 2 te) (car te) (nth 1 te))))
     ;; Now the times are strings we can parse.
-    (if ts (setq ts (org-float-time
-                    (seconds-to-time (org-matcher-time ts)))))
-    (if te (setq te (org-float-time
-                    (seconds-to-time (org-matcher-time te)))))
+    (if ts (setq ts (org-matcher-time ts)))
+    (if te (setq te (org-matcher-time te)))
     (save-excursion
       (org-clock-sum ts te
                     (unless (null matcher)
@@ -2813,8 +2814,8 @@ The details of what will be saved are regulated by the variable
          (delete-region (point-min) (point-max))
          ;;Store clock
          (insert (format ";; org-persist.el - %s at %s\n"
-                         system-name (format-time-string
-                                      (cdr org-time-stamp-formats))))
+                         (system-name) (format-time-string
+                                        (cdr org-time-stamp-formats))))
          (if (and (memq org-clock-persist '(t clock))
                   (setq b (org-clocking-buffer))
                   (setq b (or (buffer-base-buffer b) b))