Optionally buttinofy URLs in "i" type dir entries.
authorTim Vaughan <tgvaughan@gmail.com>
Wed, 29 May 2019 08:17:17 +0000 (10:17 +0200)
committerTim Vaughan <tgvaughan@gmail.com>
Wed, 29 May 2019 08:17:17 +0000 (10:17 +0200)
elpher.el

index b977a8c..a8f8edd 100644 (file)
--- a/elpher.el
+++ b/elpher.el
 Otherwise, use the system browser via the BROWSE-URL function."
   :type '(boolean))
 
+(defcustom elpher-buttonify-urls-in-directories nil
+  "If non-nil, turns URLs matched in \"i\" item types in directories
+into clickable buttons."
+  :type '(boolean))
+
 (defcustom elpher-cache-images nil
   "If non-nil, cache images in memory in the same way as other content."
   :type '(boolean))
@@ -173,7 +178,6 @@ Otherwise, a list containing the selector, host and port of a directory to
 use as the start page."
   :type '(list string string integer))
 
-
 ;;; Model
 ;;
 
@@ -334,8 +338,11 @@ content and cursor position fields of the node."
                                                  selector host port)))
       (pcase type
         (?i (elpher-insert-margin) ;; Information
-            (insert (propertize display-string
-                                'face 'elpher-info)))
+            (insert (propertize
+                     (if elpher-buttonify-urls-in-directories
+                         (elpher-buttonify-urls display-string)
+                       display-string)
+                     'face 'elpher-info)))
         (?h (elpher-insert-margin "W") ;; Web link
             (let ((url (elt (split-string selector "URL:") 1)))
               (insert-text-button display-string