瀏覽代碼

Fix bug in org-git-link.el.

Patch by David Maus
Carsten Dominik 15 年之前
父節點
當前提交
6a5f6deaac
共有 2 個文件被更改,包括 11 次插入5 次删除
  1. 5 0
      contrib/ChangeLog
  2. 6 5
      contrib/lisp/org-git-link.el

+ 5 - 0
contrib/ChangeLog

@@ -1,3 +1,8 @@
+2010-02-20  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* lisp/org-git-link.el (org-git-store-link): Check if there is a
+	file name associated with the buffer.
+
 2010-02-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* lisp/org-export-generic.el (org-export-generic): Provide.

+ 6 - 5
contrib/lisp/org-git-link.el

@@ -175,11 +175,12 @@
 
 (defun org-git-store-link ()
   "Store git link to current file."
-  (let ((file (abbreviate-file-name (buffer-file-name))))
-    (when (org-git-gitrepos-p file)
-      (org-store-link-props
-       :type "git"
-       :link (org-git-create-git-link file)))))
+  (when (buffer-file-name)
+    (let ((file (abbreviate-file-name (buffer-file-name))))
+      (when (org-git-gitrepos-p file)
+	(org-store-link-props
+	 :type "git"
+	 :link (org-git-create-git-link file))))))
 
 (add-hook 'org-store-link-functions 'org-git-store-link)