Re: [O] Function that jumps to an entry with a certain CUSTOM_ID

2015-04-06 Thread Leo Ufimtsev
+1

* Non-technical feedback ::
 - Thank you so much for sharing. I've been looking for something like this for 
a while.
 - I hope it'll make it into org-mode some way or another, it seems like a 
valuable addition. 
 - imho the HELM integration is essential.

Leo Ufimtsev | Software Engineer @ Eclipse Team

- Original Message -
From: Christoph LANGE math.semantic@gmail.com
To: emacs-orgmode@gnu.org
Sent: Tuesday, March 31, 2015 12:36:45 PM
Subject: [O] Function that jumps to an entry with a certain CUSTOM_ID

Hi all,

the following function has served me well for a few years, so I thought 
I'd share it.  I would even be happy to contribute it to the codebase of 
org-mode (core or contrib); however in this case someone would have to 
point me to a fool-proof guide for how to do this.  I know that for 
contributing code I will have to sign some FSF copyright forms, and I 
know how to use git, but I don't know the exact org-mode specific steps 
of doing so.

--- % --- % --- % --- % --- % --- % --- % --- % --- % --- % ---
(defun org-jump-to-id ()
   Asks for an identifier and searches for the first entry in the 
current file that has this identifier as a CUSTOM_ID property.
   (interactive)
   (let* ((property CUSTOM_ID)
  (custom-id (org-icompleting-read CUSTOM_ID of entry: 
   (mapcar 'list 
(org-property-values property)
   (org-link-search (concat # custom-id

(define-key org-mode-map (kbd \C-cj) 'org-jump-to-id)
--- % --- % --- % --- % --- % --- % --- % --- % --- % --- % ---

This implementation works efficiently in a 4 MB org file with 100 IDs. 
Together with ido or helm I find it a very user-friendly way of jumping 
to frequently used headlines.

I noticed that org-babel-ref-goto-headline-id does something similar, so 
maybe some code could be shared among the two functions.

Cheers,

Christoph

-- 
Dr. Christoph Lange, Enterprise Information Systems Department
Applied Computer Science @ University of Bonn; Fraunhofer IAIS
http://langec.wordpress.com/about, Skype duke4701

→ Semantic Publishing Challenge: Assessing the Quality of Scientific Output
   ESWC, 31 May–4 June 2014, Portorož, Slovenia. 
https://tinyurl.com/SPChallenge15
   Submission deadline 27 March (abstracts: 20 March)




Re: [O] Function that jumps to an entry with a certain CUSTOM_ID

2015-04-01 Thread Nicolas Goaziou
Christoph Lange math.semantic@gmail.com writes:

 On Mar 31, 2015 9:53 PM, Nicolas Goaziou m...@nicolasgoaziou.fr wrote:
 The problem is that we're running out of interesting keybindings.

 Let me ask the question differently: as all reasonable key bindings are
 taken (a statement to which I tend to agree), is the suggestion of
 interactive functions to be added to the core of org-mode no longer
 appropriate?

IMO we can't afford maintaining all end-user functions imaginable in
org.el. What is possible, however is to extend some existing
behaviour.

For example, `org-open-at-point' could be a good candidate: with C-u
C-u, it could offer to type in a link and open it. So, in order to jump
to a custom-id, you can use

  C-u C-u C-o #my-custom RET

Of course, you lose completion, in this case, which is a serious
drawback.

Another option would be to extend `org-goto' (C-c C-j) and offer to jump
to custom-id.

 But I think I should rather aim at Worg's contrib directory,

There's no such thing as Worg contrib directory. There's Worg, OT1H,
and a contrib/ directory OTOH, but they are not related.

Worg is a good place to share useful code snippets.


Regards,



[O] Function that jumps to an entry with a certain CUSTOM_ID

2015-03-31 Thread Christoph LANGE

Hi all,

the following function has served me well for a few years, so I thought 
I'd share it.  I would even be happy to contribute it to the codebase of 
org-mode (core or contrib); however in this case someone would have to 
point me to a fool-proof guide for how to do this.  I know that for 
contributing code I will have to sign some FSF copyright forms, and I 
know how to use git, but I don't know the exact org-mode specific steps 
of doing so.


--- % --- % --- % --- % --- % --- % --- % --- % --- % --- % ---
(defun org-jump-to-id ()
  Asks for an identifier and searches for the first entry in the 
current file that has this identifier as a CUSTOM_ID property.

  (interactive)
  (let* ((property CUSTOM_ID)
 (custom-id (org-icompleting-read CUSTOM_ID of entry: 
  (mapcar 'list 
(org-property-values property)

  (org-link-search (concat # custom-id

(define-key org-mode-map (kbd \C-cj) 'org-jump-to-id)
--- % --- % --- % --- % --- % --- % --- % --- % --- % --- % ---

This implementation works efficiently in a 4 MB org file with 100 IDs. 
Together with ido or helm I find it a very user-friendly way of jumping 
to frequently used headlines.


I noticed that org-babel-ref-goto-headline-id does something similar, so 
maybe some code could be shared among the two functions.


Cheers,

Christoph

--
Dr. Christoph Lange, Enterprise Information Systems Department
Applied Computer Science @ University of Bonn; Fraunhofer IAIS
http://langec.wordpress.com/about, Skype duke4701

→ Semantic Publishing Challenge: Assessing the Quality of Scientific Output
  ESWC, 31 May–4 June 2014, Portorož, Slovenia. 
https://tinyurl.com/SPChallenge15

  Submission deadline 27 March (abstracts: 20 March)



Re: [O] Function that jumps to an entry with a certain CUSTOM_ID

2015-03-31 Thread Nicolas Goaziou
Hello,

Christoph LANGE math.semantic@gmail.com writes:

 the following function has served me well for a few years, so
 I thought I'd share it.  I would even be happy to contribute it to the
 codebase of org-mode (core or contrib); however in this case someone
 would have to point me to a fool-proof guide for how to do this.
 I know that for contributing code I will have to sign some FSF
 copyright forms, and I know how to use git, but I don't know the exact
 org-mode specific steps of doing so.

The problem is that we're running out of interesting keybindings. C-c
j is not an option since it is reserved to users.

Another option would be to add it to Worg.

 --- % --- % --- % --- % --- % --- % --- % --- % --- % --- % ---
 (defun org-jump-to-id ()
   Asks for an identifier and searches for the first entry in the
 current file that has this identifier as a CUSTOM_ID property.
   (interactive)
   (let* ((property CUSTOM_ID)
  (custom-id (org-icompleting-read CUSTOM_ID of entry: 
   (mapcar 'list
 (org-property-values property)
   (org-link-search (concat # custom-id

 (define-key org-mode-map (kbd \C-cj) 'org-jump-to-id)
 --- % --- % --- % --- % --- % --- % --- % --- % --- % --- % ---

 This implementation works efficiently in a 4 MB org file with 100 IDs.
 Together with ido or helm I find it a very user-friendly way of
 jumping to frequently used headlines.

Note that you can use

  (let ((h (org-find-property CUSTOM_ID custom-id)))
(when h (goto-char h)))

instead of

  (org-link-search ...)

for one less level of indirection.

 I noticed that org-babel-ref-goto-headline-id does something similar,
 so maybe some code could be shared among the two functions.

Indeed. I modified it so it uses `org-find-property'.

Regards,

-- 
Nicolas Goaziou



Re: [O] Function that jumps to an entry with a certain CUSTOM_ID

2015-03-31 Thread Christoph Lange
On Mar 31, 2015 9:53 PM, Nicolas Goaziou m...@nicolasgoaziou.fr wrote:
 The problem is that we're running out of interesting keybindings.

Let me ask the question differently: as all reasonable key bindings are
taken (a statement to which I tend to agree), is the suggestion of
interactive functions to be added to the core of org-mode no longer
appropriate? I.e. should I contribute them to Worg (with which I still need
to familiarise myself) rather than suggesting them here? Or, asking about a
middle course, what's the role of org's contrib directory? (Is it even
suitable for something that is not a complete plugin of its own right, but
rather just a single function?)

 C-c
 j is not an option since it is reserved to users.

Sorry, this was unfortunate in my initial post. I didn't intend to
hard-code this as the default key binding, but it was rather meant to be
read as if you like this function, you could bind it, for example, to 

 Note that you can use

   (let ((h (org-find-property CUSTOM_ID custom-id)))
 (when h (goto-char h)))

 instead of

   (org-link-search ...)

 for one less level of indirection.

Thanks - makes sense. However probably not if I write a tutorial in the
style of if you want to do something, then copy the following lines to
your. emacs.

But I think I should rather aim at Worg's contrib directory, with a short
elisp file containing my function, plus a short HTML file explaining that
there exists an elisp file containing a function that does a few words
about the functionality - does this make sense?

Cheers, and thanks for your advice,

Christoph

-- 
Christoph Lange(-Bever)
http://langec.wordpress.com/about
Sent from a mobile device; please excuse my brevity.