emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: torys.anderson@gmail.com (Tory S. Anderson)
To: orgmode list <emacs-orgmode@gnu.org>, Drew Adams <drew.adams@oracle.com>
Subject: Org Linking to Bookmark [+]
Date: Wed, 11 Feb 2015 06:49:45 -0500	[thread overview]
Message-ID: <8761b8acrq.fsf@gmail.com> (raw)

I have weekly TODO items that link to something that needs to be updated; for instance, I write a weekly letter to my daughter where  each week the actual file for the letter will change. Right now I have to manually update that link in the org file, which is quite cumbersome. If I could just link to a bookmark then periodic updates of the bookmark would take care of any problem with updating the todo item. So, I've been tryin to kludge a solution based on the orgmode manual; while any suggestions would be useful for my budding elisp skills, in particular I'm not sure how to write the last function (org-bmkp-get-bookmark-name). Any suggestions? 

--8<---------------cut here---------------start------------->8---
;;; * bmkp links http://orgmode.org/manual/Adding-hyperlink-types.html
     (org-add-link-type "bmkp" 'org-bmkp-open)
     (add-hook 'org-store-link-functions 'org-bmkp-store-link)
     
     (defcustom org-bmkp-command 'bmkp
       "The Emacs command to be used to display a bmkp page."
       :group 'org-link
       :type '(choice (const bookmark-jump) (const bookmark-jump-other-window)))
     
     (defun org-bmkp-open (path)
       "Visit the bmkppage on PATH.
     PATH should be a bookmark name that can be thrown at the `bookmark-jump' function."
       (funcall org-bmkp-command path))
     
     (defun org-bmkp-store-link ()
       "Store a link to a bmkp bookmark."
       (when (memq major-mode '(bookmark-bmenu-mode))
         (let* ((bookmark (org-bmkp-get-bookmark-name))
                (link (concat "bmkp:" bookmark))
                (description (format "Bookmark")))
           (org-store-link-props
            :type "bmkp"
            :link link
            :description description))))
     
     (defun org-bmkp-get-bookmark-name () ;; TODO
       "Get the bookmark name at point (from bookmark list)."
       (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
           (match-string 1 (buffer-name))
         (error "Cannot create link to this bmkp bookmark")))
--8<---------------cut here---------------end--------------->8---

             reply	other threads:[~2015-02-11 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 11:49 Tory S. Anderson [this message]
2015-02-11 14:46 ` Org Linking to Bookmark [+] Drew Adams
2015-02-11 16:45   ` [DONE] " Tory S. Anderson
2015-02-11 21:28   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761b8acrq.fsf@gmail.com \
    --to=torys.anderson@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).