瀏覽代碼

org-babel: tightening up insertion of results

Previously, altering the name of a source block, followed by C-c C-c,
did not alter the name of the corresponding results.
Dan Davison 15 年之前
父節點
當前提交
fe5c0d96c6
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      contrib/babel/lisp/org-babel.el

+ 5 - 4
contrib/babel/lisp/org-babel.el

@@ -488,10 +488,11 @@ line.  If no result exists for this block then create a
                (progn (move-end-of-line 1)
 		      (if (eobp) (insert "\n") (forward-char 1))
 		      (setq end (point))
-                      (or (progn ;; either an unnamed #+resname: line already exists
-                            (re-search-forward "[^ \f\t\n\r\v]" nil t)
-                            (move-beginning-of-line 1) (looking-at "#\\+resname:"))
-                          ;; or (with optional insert) we need to back up and make one ourselves
+                      (or (and (not name)
+			       (progn ;; either the unnamed #+resname: line already exists
+				 (re-search-forward "[^ \f\t\n\r\v]" nil t)
+				 (move-beginning-of-line 1) (looking-at "#\\+resname:\n")))
+			  ;; or (with optional insert) we need to back up and make one ourselves
                           (when insert
                             (goto-char end) (open-line 2) (forward-char 1)
                             (insert (concat "#+resname:" (if name (concat " " name)) "\n"))