;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\306\307\310\311\312%\210\313\314\315\316\317\320\311\306&\210\313\321\307\322\317\323\311\306&\207" [require cl-lib ivy browse-url json custom-declare-group ivy-lobsters nil "Customs for `ivy-lobsters'" :group applications custom-declare-variable ivy-lobsters-url "https://lobste.rs/newest.json" "Variable to define lobste.rs newest articles url." :type string ivy-lobsters-keep-focus "Variable to control if the browser takes focus from Emacs. Currently only work for macOS." boolean] 8) #@49 Get newest posts json and store parsed stories. (defalias 'ivy-lobsters-get-posts #[nil "\304\305\306\"rq\210\307\216\310\311\312\306\312\313 &\314U\204\315\316 \"\210\312\31710\320\321ed\"!\3060\2022\210\312\211\204;\315\322!\210\n-\207" [#1=#:temp-buffer ivy-lobsters-url json ret generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] call-process "curl" nil "-s" 0 error "Failed: 'curl -s %s'" (error) json-read-from-string buffer-substring-no-properties "Error: Can't get JSON response"] 8 (#$ . 648)]) #@37 Parse the json provided by STORIES. (defalias 'ivy-lobsters-parse #[(stories) "\306\307\211\307\211 \307\211\307\211\310 \203~ :\204,\n GW\203~ :\2039 \211A\242\202< \nH\311\304 \"\312 !\311\313 \" \311\314 \"\311\315 \"\316\317\316\320\f\" $\211\321 \322\f\323\257BB\nT\307\202\237. \207" [stories #1=#:--cl-seq-- #2=#:--cl-idx-- story score title 0 nil t ivy-lobsters-extract ivy-lobsters-format-title url comment_count comments_url format "%s %s (%s comments)" "[%d]" :url :score :comments-url comment-count comments-url cand #3=#:--cl-var-- #4=#:--cl-var--] 8 (#$ . 1214)]) #@37 Build the tree-assoc from KEY TREE. (defalias 'ivy-lobsters-tree-assoc #[(key tree) ":\2052\211\203 \211A\242\202\304\305\306 GD\"\307\n \"\203&\2021\310 \n\"\2061\310 \"*\207" [tree y x key signal wrong-number-of-arguments (x . y) eql ivy-lobsters-tree-assoc] 5 (#$ . 1848)]) #@36 Extract KEY from STORY tree-assoc. (defalias 'ivy-lobsters-extract #[(key story) "\302 \"A\207" [key story ivy-lobsters-tree-assoc] 3 (#$ . 2146)]) #@21 Format STORY title. (defalias 'ivy-lobsters-format-title #[(story) "\301\302\303\304\"!\305\"\207" [story decode-coding-string string-make-multibyte ivy-lobsters-extract title utf-8] 5 (#$ . 2301)]) #@85 Optionally keep focus in Emacs when opening a link. Takes the URL as an arguement. (defalias 'ivy-lobsters-browse #[(url) "\203 \303=\203\304\305\nP\306\307\n\310%\207\311\n!\207" [ivy-lobsters-keep-focus system-type url darwin start-process "ivy-lobsters-" nil "open" "-g" browse-url] 6 (#$ . 2507)]) #@32 Show latest lobste.rs stories. (defalias 'ivy-lobsters #[nil "\303\304\305\216 \203\306 \307\310 \"\210\311\312 !\313\314\n\315\316$,\207" [#1=#:current-message #2=#:with-temp-message stories "Loading stories..." nil #[nil "\205 \203 \302\303 \"\207\302\304!\207" [#2# #1# message #3="%s" nil] 3] current-message message #3# ivy-lobsters-parse ivy-lobsters-get-posts ivy-read "Lobste.rs latest stories: " :action #[(story) "\301\302A\303\"!\207" [story ivy-lobsters-browse plist-get :url] 4]] 5 (#$ . 2821) nil]) (byte-code "\300\301\302\"\210\303\301!\207" [ivy-set-actions ivy-lobsters (("c" (lambda (story) (ivy-lobsters-browse (plist-get (cdr story) :comments-url))) "Browse Comments")) provide] 3)