The Lambda Lab
/
projects
/
elpher.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added spartan to integrations.
[elpher.git]
/
elpher.el
diff --git
a/elpher.el
b/elpher.el
index
bb628de
..
e503a5c
100644
(file)
--- a/
elpher.el
+++ b/
elpher.el
@@
-276,7
+276,7
@@
meaningfully."
"Face used for Gemini type directory records.")
(defface elpher-spartan
"Face used for Gemini type directory records.")
(defface elpher-spartan
- '((t :inherit font-lock-
constant
-face))
+ '((t :inherit font-lock-
type
-face))
"Face used for Spartan type directory records.")
(defface elpher-spartan-post
"Face used for Spartan type directory records.")
(defface elpher-spartan-post
@@
-363,8
+363,8
@@
is not explicitly given."
(when (or (equal (url-filename url) "")
(equal (url-filename url) "/"))
(setf (url-filename url) "/1")))
(when (or (equal (url-filename url) "")
(equal (url-filename url) "/"))
(setf (url-filename url) "/1")))
- (when (
equal "gemini" (url-type url
))
- ;; Gemini defaults
+ (when (
member (url-type url) '("gemini" "spartan"
))
+ ;; Gemini
and Spartan
defaults
(if (equal (url-filename url) "")
(setf (url-filename url) "/"))))
(elpher-remove-redundant-ports url))
(if (equal (url-filename url) "")
(setf (url-filename url) "/"))))
(elpher-remove-redundant-ports url))
@@
-475,12
+475,6
@@
If no address is defined, returns 0. (This is for compatibility with
the URL library.)"
(url-port address))
the URL library.)"
(url-port address))
-(defun elpher-address-path-and-query (address)
- "Retrieve path and query portion of ADDRESS as a pair."
- (let ((path-and-query (url-path-and-query address)))
- (cons (car path-and-query)
- (url-unhex-string (cdr path-and-query)))))
-
(defun elpher-gopher-address-selector (address)
"Retrieve gopher selector from ADDRESS object."
(if (member (url-filename address) '("" "/"))
(defun elpher-gopher-address-selector (address)
"Retrieve gopher selector from ADDRESS object."
(if (member (url-filename address) '("" "/"))
@@
-1539,7
+1533,7
@@
treatment that a separate function is warranted."
(setf (url-host address) (puny-encode-domain (url-host address))))
(unless (url-type address)
(setf (url-type address) (url-type current-address)))
(setf (url-host address) (puny-encode-domain (url-host address))))
(unless (url-type address)
(setf (url-type address) (url-type current-address)))
- (when (
equal (url-type address) "gemini"
)
+ (when (
member (url-type address) '("gemini" "spartan")
)
(setf (url-filename address)
(elpher-collapse-dot-sequences (url-filename address)))))
(elpher-remove-redundant-ports address)))
(setf (url-filename address)
(elpher-collapse-dot-sequences (url-filename address)))))
(elpher-remove-redundant-ports address)))
@@
-1733,7
+1727,7
@@
can be used to toggle the display of the preformatted text."
(defun elpher-get-spartan-response (address renderer)
"Get response string from spartan server at ADDRESS and render using RENDERER."
(let* ((host (elpher-address-host address))
(defun elpher-get-spartan-response (address renderer)
"Get response string from spartan server at ADDRESS and render using RENDERER."
(let* ((host (elpher-address-host address))
- (path-and-query (
elpher-address
-path-and-query address))
+ (path-and-query (
url
-path-and-query address))
(filename (car path-and-query))
(data (cdr path-and-query))
(data-len (length data)))
(filename (car path-and-query))
(data (cdr path-and-query))
(data-len (length data)))
@@
-2233,9
+2227,10
@@
of gemini, gopher or finger."
(let* ((url (elpher-info-current))
(desc (car elpher-current-page))
(protocol (cond
(let* ((url (elpher-info-current))
(desc (car elpher-current-page))
(protocol (cond
- ((string-prefix-p "gemini:" url) "gemini")
((string-prefix-p "gopher:" url) "gopher")
((string-prefix-p "finger:" url) "finger")
((string-prefix-p "gopher:" url) "gopher")
((string-prefix-p "finger:" url) "finger")
+ ((string-prefix-p "gemini:" url) "gemini")
+ ((string-prefix-p "spartan:" url) "spartan")
(t "elpher"))))
(when (equal "elpher" protocol)
;; Weird link. Or special inner link?
(t "elpher"))))
(when (equal "elpher" protocol)
;; Weird link. Or special inner link?
@@
-2271,6
+2266,11
@@
supports the old protocol elpher, where the link is self-contained."
:export (lambda (link description format _plist)
(elpher-org-export-link link description format "gopher"))
:follow (lambda (link _arg) (elpher-org-follow-link link "gopher")))
:export (lambda (link description format _plist)
(elpher-org-export-link link description format "gopher"))
:follow (lambda (link _arg) (elpher-org-follow-link link "gopher")))
+ (org-link-set-parameters
+ "spartan"
+ :export (lambda (link description format _plist)
+ (elpher-org-export-link link description format "spartan"))
+ :follow (lambda (link _arg) (elpher-org-follow-link link "spartan")))
(org-link-set-parameters
"finger"
:export (lambda (link description format _plist)
(org-link-set-parameters
"finger"
:export (lambda (link description format _plist)
@@
-2292,7
+2292,7
@@
supports the old protocol elpher, where the link is self-contained."
(if (boundp 'browse-url-default-handlers)
(add-to-list
'browse-url-default-handlers
(if (boundp 'browse-url-default-handlers)
(add-to-list
'browse-url-default-handlers
- '("^\\(gopher\\|finger\\|gemini\\)://" . elpher-browse-url-elpher))
+ '("^\\(gopher\\|finger\\|gemini\\
|spartan\\
)://" . elpher-browse-url-elpher))
;; Patch `browse-url-browser-function' for older ones. The value of
;; that variable is `browse-url-default-browser' by default, so
;; that's the function that gets advised. If the value is an alist,
;; Patch `browse-url-browser-function' for older ones. The value of
;; that variable is `browse-url-default-browser' by default, so
;; that's the function that gets advised. If the value is an alist,
@@
-2303,7
+2303,7
@@
supports the old protocol elpher, where the link is self-contained."
(lambda (url &rest _args)
"Handle gemini, gopher, and finger schemes using Elpher."
(let ((scheme (downcase (car (split-string url ":" t)))))
(lambda (url &rest _args)
"Handle gemini, gopher, and finger schemes using Elpher."
(let ((scheme (downcase (car (split-string url ":" t)))))
- (if (member scheme '("g
emini" "gopher
" "finger"))
+ (if (member scheme '("g
opher" "gemini" "spartan
" "finger"))
;; `elpher-go' always returns nil, which will stop the
;; advice chain here in a before-while
(elpher-go url)
;; `elpher-go' always returns nil, which will stop the
;; advice chain here in a before-while
(elpher-go url)
@@
-2318,13
+2318,13
@@
supports the old protocol elpher, where the link is self-contained."
;; Make mu4e aware of the gemini world
(setq mu4e~view-beginning-of-url-regexp
;; Make mu4e aware of the gemini world
(setq mu4e~view-beginning-of-url-regexp
- "\\(?:https?\\|gopher\\|finger\\|gemini\\)://\\|mailto:")
+ "\\(?:https?\\|gopher\\|finger\\|gemini\\
|spartan\\
)://\\|mailto:")
;;; eww:
;; Let elpher handle gemini, gopher links in eww buffer.
(setq eww-use-browse-url
;;; eww:
;; Let elpher handle gemini, gopher links in eww buffer.
(setq eww-use-browse-url
- "\\`mailto:\\|\\(\\`gemini\\|\\`gopher\\|\\`finger\\)://")
+ "\\`mailto:\\|\\(\\`gemini\\|\\`gopher\\|\\`finger\\
|\\`spartan\\
)://")
;;; Interactive procedures
;;; Interactive procedures