branch: externals/dicom
commit e5db7a09a1feed7fb74c2ac8ddd56276307a5d09
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    Register Org links
    
    File links work too, but then the DICOM file content is loaded first into a
    buffer.
---
 dicom.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/dicom.el b/dicom.el
index fa07255870..a5639574d6 100644
--- a/dicom.el
+++ b/dicom.el
@@ -622,5 +622,20 @@ REUSE can be a buffer name to reuse."
   (add-to-list 'auto-mode-alist '("\\.\\(?:dcm\\|ima\\)\\'" . dicom-auto-mode))
   (add-to-list 'auto-mode-alist '("DICOMDIR" . dicom-auto-mode)))
 
+;;;###autoload
+(funcall 'eval-after-load 'ol
+  (lambda ()
+    (declare-function org-link-set-parameters "ol")
+    (declare-function org-link-store-props "ol")
+    (org-link-set-parameters
+     "dicom"
+     :follow (lambda (link _) (dicom-open link))
+     :store
+     (lambda ()
+       (when (eq major-mode 'dicom-mode)
+         (org-link-store-props
+          :type "dicom"
+          :link (concat "dicom:" (abbreviate-file-name dicom--file))))))))
+
 (provide 'dicom)
 ;;; dicom.el ends here

Reply via email to