From: James TD Smith <ahktenzero@mohorovi.cc>
To: emacs-orgmode@gnu.org
Subject: [PATCH 1/7] Some improvements to the modeline clock display
Date: Fri, 25 Jul 2008 00:46:08 +0100 [thread overview]
Message-ID: <20080724234608.23478.48564.stgit@nyarlathotep.internal.mohorovi.cc> (raw)
Allow users to specify a maximum length for the modeline clock. Add an option to
limit the length of the clock string in the modeline. When the limit is in
effect, the full item text is included in the tooltip on the clock string.
Make clicking on the clock string now goes to the currently clocked item.
---
lisp/ChangeLog | 17 ++++++++++-------
lisp/org-clock.el | 36 ++++++++++++++++++++++++++----------
2 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4571cb4..903aa8c 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-25 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * lisp/org-clock.el (org-update-mode-line): Support limiting the
+ modeline clock string, and display the full todo value in the
+ tooltip. Set a local keymap so mouse-3 on the clock string goes to
+ the currently clocked task.
+ (org-clock-string-limit): Add a custom value for the maximum
+ length of the clock string in the modeline.
+ (org-clock-mode-map): Add a keymap for the modeline string
+
2008-07-24 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-as-html): Add attributes also in mailto
@@ -5,13 +15,6 @@
* org.el (org-autoload): Add `org-dblock-write:columnview'.
-
-
-
-
-
-
-
2008-07-23 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-region-as-html, org-export-as-html): Make
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 6caf839..6d49906 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -86,6 +86,10 @@ The function is called with point at the beginning of the headline."
: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.
@@ -107,6 +111,9 @@ of a different task.")
(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)))
@@ -190,15 +197,23 @@ of a different task.")
(when (and cat task)
(insert (format "[%c] %-15s %s\n" i cat task))
(cons i marker)))))
-
+
(defun org-update-mode-line ()
(let* ((delta (- (time-to-seconds (current-time))
- (time-to-seconds org-clock-start-time)))
+ (time-to-seconds org-clock-start-time)))
(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"))
+ (propertize (let ((clock-string (format (concat "-[" org-time-clocksum-format " (%s)]")
+ h m org-clock-heading))
+ (help-text "Org-mode clock is running"))
+ (if (and (> org-clock-string-limit 0)
+ (> (length clock-string) org-clock-string-limit))
+ (propertize (substring clock-string 0 org-clock-string-limit)
+ 'help-echo (concat help-text ": " org-clock-heading))
+ (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,12 +268,13 @@ the clocking selection, associated with the letter `d'."
org-clock-in-switch-to-state
"\\>"))))
(org-todo org-clock-in-switch-to-state))
- (if (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
+ (cond ((and org-clock-heading-function
+ (functionp org-clock-heading-function))
+ (funcall org-clock-heading-function))
+ ((looking-at org-complex-heading-regexp)
+ (match-string 4))
+ (t "???")))
(setq org-clock-heading (propertize org-clock-heading 'face nil))
(org-clock-find-position)
next reply other threads:[~2008-07-24 23:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-24 23:46 James TD Smith [this message]
2008-07-24 23:46 ` [PATCH 2/7] Fix X clipboard handling in emacs21 James TD Smith
2008-07-24 23:46 ` [PATCH 3/7] Show durations of clocked times in timeline James TD Smith
2008-07-24 23:46 ` [PATCH 4/7] Fix link display in imenus and the refile interface James TD Smith
2008-07-24 23:46 ` [PATCH 5/7] Fix note insertion in entries with drawers James TD Smith
2008-07-24 23:46 ` [PATCH 6/7] Add some functions for handling checklists James TD Smith
2008-07-24 23:46 ` [PATCH 7/7] Add some new interaction between remember and clocked tasks James TD Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080724234608.23478.48564.stgit@nyarlathotep.internal.mohorovi.cc \
--to=ahktenzero@mohorovi.cc \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.