Browse Source

Merge branch 'master' of code.orgmode.org:bzg/org-mode

Bastien 2 years ago
parent
commit
f5bc23f12f
2 changed files with 24 additions and 17 deletions
  1. 2 2
      lisp/org-clock.el
  2. 22 15
      lisp/org.el

+ 2 - 2
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:

+ 22 - 15
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))