;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307DD\310\311\312\313\302&\210\303\314\305\306\315DD\316\311\312\313\302&\210\303\317\305\306\320DD\321\311\322\313\302&\207" [require json helm-net custom-declare-variable helm-wikipedia-suggest-url funcall function #[0 "\300\207" [#1="https://en.wikipedia.org/w/api.php?action=opensearch&search=%s"] 1 #1#] "Url used for looking up Wikipedia suggestions.\nThis is a format string, don't forget the `%s'." :type string :group helm-wikipedia-summary-url #[0 "\300\207" [#2="https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&titles=%s&exintro=1&explaintext=1&redirects=1"] 1 #2#] "URL for getting the summary of a Wikipedia topic.\nThis is a format string, don't forget the `%s'." helm-wikipedia-input-idle-delay #[0 "\300\207" [0.6] 1] "`helm-input-idle-delay' used for helm-wikipedia." float] 8) #@56 Fetch Wikipedia suggestions and return them as a list. (defalias 'helm-wikipedia-suggest-fetch #[0 "\302\303!\210\304\305 !\"\306\307\"\207" [helm-wikipedia-suggest-url helm-pattern require json format url-hexify-string helm-net--url-retrieve-sync helm-wikipedia--parse-buffer] 4 (#$ . 966)]) #@25 Parse wikipedia buffer. (defalias 'helm-wikipedia--parse-buffer #[0 "eb\210\301\302\303\304#\205B\305\306\307!!\310H\311\303\211T\211\262\2032GW\2032H\262\211C\244\262\202\211\206@\312\313\314\"BC\"\266\204\207" [helm-pattern re-search-forward "^\\[.+\\[\\(.*\\)\\]\\]" nil t json-read-from-string match-string 0 1 -1 append format "Search for '%s' on wikipedia"] 9 (#$ . 1267)]) #@42 A temporary cache for wikipedia summary. (defvar helm-wikipedia--summary-cache (make-hash-table :test 'equal) (#$ . 1671)) #@61 Show Wikipedia summary for INPUT in new buffer. (fn INPUT) (defalias 'helm-wikipedia-show-summary #[257 "\300\301!\302!rq\210\303 \210\304 \210\211c\210\305p!\210eb)\207" [get-buffer-create "*helm wikipedia summary*" helm-wikipedia--get-summary visual-line-mode erase-buffer pop-to-buffer] 5 (#$ . 1800) nil]) #@59 Run PA on CANDIDATE for wikipedia source. (fn CANDIDATE) (defalias 'helm-wikipedia-persistent-action #[257 "\302\303\"\304\305\306\"\230?\2051\307\310!\210\311\312!\313!rq\210\314 \210\305\211c\210\315ed\"\210eb\210)\316!\266\202\207" [helm-pattern cursor-type format "Search for '%s' on wikipedia" helm-get-selection nil t message "Fetching summary from Wikipedia..." get-buffer-create "*helm wikipedia summary*" helm-wikipedia--get-summary erase-buffer fill-region display-buffer] 6 (#$ . 2119)]) #@155 Return Wikipedia summary for INPUT as string. Follows any redirections from Wikipedia, and stores results in `helm-wikipedia--summary-cache'. (fn INPUT) (defalias 'helm-wikipedia--get-summary #[257 "\301\302\"\206\303\304!#\262\211\203&\211<\203&\211A\262\305\306\"\210\202\211\204.\307\310!\210\207" [helm-wikipedia--summary-cache nil gethash puthash helm-wikipedia--fetch-summary message "Redirected to %s" error "Error when getting summary"] 6 (#$ . 2632)]) #@53 Fetch wikipedia summary matching INPUT. (fn INPUT) (defalias 'helm-wikipedia--fetch-summary #[257 "\301\302!\"\303\304\"\207" [helm-wikipedia-summary-url format url-hexify-string helm-net--url-retrieve-sync helm-wikipedia--parse-summary] 5 (#$ . 3115)]) #@142 Return plain-text rendering of article summary. Read from JSON in HTTP response buffer. Should be called in `url-retrieve' response buffer. (defalias 'helm-wikipedia--parse-summary #[0 "eb\210\300\301\302\303#\210\304 \211\305\306\236A\236A\211\262\262\307\310@\"\207" [re-search-forward "\n\n" nil t json-read pages query alist-get extract] 5 (#$ . 3380)]) #@38 Keymap for `helm-wikipedia-suggest'. (defvar helm-wikipedia-map (byte-code "\301!\302\303\304#\210\207" [helm-map copy-keymap define-key [C-return] helm-wikipedia-show-summary-action] 5) (#$ . 3749)) (defvar helm-source-wikipedia-suggest (helm-make-source "Wikipedia Suggest" 'helm-source-sync :candidates 'helm-wikipedia-suggest-fetch :action '(("Wikipedia" lambda (candidate) (helm-search-suggest-perform-additional-action helm-search-suggest-action-wikipedia-url candidate)) ("Show summary in new buffer (C-RET)" . helm-wikipedia-show-summary)) :persistent-action 'helm-wikipedia-persistent-action :persistent-help "show summary" :match-dynamic t :keymap helm-wikipedia-map :requires-pattern 3)) #@82 Exit Helm buffer and call `helm-wikipedia-show-summary' with selected candidate. (defalias 'helm-wikipedia-show-summary-action #[0 "\203\301\302!\207\303\304!\207" [helm-alive-p helm-exit-and-execute-action helm-wikipedia-show-summary error "Running helm command outside of context"] 2 (#$ . 4456) nil]) #@67 Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest. (defalias 'helm-wikipedia-suggest #[0 "\302\303\304\305\306\307\310 ]&)\207" [helm-wikipedia-input-idle-delay helm-input-idle-delay helm :sources helm-source-wikipedia-suggest :buffer "*helm wikipedia*" :input-idle-delay 0.4] 8 (#$ . 4769) nil]) (provide 'helm-wikipedia)