* Bug: org-git-link.el fails for file in $HOME but not under Git [9.0.7 (release_9.0.7-493-g82a503 @ /Users/xcy/src/org-mode/lisp/)]
@ 2017-05-29 9:27 Chunyang Xu
2017-05-29 12:49 ` Kyle Meyer
0 siblings, 1 reply; 2+ messages in thread
From: Chunyang Xu @ 2017-05-29 9:27 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 3527 bytes --]
Hi,
After loading org-git-link.el, 'C-c l' ('org-store-link') fails for file
in $HOME but not under Git, such as "~/foo.c". The following is contents
of the *Backtrace* buffer while the error happens. I have attached a
patch to fix this issue.
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
directory-file-name(nil)
(file-name-directory (directory-file-name dirpath))
(let ((dirname (file-name-directory (directory-file-name dirpath))) (basename (file-name-nondirectory (directory-file-name dirpath)))) (list dirname basename))
org-git-split-dirpath(nil)
(let ((dirlist (org-git-split-dirpath dir))) (if (string= (nth 1 dirlist) "") (progn (throw (quote toplevel) nil))) (setq dir (nth 0 dirlist) relpath (concat (file-name-as-directory (nth 1 dirlist)) relpath)))
(while (not (file-exists-p (expand-file-name ".git" dir))) (let ((dirlist (org-git-split-dirpath dir))) (if (string= (nth 1 dirlist) "") (progn (throw (quote toplevel) nil))) (setq dir (nth 0 dirlist) relpath (concat (file-name-as-directory (nth 1 dirlist)) relpath))))
(catch (quote toplevel) (while (not (file-exists-p (expand-file-name ".git" dir))) (let ((dirlist (org-git-split-dirpath dir))) (if (string= (nth 1 dirlist) "") (progn (throw (quote toplevel) nil))) (setq dir (nth 0 dirlist) relpath (concat (file-name-as-directory (nth 1 dirlist)) relpath)))) (list (expand-file-name ".git" dir) relpath))
(let ((dir (file-name-directory path)) (relpath (file-name-nondirectory path))) (catch (quote toplevel) (while (not (file-exists-p (expand-file-name ".git" dir))) (let ((dirlist (org-git-split-dirpath dir))) (if (string= (nth 1 dirlist) "") (progn (throw (quote toplevel) nil))) (setq dir (nth 0 dirlist) relpath (concat (file-name-as-directory (nth 1 dirlist)) relpath)))) (list (expand-file-name ".git" dir) relpath)))
org-git-gitrepos-p("~/foo.c")
(if (org-git-gitrepos-p file) (progn (org-store-link-props :type "git" :link (org-git-create-git-link file line))))
(let ((file (abbreviate-file-name (buffer-file-name))) (line (line-number-at-pos))) (if (org-git-gitrepos-p file) (progn (org-store-link-props :type "git" :link (org-git-create-git-link file line)))))
(progn (let ((file (abbreviate-file-name (buffer-file-name))) (line (line-number-at-pos))) (if (org-git-gitrepos-p file) (progn (org-store-link-props :type "git" :link (org-git-create-git-link file line))))))
(if (buffer-file-name) (progn (let ((file (abbreviate-file-name (buffer-file-name))) (line (line-number-at-pos))) (if (org-git-gitrepos-p file) (progn (org-store-link-props :type "git" :link (org-git-create-git-link file line)))))))
org-git-store-link()
#[257 "\300. \205\f.\x01.B\211\262.\207" [nil] 4 "\n\n(fn F)"](org-git-store-link)
mapcar(#[257 "\300. \205\f.\x01.B\211\262.\207" [nil] 4 "\n\n(fn F)"] (org-git-store-link org-rmail-store-link org-mhe-store-link org-irc-store-link org-info-store-link org-gnus-store-link org-docview-store-link org-bibtex-store-link org-bbdb-store-link org-w3m-store-link org-notmuch-search-store-link org-notmuch-store-link org-eww-store-link org-man-store-link))
org-store-link(nil)
funcall-interactively(org-store-link nil)
call-interactively(org-store-link nil nil)
command-execute(org-store-link)
Emacs : GNU Emacs 25.2.1 (x86_64-apple-darwin16.4.0, Carbon Version 157 AppKit 1504.81)
of 2017-04-26
Package: Org mode version 9.0.7 (release_9.0.7-493-g82a503 @ /Users/xcy/src/org-mode/lisp/)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-git-link.el-Fix-org-git-find-gitdir.patch --]
[-- Type: text/x-patch, Size: 1014 bytes --]
From 15a25f5dba882aa913b12ae42fa89874b3cd8a0d Mon Sep 17 00:00:00 2001
From: Chunyang Xu <mail@xuchunyang.me>
Date: Mon, 29 May 2017 17:03:24 +0800
Subject: [PATCH] org-git-link.el: Fix `org-git-find-gitdir'
* contrib/lisp/org-git-link.el (org-git-find-gitdir): Expand
abbreviated directory name.
---
contrib/lisp/org-git-link.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/lisp/org-git-link.el b/contrib/lisp/org-git-link.el
index 65f25b294..0028daf9b 100644
--- a/contrib/lisp/org-git-link.el
+++ b/contrib/lisp/org-git-link.el
@@ -126,7 +126,7 @@
the path. Example: (org-git-find-gitdir
\"~/gitrepos/foo/bar.txt\") returns
'(\"/home/user/gitrepos/.git\" \"foo/bar.txt\"). When not in a git repository, return nil."
- (let ((dir (file-name-directory path))
+ (let ((dir (expand-file-name (file-name-directory path)))
(relpath (file-name-nondirectory path)))
(catch 'toplevel
(while (not (file-exists-p (expand-file-name ".git" dir)))
--
2.13.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Bug: org-git-link.el fails for file in $HOME but not under Git [9.0.7 (release_9.0.7-493-g82a503 @ /Users/xcy/src/org-mode/lisp/)]
2017-05-29 9:27 Bug: org-git-link.el fails for file in $HOME but not under Git [9.0.7 (release_9.0.7-493-g82a503 @ /Users/xcy/src/org-mode/lisp/)] Chunyang Xu
@ 2017-05-29 12:49 ` Kyle Meyer
0 siblings, 0 replies; 2+ messages in thread
From: Kyle Meyer @ 2017-05-29 12:49 UTC (permalink / raw)
To: Chunyang Xu, emacs-orgmode
Chunyang Xu <mail@xuchunyang.me> writes:
> After loading org-git-link.el, 'C-c l' ('org-store-link') fails for file
> in $HOME but not under Git, such as "~/foo.c". The following is contents
> of the *Backtrace* buffer while the error happens. I have attached a
> patch to fix this issue.
Thanks. Applied in 1fbbce4d8.
--
Kyle
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-29 12:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-29 9:27 Bug: org-git-link.el fails for file in $HOME but not under Git [9.0.7 (release_9.0.7-493-g82a503 @ /Users/xcy/src/org-mode/lisp/)] Chunyang Xu
2017-05-29 12:49 ` Kyle Meyer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).