Re: [O] Fast linking to files in private git repos through a hyperlink
Hi Dov, Dov Grobgeld dov.grobg...@gmail.com writes: Thanks for the link. I wasn't aware of that package. I see that I have a conflict in syntax as I used double colon for indicating the git repo while org-git-link.el used double colon for search pattern. The double colon is standard in Org for indicating the search pattern, please use it this way too. Thus to join the packages I need to change the syntax. Which of the following would make more sense: git:@repo:file-in-repo::pattern-in-file git://repo/file-in-repo::pattern-in-file or perhaps some other syntax? Suggestions? git:[user@?][repo-server]:[git-repo-itself]::[search-pattern] When user is set, the repo-server URL won't have a protocol (git will be used by default as a protocol.) When user is not set, the repo-server may contain git:// or http:// as the protocol. But I didn't test your packing, so I'm maybe shooting in the dark for this syntax suggestion. HTH, -- Bastien
Re: [O] Fast linking to files in private git repos through a hyperlink
Thanks for your suggestion Bastien, but unfortunately it does not directly map to the shortcut that I implemented in my package. In my *old* syntax: git:repo::file.txt file.txt is a search pattern for a *file* with in the symbolic repo repo which maps to a real repo through the hash variable my-org-repos. The whole idea was that I wanted to be able to use the symbolic name as a shortcut. In addition file.txt is not the path of a file in the repo, but a search pattern for a file in the repo. In case of duplicates the user is prompted to interactively resolve the file. In addition I would also like to add a search pattern for a string in the file. My problem is how to merge this syntax with the org-git-link.el which uses the syntax git:/home/user/repo/data/results.png::nobelprize where /home/.../results.png is the name of the path to a file and nobelprize is the name of a tag. Both my linking and the org-git-linking are two different equally valid use cases. My problem is how to merge both these use cases under a single syntax. Regards, Dov On Thu, Apr 26, 2012 at 17:00, Bastien b...@gnu.org wrote: Hi Dov, Dov Grobgeld dov.grobg...@gmail.com writes: Thanks for the link. I wasn't aware of that package. I see that I have a conflict in syntax as I used double colon for indicating the git repo while org-git-link.el used double colon for search pattern. The double colon is standard in Org for indicating the search pattern, please use it this way too. Thus to join the packages I need to change the syntax. Which of the following would make more sense: git:@repo:file-in-repo::pattern-in-file git://repo/file-in-repo::pattern-in-file or perhaps some other syntax? Suggestions? git:[user@?][repo-server]:[git-repo-itself]::[search-pattern] When user is set, the repo-server URL won't have a protocol (git will be used by default as a protocol.) When user is not set, the repo-server may contain git:// or http:// as the protocol. But I didn't test your packing, so I'm maybe shooting in the dark for this syntax suggestion. HTH, -- Bastien
Re: [O] Fast linking to files in private git repos through a hyperlink
I imagine git allows a lot of opportunities for more features that we would want in such a link. Perhaps a more general, flexible, lispy keyword-style syntax would be useful here? Or handle with different link types and shunt off to a git call? -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com
Re: [O] Fast linking to files in private git repos through a hyperlink
Thanks for the link. I wasn't aware of that package. I see that I have a conflict in syntax as I used double colon for indicating the git repo while org-git-link.el used double colon for search pattern. Thus to join the packages I need to change the syntax. Which of the following would make more sense: git:@repo:file-in-repo::pattern-in-file git://repo/file-in-repo::pattern-in-file or perhaps some other syntax? Suggestions? Regards, Dov On Fri, Apr 20, 2012 at 15:01, Bastien b...@altern.org wrote: Hi Dov, Dov Grobgeld dov.grobg...@gmail.com writes: I thought I would share the following hack that I did with git. In my org-mode notebook I often find myself references files that reside in various private git repos. So far I have referenced these either by just writing their name or giving a full path. But giving the full path is disruptive and if the repo moves it will no longer work. So I added a hack to make the following hyperlink work git:myrepo::myfile . When opening it the following happens: - myrepo is looked up in the emacs hash my-git-repos and mapped to the path of a git repo root. - git-find-file-in-repo searches for the the file myfile in the the repo repo Here's the code for org-git-hyperlink.el: Nice. Can you try to merge these features with contrib/lisp/org-git-link.el from the current repo? Thanks! -- Bastien
Re: [O] Fast linking to files in private git repos through a hyperlink
Hi Dov, Dov Grobgeld dov.grobg...@gmail.com writes: I thought I would share the following hack that I did with git. In my org-mode notebook I often find myself references files that reside in various private git repos. So far I have referenced these either by just writing their name or giving a full path. But giving the full path is disruptive and if the repo moves it will no longer work. So I added a hack to make the following hyperlink work git:myrepo::myfile . When opening it the following happens: - myrepo is looked up in the emacs hash my-git-repos and mapped to the path of a git repo root. - git-find-file-in-repo searches for the the file myfile in the the repo repo Here's the code for org-git-hyperlink.el: Nice. Can you try to merge these features with contrib/lisp/org-git-link.el from the current repo? Thanks! -- Bastien
[O] Fast linking to files in private git repos through a hyperlink
I thought I would share the following hack that I did with git. In my org-mode notebook I often find myself references files that reside in various private git repos. So far I have referenced these either by just writing their name or giving a full path. But giving the full path is disruptive and if the repo moves it will no longer work. So I added a hack to make the following hyperlink work git:myrepo::myfile . When opening it the following happens: - myrepo is looked up in the emacs hash my-git-repos and mapped to the path of a git repo root. - git-find-file-in-repo searches for the the file myfile in the the repo repo Here's the code for org-git-hyperlink.el: (require 'org) (org-add-link-type git 'org-git-hyperlink-open) (defun org-git-hyperlink-open (path) Visit the file in learning-git (let* ((parts (split-string path ::)) (repo-name (car parts)) (filename (cadr parts)) (repo (gethash repo-name my-git-repos)) ) (git-find-file-in-repo repo filename))) (org-git-hyperlink-open learning::PointPatternMatching.py) ;;; org-learning.el ends here (provide 'org-git-hyperlink) ;;; org-git-hyperlink.el ends here The code for git-find-file-in-repo is here: https://github.com/hjz/emacs/blob/master/jz/git-find-file.el with the following addition: (defun git-find-file-in-repo (root file-name) Prompt with a completing list of all files in the project to find one. (interactive) (let* ((project-files (ffip-project-files root)) (files (delete-dups (mapcar 'car project-files))) (file-paths (delq 'nil (mapcar '(lambda (file-cons) (when (string= file-name (car file-cons)) (cdr file-cons))) project-files))) (file-path (if (cdr file-paths) (ffip-completing-read Disambiguate: file-paths) (car file-paths (find-file (concat root file-path Regards, Dov
Re: [O] Fast linking to files in private git repos through a hyperlink
* Dov Grobgeld dov.grobg...@gmail.com wrote: I thought I would share the following hack that I did with git. In my org-mode notebook I often find myself references files that reside in various private git repos. So far I have referenced these either by just writing their name or giving a full path. But giving the full path is disruptive and if the repo moves it will no longer work. So I added a hack to make the following hyperlink work git:myrepo::myfile . When opening it the following happens: - myrepo is looked up in the emacs hash my-git-repos and mapped to the path of a git repo root. - git-find-file-in-repo searches for the the file myfile in the the repo repo Cool hack! :-) You might be interested in looking at the git-module of Memacs[1]. It puts your commits into your Agenda if you want. And for this purpose it already holds a list of your local repositories. But this list is generated using shell scripts - Sorry no ELISP here. I do think both solutions could go well together ... 1. https://github.com/novoid/Memacs -- Karl Voit