From 309a34cea5a22d082fce87a1ecea378c41b17ff5 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 17 Jan 2022 17:12:34 -0600 Subject: Open local HTML files with `browse-url' --- init.el | 2 ++ lisp/+org.el | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/init.el b/init.el index 4eb8cdd..4438393 100644 --- a/init.el +++ b/init.el @@ -490,6 +490,8 @@ "|" "DONE(d!)") (sequence "|" "CANCELED(k!)") (sequence "MEETING(m)"))) + (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) + #'+org-open-html) (:bind "RET" #'+org-return-dwim "" #'+org-table-copy-down "C-c C-l" #'+org-insert-link-dwim diff --git a/lisp/+org.el b/lisp/+org.el index 348ba6e..5869622 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -442,5 +442,15 @@ the deletion might narrow the column." (org-up-heading-all 1)) (org-open-at-point arg))))) +;;; Open local HTML files with `browse-url' + +(defun +org-open-html (file-path link-string) + "Open FILE-PATH with `browse-url'. +This function is intended to use with `org-file-apps'. See the +documentation of that function for a description of the two +arguments here, FILE-PATH and LINK-STRING." + (message "Opening %s (%s)..." file-path link-string) + (browse-url file-path)) + (provide '+org) ;;; +org.el ends here -- cgit 1.4.1-21-gabe81