Ver código fonte

org-clock: Replace org-clocking-buffer with org-clock-is-active

org-clocking-buffer and org-clock-is-active have the same definition.
org-clocking-buffer is defined in org-clock.el while
org-clock-is-active is defined in org.el.  org-clock.el requires
org.el.

org-clocking-buffer is kept as an alias to preserve backward
compatibility with any user code.

* lisp/org-clock.el (org-clocking-buffer): Moved to org.el.
* lisp/org.el (org-clocking-buffer): Moved function.
(org-clock-is-active): Made into an alias.
Allen Li 4 anos atrás
pai
commit
16b5ee0efb
2 arquivos alterados com 3 adições e 7 exclusões
  1. 0 4
      lisp/org-clock.el
  2. 3 3
      lisp/org.el

+ 0 - 4
lisp/org-clock.el

@@ -618,10 +618,6 @@ cannot be translated."
 	  ((stringp drawer) drawer)
 	  ((stringp drawer) drawer)
 	  (t nil))))
 	  (t nil))))
 
 
-(defun org-clocking-buffer ()
-  "Return the clocking buffer if we are currently clocking a task or nil."
-  (marker-buffer org-clock-marker))
-
 (defun org-clocking-p ()
 (defun org-clocking-p ()
   "Return t when clocking a task."
   "Return t when clocking a task."
   (not (equal (org-clocking-buffer) nil)))
   (not (equal (org-clocking-buffer) nil)))

+ 3 - 3
lisp/org.el

@@ -144,7 +144,6 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-clock-timestamps-down "org-clock" (&optional n))
 (declare-function org-clock-timestamps-down "org-clock" (&optional n))
 (declare-function org-clock-timestamps-up "org-clock" (&optional n))
 (declare-function org-clock-timestamps-up "org-clock" (&optional n))
 (declare-function org-clock-update-time-maybe "org-clock" ())
 (declare-function org-clock-update-time-maybe "org-clock" ())
-(declare-function org-clocking-buffer "org-clock" ())
 (declare-function org-clocktable-shift "org-clock" (dir n))
 (declare-function org-clocktable-shift "org-clock" (dir n))
 (declare-function org-columns-quit "org-colview" ())
 (declare-function org-columns-quit "org-colview" ())
 (declare-function org-columns-insert-dblock "org-colview" ())
 (declare-function org-columns-insert-dblock "org-colview" ())
@@ -3828,10 +3827,11 @@ This is needed for font-lock setup.")
   "Marker recording the last clock-in, but the headline position.")
   "Marker recording the last clock-in, but the headline position.")
 (defvar org-clock-heading ""
 (defvar org-clock-heading ""
   "The heading of the current clock entry.")
   "The heading of the current clock entry.")
-(defun org-clock-is-active ()
+(defun org-clocking-buffer ()
   "Return the buffer where the clock is currently running.
   "Return the buffer where the clock is currently running.
 Return nil if no clock is running."
 Return nil if no clock is running."
   (marker-buffer org-clock-marker))
   (marker-buffer org-clock-marker))
+(defalias 'org-clock-is-active #'org-clocking-buffer)
 
 
 (defun org-check-running-clock ()
 (defun org-check-running-clock ()
   "Check if the current buffer contains the running clock.
   "Check if the current buffer contains the running clock.
@@ -8254,7 +8254,7 @@ function is being called interactively."
 	     ;; The clock marker is lost when using `sort-subr'; mark
 	     ;; The clock marker is lost when using `sort-subr'; mark
 	     ;; the clock with temporary `:org-clock-marker-backup'
 	     ;; the clock with temporary `:org-clock-marker-backup'
 	     ;; text property.
 	     ;; text property.
-	     (when (and (eq (org-clock-is-active) (current-buffer))
+	     (when (and (eq (org-clocking-buffer) (current-buffer))
 			(<= start (marker-position org-clock-marker))
 			(<= start (marker-position org-clock-marker))
 			(>= end (marker-position org-clock-marker)))
 			(>= end (marker-position org-clock-marker)))
 	       (with-silent-modifications
 	       (with-silent-modifications