From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: paste from clip to code block Date: Mon, 07 Sep 2015 16:18:51 -0400 Message-ID: References: <87383ypzbd.fsf@yale.edu> <86k2wkbyyb.fsf@example.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ2sZ-0000xo-VU for emacs-orgmode@gnu.org; Mon, 07 Sep 2015 16:19:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZ2sW-0000BV-O7 for emacs-orgmode@gnu.org; Mon, 07 Sep 2015 16:19:03 -0400 Received: from mail-qg0-x235.google.com ([2607:f8b0:400d:c04::235]:33103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ2sW-0000BM-Jv for emacs-orgmode@gnu.org; Mon, 07 Sep 2015 16:19:00 -0400 Received: by qgev79 with SMTP id v79so68082211qge.0 for ; Mon, 07 Sep 2015 13:18:59 -0700 (PDT) In-reply-to: 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: Grant Rettke Cc: Sebastien Vauban , "emacs-orgmode@gnu.org" For example with the cursor on a src-block press C-c l to store a link to that name, and later type C-c C-l to insert a link to that src-block. It would look a little like this: #+BEGIN_SRC emacs-lisp (defun org-src-block-store-link () (let* ((object (org-element-context))) (when (equal (org-element-type object) 'src-block) (org-store-link-props :type "src-block" :link (concat "src-block:" (org-element-property :name object)))))) (add-hook 'org-store-link-functions 'org-src-block-store-link) (org-add-link-type "src-block" (lambda (label) (org-mark-ring-push) (widen) (goto-char (point-min)) (re-search-forward (regexp-quote (format "#+NAME: %s" label))) (beginning-of-line))) #+END_SRC it only works in the current file though. Grant Rettke writes: > On Mon, Sep 7, 2015 at 9:09 AM, John Kitchin wrote: >> Neat. Do you have some handy way to store a link to the source block, or >> jump to them? > > I don't, but please tell us more about what you mean. -- 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