[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] w3m-lnum add highlight
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Mon, 05 Sep 2011 08:52:22 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 11642
- 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> <87eid76kds.fsf@xxxxxxxxx> <b4mtym2zbv9.fsf@xxxxxxx> <87r5gi9owm.fsf@xxxxxxxxx> <b4mbp7keygd.fsf@xxxxxxx> <87k49o8ru3.fsf@xxxxxxxxx>
In [emacs-w3m : No.11641] Andrey Kotlarski wrote:
> The following message is a courtesy copy of an article
> that has been posted to gmane.emacs.w3m as well.
Gmane doesn't work nowadays at last for the emacs-w3m list. :<
> Hello,
> long time no hear, but here comes another set of additions/improvements
> to w3m-lnum.el. Main things are:
[...]
> There are little fixes and refactoring here and there as well. I've
> been using this stuff for some weeks without issues.
[...]
Thank you very much for the patch. .That's cool!
I've installed it with some modifications to make it work for
XEmacs and old Emacsen. Here's what I did:
2011-09-04 Katsumi Yamaoka <yamaoka@xxxxxxx>
* w3m-lnum.el (w3m-link-numbering, w3m-linknum-minibuffer-prompt)
(w3m-linknum-match): Use old defface style for XEmacs.
(w3m-link-set-numbering): Replace w3m-string-match-p w/ string-match-p.
(w3m-highlight-numbered-anchor, w3m-get-match-info): Fix range passed
to overlays-in to make it work for XEmacs.
--- w3m-lnum.el~ 2011-09-04 23:37:52.953125000 +0000
+++ w3m-lnum.el 2011-09-04 23:39:38.812500000 +0000
@@ -50,30 +50,30 @@
(defface w3m-link-numbering
'((((class color) (min-colors 16) (background light))
- :foreground "gray60")
+ (:foreground "gray60"))
(((class color) (min-colors 16) (background dark))
- :foreground "gray50")
- (t :foreground "gray"))
+ (:foreground "gray50"))
+ (t (:foreground "gray")))
"Face used to highlight link numbers."
:group 'w3m-face)
;; backward-compatibility alias
(put 'w3m-link-numbering-face 'face-alias 'w3m-link-numbering)
(defface w3m-linknum-minibuffer-prompt
- '((((class color) (background light) (type tty)) :foreground "blue")
- (((class color) (background dark)) :foreground "cyan")
- (t :foreground "medium blue"))
+ '((((class color) (background light) (type tty)) (:foreground "blue"))
+ (((class color) (background dark)) (:foreground "cyan"))
+ (t (:foreground "medium blue")))
"Face for w3m linknum minibuffer prompt."
:group 'w3m-face)
(defface w3m-linknum-match
'((((class color) (background light) (type tty))
- :background "yellow" :foreground "black")
+ (:background "yellow" :foreground "black"))
(((class color) (background dark) (type tty))
- :background "blue" :foreground "white")
- (((class color) (background light)) :background "yellow1")
- (((class color) (background dark)) :background "RoyalBlue3")
- (t :background "gray"))
+ (:background "blue" :foreground "white"))
+ (((class color) (background light)) (:background "yellow1"))
+ (((class color) (background dark)) (:background "RoyalBlue3"))
+ (t (:background "gray")))
"Face used to highlight matches in `w3m-link-numbering-mode'."
:group 'w3m-face)
@@ -225,7 +225,7 @@
(context (or (car (assoc-default
w3m-current-url
w3m-link-numbering-context-alist
- 'string-match-p))
+ 'w3m-string-match-p))
0)))
(while (and pos
(setq pos (funcall next-func pos))
@@ -497,7 +497,8 @@
"Highlight specified by ARG number anchor.
Return selected anchor."
(let (newly-marked)
- (dolist (overlay (overlays-in (1- (window-start)) (window-end)))
+ (dolist (overlay (overlays-in (max (1- (window-start)) (point-min))
+ (window-end)))
(cond
((overlay-get overlay 'w3m-linknum-match)
(delete-overlay overlay))
@@ -526,7 +527,8 @@
(defmacro w3m-get-match-info (condition found-tag)
"For the first overlay matching CONDITION throw through FOUND-TAG
anchor info."
- `(dolist (overlay (overlays-in (1- (window-start)) (window-end)))
+ `(dolist (overlay (overlays-in (max (1- (window-start)) (point-min))
+ (window-end)))
(if ,condition
(let* ((pos (overlay-start overlay))
(href (w3m-anchor pos)))