* Insert org-id Link at Point via Outline Path Completion
@ 2015-05-12 19:57 Dominic Surano
2015-07-31 6:43 ` Xebar Saram
0 siblings, 1 reply; 14+ messages in thread
From: Dominic Surano @ 2015-05-12 19:57 UTC (permalink / raw)
To: emacs-orgmode
Hello,
I use org-mode a lot like a wiki so links to other org-mode headings are
very common. Currently, I navigate to the heading or pull it up in an
agenda view, store the link with C-l, going back to where I want to
insert the link, then insert the link with C-c C-l RET. This is a bit
time consuming.
Instead, I would prefer to map a key that allows me to insert a link at
the current point using tab completion similar to org-refile (C-c C-w).
Looking through org-id.el, it seems like org-id-get-with-outline-path
completion was designed for this purpose. I tried:
(global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
outline-path-completion)))
but it didn't work as intended. Anyone have any ideas?
Thanks!
-D
For reference, I have the following set in my configuration:
;; Use global IDs
(require 'org-id)
(setq org-id-link-to-org-use-id t)
;; Update ID file .org-id-locations on startup
(org-id-update-id-locations)
;; Targets include this file and any file contributing to the agenda -
up to 9 levels deep
(setq org-refile-targets (quote ((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9))))
(setq org-refile-use-outline-path 'file)
(setq org-outline-path-complete-in-steps t)
(setq org-refile-allow-creating-parent-nodes t)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-05-12 19:57 Insert org-id Link at Point via Outline Path Completion Dominic Surano
@ 2015-07-31 6:43 ` Xebar Saram
2015-07-31 7:13 ` Eric Abrahamsen
2015-08-01 9:07 ` Bernhard Pröll
0 siblings, 2 replies; 14+ messages in thread
From: Xebar Saram @ 2015-07-31 6:43 UTC (permalink / raw)
To: Dominic Surano; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 1594 bytes --]
i also have a similar workflow and would love to hear Dominic if you found
a solution for this or if anyone on the list has other suggestions?
best
Z
On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com>
wrote:
> Hello,
>
> I use org-mode a lot like a wiki so links to other org-mode headings are
> very common. Currently, I navigate to the heading or pull it up in an
> agenda view, store the link with C-l, going back to where I want to
> insert the link, then insert the link with C-c C-l RET. This is a bit
> time consuming.
>
> Instead, I would prefer to map a key that allows me to insert a link at
> the current point using tab completion similar to org-refile (C-c C-w).
> Looking through org-id.el, it seems like org-id-get-with-outline-path
> completion was designed for this purpose. I tried:
>
> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
> outline-path-completion)))
>
> but it didn't work as intended. Anyone have any ideas?
>
> Thanks!
> -D
>
> For reference, I have the following set in my configuration:
>
> ;; Use global IDs
> (require 'org-id)
> (setq org-id-link-to-org-use-id t)
>
> ;; Update ID file .org-id-locations on startup
> (org-id-update-id-locations)
>
> ;; Targets include this file and any file contributing to the agenda -
> up to 9 levels deep
> (setq org-refile-targets (quote ((nil :maxlevel . 9)
> (org-agenda-files :maxlevel . 9))))
> (setq org-refile-use-outline-path 'file)
> (setq org-outline-path-complete-in-steps t)
> (setq org-refile-allow-creating-parent-nodes t)
>
>
>
[-- Attachment #2: Type: text/html, Size: 2101 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-07-31 6:43 ` Xebar Saram
@ 2015-07-31 7:13 ` Eric Abrahamsen
2015-08-01 9:07 ` Bernhard Pröll
1 sibling, 0 replies; 14+ messages in thread
From: Eric Abrahamsen @ 2015-07-31 7:13 UTC (permalink / raw)
To: emacs-orgmode
Xebar Saram <zeltakc@gmail.com> writes:
> i also have a similar workflow and would love to hear Dominic if you
> found a solution for this or if anyone on the list has other
> suggestions?
The function `org-refile-get-targets' is the standard way of producing a
list of all possible headings -- ostensibly to refile to, but you can do
anything you want with them.
If you want to restrict this to Org headings that already have ids
(though I'm not sure why you would), you can use the org-id-locations
hashtable.
I still think you'd have to use one of the above to pick a heading, then
go to the heading in a `save-excursion', call `org-store-link', then
back to your original location, and call `org-insert-link'. I don't
think there's any cleaner way of doing that...
Eric
> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com>
> wrote:
>
>
> Hello,
>
> I use org-mode a lot like a wiki so links to other org-mode
> headings are
> very common. Currently, I navigate to the heading or pull it up in
> an
> agenda view, store the link with C-l, going back to where I want
> to
> insert the link, then insert the link with C-c C-l RET. This is a
> bit
> time consuming.
>
> Instead, I would prefer to map a key that allows me to insert a
> link at
> the current point using tab completion similar to org-refile (C-c
> C-w).
> Looking through org-id.el, it seems like
> org-id-get-with-outline-path
> completion was designed for this purpose. I tried:
>
> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
> outline-path-completion)))
>
> but it didn't work as intended. Anyone have any ideas?
>
> Thanks!
> -D
>
> For reference, I have the following set in my configuration:
>
> ;; Use global IDs
> (require 'org-id)
> (setq org-id-link-to-org-use-id t)
>
> ;; Update ID file .org-id-locations on startup
> (org-id-update-id-locations)
>
> ;; Targets include this file and any file contributing to the
> agenda -
> up to 9 levels deep
> (setq org-refile-targets (quote ((nil :maxlevel . 9)
> (org-agenda-files :maxlevel . 9))))
> (setq org-refile-use-outline-path 'file)
> (setq org-outline-path-complete-in-steps t)
> (setq org-refile-allow-creating-parent-nodes t)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-07-31 6:43 ` Xebar Saram
2015-07-31 7:13 ` Eric Abrahamsen
@ 2015-08-01 9:07 ` Bernhard Pröll
2015-08-01 13:20 ` Xebar Saram
1 sibling, 1 reply; 14+ messages in thread
From: Bernhard Pröll @ 2015-08-01 9:07 UTC (permalink / raw)
To: Xebar Saram; +Cc: org mode, Dominic Surano
Hi Saram,
I've been in the same boat and decided to write a company-backend for
this purpose. So if you're already using company-mode, this may be worth
looking into:
https://github.com/mutbuerger/company-org-headings
Keep in mind that I'm in the process of learning Elisp and
there has been little to no testing done on the package. Furthermore it
uses org-store-link instead of org-id-store-link.
Regards,
Bernhard Pröll
On Fri, 31. Jul 09:43, Xebar Saram wrote:
>i also have a similar workflow and would love to hear Dominic if you found a
>solution for this or if anyone on the list has other suggestions?
>
>best
>
>Z
>
>On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com> wrote:
>
> Hello,
>
> I use org-mode a lot like a wiki so links to other org-mode headings are
> very common. Currently, I navigate to the heading or pull it up in an
> agenda view, store the link with C-l, going back to where I want to
> insert the link, then insert the link with C-c C-l RET. This is a bit
> time consuming.
>
> Instead, I would prefer to map a key that allows me to insert a link at
> the current point using tab completion similar to org-refile (C-c C-w).
> Looking through org-id.el, it seems like org-id-get-with-outline-path
> completion was designed for this purpose. I tried:
>
> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
> outline-path-completion)))
>
> but it didn't work as intended. Anyone have any ideas?
>
> Thanks!
> -D
>
> For reference, I have the following set in my configuration:
>
> ;; Use global IDs
> (require 'org-id)
> (setq org-id-link-to-org-use-id t)
>
> ;; Update ID file .org-id-locations on startup
> (org-id-update-id-locations)
>
> ;; Targets include this file and any file contributing to the agenda -
> up to 9 levels deep
> (setq org-refile-targets (quote ((nil :maxlevel . 9)
> (org-agenda-files :maxlevel . 9))))
> (setq org-refile-use-outline-path 'file)
> (setq org-outline-path-complete-in-steps t)
> (setq org-refile-allow-creating-parent-nodes t)
>
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 9:07 ` Bernhard Pröll
@ 2015-08-01 13:20 ` Xebar Saram
2015-08-01 16:33 ` John Kitchin
2015-08-02 7:03 ` Bernhard Pröll
0 siblings, 2 replies; 14+ messages in thread
From: Xebar Saram @ 2015-08-01 13:20 UTC (permalink / raw)
To: Xebar Saram, Dominic Surano, org mode
[-- Attachment #1: Type: text/plain, Size: 3157 bytes --]
Thx so much Bernhard
this looks really promising. i never had luck with either company or
auto-complete t o get it to work reliably (it often stops working even
though its still in the mod bar).
anyway i tried it and added this to my config (after cloning from git):
(add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
(add-hook 'org-mode-hook
(lambda () (set (make-local-variable 'company-backends)
'((company-org-headings)))))
i dont see it completes on org heading, is there any keys i need to press
or anything else in need to config? does this work only when you try to
insert a link?
best and thx so much, this look awesome
P.S have you considered Helm for this as well?
best
Z
On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <bmutbuerger@gmail.com>
wrote:
> Hi Saram,
>
> I've been in the same boat and decided to write a company-backend for
> this purpose. So if you're already using company-mode, this may be worth
> looking into:
>
> https://github.com/mutbuerger/company-org-headings
>
> Keep in mind that I'm in the process of learning Elisp and
> there has been little to no testing done on the package. Furthermore it
> uses org-store-link instead of org-id-store-link.
>
> Regards,
> Bernhard Pröll
>
>
> On Fri, 31. Jul 09:43, Xebar Saram wrote:
>
>> i also have a similar workflow and would love to hear Dominic if you
>> found a
>> solution for this or if anyone on the list has other suggestions?
>>
>> best
>>
>> Z
>>
>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com>
>> wrote:
>>
>> Hello,
>>
>> I use org-mode a lot like a wiki so links to other org-mode headings
>> are
>> very common. Currently, I navigate to the heading or pull it up in an
>> agenda view, store the link with C-l, going back to where I want to
>> insert the link, then insert the link with C-c C-l RET. This is a bit
>> time consuming.
>>
>> Instead, I would prefer to map a key that allows me to insert a link at
>> the current point using tab completion similar to org-refile (C-c C-w).
>> Looking through org-id.el, it seems like org-id-get-with-outline-path
>> completion was designed for this purpose. I tried:
>>
>> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
>> outline-path-completion)))
>>
>> but it didn't work as intended. Anyone have any ideas?
>>
>> Thanks!
>> -D
>>
>> For reference, I have the following set in my configuration:
>>
>> ;; Use global IDs
>> (require 'org-id)
>> (setq org-id-link-to-org-use-id t)
>>
>> ;; Update ID file .org-id-locations on startup
>> (org-id-update-id-locations)
>>
>> ;; Targets include this file and any file contributing to the agenda -
>> up to 9 levels deep
>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
>> (org-agenda-files :maxlevel . 9))))
>> (setq org-refile-use-outline-path 'file)
>> (setq org-outline-path-complete-in-steps t)
>> (setq org-refile-allow-creating-parent-nodes t)
>>
>>
>>
>>
>>
[-- Attachment #2: Type: text/html, Size: 4342 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 13:20 ` Xebar Saram
@ 2015-08-01 16:33 ` John Kitchin
2015-08-01 17:36 ` Xebar Saram
2015-08-02 7:03 ` Bernhard Pröll
1 sibling, 1 reply; 14+ messages in thread
From: John Kitchin @ 2015-08-01 16:33 UTC (permalink / raw)
To: Xebar Saram; +Cc: org mode, Dominic Surano
(helm-org-agenda-files-headings) seems to do this already for all
headlines in your agenda files. the third action is to insert a link to
the selected headline.
You can use let to temporarily define the org-agenda-files list to what
you want, and just use the (helm-org-agenda-files-headings) command for
non-agenda files.
e.g.
#+BEGIN_SRC emacs-lisp
(defun insert-heading-link (dir)
"select a headline from org-files in dir and insert a link to it."
(interactive (list (read-directory-name "Directory: ")))
(let ((org-agenda-files (f-entries
dir
(lambda (f)
(string=
"org"
(file-name-extension f)))
t)))
(helm-org-agenda-files-headings)))
#+END_SRC
gives me a helm buffer to select headlines from org-files in the
directory I select and when I press f3 (for the third
action), it inserts a link to the selected headline. It does the file
finding recursively, so you might not want to run this on / ;)
You could bind it to a key for easy use.
Xebar Saram writes:
> Thx so much Bernhard
>
> this looks really promising. i never had luck with either company or
> auto-complete t o get it to work reliably (it often stops working even
> though its still in the mod bar).
> anyway i tried it and added this to my config (after cloning from git):
>
> (add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
> (add-hook 'org-mode-hook
> (lambda () (set (make-local-variable 'company-backends)
> '((company-org-headings)))))
>
> i dont see it completes on org heading, is there any keys i need to press
> or anything else in need to config? does this work only when you try to
> insert a link?
>
> best and thx so much, this look awesome
>
> P.S have you considered Helm for this as well?
>
> best
>
> Z
>
>
>
> On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <bmutbuerger@gmail.com>
> wrote:
>
>> Hi Saram,
>>
>> I've been in the same boat and decided to write a company-backend for
>> this purpose. So if you're already using company-mode, this may be worth
>> looking into:
>>
>> https://github.com/mutbuerger/company-org-headings
>>
>> Keep in mind that I'm in the process of learning Elisp and
>> there has been little to no testing done on the package. Furthermore it
>> uses org-store-link instead of org-id-store-link.
>>
>> Regards,
>> Bernhard Pröll
>>
>>
>> On Fri, 31. Jul 09:43, Xebar Saram wrote:
>>
>>> i also have a similar workflow and would love to hear Dominic if you
>>> found a
>>> solution for this or if anyone on the list has other suggestions?
>>>
>>> best
>>>
>>> Z
>>>
>>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com>
>>> wrote:
>>>
>>> Hello,
>>>
>>> I use org-mode a lot like a wiki so links to other org-mode headings
>>> are
>>> very common. Currently, I navigate to the heading or pull it up in an
>>> agenda view, store the link with C-l, going back to where I want to
>>> insert the link, then insert the link with C-c C-l RET. This is a bit
>>> time consuming.
>>>
>>> Instead, I would prefer to map a key that allows me to insert a link at
>>> the current point using tab completion similar to org-refile (C-c C-w).
>>> Looking through org-id.el, it seems like org-id-get-with-outline-path
>>> completion was designed for this purpose. I tried:
>>>
>>> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
>>> outline-path-completion)))
>>>
>>> but it didn't work as intended. Anyone have any ideas?
>>>
>>> Thanks!
>>> -D
>>>
>>> For reference, I have the following set in my configuration:
>>>
>>> ;; Use global IDs
>>> (require 'org-id)
>>> (setq org-id-link-to-org-use-id t)
>>>
>>> ;; Update ID file .org-id-locations on startup
>>> (org-id-update-id-locations)
>>>
>>> ;; Targets include this file and any file contributing to the agenda -
>>> up to 9 levels deep
>>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
>>> (org-agenda-files :maxlevel . 9))))
>>> (setq org-refile-use-outline-path 'file)
>>> (setq org-outline-path-complete-in-steps t)
>>> (setq org-refile-allow-creating-parent-nodes t)
>>>
>>>
>>>
>>>
>>>
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 16:33 ` John Kitchin
@ 2015-08-01 17:36 ` Xebar Saram
2015-08-01 17:49 ` Xebar Saram
0 siblings, 1 reply; 14+ messages in thread
From: Xebar Saram @ 2015-08-01 17:36 UTC (permalink / raw)
To: John Kitchin; +Cc: org mode, Dominic Surano
[-- Attachment #1: Type: text/plain, Size: 5150 bytes --]
John, this is superb!
thx so much it answers all my needs, what a great find :)
kind regards
Z
On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:
> (helm-org-agenda-files-headings) seems to do this already for all
> headlines in your agenda files. the third action is to insert a link to
> the selected headline.
>
> You can use let to temporarily define the org-agenda-files list to what
> you want, and just use the (helm-org-agenda-files-headings) command for
> non-agenda files.
>
> e.g.
>
> #+BEGIN_SRC emacs-lisp
> (defun insert-heading-link (dir)
> "select a headline from org-files in dir and insert a link to it."
> (interactive (list (read-directory-name "Directory: ")))
> (let ((org-agenda-files (f-entries
> dir
> (lambda (f)
> (string=
> "org"
> (file-name-extension f)))
> t)))
> (helm-org-agenda-files-headings)))
> #+END_SRC
>
> gives me a helm buffer to select headlines from org-files in the
> directory I select and when I press f3 (for the third
> action), it inserts a link to the selected headline. It does the file
> finding recursively, so you might not want to run this on / ;)
>
> You could bind it to a key for easy use.
>
> Xebar Saram writes:
>
> > Thx so much Bernhard
> >
> > this looks really promising. i never had luck with either company or
> > auto-complete t o get it to work reliably (it often stops working even
> > though its still in the mod bar).
> > anyway i tried it and added this to my config (after cloning from git):
> >
> > (add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
> > (add-hook 'org-mode-hook
> > (lambda () (set (make-local-variable 'company-backends)
> > '((company-org-headings)))))
> >
> > i dont see it completes on org heading, is there any keys i need to press
> > or anything else in need to config? does this work only when you try to
> > insert a link?
> >
> > best and thx so much, this look awesome
> >
> > P.S have you considered Helm for this as well?
> >
> > best
> >
> > Z
> >
> >
> >
> > On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <bmutbuerger@gmail.com>
> > wrote:
> >
> >> Hi Saram,
> >>
> >> I've been in the same boat and decided to write a company-backend for
> >> this purpose. So if you're already using company-mode, this may be worth
> >> looking into:
> >>
> >> https://github.com/mutbuerger/company-org-headings
> >>
> >> Keep in mind that I'm in the process of learning Elisp and
> >> there has been little to no testing done on the package. Furthermore it
> >> uses org-store-link instead of org-id-store-link.
> >>
> >> Regards,
> >> Bernhard Pröll
> >>
> >>
> >> On Fri, 31. Jul 09:43, Xebar Saram wrote:
> >>
> >>> i also have a similar workflow and would love to hear Dominic if you
> >>> found a
> >>> solution for this or if anyone on the list has other suggestions?
> >>>
> >>> best
> >>>
> >>> Z
> >>>
> >>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com>
> >>> wrote:
> >>>
> >>> Hello,
> >>>
> >>> I use org-mode a lot like a wiki so links to other org-mode headings
> >>> are
> >>> very common. Currently, I navigate to the heading or pull it up in
> an
> >>> agenda view, store the link with C-l, going back to where I want to
> >>> insert the link, then insert the link with C-c C-l RET. This is a
> bit
> >>> time consuming.
> >>>
> >>> Instead, I would prefer to map a key that allows me to insert a
> link at
> >>> the current point using tab completion similar to org-refile (C-c
> C-w).
> >>> Looking through org-id.el, it seems like
> org-id-get-with-outline-path
> >>> completion was designed for this purpose. I tried:
> >>>
> >>> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
> >>> outline-path-completion)))
> >>>
> >>> but it didn't work as intended. Anyone have any ideas?
> >>>
> >>> Thanks!
> >>> -D
> >>>
> >>> For reference, I have the following set in my configuration:
> >>>
> >>> ;; Use global IDs
> >>> (require 'org-id)
> >>> (setq org-id-link-to-org-use-id t)
> >>>
> >>> ;; Update ID file .org-id-locations on startup
> >>> (org-id-update-id-locations)
> >>>
> >>> ;; Targets include this file and any file contributing to the
> agenda -
> >>> up to 9 levels deep
> >>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
> >>> (org-agenda-files :maxlevel . 9))))
> >>> (setq org-refile-use-outline-path 'file)
> >>> (setq org-outline-path-complete-in-steps t)
> >>> (setq org-refile-allow-creating-parent-nodes t)
> >>>
> >>>
> >>>
> >>>
> >>>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
[-- Attachment #2: Type: text/html, Size: 7086 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 17:36 ` Xebar Saram
@ 2015-08-01 17:49 ` Xebar Saram
2015-08-01 19:03 ` John Kitchin
0 siblings, 1 reply; 14+ messages in thread
From: Xebar Saram @ 2015-08-01 17:49 UTC (permalink / raw)
To: John Kitchin; +Cc: org mode, Dominic Surano
[-- Attachment #1: Type: text/plain, Size: 5840 bytes --]
Hi again
so excited over this had to ask 2 more questions ;-)
1.can that function include/link to org-id (so that it can keep the links
even if the headers move around in/out of the files)
2.i saw there are 3 options to that helm function. can this be customized
to add more commands (can really think of which ones know but could see
potential in future :))
thx so much John as always you rock ;-)
Z
On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram <zeltakc@gmail.com> wrote:
> John, this is superb!
>
> thx so much it answers all my needs, what a great find :)
>
> kind regards
>
> Z
>
> On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> (helm-org-agenda-files-headings) seems to do this already for all
>> headlines in your agenda files. the third action is to insert a link to
>> the selected headline.
>>
>> You can use let to temporarily define the org-agenda-files list to what
>> you want, and just use the (helm-org-agenda-files-headings) command for
>> non-agenda files.
>>
>> e.g.
>>
>> #+BEGIN_SRC emacs-lisp
>> (defun insert-heading-link (dir)
>> "select a headline from org-files in dir and insert a link to it."
>> (interactive (list (read-directory-name "Directory: ")))
>> (let ((org-agenda-files (f-entries
>> dir
>> (lambda (f)
>> (string=
>> "org"
>> (file-name-extension f)))
>> t)))
>> (helm-org-agenda-files-headings)))
>> #+END_SRC
>>
>> gives me a helm buffer to select headlines from org-files in the
>> directory I select and when I press f3 (for the third
>> action), it inserts a link to the selected headline. It does the file
>> finding recursively, so you might not want to run this on / ;)
>>
>> You could bind it to a key for easy use.
>>
>> Xebar Saram writes:
>>
>> > Thx so much Bernhard
>> >
>> > this looks really promising. i never had luck with either company or
>> > auto-complete t o get it to work reliably (it often stops working even
>> > though its still in the mod bar).
>> > anyway i tried it and added this to my config (after cloning from git):
>> >
>> > (add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
>> > (add-hook 'org-mode-hook
>> > (lambda () (set (make-local-variable 'company-backends)
>> > '((company-org-headings)))))
>> >
>> > i dont see it completes on org heading, is there any keys i need to
>> press
>> > or anything else in need to config? does this work only when you try to
>> > insert a link?
>> >
>> > best and thx so much, this look awesome
>> >
>> > P.S have you considered Helm for this as well?
>> >
>> > best
>> >
>> > Z
>> >
>> >
>> >
>> > On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <bmutbuerger@gmail.com>
>> > wrote:
>> >
>> >> Hi Saram,
>> >>
>> >> I've been in the same boat and decided to write a company-backend for
>> >> this purpose. So if you're already using company-mode, this may be
>> worth
>> >> looking into:
>> >>
>> >> https://github.com/mutbuerger/company-org-headings
>> >>
>> >> Keep in mind that I'm in the process of learning Elisp and
>> >> there has been little to no testing done on the package. Furthermore it
>> >> uses org-store-link instead of org-id-store-link.
>> >>
>> >> Regards,
>> >> Bernhard Pröll
>> >>
>> >>
>> >> On Fri, 31. Jul 09:43, Xebar Saram wrote:
>> >>
>> >>> i also have a similar workflow and would love to hear Dominic if you
>> >>> found a
>> >>> solution for this or if anyone on the list has other suggestions?
>> >>>
>> >>> best
>> >>>
>> >>> Z
>> >>>
>> >>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com
>> >
>> >>> wrote:
>> >>>
>> >>> Hello,
>> >>>
>> >>> I use org-mode a lot like a wiki so links to other org-mode
>> headings
>> >>> are
>> >>> very common. Currently, I navigate to the heading or pull it up in
>> an
>> >>> agenda view, store the link with C-l, going back to where I want to
>> >>> insert the link, then insert the link with C-c C-l RET. This is a
>> bit
>> >>> time consuming.
>> >>>
>> >>> Instead, I would prefer to map a key that allows me to insert a
>> link at
>> >>> the current point using tab completion similar to org-refile (C-c
>> C-w).
>> >>> Looking through org-id.el, it seems like
>> org-id-get-with-outline-path
>> >>> completion was designed for this purpose. I tried:
>> >>>
>> >>> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
>> >>> outline-path-completion)))
>> >>>
>> >>> but it didn't work as intended. Anyone have any ideas?
>> >>>
>> >>> Thanks!
>> >>> -D
>> >>>
>> >>> For reference, I have the following set in my configuration:
>> >>>
>> >>> ;; Use global IDs
>> >>> (require 'org-id)
>> >>> (setq org-id-link-to-org-use-id t)
>> >>>
>> >>> ;; Update ID file .org-id-locations on startup
>> >>> (org-id-update-id-locations)
>> >>>
>> >>> ;; Targets include this file and any file contributing to the
>> agenda -
>> >>> up to 9 levels deep
>> >>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
>> >>> (org-agenda-files :maxlevel .
>> 9))))
>> >>> (setq org-refile-use-outline-path 'file)
>> >>> (setq org-outline-path-complete-in-steps t)
>> >>> (setq org-refile-allow-creating-parent-nodes t)
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>>
>> --
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>
>
>
[-- Attachment #2: Type: text/html, Size: 8097 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 17:49 ` Xebar Saram
@ 2015-08-01 19:03 ` John Kitchin
2015-08-01 19:17 ` Dominic Surano
2015-08-02 18:20 ` Xebar Saram
0 siblings, 2 replies; 14+ messages in thread
From: John Kitchin @ 2015-08-01 19:03 UTC (permalink / raw)
To: Xebar Saram; +Cc: org mode, Dominic Surano
usually it is pretty easy to add new functions in helm, but it is less
easy in this case because the source is dynamically generated from a
function. So, in this case I think we have to just redefine the function
that generates the source. here is an example that I think makes an id
link as a new action.
#+BEGIN_SRC emacs-lisp
(defun helm-org-insert-id-link-to-heading-at-marker (marker)
(with-current-buffer (marker-buffer marker)
(let ((file-name (buffer-file-name))
(id (save-excursion (goto-char (marker-position marker))
(org-id-get-create)
(org-id-store-link))))
(with-helm-current-buffer
(org-insert-link
file-name id)))))
(cl-defun helm-source-org-headings-for-files (filenames
&optional (min-depth 1) (max-depth 8))
(helm-build-sync-source "Org Headings"
:candidates (helm-org-get-candidates filenames min-depth max-depth)
:action '(("Go to line" . helm-org-goto-marker)
("Refile to this heading" . helm-org-heading-refile)
("Insert link to this heading"
. helm-org-insert-link-to-heading-at-marker)
("Insert id link to this heading" .
helm-org-insert-id-link-to-heading-at-marker))))
#+END_SRC
Xebar Saram writes:
> Hi again
>
> so excited over this had to ask 2 more questions ;-)
>
> 1.can that function include/link to org-id (so that it can keep the links
> even if the headers move around in/out of the files)
> 2.i saw there are 3 options to that helm function. can this be customized
> to add more commands (can really think of which ones know but could see
> potential in future :))
>
> thx so much John as always you rock ;-)
>
> Z
>
> On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram <zeltakc@gmail.com> wrote:
>
>> John, this is superb!
>>
>> thx so much it answers all my needs, what a great find :)
>>
>> kind regards
>>
>> Z
>>
>> On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin <jkitchin@andrew.cmu.edu>
>> wrote:
>>
>>> (helm-org-agenda-files-headings) seems to do this already for all
>>> headlines in your agenda files. the third action is to insert a link to
>>> the selected headline.
>>>
>>> You can use let to temporarily define the org-agenda-files list to what
>>> you want, and just use the (helm-org-agenda-files-headings) command for
>>> non-agenda files.
>>>
>>> e.g.
>>>
>>> #+BEGIN_SRC emacs-lisp
>>> (defun insert-heading-link (dir)
>>> "select a headline from org-files in dir and insert a link to it."
>>> (interactive (list (read-directory-name "Directory: ")))
>>> (let ((org-agenda-files (f-entries
>>> dir
>>> (lambda (f)
>>> (string=
>>> "org"
>>> (file-name-extension f)))
>>> t)))
>>> (helm-org-agenda-files-headings)))
>>> #+END_SRC
>>>
>>> gives me a helm buffer to select headlines from org-files in the
>>> directory I select and when I press f3 (for the third
>>> action), it inserts a link to the selected headline. It does the file
>>> finding recursively, so you might not want to run this on / ;)
>>>
>>> You could bind it to a key for easy use.
>>>
>>> Xebar Saram writes:
>>>
>>> > Thx so much Bernhard
>>> >
>>> > this looks really promising. i never had luck with either company or
>>> > auto-complete t o get it to work reliably (it often stops working even
>>> > though its still in the mod bar).
>>> > anyway i tried it and added this to my config (after cloning from git):
>>> >
>>> > (add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
>>> > (add-hook 'org-mode-hook
>>> > (lambda () (set (make-local-variable 'company-backends)
>>> > '((company-org-headings)))))
>>> >
>>> > i dont see it completes on org heading, is there any keys i need to
>>> press
>>> > or anything else in need to config? does this work only when you try to
>>> > insert a link?
>>> >
>>> > best and thx so much, this look awesome
>>> >
>>> > P.S have you considered Helm for this as well?
>>> >
>>> > best
>>> >
>>> > Z
>>> >
>>> >
>>> >
>>> > On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <bmutbuerger@gmail.com>
>>> > wrote:
>>> >
>>> >> Hi Saram,
>>> >>
>>> >> I've been in the same boat and decided to write a company-backend for
>>> >> this purpose. So if you're already using company-mode, this may be
>>> worth
>>> >> looking into:
>>> >>
>>> >> https://github.com/mutbuerger/company-org-headings
>>> >>
>>> >> Keep in mind that I'm in the process of learning Elisp and
>>> >> there has been little to no testing done on the package. Furthermore it
>>> >> uses org-store-link instead of org-id-store-link.
>>> >>
>>> >> Regards,
>>> >> Bernhard Pröll
>>> >>
>>> >>
>>> >> On Fri, 31. Jul 09:43, Xebar Saram wrote:
>>> >>
>>> >>> i also have a similar workflow and would love to hear Dominic if you
>>> >>> found a
>>> >>> solution for this or if anyone on the list has other suggestions?
>>> >>>
>>> >>> best
>>> >>>
>>> >>> Z
>>> >>>
>>> >>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com
>>> >
>>> >>> wrote:
>>> >>>
>>> >>> Hello,
>>> >>>
>>> >>> I use org-mode a lot like a wiki so links to other org-mode
>>> headings
>>> >>> are
>>> >>> very common. Currently, I navigate to the heading or pull it up in
>>> an
>>> >>> agenda view, store the link with C-l, going back to where I want to
>>> >>> insert the link, then insert the link with C-c C-l RET. This is a
>>> bit
>>> >>> time consuming.
>>> >>>
>>> >>> Instead, I would prefer to map a key that allows me to insert a
>>> link at
>>> >>> the current point using tab completion similar to org-refile (C-c
>>> C-w).
>>> >>> Looking through org-id.el, it seems like
>>> org-id-get-with-outline-path
>>> >>> completion was designed for this purpose. I tried:
>>> >>>
>>> >>> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
>>> >>> outline-path-completion)))
>>> >>>
>>> >>> but it didn't work as intended. Anyone have any ideas?
>>> >>>
>>> >>> Thanks!
>>> >>> -D
>>> >>>
>>> >>> For reference, I have the following set in my configuration:
>>> >>>
>>> >>> ;; Use global IDs
>>> >>> (require 'org-id)
>>> >>> (setq org-id-link-to-org-use-id t)
>>> >>>
>>> >>> ;; Update ID file .org-id-locations on startup
>>> >>> (org-id-update-id-locations)
>>> >>>
>>> >>> ;; Targets include this file and any file contributing to the
>>> agenda -
>>> >>> up to 9 levels deep
>>> >>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
>>> >>> (org-agenda-files :maxlevel .
>>> 9))))
>>> >>> (setq org-refile-use-outline-path 'file)
>>> >>> (setq org-outline-path-complete-in-steps t)
>>> >>> (setq org-refile-allow-creating-parent-nodes t)
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>>
>>> --
>>> Professor John Kitchin
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu
>>>
>>
>>
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 19:03 ` John Kitchin
@ 2015-08-01 19:17 ` Dominic Surano
2015-08-02 18:20 ` Xebar Saram
1 sibling, 0 replies; 14+ messages in thread
From: Dominic Surano @ 2015-08-01 19:17 UTC (permalink / raw)
To: John Kitchin; +Cc: Xebar Saram, org mode
[-- Attachment #1: Type: text/plain, Size: 9203 bytes --]
Sorry, I meant to get to this yesterday. See my question on Emacs
StackExchange
<http://emacs.stackexchange.com/questions/12391/insert-org-id-link-at-point-via-outline-path-completion>
and my configuration file
<https://github.com/sk8ingdom/.emacs.d/blob/master/org-mode-config/org-general.el>
where
I added this functionality. Basically, you go to insert a link with C-c
C-l, type id: <ENTER> and then you'll be prompted to find the org-id via
outline completion. I've reproduced the code below for convenience:
#+BEGIN_SRC emacs-lisp
;; Add ID properties to all headlines in the current file which do not
already have one
(defun my/org-add-ids-to-headlines-in-file ()
(interactive)
(org-map-entries 'org-id-get-create))
#+END_SRC
The other responses look good as well. Hope this helps!
-D
On Sat, Aug 1, 2015 at 12:03 PM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:
> usually it is pretty easy to add new functions in helm, but it is less
> easy in this case because the source is dynamically generated from a
> function. So, in this case I think we have to just redefine the function
> that generates the source. here is an example that I think makes an id
> link as a new action.
>
> #+BEGIN_SRC emacs-lisp
> (defun helm-org-insert-id-link-to-heading-at-marker (marker)
> (with-current-buffer (marker-buffer marker)
> (let ((file-name (buffer-file-name))
> (id (save-excursion (goto-char (marker-position marker))
> (org-id-get-create)
> (org-id-store-link))))
>
> (with-helm-current-buffer
> (org-insert-link
> file-name id)))))
>
>
> (cl-defun helm-source-org-headings-for-files (filenames
> &optional (min-depth 1)
> (max-depth 8))
> (helm-build-sync-source "Org Headings"
> :candidates (helm-org-get-candidates filenames min-depth max-depth)
> :action '(("Go to line" . helm-org-goto-marker)
> ("Refile to this heading" . helm-org-heading-refile)
> ("Insert link to this heading"
> . helm-org-insert-link-to-heading-at-marker)
> ("Insert id link to this heading" .
> helm-org-insert-id-link-to-heading-at-marker))))
>
> #+END_SRC
> Xebar Saram writes:
>
> > Hi again
> >
> > so excited over this had to ask 2 more questions ;-)
> >
> > 1.can that function include/link to org-id (so that it can keep the
> links
> > even if the headers move around in/out of the files)
> > 2.i saw there are 3 options to that helm function. can this be customized
> > to add more commands (can really think of which ones know but could see
> > potential in future :))
> >
> > thx so much John as always you rock ;-)
> >
> > Z
> >
> > On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram <zeltakc@gmail.com> wrote:
> >
> >> John, this is superb!
> >>
> >> thx so much it answers all my needs, what a great find :)
> >>
> >> kind regards
> >>
> >> Z
> >>
> >> On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin <jkitchin@andrew.cmu.edu>
> >> wrote:
> >>
> >>> (helm-org-agenda-files-headings) seems to do this already for all
> >>> headlines in your agenda files. the third action is to insert a link to
> >>> the selected headline.
> >>>
> >>> You can use let to temporarily define the org-agenda-files list to what
> >>> you want, and just use the (helm-org-agenda-files-headings) command for
> >>> non-agenda files.
> >>>
> >>> e.g.
> >>>
> >>> #+BEGIN_SRC emacs-lisp
> >>> (defun insert-heading-link (dir)
> >>> "select a headline from org-files in dir and insert a link to it."
> >>> (interactive (list (read-directory-name "Directory: ")))
> >>> (let ((org-agenda-files (f-entries
> >>> dir
> >>> (lambda (f)
> >>> (string=
> >>> "org"
> >>> (file-name-extension f)))
> >>> t)))
> >>> (helm-org-agenda-files-headings)))
> >>> #+END_SRC
> >>>
> >>> gives me a helm buffer to select headlines from org-files in the
> >>> directory I select and when I press f3 (for the third
> >>> action), it inserts a link to the selected headline. It does the file
> >>> finding recursively, so you might not want to run this on / ;)
> >>>
> >>> You could bind it to a key for easy use.
> >>>
> >>> Xebar Saram writes:
> >>>
> >>> > Thx so much Bernhard
> >>> >
> >>> > this looks really promising. i never had luck with either company or
> >>> > auto-complete t o get it to work reliably (it often stops working
> even
> >>> > though its still in the mod bar).
> >>> > anyway i tried it and added this to my config (after cloning from
> git):
> >>> >
> >>> > (add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
> >>> > (add-hook 'org-mode-hook
> >>> > (lambda () (set (make-local-variable 'company-backends)
> >>> > '((company-org-headings)))))
> >>> >
> >>> > i dont see it completes on org heading, is there any keys i need to
> >>> press
> >>> > or anything else in need to config? does this work only when you try
> to
> >>> > insert a link?
> >>> >
> >>> > best and thx so much, this look awesome
> >>> >
> >>> > P.S have you considered Helm for this as well?
> >>> >
> >>> > best
> >>> >
> >>> > Z
> >>> >
> >>> >
> >>> >
> >>> > On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <
> bmutbuerger@gmail.com>
> >>> > wrote:
> >>> >
> >>> >> Hi Saram,
> >>> >>
> >>> >> I've been in the same boat and decided to write a company-backend
> for
> >>> >> this purpose. So if you're already using company-mode, this may be
> >>> worth
> >>> >> looking into:
> >>> >>
> >>> >> https://github.com/mutbuerger/company-org-headings
> >>> >>
> >>> >> Keep in mind that I'm in the process of learning Elisp and
> >>> >> there has been little to no testing done on the package.
> Furthermore it
> >>> >> uses org-store-link instead of org-id-store-link.
> >>> >>
> >>> >> Regards,
> >>> >> Bernhard Pröll
> >>> >>
> >>> >>
> >>> >> On Fri, 31. Jul 09:43, Xebar Saram wrote:
> >>> >>
> >>> >>> i also have a similar workflow and would love to hear Dominic if
> you
> >>> >>> found a
> >>> >>> solution for this or if anyone on the list has other suggestions?
> >>> >>>
> >>> >>> best
> >>> >>>
> >>> >>> Z
> >>> >>>
> >>> >>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <
> sk8ingdom@gmail.com
> >>> >
> >>> >>> wrote:
> >>> >>>
> >>> >>> Hello,
> >>> >>>
> >>> >>> I use org-mode a lot like a wiki so links to other org-mode
> >>> headings
> >>> >>> are
> >>> >>> very common. Currently, I navigate to the heading or pull it up
> in
> >>> an
> >>> >>> agenda view, store the link with C-l, going back to where I
> want to
> >>> >>> insert the link, then insert the link with C-c C-l RET. This is
> a
> >>> bit
> >>> >>> time consuming.
> >>> >>>
> >>> >>> Instead, I would prefer to map a key that allows me to insert a
> >>> link at
> >>> >>> the current point using tab completion similar to org-refile
> (C-c
> >>> C-w).
> >>> >>> Looking through org-id.el, it seems like
> >>> org-id-get-with-outline-path
> >>> >>> completion was designed for this purpose. I tried:
> >>> >>>
> >>> >>> (global-set-key "\C-ci" (lambda () (interactive)
> (org-id-get-with
> >>> >>> outline-path-completion)))
> >>> >>>
> >>> >>> but it didn't work as intended. Anyone have any ideas?
> >>> >>>
> >>> >>> Thanks!
> >>> >>> -D
> >>> >>>
> >>> >>> For reference, I have the following set in my configuration:
> >>> >>>
> >>> >>> ;; Use global IDs
> >>> >>> (require 'org-id)
> >>> >>> (setq org-id-link-to-org-use-id t)
> >>> >>>
> >>> >>> ;; Update ID file .org-id-locations on startup
> >>> >>> (org-id-update-id-locations)
> >>> >>>
> >>> >>> ;; Targets include this file and any file contributing to the
> >>> agenda -
> >>> >>> up to 9 levels deep
> >>> >>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
> >>> >>> (org-agenda-files :maxlevel .
> >>> 9))))
> >>> >>> (setq org-refile-use-outline-path 'file)
> >>> >>> (setq org-outline-path-complete-in-steps t)
> >>> >>> (setq org-refile-allow-creating-parent-nodes t)
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>>
> >>>
> >>> --
> >>> Professor John Kitchin
> >>> Doherty Hall A207F
> >>> Department of Chemical Engineering
> >>> Carnegie Mellon University
> >>> Pittsburgh, PA 15213
> >>> 412-268-7803
> >>> @johnkitchin
> >>> http://kitchingroup.cheme.cmu.edu
> >>>
> >>
> >>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
--
Dominic Surano
Email is my fastest and preferred method of contact
Phone, address, etc. available upon request
Life should be an adventure <http://xkcd.com/167/>
[-- Attachment #2: Type: text/html, Size: 13525 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 13:20 ` Xebar Saram
2015-08-01 16:33 ` John Kitchin
@ 2015-08-02 7:03 ` Bernhard Pröll
1 sibling, 0 replies; 14+ messages in thread
From: Bernhard Pröll @ 2015-08-02 7:03 UTC (permalink / raw)
To: Xebar Saram; +Cc: org mode, Dominic Surano
Hi again,
my guess into the blue: You haven't set the directory as described in
the readme (it defaults to nil).
Since I don't use helm, I haven't considered it.
The purpose of this backend is avoiding the `find-file-noselect' as used
in `org-refile' and the `helm-org-agenda-headings' suggested by John.
It's somewhat in-between using `org-refile' and an indexing with
external tools (recoll for example as recently debated on this list).
Regards,
Bernhard Pröll
On Sat, 01. Aug 16:20, Xebar Saram wrote:
>Thx so much Bernhard
>
>this looks really promising. i never had luck with either company or
>auto-complete t o get it to work reliably (it often stops working even though
>its still in the mod bar).
>anyway i tried it and added this to my config (after cloning from git):
>
>(add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
>(add-hook 'org-mode-hook
> (lambda () (set (make-local-variable 'company-backends)
> '((company-org-headings)))))
>
>i dont see it completes on org heading, is there any keys i need to press or
>anything else in need to config? does this work only when you try to insert a
>link?
>
>best and thx so much, this look awesome
>
>P.S have you considered Helm for this as well?
>
>best
>
>Z
>
>
>
>On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <bmutbuerger@gmail.com> wrote:
>
> Hi Saram,
>
> I've been in the same boat and decided to write a company-backend for
> this purpose. So if you're already using company-mode, this may be worth
> looking into:
>
> https://github.com/mutbuerger/company-org-headings
>
> Keep in mind that I'm in the process of learning Elisp and
> there has been little to no testing done on the package. Furthermore it
> uses org-store-link instead of org-id-store-link.
>
> Regards,
> Bernhard Pröll
>
>
> On Fri, 31. Jul 09:43, Xebar Saram wrote:
>
> i also have a similar workflow and would love to hear Dominic if you
> found a
> solution for this or if anyone on the list has other suggestions?
>
> best
>
> Z
>
> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <sk8ingdom@gmail.com>
> wrote:
>
> Hello,
>
> I use org-mode a lot like a wiki so links to other org-mode headings
> are
> very common. Currently, I navigate to the heading or pull it up in
> an
> agenda view, store the link with C-l, going back to where I want to
> insert the link, then insert the link with C-c C-l RET. This is a
> bit
> time consuming.
>
> Instead, I would prefer to map a key that allows me to insert a link
> at
> the current point using tab completion similar to org-refile (C-c
> C-w).
> Looking through org-id.el, it seems like
> org-id-get-with-outline-path
> completion was designed for this purpose. I tried:
>
> (global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with
> outline-path-completion)))
>
> but it didn't work as intended. Anyone have any ideas?
>
> Thanks!
> -D
>
> For reference, I have the following set in my configuration:
>
> ;; Use global IDs
> (require 'org-id)
> (setq org-id-link-to-org-use-id t)
>
> ;; Update ID file .org-id-locations on startup
> (org-id-update-id-locations)
>
> ;; Targets include this file and any file contributing to the agenda
> -
> up to 9 levels deep
> (setq org-refile-targets (quote ((nil :maxlevel . 9)
> (org-agenda-files :maxlevel . 9))))
> (setq org-refile-use-outline-path 'file)
> (setq org-outline-path-complete-in-steps t)
> (setq org-refile-allow-creating-parent-nodes t)
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-01 19:03 ` John Kitchin
2015-08-01 19:17 ` Dominic Surano
@ 2015-08-02 18:20 ` Xebar Saram
2015-08-02 18:31 ` John Kitchin
1 sibling, 1 reply; 14+ messages in thread
From: Xebar Saram @ 2015-08-02 18:20 UTC (permalink / raw)
To: John Kitchin; +Cc: org mode, Dominic Surano
[-- Attachment #1: Type: text/plain, Size: 8307 bytes --]
Thx john
i evaled the code yet i cant see it under M-x, am i missing something?
best
Z
On Sat, Aug 1, 2015 at 10:03 PM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:
> usually it is pretty easy to add new functions in helm, but it is less
> easy in this case because the source is dynamically generated from a
> function. So, in this case I think we have to just redefine the function
> that generates the source. here is an example that I think makes an id
> link as a new action.
>
> #+BEGIN_SRC emacs-lisp
> (defun helm-org-insert-id-link-to-heading-at-marker (marker)
> (with-current-buffer (marker-buffer marker)
> (let ((file-name (buffer-file-name))
> (id (save-excursion (goto-char (marker-position marker))
> (org-id-get-create)
> (org-id-store-link))))
>
> (with-helm-current-buffer
> (org-insert-link
> file-name id)))))
>
>
> (cl-defun helm-source-org-headings-for-files (filenames
> &optional (min-depth 1)
> (max-depth 8))
> (helm-build-sync-source "Org Headings"
> :candidates (helm-org-get-candidates filenames min-depth max-depth)
> :action '(("Go to line" . helm-org-goto-marker)
> ("Refile to this heading" . helm-org-heading-refile)
> ("Insert link to this heading"
> . helm-org-insert-link-to-heading-at-marker)
> ("Insert id link to this heading" .
> helm-org-insert-id-link-to-heading-at-marker))))
>
> #+END_SRC
> Xebar Saram writes:
>
> > Hi again
> >
> > so excited over this had to ask 2 more questions ;-)
> >
> > 1.can that function include/link to org-id (so that it can keep the
> links
> > even if the headers move around in/out of the files)
> > 2.i saw there are 3 options to that helm function. can this be customized
> > to add more commands (can really think of which ones know but could see
> > potential in future :))
> >
> > thx so much John as always you rock ;-)
> >
> > Z
> >
> > On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram <zeltakc@gmail.com> wrote:
> >
> >> John, this is superb!
> >>
> >> thx so much it answers all my needs, what a great find :)
> >>
> >> kind regards
> >>
> >> Z
> >>
> >> On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin <jkitchin@andrew.cmu.edu>
> >> wrote:
> >>
> >>> (helm-org-agenda-files-headings) seems to do this already for all
> >>> headlines in your agenda files. the third action is to insert a link to
> >>> the selected headline.
> >>>
> >>> You can use let to temporarily define the org-agenda-files list to what
> >>> you want, and just use the (helm-org-agenda-files-headings) command for
> >>> non-agenda files.
> >>>
> >>> e.g.
> >>>
> >>> #+BEGIN_SRC emacs-lisp
> >>> (defun insert-heading-link (dir)
> >>> "select a headline from org-files in dir and insert a link to it."
> >>> (interactive (list (read-directory-name "Directory: ")))
> >>> (let ((org-agenda-files (f-entries
> >>> dir
> >>> (lambda (f)
> >>> (string=
> >>> "org"
> >>> (file-name-extension f)))
> >>> t)))
> >>> (helm-org-agenda-files-headings)))
> >>> #+END_SRC
> >>>
> >>> gives me a helm buffer to select headlines from org-files in the
> >>> directory I select and when I press f3 (for the third
> >>> action), it inserts a link to the selected headline. It does the file
> >>> finding recursively, so you might not want to run this on / ;)
> >>>
> >>> You could bind it to a key for easy use.
> >>>
> >>> Xebar Saram writes:
> >>>
> >>> > Thx so much Bernhard
> >>> >
> >>> > this looks really promising. i never had luck with either company or
> >>> > auto-complete t o get it to work reliably (it often stops working
> even
> >>> > though its still in the mod bar).
> >>> > anyway i tried it and added this to my config (after cloning from
> git):
> >>> >
> >>> > (add-to-list 'load-path "/home/zeltak/.emacs.g/company-org-headings")
> >>> > (add-hook 'org-mode-hook
> >>> > (lambda () (set (make-local-variable 'company-backends)
> >>> > '((company-org-headings)))))
> >>> >
> >>> > i dont see it completes on org heading, is there any keys i need to
> >>> press
> >>> > or anything else in need to config? does this work only when you try
> to
> >>> > insert a link?
> >>> >
> >>> > best and thx so much, this look awesome
> >>> >
> >>> > P.S have you considered Helm for this as well?
> >>> >
> >>> > best
> >>> >
> >>> > Z
> >>> >
> >>> >
> >>> >
> >>> > On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <
> bmutbuerger@gmail.com>
> >>> > wrote:
> >>> >
> >>> >> Hi Saram,
> >>> >>
> >>> >> I've been in the same boat and decided to write a company-backend
> for
> >>> >> this purpose. So if you're already using company-mode, this may be
> >>> worth
> >>> >> looking into:
> >>> >>
> >>> >> https://github.com/mutbuerger/company-org-headings
> >>> >>
> >>> >> Keep in mind that I'm in the process of learning Elisp and
> >>> >> there has been little to no testing done on the package.
> Furthermore it
> >>> >> uses org-store-link instead of org-id-store-link.
> >>> >>
> >>> >> Regards,
> >>> >> Bernhard Pröll
> >>> >>
> >>> >>
> >>> >> On Fri, 31. Jul 09:43, Xebar Saram wrote:
> >>> >>
> >>> >>> i also have a similar workflow and would love to hear Dominic if
> you
> >>> >>> found a
> >>> >>> solution for this or if anyone on the list has other suggestions?
> >>> >>>
> >>> >>> best
> >>> >>>
> >>> >>> Z
> >>> >>>
> >>> >>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <
> sk8ingdom@gmail.com
> >>> >
> >>> >>> wrote:
> >>> >>>
> >>> >>> Hello,
> >>> >>>
> >>> >>> I use org-mode a lot like a wiki so links to other org-mode
> >>> headings
> >>> >>> are
> >>> >>> very common. Currently, I navigate to the heading or pull it up
> in
> >>> an
> >>> >>> agenda view, store the link with C-l, going back to where I
> want to
> >>> >>> insert the link, then insert the link with C-c C-l RET. This is
> a
> >>> bit
> >>> >>> time consuming.
> >>> >>>
> >>> >>> Instead, I would prefer to map a key that allows me to insert a
> >>> link at
> >>> >>> the current point using tab completion similar to org-refile
> (C-c
> >>> C-w).
> >>> >>> Looking through org-id.el, it seems like
> >>> org-id-get-with-outline-path
> >>> >>> completion was designed for this purpose. I tried:
> >>> >>>
> >>> >>> (global-set-key "\C-ci" (lambda () (interactive)
> (org-id-get-with
> >>> >>> outline-path-completion)))
> >>> >>>
> >>> >>> but it didn't work as intended. Anyone have any ideas?
> >>> >>>
> >>> >>> Thanks!
> >>> >>> -D
> >>> >>>
> >>> >>> For reference, I have the following set in my configuration:
> >>> >>>
> >>> >>> ;; Use global IDs
> >>> >>> (require 'org-id)
> >>> >>> (setq org-id-link-to-org-use-id t)
> >>> >>>
> >>> >>> ;; Update ID file .org-id-locations on startup
> >>> >>> (org-id-update-id-locations)
> >>> >>>
> >>> >>> ;; Targets include this file and any file contributing to the
> >>> agenda -
> >>> >>> up to 9 levels deep
> >>> >>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
> >>> >>> (org-agenda-files :maxlevel .
> >>> 9))))
> >>> >>> (setq org-refile-use-outline-path 'file)
> >>> >>> (setq org-outline-path-complete-in-steps t)
> >>> >>> (setq org-refile-allow-creating-parent-nodes t)
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>>
> >>>
> >>> --
> >>> Professor John Kitchin
> >>> Doherty Hall A207F
> >>> Department of Chemical Engineering
> >>> Carnegie Mellon University
> >>> Pittsburgh, PA 15213
> >>> 412-268-7803
> >>> @johnkitchin
> >>> http://kitchingroup.cheme.cmu.edu
> >>>
> >>
> >>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
[-- Attachment #2: Type: text/html, Size: 12335 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-02 18:20 ` Xebar Saram
@ 2015-08-02 18:31 ` John Kitchin
2015-08-02 18:38 ` Xebar Saram
0 siblings, 1 reply; 14+ messages in thread
From: John Kitchin @ 2015-08-02 18:31 UTC (permalink / raw)
To: Xebar Saram; +Cc: org mode, Dominic Surano
[-- Attachment #1: Type: text/plain, Size: 9159 bytes --]
You are, that code modifies the helm-org-agenda-files-headings function by
adding a new action to it. So, try:
M-x helm-org-agenda-files-headings
select a heading, press tab, and you should see a 4th, new action to insert
an org-id link.
John
-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
On Sun, Aug 2, 2015 at 2:20 PM, Xebar Saram <zeltakc@gmail.com> wrote:
> Thx john
>
> i evaled the code yet i cant see it under M-x, am i missing something?
>
> best
>
> Z
>
> On Sat, Aug 1, 2015 at 10:03 PM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> usually it is pretty easy to add new functions in helm, but it is less
>> easy in this case because the source is dynamically generated from a
>> function. So, in this case I think we have to just redefine the function
>> that generates the source. here is an example that I think makes an id
>> link as a new action.
>>
>> #+BEGIN_SRC emacs-lisp
>> (defun helm-org-insert-id-link-to-heading-at-marker (marker)
>> (with-current-buffer (marker-buffer marker)
>> (let ((file-name (buffer-file-name))
>> (id (save-excursion (goto-char (marker-position marker))
>> (org-id-get-create)
>> (org-id-store-link))))
>>
>> (with-helm-current-buffer
>> (org-insert-link
>> file-name id)))))
>>
>>
>> (cl-defun helm-source-org-headings-for-files (filenames
>> &optional (min-depth 1)
>> (max-depth 8))
>> (helm-build-sync-source "Org Headings"
>> :candidates (helm-org-get-candidates filenames min-depth max-depth)
>> :action '(("Go to line" . helm-org-goto-marker)
>> ("Refile to this heading" . helm-org-heading-refile)
>> ("Insert link to this heading"
>> . helm-org-insert-link-to-heading-at-marker)
>> ("Insert id link to this heading" .
>> helm-org-insert-id-link-to-heading-at-marker))))
>>
>> #+END_SRC
>> Xebar Saram writes:
>>
>> > Hi again
>> >
>> > so excited over this had to ask 2 more questions ;-)
>> >
>> > 1.can that function include/link to org-id (so that it can keep the
>> links
>> > even if the headers move around in/out of the files)
>> > 2.i saw there are 3 options to that helm function. can this be
>> customized
>> > to add more commands (can really think of which ones know but could see
>> > potential in future :))
>> >
>> > thx so much John as always you rock ;-)
>> >
>> > Z
>> >
>> > On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram <zeltakc@gmail.com> wrote:
>> >
>> >> John, this is superb!
>> >>
>> >> thx so much it answers all my needs, what a great find :)
>> >>
>> >> kind regards
>> >>
>> >> Z
>> >>
>> >> On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin <jkitchin@andrew.cmu.edu>
>> >> wrote:
>> >>
>> >>> (helm-org-agenda-files-headings) seems to do this already for all
>> >>> headlines in your agenda files. the third action is to insert a link
>> to
>> >>> the selected headline.
>> >>>
>> >>> You can use let to temporarily define the org-agenda-files list to
>> what
>> >>> you want, and just use the (helm-org-agenda-files-headings) command
>> for
>> >>> non-agenda files.
>> >>>
>> >>> e.g.
>> >>>
>> >>> #+BEGIN_SRC emacs-lisp
>> >>> (defun insert-heading-link (dir)
>> >>> "select a headline from org-files in dir and insert a link to it."
>> >>> (interactive (list (read-directory-name "Directory: ")))
>> >>> (let ((org-agenda-files (f-entries
>> >>> dir
>> >>> (lambda (f)
>> >>> (string=
>> >>> "org"
>> >>> (file-name-extension f)))
>> >>> t)))
>> >>> (helm-org-agenda-files-headings)))
>> >>> #+END_SRC
>> >>>
>> >>> gives me a helm buffer to select headlines from org-files in the
>> >>> directory I select and when I press f3 (for the third
>> >>> action), it inserts a link to the selected headline. It does the file
>> >>> finding recursively, so you might not want to run this on / ;)
>> >>>
>> >>> You could bind it to a key for easy use.
>> >>>
>> >>> Xebar Saram writes:
>> >>>
>> >>> > Thx so much Bernhard
>> >>> >
>> >>> > this looks really promising. i never had luck with either company or
>> >>> > auto-complete t o get it to work reliably (it often stops working
>> even
>> >>> > though its still in the mod bar).
>> >>> > anyway i tried it and added this to my config (after cloning from
>> git):
>> >>> >
>> >>> > (add-to-list 'load-path
>> "/home/zeltak/.emacs.g/company-org-headings")
>> >>> > (add-hook 'org-mode-hook
>> >>> > (lambda () (set (make-local-variable 'company-backends)
>> >>> > '((company-org-headings)))))
>> >>> >
>> >>> > i dont see it completes on org heading, is there any keys i need to
>> >>> press
>> >>> > or anything else in need to config? does this work only when you
>> try to
>> >>> > insert a link?
>> >>> >
>> >>> > best and thx so much, this look awesome
>> >>> >
>> >>> > P.S have you considered Helm for this as well?
>> >>> >
>> >>> > best
>> >>> >
>> >>> > Z
>> >>> >
>> >>> >
>> >>> >
>> >>> > On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <
>> bmutbuerger@gmail.com>
>> >>> > wrote:
>> >>> >
>> >>> >> Hi Saram,
>> >>> >>
>> >>> >> I've been in the same boat and decided to write a company-backend
>> for
>> >>> >> this purpose. So if you're already using company-mode, this may be
>> >>> worth
>> >>> >> looking into:
>> >>> >>
>> >>> >> https://github.com/mutbuerger/company-org-headings
>> >>> >>
>> >>> >> Keep in mind that I'm in the process of learning Elisp and
>> >>> >> there has been little to no testing done on the package.
>> Furthermore it
>> >>> >> uses org-store-link instead of org-id-store-link.
>> >>> >>
>> >>> >> Regards,
>> >>> >> Bernhard Pröll
>> >>> >>
>> >>> >>
>> >>> >> On Fri, 31. Jul 09:43, Xebar Saram wrote:
>> >>> >>
>> >>> >>> i also have a similar workflow and would love to hear Dominic if
>> you
>> >>> >>> found a
>> >>> >>> solution for this or if anyone on the list has other suggestions?
>> >>> >>>
>> >>> >>> best
>> >>> >>>
>> >>> >>> Z
>> >>> >>>
>> >>> >>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <
>> sk8ingdom@gmail.com
>> >>> >
>> >>> >>> wrote:
>> >>> >>>
>> >>> >>> Hello,
>> >>> >>>
>> >>> >>> I use org-mode a lot like a wiki so links to other org-mode
>> >>> headings
>> >>> >>> are
>> >>> >>> very common. Currently, I navigate to the heading or pull it
>> up in
>> >>> an
>> >>> >>> agenda view, store the link with C-l, going back to where I
>> want to
>> >>> >>> insert the link, then insert the link with C-c C-l RET. This
>> is a
>> >>> bit
>> >>> >>> time consuming.
>> >>> >>>
>> >>> >>> Instead, I would prefer to map a key that allows me to insert a
>> >>> link at
>> >>> >>> the current point using tab completion similar to org-refile
>> (C-c
>> >>> C-w).
>> >>> >>> Looking through org-id.el, it seems like
>> >>> org-id-get-with-outline-path
>> >>> >>> completion was designed for this purpose. I tried:
>> >>> >>>
>> >>> >>> (global-set-key "\C-ci" (lambda () (interactive)
>> (org-id-get-with
>> >>> >>> outline-path-completion)))
>> >>> >>>
>> >>> >>> but it didn't work as intended. Anyone have any ideas?
>> >>> >>>
>> >>> >>> Thanks!
>> >>> >>> -D
>> >>> >>>
>> >>> >>> For reference, I have the following set in my configuration:
>> >>> >>>
>> >>> >>> ;; Use global IDs
>> >>> >>> (require 'org-id)
>> >>> >>> (setq org-id-link-to-org-use-id t)
>> >>> >>>
>> >>> >>> ;; Update ID file .org-id-locations on startup
>> >>> >>> (org-id-update-id-locations)
>> >>> >>>
>> >>> >>> ;; Targets include this file and any file contributing to the
>> >>> agenda -
>> >>> >>> up to 9 levels deep
>> >>> >>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
>> >>> >>> (org-agenda-files :maxlevel .
>> >>> 9))))
>> >>> >>> (setq org-refile-use-outline-path 'file)
>> >>> >>> (setq org-outline-path-complete-in-steps t)
>> >>> >>> (setq org-refile-allow-creating-parent-nodes t)
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>> >>>
>> >>>
>> >>> --
>> >>> Professor John Kitchin
>> >>> Doherty Hall A207F
>> >>> Department of Chemical Engineering
>> >>> Carnegie Mellon University
>> >>> Pittsburgh, PA 15213
>> >>> 412-268-7803
>> >>> @johnkitchin
>> >>> http://kitchingroup.cheme.cmu.edu
>> >>>
>> >>
>> >>
>>
>> --
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>
>
>
[-- Attachment #2: Type: text/html, Size: 13570 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Insert org-id Link at Point via Outline Path Completion
2015-08-02 18:31 ` John Kitchin
@ 2015-08-02 18:38 ` Xebar Saram
0 siblings, 0 replies; 14+ messages in thread
From: Xebar Saram @ 2015-08-02 18:38 UTC (permalink / raw)
To: John Kitchin; +Cc: org mode, Dominic Surano
[-- Attachment #1: Type: text/plain, Size: 9628 bytes --]
Perfect :D
thx so much, as always really appreciate it!
z
On Sun, Aug 2, 2015 at 9:31 PM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:
> You are, that code modifies the helm-org-agenda-files-headings function by
> adding a new action to it. So, try:
>
> M-x helm-org-agenda-files-headings
>
> select a heading, press tab, and you should see a 4th, new action to
> insert an org-id link.
>
> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
> On Sun, Aug 2, 2015 at 2:20 PM, Xebar Saram <zeltakc@gmail.com> wrote:
>
>> Thx john
>>
>> i evaled the code yet i cant see it under M-x, am i missing something?
>>
>> best
>>
>> Z
>>
>> On Sat, Aug 1, 2015 at 10:03 PM, John Kitchin <jkitchin@andrew.cmu.edu>
>> wrote:
>>
>>> usually it is pretty easy to add new functions in helm, but it is less
>>> easy in this case because the source is dynamically generated from a
>>> function. So, in this case I think we have to just redefine the function
>>> that generates the source. here is an example that I think makes an id
>>> link as a new action.
>>>
>>> #+BEGIN_SRC emacs-lisp
>>> (defun helm-org-insert-id-link-to-heading-at-marker (marker)
>>> (with-current-buffer (marker-buffer marker)
>>> (let ((file-name (buffer-file-name))
>>> (id (save-excursion (goto-char (marker-position marker))
>>> (org-id-get-create)
>>> (org-id-store-link))))
>>>
>>> (with-helm-current-buffer
>>> (org-insert-link
>>> file-name id)))))
>>>
>>>
>>> (cl-defun helm-source-org-headings-for-files (filenames
>>> &optional (min-depth 1)
>>> (max-depth 8))
>>> (helm-build-sync-source "Org Headings"
>>> :candidates (helm-org-get-candidates filenames min-depth max-depth)
>>> :action '(("Go to line" . helm-org-goto-marker)
>>> ("Refile to this heading" . helm-org-heading-refile)
>>> ("Insert link to this heading"
>>> . helm-org-insert-link-to-heading-at-marker)
>>> ("Insert id link to this heading" .
>>> helm-org-insert-id-link-to-heading-at-marker))))
>>>
>>> #+END_SRC
>>> Xebar Saram writes:
>>>
>>> > Hi again
>>> >
>>> > so excited over this had to ask 2 more questions ;-)
>>> >
>>> > 1.can that function include/link to org-id (so that it can keep the
>>> links
>>> > even if the headers move around in/out of the files)
>>> > 2.i saw there are 3 options to that helm function. can this be
>>> customized
>>> > to add more commands (can really think of which ones know but could see
>>> > potential in future :))
>>> >
>>> > thx so much John as always you rock ;-)
>>> >
>>> > Z
>>> >
>>> > On Sat, Aug 1, 2015 at 8:36 PM, Xebar Saram <zeltakc@gmail.com> wrote:
>>> >
>>> >> John, this is superb!
>>> >>
>>> >> thx so much it answers all my needs, what a great find :)
>>> >>
>>> >> kind regards
>>> >>
>>> >> Z
>>> >>
>>> >> On Sat, Aug 1, 2015 at 7:33 PM, John Kitchin <jkitchin@andrew.cmu.edu
>>> >
>>> >> wrote:
>>> >>
>>> >>> (helm-org-agenda-files-headings) seems to do this already for all
>>> >>> headlines in your agenda files. the third action is to insert a link
>>> to
>>> >>> the selected headline.
>>> >>>
>>> >>> You can use let to temporarily define the org-agenda-files list to
>>> what
>>> >>> you want, and just use the (helm-org-agenda-files-headings) command
>>> for
>>> >>> non-agenda files.
>>> >>>
>>> >>> e.g.
>>> >>>
>>> >>> #+BEGIN_SRC emacs-lisp
>>> >>> (defun insert-heading-link (dir)
>>> >>> "select a headline from org-files in dir and insert a link to it."
>>> >>> (interactive (list (read-directory-name "Directory: ")))
>>> >>> (let ((org-agenda-files (f-entries
>>> >>> dir
>>> >>> (lambda (f)
>>> >>> (string=
>>> >>> "org"
>>> >>> (file-name-extension f)))
>>> >>> t)))
>>> >>> (helm-org-agenda-files-headings)))
>>> >>> #+END_SRC
>>> >>>
>>> >>> gives me a helm buffer to select headlines from org-files in the
>>> >>> directory I select and when I press f3 (for the third
>>> >>> action), it inserts a link to the selected headline. It does the file
>>> >>> finding recursively, so you might not want to run this on / ;)
>>> >>>
>>> >>> You could bind it to a key for easy use.
>>> >>>
>>> >>> Xebar Saram writes:
>>> >>>
>>> >>> > Thx so much Bernhard
>>> >>> >
>>> >>> > this looks really promising. i never had luck with either company
>>> or
>>> >>> > auto-complete t o get it to work reliably (it often stops working
>>> even
>>> >>> > though its still in the mod bar).
>>> >>> > anyway i tried it and added this to my config (after cloning from
>>> git):
>>> >>> >
>>> >>> > (add-to-list 'load-path
>>> "/home/zeltak/.emacs.g/company-org-headings")
>>> >>> > (add-hook 'org-mode-hook
>>> >>> > (lambda () (set (make-local-variable 'company-backends)
>>> >>> > '((company-org-headings)))))
>>> >>> >
>>> >>> > i dont see it completes on org heading, is there any keys i need to
>>> >>> press
>>> >>> > or anything else in need to config? does this work only when you
>>> try to
>>> >>> > insert a link?
>>> >>> >
>>> >>> > best and thx so much, this look awesome
>>> >>> >
>>> >>> > P.S have you considered Helm for this as well?
>>> >>> >
>>> >>> > best
>>> >>> >
>>> >>> > Z
>>> >>> >
>>> >>> >
>>> >>> >
>>> >>> > On Sat, Aug 1, 2015 at 12:07 PM, Bernhard Pröll <
>>> bmutbuerger@gmail.com>
>>> >>> > wrote:
>>> >>> >
>>> >>> >> Hi Saram,
>>> >>> >>
>>> >>> >> I've been in the same boat and decided to write a company-backend
>>> for
>>> >>> >> this purpose. So if you're already using company-mode, this may be
>>> >>> worth
>>> >>> >> looking into:
>>> >>> >>
>>> >>> >> https://github.com/mutbuerger/company-org-headings
>>> >>> >>
>>> >>> >> Keep in mind that I'm in the process of learning Elisp and
>>> >>> >> there has been little to no testing done on the package.
>>> Furthermore it
>>> >>> >> uses org-store-link instead of org-id-store-link.
>>> >>> >>
>>> >>> >> Regards,
>>> >>> >> Bernhard Pröll
>>> >>> >>
>>> >>> >>
>>> >>> >> On Fri, 31. Jul 09:43, Xebar Saram wrote:
>>> >>> >>
>>> >>> >>> i also have a similar workflow and would love to hear Dominic if
>>> you
>>> >>> >>> found a
>>> >>> >>> solution for this or if anyone on the list has other suggestions?
>>> >>> >>>
>>> >>> >>> best
>>> >>> >>>
>>> >>> >>> Z
>>> >>> >>>
>>> >>> >>> On Tue, May 12, 2015 at 10:57 PM, Dominic Surano <
>>> sk8ingdom@gmail.com
>>> >>> >
>>> >>> >>> wrote:
>>> >>> >>>
>>> >>> >>> Hello,
>>> >>> >>>
>>> >>> >>> I use org-mode a lot like a wiki so links to other org-mode
>>> >>> headings
>>> >>> >>> are
>>> >>> >>> very common. Currently, I navigate to the heading or pull it
>>> up in
>>> >>> an
>>> >>> >>> agenda view, store the link with C-l, going back to where I
>>> want to
>>> >>> >>> insert the link, then insert the link with C-c C-l RET. This
>>> is a
>>> >>> bit
>>> >>> >>> time consuming.
>>> >>> >>>
>>> >>> >>> Instead, I would prefer to map a key that allows me to insert
>>> a
>>> >>> link at
>>> >>> >>> the current point using tab completion similar to org-refile
>>> (C-c
>>> >>> C-w).
>>> >>> >>> Looking through org-id.el, it seems like
>>> >>> org-id-get-with-outline-path
>>> >>> >>> completion was designed for this purpose. I tried:
>>> >>> >>>
>>> >>> >>> (global-set-key "\C-ci" (lambda () (interactive)
>>> (org-id-get-with
>>> >>> >>> outline-path-completion)))
>>> >>> >>>
>>> >>> >>> but it didn't work as intended. Anyone have any ideas?
>>> >>> >>>
>>> >>> >>> Thanks!
>>> >>> >>> -D
>>> >>> >>>
>>> >>> >>> For reference, I have the following set in my configuration:
>>> >>> >>>
>>> >>> >>> ;; Use global IDs
>>> >>> >>> (require 'org-id)
>>> >>> >>> (setq org-id-link-to-org-use-id t)
>>> >>> >>>
>>> >>> >>> ;; Update ID file .org-id-locations on startup
>>> >>> >>> (org-id-update-id-locations)
>>> >>> >>>
>>> >>> >>> ;; Targets include this file and any file contributing to the
>>> >>> agenda -
>>> >>> >>> up to 9 levels deep
>>> >>> >>> (setq org-refile-targets (quote ((nil :maxlevel . 9)
>>> >>> >>> (org-agenda-files :maxlevel .
>>> >>> 9))))
>>> >>> >>> (setq org-refile-use-outline-path 'file)
>>> >>> >>> (setq org-outline-path-complete-in-steps t)
>>> >>> >>> (setq org-refile-allow-creating-parent-nodes t)
>>> >>> >>>
>>> >>> >>>
>>> >>> >>>
>>> >>> >>>
>>> >>> >>>
>>> >>>
>>> >>> --
>>> >>> Professor John Kitchin
>>> >>> Doherty Hall A207F
>>> >>> Department of Chemical Engineering
>>> >>> Carnegie Mellon University
>>> >>> Pittsburgh, PA 15213
>>> >>> 412-268-7803
>>> >>> @johnkitchin
>>> >>> http://kitchingroup.cheme.cmu.edu
>>> >>>
>>> >>
>>> >>
>>>
>>> --
>>> Professor John Kitchin
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu
>>>
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 14129 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-08-02 18:38 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 19:57 Insert org-id Link at Point via Outline Path Completion Dominic Surano
2015-07-31 6:43 ` Xebar Saram
2015-07-31 7:13 ` Eric Abrahamsen
2015-08-01 9:07 ` Bernhard Pröll
2015-08-01 13:20 ` Xebar Saram
2015-08-01 16:33 ` John Kitchin
2015-08-01 17:36 ` Xebar Saram
2015-08-01 17:49 ` Xebar Saram
2015-08-01 19:03 ` John Kitchin
2015-08-01 19:17 ` Dominic Surano
2015-08-02 18:20 ` Xebar Saram
2015-08-02 18:31 ` John Kitchin
2015-08-02 18:38 ` Xebar Saram
2015-08-02 7:03 ` Bernhard Pröll
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).