From mboxrd@z Thu Jan 1 00:00:00 1970 From: torys.anderson@gmail.com (Tory S. Anderson) Subject: Org Linking to Bookmark [+] Date: Wed, 11 Feb 2015 06:49:45 -0500 Message-ID: <8761b8acrq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLVnh-0004hF-BA for emacs-orgmode@gnu.org; Wed, 11 Feb 2015 06:49:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLVng-0005J5-2g for emacs-orgmode@gnu.org; Wed, 11 Feb 2015 06:49:49 -0500 Received: from mail-qg0-x236.google.com ([2607:f8b0:400d:c04::236]:54044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLVnf-0005Iw-Vh for emacs-orgmode@gnu.org; Wed, 11 Feb 2015 06:49:48 -0500 Received: by mail-qg0-f54.google.com with SMTP id z60so2075672qgd.13 for ; Wed, 11 Feb 2015 03:49:47 -0800 (PST) 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: orgmode list , Drew Adams 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---