;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. #@36 Version number of `web-search.el'. (defconst web-search-version "0.1.2" (#$ . 87)) (byte-code "\301\302!\210\303\304\305\306\307\310%\210\311\300\312\313\314DD\315\307\304\316\317&\210\311\320\312\313\321DD\322\307\304\316\323\324\"\325B\262&\207" [web-search-providers require cl-lib custom-declare-group web-search nil "Open a web search." :group tools custom-declare-variable funcall function #[0 "\300\207" [(("500px" "https://500px.com/search?q=%s&type=photos" "Photos") ("Arch Package" "https://www.archlinux.org/packages/?q=%s" "Arch Linux") ("Arch Wiki" "https://wiki.archlinux.org/index.php?search=%s" "Arch Linux") ("Bandcamp" "https://bandcamp.com/search?q=%s" "Music") ("Bing" "https://www.bing.com/search?q=%s" "Search") ("Debian Manpages" "https://manpages.debian.org/jump?q=%s") ("Debian Package" "https://packages.debian.org/search?keywords=%s&searchon=names&suite=stable§ion=all") ("DuckDuckGo" "https://duckduckgo.com/lite/?q=%s" "Search") ("Gist" "https://gist.github.com/search?q=%s" "Code") ("GitHub" "https://github.com/search?q=%s" "Code") ("Google" "https://www.google.com/search?q=%s" "Search") ("Hacker News" "https://hn.algolia.com/?q=%s" "Tech-News") ("MacPorts" "https://www.macports.org/ports.php?by=name&substr=%s") ("Pinterest" "https://www.pinterest.com/search/pins/?q=%s") ("Reddit" web-search-providers--format-url:reddit) ("RubyGems" "https://rubygems.org/search?query=%s") ("Soundcloud" "https://soundcloud.com/search?q=%s" "Music") ("Stack Overflow" "https://stackoverflow.com/search?q=%s" "Code") ("Wikipedia" "https://en.wikipedia.org/wiki/Special:Search?search=%s" "Education") ("YouTube" "https://www.youtube.com/results?search_query=%s") ("Zhihu" "https://www.zhihu.com/search?type=content&q=%s" "Forums"))] 1] "Search providers, a list of (NAME URL TAG1 TAG2 ...).\nURL can be either String or Function.\nIf it is a string, it must contains a %s token for the query string.\nIf it is a function, it must takes a argument which is the query string." :type sexp web-search-default-provider #[0 "\300\207" [#1="Google"] 1 #1#] "Default search provider." mapcar #[257 "\300\301@\302@\257\207" [string :tag :value] 6 "\n\n(fn P)"] choice] 10) #@193 Build search URL base on QUERY. If QUERY looks like "/r/subreddit query", treat as subreddit and do restrict search on the subreddit. Otherwise, treat it as regular reddit search (fn QUERY) (defalias 'web-search-providers--format-url:reddit #[257 "\300\301\"\203\302\303\"\302\304\"\305\306\307!#\207\305\310\307!\"\207" [string-match "^/r/\\([^ ]*\\) \\(.*\\)" match-string 1 2 format "https://www.reddit.com/r/%s/search?q=%s&restrict_sr=on" url-hexify-string "https://www.reddit.com/search?q=%s"] 8 (#$ . 2288)]) (defalias 'web-search--tags #[0 "\301\302\211:\203@\262\303AA!\244\262A\262\202\211\237\266\203!\207" [web-search-providers delete-dups nil reverse] 6]) #@62 Return a list of providers which is tagged by TAG. (fn TAG) (defalias 'web-search--find-providers #[257 "\301\211:\203$@\262\227\302\303AA\"\235\203B\262A\262\202\211\237\266\203\206/\304\305\"\207" [web-search-providers nil mapcar downcase error "Unknown tag '%s'"] 8 (#$ . 2985)]) #@188 Format a URL for search QUERY on PROVIDER. PROVIDER can be a string (the name of one provider) or a list (one provider, i.e., one element of `web-search-providers'). (fn QUERY PROVIDER) (defalias 'web-search--format-url #[514 "\211<\203 \211A@\202?\211;\205?\301\211\211:\203=@\262\227@\227\230\2032A@\262\301\211\262\2023\302\203=A\262\202\266\203\211;\203K\303\304!\"\207\305!\203U\211!\207\306\307\"\207" [web-search-providers nil t format url-hexify-string functionp error "Unknown provider '%S'"] 8 (#$ . 3294)]) #@24 (fn QUERY PROVIDERS) (defalias 'web-search--format-urls #[514 "\300\301\302\"\"\207" [mapcar make-closure #[257 "\301\300\"\207" [V0 web-search--format-url] 4 "\n\n(fn PROVIDER)"]] 6 (#$ . 3846)]) #@235 Search for QUERY on website(s). Without prefix argument, search on `web-search-default-provider'. One C-u, choose a provider. Two C-u, choose a tag (notes that a tag can match multiple providers). (fn QUERY &optional PROVIDERS TAG) (defalias 'web-search #[769 "\211\203\n\301!\206\206C\262\302\303\304\"\"\207" [web-search-default-provider web-search--find-providers mapc browse-url web-search--format-urls] 8 (#$ . 4055) (byte-code "\304\232\203 \305\306\"\307\310 \311\307\311\211&)C\266\202\202! C\312\232\205,\310\313\314 \"\315 \203:\316\317 \320 \"\202<\321 \305\322\203P\323\324\325\326\327!\"\330#\202V\323\324\330#\"\331\"\266\202\211E\207" [current-prefix-arg web-search-default-provider completion-ignore-case web-search-providers (4) format "Provider (default %s): " t completing-read nil (16) "Tag: " web-search--tags use-region-p buffer-substring-no-properties region-beginning region-end current-word "Search %s: " mapconcat identity mapcar car web-search--find-providers ", " read-string] 11)]) (defalias 'web-search-batch-print-usage #[0 "\301\302\303\304\305!\206\n\306#!\207" [web-search-default-provider princ format "Web search from the terminal.\n\nUsage: %s [options]\n\nOptions:\n -h, --help display help\n -l, --list-providers list supported providers\n --list-tags list available tags\n -o, --output output only mode\n -p, --provider string search provider (default \"%s\")\n -t, --tag string search tag\n -v, --verbose verbose mode\n --version display version\n --completion display completion code for Bash/Zsh\n" getenv "WEB_SEARCH_PROGRAM_NAME" "emacs -Q --batch -l web-search.el -f web-search-batch --"] 5]) (defalias 'web-search-batch #[0 "\204\306\307!\203\307\202\310\311!\210\312\313 \"\314 \235\204#\315 \235\203*\316 \210\317\320!\210\321 \235\203<\322\323\324\n #!\210\317\320!\210\325 \235\204H\326 \235\203Q\327\330\f\"\210\317\320!\210\331 \235\203d\327\332\333\334 \335\"\"\210\317\320!\210\336\211\211\211\211\211\211\211 \211A\242\211\262 \203\261\337\267\202\236\340\262\202l\340\262\202l \211A\242\262\202l \211A\242\262\202l\203\252\341 Q\202\254\262\202l\204\274\316 \210\317\342!\210\203\306\343!\206\321\203\317C\206\321 C\262\344\"\262\204\342\203\347\327\345\"\210?\205\360\327\346\"\207" [noninteractive argv web-search-version emacs-version web-search-providers web-search-default-provider fboundp user-error error "`web-search-batch' can only be called in batch mode" delete "--" "-h" "--help" web-search-batch-print-usage kill-emacs 0 "--version" princ format "web-search.el %s\nGNU Emacs %s\n" "-l" "--list-providers" mapc #[257 "\300\301\302@\"!\207" [princ format "%s\n"] 5 "\n\n(fn P)"] "--list-tags" #[257 "\300\301\302\"!\207" [princ format "%s\n"] 5 "\n\n(fn S)"] sort web-search--tags string< nil #s(hash-table size 8 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data ("--verbose" 126 "-v" 126 "--output" 132 "-o" 132 "--provider" 138 "-p" 138 "--tag" 148 "-t" 148)) t " " 1 web-search--find-providers web-search--format-urls #[257 "\300\301\302\"!\207" [princ format "%s\n"] 5 "\n\n(fn URL)"] #[257 "\300!\301!\205\f\302!\207" [browse-url processp accept-process-output] 4 "\n\n(fn URL)"]] 11]) (provide 'web-search)