Browse Source

ID links: Honor `org-link-frame-setup'.

Carsten Dominik 15 years ago
parent
commit
98998abc0d
2 changed files with 17 additions and 2 deletions
  1. 4 0
      lisp/ChangeLog
  2. 13 2
      lisp/org-id.el

+ 4 - 0
lisp/ChangeLog

@@ -1,3 +1,7 @@
+2009-08-02  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-id.el (org-id-open): Honor `org-link-frame-setup'.
+
 2009-08-01  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-exp.el (org-export-as-org): Insert the "-source" string

+ 13 - 2
lisp/org-id.el

@@ -577,11 +577,22 @@ optional argument MARKERP, return the position as a new marker."
 (defun org-id-open (id)
   "Go to the entry with id ID."
   (org-mark-ring-push)
-  (let ((m (org-id-find id 'marker)))
+  (let ((m (org-id-find id 'marker))
+	cmd)
     (unless m
       (error "Cannot find entry with ID \"%s\"" id))
+    ;; Use a buffer-switching command in analogy to finding files
+    (setq cmd
+	  (or
+	   (cdr
+	    (assq
+	     (cdr (assq 'file org-link-frame-setup))
+	     '((find-file . switch-to-buffer)
+	       (find-file-other-window . switch-to-buffer-other-window)
+	       (find-file-other-frame . switch-to-buffer-other-frame))))
+	   switch-to-buffer-other-window))
     (if (not (equal (current-buffer) (marker-buffer m)))
-	(switch-to-buffer-other-window (marker-buffer m)))
+	(funcall cmd (marker-buffer m)))
     (goto-char m)
     (move-marker m nil)
     (org-show-context)))