diff options
author | Bastien <bzg@gnu.org> | 2018-11-04 10:24:08 +0100 |
---|---|---|
committer | Bastien <bzg@gnu.org> | 2018-11-04 10:24:08 +0100 |
commit | f5bc23f12fb5804f167f924b6ebfceb7cbaef5e3 (patch) | |
tree | 4736963f382d519223b7d1140bd49a32d80fc9cb | |
parent | 9cb0470723c67697c8e87261d87fd8b0aecac2cc (diff) | |
parent | 6e51b42e164df978df66580b0ca82b4fc84c7e0e (diff) | |
download | org-mode-f5bc23f12fb5804f167f924b6ebfceb7cbaef5e3.tar.gz |
Merge branch 'master' of code.orgmode.org:bzg/org-mode
-rw-r--r-- | lisp/org-clock.el | 4 | ||||
-rw-r--r-- | lisp/org.el | 37 |
2 files changed, 24 insertions, 17 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 6292a25..672523f 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2726,9 +2726,9 @@ The TS argument has the same type as the return values of (org-clocktable-increment-day ts ; decrement (- ws dow)))) ts)) - (while (< tsb te) + (while (< (float-time tsb) te) (unless (bolp) (insert "\n")) - (let* ((start-time (seconds-to-time (max tsb ts))) + (let* ((start-time (seconds-to-time (max (float-time tsb) ts))) (dow (nth 6 (decode-time (seconds-to-time tsb)))) (days-to-skip (cond ((eq step0 'day) 1) ;; else 'week: diff --git a/lisp/org.el b/lisp/org.el index dce66fc..71921cf 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9242,23 +9242,30 @@ non-nil." (setq desc (or (plist-get org-store-link-plist :description) link))) - ;; Store a link from a source code buffer. + ;; Store a link from a remote editing buffer. ((org-src-edit-buffer-p) (let ((coderef-format (org-src-coderef-format))) - (cond ((org-match-line (org-src-coderef-regexp coderef-format)) - (setq link (format "(%s)" (match-string-no-properties 3)))) - (interactive? - (let ((label (read-string "Code line label: "))) - (end-of-line) - (setq link (format coderef-format label)) - (let ((gc (- 79 (length link)))) - (if (< (current-column) gc) - (org-move-to-column gc t) - (insert " "))) - (insert link) - (setq link (concat "(" label ")")) - (setq desc nil))) - (t (setq link nil))))) + (cond + ;; A code reference exists. Use it. + ((save-excursion + (beginning-of-line) + (re-search-forward (org-src-coderef-regexp coderef-format) + (line-end-position) + t)) + (setq link (format "(%s)" (match-string-no-properties 3)))) + ;; No code reference. Create a new one then store the link + ;; to it, but only in the function is called interactively. + (interactive? + (end-of-line) + (let* ((label (read-string "Code line label: ")) + (reference (format coderef-format label)) + (gc (- 79 (length link)))) + (if (< (current-column) gc) + (org-move-to-column gc t) + (insert " ")) + (insert reference) + (setq link (format "(%s)" label)))) + (t (setq link nil))))) ;; We are in the agenda, link to referenced location ((equal (bound-and-true-p org-agenda-buffer-name) (buffer-name)) |