[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
w3m-view-next-page (Was: Known BUGs and TODOs)
大和です.
> ■ 既知の問題
> ...
> (4) w3m-view-next-page がない。
w3m-view-next-pageを作ってみました.
w3m-url-historyとは逆方向に履歴をためるリスト
w3m-url-yrotsihを導入しました.変数名が最悪ですが良い名前が
思いつきませんでした.
2001-03-13 Masatake YAMATO <jet@gyve.org>
* w3m.el (w3m-url-yrotsih): New variable.
(w3m-view-previous-page): Set w3m-url-yrotsih.
Use while/cdr instead of nthcdr.
(w3m-view-next-page): New function.
(w3m-mode-map): Bind w3m-view-next-page.
(w3m-mode): Added w3m-view-next-page and w3m-view-parent-page
to the function document.
(w3m-reload-this-page): Guard w3m-url-yrotsih from resetting.
(w3m-exec): Reset yrotsih.
Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.101
diff -u -r1.101 w3m.el
--- w3m.el 2001/03/13 06:15:05 1.101
+++ w3m.el 2001/03/13 09:34:49
@@ -655,9 +655,11 @@
(defvar w3m-current-title nil "Title of this buffer.")
(defvar w3m-current-forms nil "Forms of this buffer.")
(defvar w3m-url-history nil "History of URL.")
+(defvar w3m-url-yrotsih nil "FIXME: Sample of wrong symbol name.")
(make-variable-buffer-local 'w3m-current-url)
(make-variable-buffer-local 'w3m-current-title)
(make-variable-buffer-local 'w3m-url-history)
+(make-variable-buffer-local 'w3m-url-yrotsih)
(defvar w3m-verbose t "Flag variable to control messages.")
@@ -2067,6 +2069,8 @@
(setq w3m-url-history (cons url w3m-url-history))
(setq-default w3m-url-history
(cons url (default-value 'w3m-url-history)))
+ (setq w3m-url-yrotsih nil)
+ (setq-default w3m-url-yrotsih nil)
(delete-region (point-min) (point-max))
(insert-buffer w3m-work-buffer-name)
(if (string= "text/html" type)
@@ -2080,6 +2084,8 @@
(setq w3m-url-history (cons url w3m-url-history))
(setq-default w3m-url-history
(cons url (default-value 'w3m-url-history)))
+ (setq w3m-url-yrotsih nil)
+ (setq-default w3m-url-yrotsih nil)
(delete-region (point-min) (point-max))
(insert (file-name-nondirectory url))
(set-text-properties (point-min)(point-max)
@@ -2132,12 +2138,32 @@
(unless arg (setq arg 1))
(let ((url (nth arg w3m-url-history)))
(when url
- (let (w3m-url-history) (w3m-goto-url url))
+ (let (w3m-url-history w3m-url-yrotsih)
+ (w3m-goto-url url))
;; restore last position
(w3m-arrived-restore-position url)
- (setq w3m-url-history
- (nthcdr arg w3m-url-history)))))
+ (while (< 0 arg)
+ (setq w3m-url-yrotsih
+ (cons (car w3m-url-history) w3m-url-yrotsih)
+ w3m-url-history (cdr w3m-url-history)
+ arg (1- arg))))))
+(defun w3m-view-next-page (&optional arg)
+ (interactive "p")
+ (unless arg (setq arg 1))
+ (setq arg (1- arg))
+ (let ((url (nth arg w3m-url-yrotsih)))
+ (when url
+ (let (w3m-url-history w3m-url-yrotsih)
+ (w3m-goto-url url))
+ ;; restore last position
+ (w3m-arrived-restore-position url)
+ (while (< -1 arg)
+ (setq w3m-url-history
+ (cons (car w3m-url-yrotsih) w3m-url-history)
+ w3m-url-yrotsih (cdr w3m-url-yrotsih)
+ arg (1- arg))))))
+
(defun w3m-view-previous-point ()
(interactive)
(w3m-arrived-restore-position w3m-current-url))
@@ -2408,6 +2434,7 @@
(define-key map "\C-c\C-b" 'w3m-view-previous-point)
(define-key map [left] 'w3m-view-previous-page)
(define-key map "B" 'w3m-view-previous-page)
+ (define-key map "N" 'w3m-view-next-page)
(define-key map "^" 'w3m-view-parent-page)
(define-key map "d" 'w3m-download-this-url)
(define-key map "u" 'w3m-print-this-url)
@@ -2473,6 +2500,8 @@
\\[w3m-next-anchor] Jump to next anchor.
\\[w3m-previous-anchor] Jump to previous anchor.
\\[w3m-view-previous-page] Back to previous page.
+\\[w3m-view-next-page] Forward to next page.
+\\[w3m-view-parent-page] Forward to next page.
\\[w3m-download-this-url] Download this url.
\\[w3m-print-this-url] Print this url.
@@ -2585,7 +2614,8 @@
(defun w3m-reload-this-page (&optional arg)
"Reload current page without cache."
(interactive "P")
- (let ((w3m-display-inline-image (if arg t w3m-display-inline-image)))
+ (let ((w3m-display-inline-image (if arg t w3m-display-inline-image))
+ w3m-url-yrotsih)
(setq w3m-url-history (cdr w3m-url-history))
(w3m-goto-url w3m-current-url 'reload)))