The Lambda Lab
/
projects
/
elpher.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1ba5bfa
)
New simplified history implementation in place.
author
Tim Vaughan
<tgvaughan@gmail.com>
Sun, 10 Nov 2019 22:54:24 +0000
(23:54 +0100)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Sun, 10 Nov 2019 22:54:39 +0000
(23:54 +0100)
elpher.el
patch
|
blob
|
history
diff --git
a/elpher.el
b/elpher.el
index
3a11487
..
c3e311f
100644
(file)
--- a/
elpher.el
+++ b/
elpher.el
@@
-181,6
+181,7
@@
allows switching from an encrypted channel back to plain text without user input
"Specifies the number of seconds to wait for a network connection to time out."
:type '(integer))
"Specifies the number of seconds to wait for a network connection to time out."
:type '(integer))
+
;;; Model
;;
;;; Model
;;
@@
-308,8
+309,6
@@
If no address is defined, returns 0. (This is for compatibility with the URL li
""
(substring (url-filename address) 2)))
""
(substring (url-filename address) 2)))
-;; Page
-
;; Cache
;; Cache
@@
-332,18
+331,18
@@
If no address is defined, returns 0. (This is for compatibility with the URL li
"Set the cursor position cache for ADDRESS to POS."
(puthash address pos elpher-pos-cache))
"Set the cursor position cache for ADDRESS to POS."
(puthash address pos elpher-pos-cache))
+
;; Page
;; Page
-(defun elpher-make-page (
address display-string
)
- (list
address display-string
))
+(defun elpher-make-page (
display-string address
)
+ (list
display-string address
))
-(defun elpher-page-
address
(page)
+(defun elpher-page-
display-string
(page)
(elt page 0))
(elt page 0))
-(defun elpher-page-
display-string
(page)
+(defun elpher-page-
address
(page)
(elt page 1))
(elt page 1))
-
(defvar elpher-current-page nil)
(defvar elpher-history nil)
(defvar elpher-current-page nil)
(defvar elpher-history nil)
@@
-353,8
+352,10
@@
Additionally, push PAGE onto the stack of previously-visited pages,
unless NO-HISTORY is non-nil."
(elpher-save-pos)
(elpher-process-cleanup)
unless NO-HISTORY is non-nil."
(elpher-save-pos)
(elpher-process-cleanup)
- (unless no-history
- (push page elpher-history))
+ (unless (or no-history
+ (equal (elpher-page-address elpher-current-page)
+ (elpher-page-address page)))
+ (push elpher-current-page elpher-history))
(setq elpher-current-page page)
(let* ((address (elpher-page-address page))
(type (elpher-address-type address))
(setq elpher-current-page page)
(let* ((address (elpher-page-address page))
(type (elpher-address-type address))
@@
-376,8
+377,9
@@
unless NO-HISTORY is non-nil."
(defun elpher-visit-previous-page ()
"Visit the previous page in the history."
(let ((previous-page (pop elpher-history)))
(defun elpher-visit-previous-page ()
"Visit the previous page in the history."
(let ((previous-page (pop elpher-history)))
- (when previous-page
- (elpher-visit-page previous-page nil t))))
+ (if previous-page
+ (elpher-visit-page previous-page nil t)
+ (error "No previous page."))))
(defun elpher-reload-current-page ()
"Reload the current page, discarding any existing cached content."
(defun elpher-reload-current-page ()
"Reload the current page, discarding any existing cached content."
@@
-1255,16
+1257,12
@@
If ADDRESS is already bookmarked, update the label only."
(defun elpher-redraw ()
"Redraw current page."
(interactive)
(defun elpher-redraw ()
"Redraw current page."
(interactive)
- (if elpher-current-page
- (elpher-visit-page elpher-current-page)
- (message "No current site.")))
+ (elpher-visit-page elpher-current-page))
(defun elpher-reload ()
"Reload current page."
(interactive)
(defun elpher-reload ()
"Reload current page."
(interactive)
- (if elpher-current-page
- (elpher-reload-current-page)
- (message "No current site.")))
+ (elpher-reload-current-page))
(defun elpher-toggle-tls ()
"Toggle TLS encryption mode for gopher."
(defun elpher-toggle-tls ()
"Toggle TLS encryption mode for gopher."
@@
-1280,19
+1278,15
@@
If ADDRESS is already bookmarked, update the label only."
(defun elpher-view-raw ()
"View raw server response for current page."
(interactive)
(defun elpher-view-raw ()
"View raw server response for current page."
(interactive)
- (if elpher-current-page
- (if (elpher-address-special-p (elpher-page-address elpher-current-page))
- (error "This page was not generated by a server")
- (elpher-visit-page elpher-current-page
- #'elpher-render-raw))
- (message "No current site.")))
+ (if (elpher-address-special-p (elpher-page-address elpher-current-page))
+ (error "This page was not generated by a server")
+ (elpher-visit-page elpher-current-page
+ #'elpher-render-raw)))
(defun elpher-back ()
"Go to previous site."
(interactive)
(defun elpher-back ()
"Go to previous site."
(interactive)
- (if elpher-history
- (error "No previous site")
- (elpher-visit-previous-page)))
+ (elpher-visit-previous-page))
(defun elpher-download ()
"Download the link at point."
(defun elpher-download ()
"Download the link at point."