- (help-string (format "mouse-1, RET: open %s on %s port %s"
- selector host port)))
- (pcase type
- (?i (elopher-insert-margin) ; Information
- (insert (propertize display-string
- 'face elopher-info-face)))
- (?0 (elopher-insert-margin "T") ; Text
- (insert-text-button display-string
- 'face elopher-text-face
- 'elopher-node (elopher-make-node elopher-current-node
- address
- #'elopher-get-text-node)
- 'action #'elopher-click-link
- 'follow-link t
- 'help-echo help-string))
- (?1 (elopher-insert-margin "/") ; Index
- (insert-text-button display-string
- 'face elopher-index-face
- 'elopher-node (elopher-make-node elopher-current-node
- address
- #'elopher-get-index-node)
- 'action #'elopher-click-link
- 'follow-link t
- 'help-echo help-string))
- ((or ?g ?p ?I) (elopher-insert-margin "im") ; Image
- (insert-text-button display-string
- 'face elopher-image-face
- 'elopher-node (elopher-make-node elopher-current-node
- address
- #'elopher-get-image-node)
- 'action #'elopher-click-link
- 'follow-link t
- 'help-echo help-string))
- ((or ?4 ?9) (elopher-insert-margin "B") ; Binary
- (insert-text-button display-string
- 'face elopher-binary-face
- 'elopher-node (elopher-make-node elopher-current-node
- address
- #'elopher-get-node-download)
- 'action #'elopher-click-link
- 'follow-link t
- 'help-echo help-string))
- (?7 (elopher-insert-margin "S")
+ (type-map-entry (alist-get type elopher-type-map)))
+ (if type-map-entry
+ (let ((getter (car type-map-entry))
+ (margin-code (cadr type-map-entry))
+ (face (caddr type-map-entry)))
+ (elopher-insert-margin margin-code)