(defalias 'elpher-color-filter-apply
(if (fboundp 'xterm-color-filter)
(lambda (s)
- (let ((xterm-color-render nil))
+ (let ((_xterm-color-render nil))
(xterm-color-filter s)))
'ansi-color-filter-apply)
"A function to filter out ANSI escape sequences.")
+
(defalias 'elpher-color-apply
(if (fboundp 'xterm-color-filter)
'xterm-color-filter
(setq-local elpher-current-page page)
(let* ((address (elpher-page-address page))
(type (elpher-address-type address))
- (type-record (cdr (assoc type elpher-type-map)))
- (page-links nil))
+ (type-record (cdr (assoc type elpher-type-map))))
(if type-record
(funcall (car type-record)
(if renderer
If non-nil, FORCE-IPV4 causes the network connection to be made over
ipv4 only. (The default behaviour when this is not set depends on
-the host operating system and the local network capabilities."
+the host operating system and the local network capabilities.)"
(if (and use-tls (not (gnutls-available-p)))
(error "Use of TLS requires Emacs to be compiled with GNU TLS support")
(unless (< (elpher-address-port address) 65536)
address
(elpher-address-to-url address))))))))
-(defvar elpher--link-number-counter 0)
+(defvar elpher--link-number-counter 0
+ "Used to number links on elpher pages.")
(defun elpher-reset-link-number-counter ()
+ "Reset the link number counter."
(setq-local elpher--link-number-counter 0))
(defun elpher--insert-text-button (label &rest properties)
- "Inserts a potentially-numbered button into the current buffer.
+ "Insert a potentially-numbered button into the current buffer.
The text for the button is provided by LABEL, while the button
properties in PROPERTIES are as per `insert-text-button'."
(error "Gemini server response unknown: %s %s"
response-code response-meta))))))
-(unless (fboundp 'read-answer)
- (defun read-answer (question answers)
- "Backfill for the new read-answer code."
- (completing-read question (mapcar 'identity answers))))
+(defun elpher--read-answer-polyfill (question answers)
+ "Polyfill for `read-answer' in Emacs 26.1.
+QUESTION is a string containing a question, and ANSWERS
+is a list of possible answers."
+ (completing-read question (mapcar 'identity answers)))
+
+(if (fboundp 'read-answer)
+ (defalias 'elpher-read-answer 'read-answer)
+ (defalias 'elpher-read-answer 'elpher--read-answer-polyfill))
(defun elpher-choose-client-certificate ()
"Prompt for a client certificate to use to establish a TLS connection."
" - c/C: copy URL representation of item under cursor or current page\n"
" - a/A: bookmark the item under cursor or current page\n"
" - B: list all bookmarks\n"
- " - h/H: show history of current buffer or for all buffers\n"
+ " - s/S: show history of current buffer or for all buffers\n"
" - r: redraw current page (using cached contents if available)\n"
" - R: reload current page (regenerates cache)\n"
- " - S: set character coding system for gopher (default is to autodetect)\n"
+ " - !: set character coding system for gopher (default is to autodetect)\n"
" - T: toggle TLS gopher mode\n"
" - F: forget/discard current TLS client certificate\n"
" - .: display the raw server response for the current page\n"
(defun elpher-show-history (pages)
"Show all PAGES in the Elpher buffer."
(elpher-with-clean-buffer
+ (insert "---- Visited link history ----\n\n")
(if pages
(dolist (page pages)
(when page
(let ((display-string (elpher-page-display-string page))
(address (elpher-page-address page)))
(elpher-insert-index-record display-string address))))
- (insert "No history items found.\n"))))
+ (insert "No history items found.\n"))
+ (insert "\n----------------------------")))
+
;;; Bookmarks
(let ((b (cdr (elt link-map (- n 1)))))
(goto-char (button-start b))
(button-activate b))
- (error "No link with that number.")))))
+ (error "No link with that number")))))
(defun elpher-root-dir ()
"Visit root of current server."
(define-key map (kbd "O") 'elpher-root-dir)
(define-key map (kbd "g") 'elpher-go)
(define-key map (kbd "o") 'elpher-go-current)
- (define-key map (kbd "h") 'elpher-history)
- (define-key map (kbd "H") 'elpher-history-all)
+ (define-key map (kbd "s") 'elpher-history)
+ (define-key map (kbd "S") 'elpher-history-all)
(define-key map (kbd "r") 'elpher-redraw)
(define-key map (kbd "R") 'elpher-reload)
(define-key map (kbd "T") 'elpher-toggle-tls)
(define-key map (kbd "a") 'elpher-set-bookmark-no-overwrite)
(define-key map (kbd "A") 'bookmark-set-no-overwrite)
(define-key map (kbd "B") 'bookmark-bmenu-list)
- (define-key map (kbd "S") 'elpher-set-gopher-coding-system)
+ (define-key map (kbd "!") 'elpher-set-gopher-coding-system)
(define-key map (kbd "F") 'elpher-forget-current-certificate)
(when (fboundp 'evil-define-key*)
(evil-define-key*
(kbd "a") 'elpher-set-bookmark-no-overwrite
(kbd "A") 'bookmark-set-no-overwrite
(kbd "B") 'bookmark-bmenu-list
- (kbd "S") 'elpher-set-gopher-coding-system
+ (kbd "!") 'elpher-set-gopher-coding-system
(kbd "F") 'elpher-forget-current-certificate))
map)
"Keymap for gopher client.")