;; Full instructions can be found in the Elpher info manual.
;; Elpher is under active development. Any suggestions for
-;; improvements are welcome, and can be made on the official
-;; project page, gopher://thelambdalab.xyz/elpher, or via the
+;; improvements are welcome, and can be made on the official project
+;; page, gopher://thelambdalab.xyz/1/projects/elpher, or via the
;; project mailing list at https://lists.sr.ht/~michel-slm/elpher.
;;; Code:
;;
(eval-when-compile
- (defvar bookmark-make-record-function)
+ (declare-function ansi-color-filter-apply "ansi-color")
+ (declare-function ansi-color-apply "ansi-color")
(declare-function bookmark-store "bookmark")
(declare-function org-link-store-props "ol")
(declare-function org-link-set-parameters "ol")
- (defvar thing-at-point-uri-schemes)
- (defvar mu4e~view-beginning-of-url-regexp))
+ (defvar ansi-color-context)
+ (defvar bookmark-make-record-function)
+ (defvar mu4e~view-beginning-of-url-regexp)
+ (defvar thing-at-point-uri-schemes))
;;; Customization group
(if (timerp elpher-network-timer)
(cancel-timer elpher-network-timer)))
+(defun elpher-make-network-timer (thunk)
+ "Creates a timer to run the THUNK after `elpher-connection-timeout' seconds.
+This is just a wraper around `run-at-time' which additionally sets the
+buffer-local variable `elpher-network-timer' to allow
+`elpher-process-cleanup' to also clear the timer."
+ (let ((timer (run-at-time elpher-connection-timeout nil thunk)))
+ (setq-local elpher-network-timer timer)
+ timer))
+
(defun elpher-get-host-response (address default-port query-string response-processor
&optional use-tls force-ipv4)
"Generic function for retrieving data from ADDRESS.
:hostname host
:keylist
(elpher-get-current-keylist address)))
- (proc (if socks (socks-open-network-stream "elpher-process" nil host service)
- (make-network-process :name "elpher-process"
- :host host
- :family (and force-ipv4 'ipv4)
- :service service
- :buffer nil
- :nowait t
- :tls-parameters
- (and use-tls
- (cons 'gnutls-x509pki
- (apply #'gnutls-boot-parameters
- gnutls-params))))))
- (timer (run-at-time elpher-connection-timeout nil
+ (timer (elpher-make-network-timer
(lambda ()
(elpher-process-cleanup)
(cond
response-processor
nil force-ipv4))
(t
- (elpher-network-error address "Connection time-out.")))))))
+ (elpher-network-error address "Connection time-out."))))))
+ (proc (if socks (socks-open-network-stream "elpher-process" nil host service)
+ (make-network-process :name "elpher-process"
+ :host host
+ :family (and force-ipv4 'ipv4)
+ :service service
+ :buffer nil
+ :nowait t
+ :tls-parameters
+ (and use-tls
+ (cons 'gnutls-x509pki
+ (apply #'gnutls-boot-parameters
+ gnutls-params)))))))
(setq elpher-network-timer timer)
(set-process-coding-system proc 'binary 'binary)
(set-process-query-on-exit-flag proc nil)
(if use-tls (apply #'gnutls-negotiate :process proc gnutls-params))
(funcall (process-sentinel proc) proc "open\n")))
(error
+ (elpher-process-cleanup)
(error "Error initiating connection to server")))))
"(Bookmarks from legacy elpher-bookmarks files will be automatically imported.)\n"
'face 'shadow))
(insert "\n"
- "For Elpher release news or to leave feedback, visit:\n")
+ "The gopher home of the Elpher project is here:\n")
(elpher-insert-index-record "The Elpher Project Page"
(elpher-make-gopher-address ?1
"/projects/elpher/"
"thelambdalab.xyz"
70))
- (insert "\n"
- "** Refer to the ")
(let ((help-string "RET,mouse-1: Open Elpher info manual (if available)"))
- (insert-text-button "Elpher info manual"
+ (insert "\n"
+ "The following info documentation is available:\n"
+ " - ")
+ (insert-text-button "Elpher Manual"
'face 'link
'action (lambda (_)
(interactive)
(info "(elpher)"))
'follow-link t
- 'help-echo help-string))
- (insert " for the full documentation. **\n")
+ 'help-echo help-string)
+ (insert "\n - ")
+ (insert-text-button "Changes introduced by the latest release"
+ 'face 'link
+ 'action (lambda (_)
+ (interactive)
+ (info "(elpher)News"))
+ 'follow-link t
+ 'help-echo help-string))
+ (insert "\n")
(insert (propertize
- (concat " (This should be available if you have installed Elpher using\n"
- " MELPA. Otherwise you will have to install the manual yourself.)\n")
+ (concat " (These documents should be available if you have installed Elpher \n"
+ " using MELPA. Otherwise you may have to install the manual yourself.)\n")
'face 'shadow))
(elpher-restore-pos)))