From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph LANGE Subject: Function that jumps to an entry with a certain CUSTOM_ID Date: Tue, 31 Mar 2015 18:36:45 +0200 Message-ID: <551ACD1D.6020501@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ycz9q-00076X-36 for emacs-orgmode@gnu.org; Tue, 31 Mar 2015 12:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ycz9l-00068q-Vx for emacs-orgmode@gnu.org; Tue, 31 Mar 2015 12:36:54 -0400 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:37974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ycz9l-00068a-Qa for emacs-orgmode@gnu.org; Tue, 31 Mar 2015 12:36:49 -0400 Received: by wibgn9 with SMTP id gn9so33405204wib.1 for ; Tue, 31 Mar 2015 09:36:48 -0700 (PDT) Received: from [10.144.103.67] (hades-dfn.bi.fraunhofer.de. [192.76.241.15]) by mx.google.com with ESMTPSA id o10sm21635989wiy.18.2015.03.31.09.36.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 09:36:47 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" 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)