[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ;;; anything.el --- open anything
From: |
address@hidden |
Subject: |
Re: ;;; anything.el --- open anything |
Date: |
Fri, 24 Aug 2007 23:52:02 -0700 |
User-agent: |
G2/1.0 |
I use Wikipedia a lot, so I made a source similar to Google Suggest
for Wikipedia titles. Here it is if someone's interested:
(defvar anything-wikipedia-title-lookup-program nil
"The program is called with one argument and it should return
matching titles from Wikipedia.")
(setq anything-sources
'(((name . "Wikipedia Titles")
(candidates
. (lambda ()
(start-process "wp-process" nil
anything-wikipedia-title-lookup-program
(replace-regexp-in-string " " "_" anything-
pattern))))
(candidate-transformer
. (lambda (candidates)
(mapcar (lambda (candidate)
(replace-regexp-in-string "_" " " candidate))
candidates)))
(action . (("Look up Title" .
(lambda (candidate)
(browse-url (concat "http://en.wikipedia.org/wiki/"
(url-hexify-string
candidate)))))))
(requires-pattern . 3)
(delayed))))
In order to get useful results exact title matches should be listed
first and substring matches afterwards. Currently, anything.el cannot
invoke two processes for the same source, one after the other, that's
why you need to supply an external program for the lookup.
It can be a simple shell script:
grep -i "^$1$" <title file>
grep -i "$1" <title file>
or a Windows batch file:
@echo off
grep.exe -i "^%1$" <title file>
grep.exe -i "%1" <title file>
The current title file can be downloaded from here:
http://download.wikimedia.org/enwiki/latest/enwiki-latest-all-titles-in-ns0.gz
Enjoy.
- Re: ;;; anything.el --- open anything, (continued)
- Re: ;;; anything.el --- open anything, Bill Clementson, 2007/08/23
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/08/24
- Re: ;;; anything.el --- open anything, Bill Clementson, 2007/08/24
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/08/24
- Re: ;;; anything.el --- open anything, Bill Clementson, 2007/08/24
- Re: ;;; anything.el --- open anything, Mark Plaksin, 2007/08/24
- Re: ;;; anything.el --- open anything, Tassilo Horn, 2007/08/24
- Re: ;;; anything.el --- open anything, Mark Plaksin, 2007/08/24
- Message not available
- Re: ;;; anything.el --- open anything, address@hidden, 2007/08/24
- Re: ;;; anything.el --- open anything, Bill Clementson, 2007/08/24
- Re: ;;; anything.el --- open anything,
address@hidden <=
- Re: ;;; anything.el --- open anything, Leo, 2007/08/29
- Message not available
- Re: ;;; anything.el --- open anything, address@hidden, 2007/08/19
Re: ;;; anything.el --- open anything, Michaƫl Cadilhac, 2007/08/31