summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-06-23 23:55:01 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-06-23 23:55:01 +0200
commit58b512013ecc96c9a0a427fb9ad68d3fbe24eb74 (patch)
treef88efc6e46a8f6e0b6d3cc01d06f3b2949ddb6b2
parentf5d5a95018f0d3b99116c9df44022f0f8d4a26a7 (diff)
downloadorg-mode-58b512013ecc96c9a0a427fb9ad68d3fbe24eb74.tar.gz
org-clock: Fix `org-clock-display'
* lisp/org-clock.el (org-clock-put-overlay): Do not expand links when displaying clocked times. Reported-by: Sheng Yang (杨圣) <yangsheng6810@gmail.com> <http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00024.html>
-rw-r--r--lisp/org-clock.el45
1 files changed, 22 insertions, 23 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 04e31f8..a013bc5 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1939,29 +1939,28 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times."
(defvar-local org-clock-overlays nil)
(defun org-clock-put-overlay (time)
- "Put an overlays on the current line, displaying TIME.
-This creates a new overlay and stores it in `org-clock-overlays', so that it
-will be easy to remove."
- (let (ov tx)
- (beginning-of-line)
- (let ((case-fold-search nil))
- (when (looking-at org-complex-heading-regexp)
- (goto-char (match-beginning 4))))
- (setq ov (make-overlay (point) (point-at-eol))
- tx (concat (buffer-substring-no-properties (point) (match-end 4))
- (org-add-props
- (make-string
- (max 0 (- (- 60 (current-column))
- (- (match-end 4) (match-beginning 4))
- (length (org-get-at-bol 'line-prefix))))
- ?\·)
- '(face shadow))
- (org-add-props
- (format " %9s " (org-duration-from-minutes time))
- '(face org-clock-overlay))
- ""))
- (overlay-put ov 'display tx)
- (push ov org-clock-overlays)))
+ "Put an overlay on the headline at point, displaying TIME.
+Create a new overlay and store it in `org-clock-overlays', so
+that it will be easy to remove. This function assumes point is
+on a headline."
+ (org-match-line org-complex-heading-regexp)
+ (goto-char (match-beginning 4))
+ (let* ((headline (match-string 4))
+ (text (concat headline
+ (org-add-props
+ (make-string
+ (max (- (- 60 (current-column))
+ (org-string-width headline)
+ (length (org-get-at-bol 'line-prefix)))
+ 0)
+ ?\·)
+ '(face shadow))
+ (org-add-props
+ (format " %9s " (org-duration-from-minutes time))
+ '(face org-clock-overlay))))
+ (o (make-overlay (point) (line-end-position))))
+ (org-overlay-display o text)
+ (push o org-clock-overlays)))
;;;###autoload
(defun org-clock-remove-overlays (&optional _beg _end noremove)