[emacs-w3m:13526] w3m--get-page-anchors()
Hideyuki SHIRAI (白井秀行) <[email protected]>
| Newsgroups | gmane.emacs.w3m |
|---|---|
| Organization | Resident at Meadowy farm. |
| Message-ID | <[email protected]> |
##
w3m--get-page-anchors()
(1) w3m-anchor-list-filter-alist URL
"\\`cite_.*[0-9]\\'" anchor
wikipedia (cite_note_*)
(cite_ref_*)
wikipedia w3m-anchor-list-filter-alist
nil :-)
(2) (setq w3m-anchor-list-filter-alist nil) note,
references anchor
<https://en.wikipedia.org/wiki/W3m>
==============================================================
Operating OS/2,^[3]^[4] Unix & Unix-like (Solaris, SunOS, HP-UX, Linux, FreeBSD and EWS-UX (EWS-4800),^[5]
return
[5] return
4. ^ ^a ^b Watson, Dave (September 2001). "Text-Mode Web Browsers for OS/2". The Southern California OS/2
User Group. Retrieved 16 August 2010.
5. ^ w3m manual page incorrect jump
correct position
==============================================================
(emacs-w3m correct
)
w3m-name-anchor, w3m-name-anchor2 property
emacs-w3m anchor search
1st step: w3m-name-anchor anchor
2nd step: w3m-name-anchor anchor
w3m-name-anchor2 anchor
( "not found")
w3m-name-anchor, w3m-name-anchor2
point sort point
w3m--get-page-anchors()
## sort
(defun w3m--get-page-anchors (&optional sub-sets sort-method)
"Return list of page anchors, sorted by SORT-METHOD.
SUB-SETS defines from where to draw anchor information. It defaults to
`all', but may also be `w3m-name-anchor' or `w3m-name-anchor2'.
SORT-METHOD defaults to `position', but may also be `name' or a function
that can be passed to `sort'."
(let ((pos (point-min))
anchor-list anchor2)
;; NOTE: w3m-name-anchor aggregates data from `w3m -half-dump'.
(unless (eq sub-sets 'w3m-name-anchor2)
(while (setq pos (next-single-property-change pos 'w3m-name-anchor))
(push (cons (car (get-text-property pos 'w3m-name-anchor)) pos)
anchor-list))
(setq pos (point-min)))
(unless (eq sub-sets 'w3m-name-anchor)
(while (setq pos (next-single-property-change pos 'w3m-name-anchor2))
(setq anchor2 (car (get-text-property pos 'w3m-name-anchor2)))
(unless (assoc anchor2 anchor-list)
(push (cons anchor2 pos) anchor-list))))
(setq anchor-list (w3m--filter-page-anchors anchor-list))
(sort anchor-list
(cond
((or (not sort-method) (eq sort-method 'position))
(lambda (x y) (< (cdr x) (cdr y))))
((eq sort-method 'name)
(lambda (x y) (string-lessp (downcase (car x)) (downcase (car y)))))
((functionp sort-method) sort-method)
(t (error "Invalid arg: SORT-METHOD"))))))
## (^_^)