[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] w3m-lnum add highlight
- From: Andrey Kotlarski <m00naticus@xxxxxxxxx>
- Date: Mon, 06 Sep 2010 17:01:51 +0300
- X-ml-name: emacs-w3m
- X-mail-count: 11333
- References: <b4mpqz1s2fg.fsf@xxxxxxx> <87k4p88gbq.fsf@xxxxxxxxx> <b4meifggiel.fsf@xxxxxxx> <878w5nv8fn.fsf@xxxxxxxxx> <b4m1vbeflye.fsf@xxxxxxx> <20100708.200709.142440111.1BF46D@xxxxxxxxxxx> <b4mwrt689f2.fsf@xxxxxxx> <87d3uxix4z.fsf@xxxxxxxxx> <b4mmxu1chti.fsf@xxxxxxx> <87zkxzbbzz.fsf@xxxxxxxxx> <b4m39vp2mkw.fsf@xxxxxxx> <87hbk3ppib.fsf@xxxxxxxxx> <b4moceak9v3.fsf@xxxxxxx> <87mxtasc90.fsf@xxxxxxxxx> <b4meiemcuja.fsf@xxxxxxx>
The following message is a courtesy copy of an article
that has been posted to gmane.emacs.w3m as well.
Hello again,
I made a few little changes. Sometimes when numbering appears, desired
link number may run out of sight. So I added keys to scroll page while
entering link number. Again, have a look if this is ok with XEmacs
too. Here's a ChangeLog:
2010-09-06 Andrey Kotlarski <m00naticus@xxxxxxxxx>
* w3m-lnum.el (w3m-linknum-remove-overlays): Simplified.
(w3m-link-numbering-mode): Using `or' instead of `unless'.
(w3m-read-int-interactive): Added ability to scroll page while
selecting number.
Here's the diff:
--- w3m-lnum-cvs.el 2010-07-31 01:57:15.727342157 +0300
+++ w3m-lnum.el 2010-08-07 19:52:45.668371247 +0300
@@ -125,19 +125,12 @@
(push (cons 'w3m-link-numbering-mode w3m-link-numbering-mode-map)
minor-mode-map-alist))
-(defun w3m-linknum-remove-overlays (&optional arg)
- "Remove numbering and match overlays.
-With ARG remove only temporary match"
- (if arg
- (catch 'done
- (dolist (overlay (overlays-in (point-min) (point-max)))
- (when (overlay-get overlay 'w3m-linknum-match)
- (delete-overlay overlay)
- (throw 'done nil))))
- (dolist (overlay (overlays-in (point-min) (point-max)))
- (if (or (overlay-get overlay 'w3m-link-numbering-overlay)
- (overlay-get overlay 'w3m-linknum-match))
- (delete-overlay overlay)))))
+(defun w3m-linknum-remove-overlays ()
+ "Remove numbering and match overlays."
+ (dolist (overlay (overlays-in (point-min) (point-max)))
+ (if (or (overlay-get overlay 'w3m-link-numbering-overlay)
+ (overlay-get overlay 'w3m-linknum-match))
+ (delete-overlay overlay))))
;;;###autoload
(defun w3m-link-numbering-mode (&optional arg)
@@ -147,16 +140,16 @@
(interactive "P")
(let ((w3m-linknum-status w3m-link-numbering-mode))
;; find current numbering status of w3m buffers
- (unless (eq major-mode 'w3m-mode)
- (save-current-buffer
- (setq w3m-linknum-status
- (catch 'found-w3m
- (dolist (buf (buffer-list))
- (set-buffer buf)
- (if (eq major-mode 'w3m-mode)
- (throw 'found-w3m w3m-link-numbering-mode)))))))
- (setq arg (not (if arg
- (zerop arg)
+ (or (eq major-mode 'w3m-mode)
+ (save-current-buffer
+ (setq w3m-linknum-status
+ (catch 'found-w3m
+ (dolist (buf (buffer-list))
+ (set-buffer buf)
+ (if (eq major-mode 'w3m-mode)
+ (throw 'found-w3m
+ w3m-link-numbering-mode)))))))
+ (setq arg (not (if arg (zerop arg)
w3m-linknum-status)))
(unless (eq arg w3m-linknum-status) ; if change of mode status
(if arg
@@ -234,6 +227,11 @@
(setq num (/ num 10)
temp-prompt (format "%s%d" prompt num))
(funcall fun num))
+ ((eq ch 32) (w3m-scroll-up-or-next-url nil)) ;space
+ ((eq ch 'delete) ;delete
+ (w3m-scroll-down-or-previous-url nil))
+ ((eq ch 60) (w3m-scroll-right nil)) ;<
+ ((eq ch 62) (w3m-scroll-left nil)) ;>
((and (w3m-static-if (featurep 'xemacs)
(characterp ch)
(numberp ch))