emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/org/org-clock.el,v


From: Carsten Dominik
Subject: [Emacs-diffs] Changes to emacs/lisp/org/org-clock.el,v
Date: Sun, 12 Oct 2008 06:12:50 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Carsten Dominik <cdominik>      08/10/12 06:12:47

Index: org-clock.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-clock.el,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- org-clock.el        25 Jul 2008 23:02:14 -0000      1.7
+++ org-clock.el        12 Oct 2008 06:12:44 -0000      1.8
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.06b
+;; Version: 6.09a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -86,6 +86,10 @@
   :group 'org-clock
   :type 'function)
 
+(defcustom org-clock-string-limit 0
+  "Maximum length of clock strings in the modeline. 0 means no limit"
+  :group 'org-clock
+  :type 'integer)
 
 ;;; The clock for measuring work time.
 
@@ -94,6 +98,7 @@
 
 (defvar org-mode-line-timer nil)
 (defvar org-clock-heading "")
+(defvar org-clock-heading-for-remember "")
 (defvar org-clock-start-time "")
 
 (defvar org-clock-history nil
@@ -107,6 +112,9 @@
 (defvar org-clock-interrupted-task (make-marker)
   "Marker pointing to the task that has been interrupted by the current 
clock.")
 
+(defvar org-clock-mode-map (make-sparse-keymap))
+(define-key org-clock-mode-map [mode-line mouse-2] 'org-clock-goto)
+
 (defun org-clock-history-push (&optional pos buffer)
   "Push a marker to the clock history."
   (setq org-clock-history-length (max 1 (min 35 org-clock-history-length)))
@@ -197,8 +205,17 @@
         (h (floor delta 3600))
         (m (floor (- delta (* 3600 h)) 60)))
     (setq org-mode-line-string
-         (propertize (format (concat "-[" org-time-clocksum-format " (%s)]") h 
m org-clock-heading)
-                     'help-echo "Org-mode clock is running"))
+         (org-propertize
+          (let ((clock-string (format (concat "-[" org-time-clocksum-format " 
(%s)]")
+                                      h m org-clock-heading))
+                (help-text "Org-mode clock is running. Mouse-2 to go there."))
+            (if (and (> org-clock-string-limit 0)
+                     (> (length clock-string) org-clock-string-limit))
+                (org-propertize (substring clock-string 0 
org-clock-string-limit)
+                            'help-echo (concat help-text ": " 
org-clock-heading))
+              (org-propertize clock-string 'help-echo help-text)))
+          'local-map org-clock-mode-map
+          'mouse-face '(face mode-line-highlight)))
     (force-mode-line-update)))
 
 (defvar org-clock-mode-line-entry nil
@@ -253,13 +270,18 @@
                                              org-clock-in-switch-to-state
                                              "\\>"))))
            (org-todo org-clock-in-switch-to-state))
-         (if (and org-clock-heading-function
+         (setq org-clock-heading-for-remember 
+               (and (looking-at org-complex-heading-regexp)
+                    (match-end 4)
+                    (org-trim (buffer-substring (match-end 1) (match-end 4)))))
+         (setq org-clock-heading
+               (cond ((and org-clock-heading-function
                   (functionp org-clock-heading-function))
-             (setq org-clock-heading (funcall org-clock-heading-function))
-           (if (looking-at org-complex-heading-regexp)
-               (setq org-clock-heading (match-string 4))
-             (setq org-clock-heading "???")))
-         (setq org-clock-heading (propertize org-clock-heading 'face nil))
+                      (funcall org-clock-heading-function))
+                     ((looking-at org-complex-heading-regexp)
+                      (match-string 4))
+                     (t "???")))
+         (setq org-clock-heading (org-propertize org-clock-heading 'face nil))
          (org-clock-find-position)
          
          (insert "\n") (backward-char 1)
@@ -306,6 +328,7 @@
        ;; Wrap current entries into a new drawer
        (goto-char last)
        (beginning-of-line 2)
+       (if (org-at-item-p) (org-end-of-item))
        (insert ":END:\n")
        (beginning-of-line 0)
        (org-indent-line-function)
@@ -368,7 +391,8 @@
               (delete-char 1)))
        (move-marker org-clock-marker nil)
        (when org-log-note-clock-out
-         (org-add-log-setup 'clock-out))
+         (org-add-log-setup 'clock-out nil nil nil
+                            (concat "# Task: " (org-get-heading t) "\n\n")))
        (when org-mode-line-timer
          (cancel-timer org-mode-line-timer)
          (setq org-mode-line-timer nil))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]