;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\300\305!\210\300\306!\207" [require sx sx-question sx-question-mode sx-question-list sx-compose sx-cache] 2) #@465 Get the alist regarding object under point of type TYPE. Looks at the text property `sx--data-here'. If it's not set, it looks at a few other reasonable variables. If those fail too, it throws an error. TYPE is a symbol restricting the type of object desired. Possible values are 'question, 'answer, 'comment, or nil (for any type). If no object of the requested type could be returned, an error is thrown unless NOERROR is non-nil. (fn &optional TYPE NOERROR) (defalias 'sx--data-here #[512 "\301`\302\"\204\f\211\202G\303!\210\211\304\236A\305\236A\306\236A\307\267\202B\205C\266\203\202E\205C\266\203\202E\211\205C\266\203\202E\310\266\203\262\262\206\201\203V\311=\203t\312\313!\203j\310\314\206c`\315\"\262\206\201\312\316!\203t\206\201\211?\205\201\317\320\206\200\321\"\207" [sx-question-mode--data get-char-property sx--data-here sx--ensure-site title answer_id comment_id #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (question 36 answer 46 comment 56)) nil question derived-mode-p sx-question-list-mode get-text-property tabulated-list-id sx-question-mode error "No %s found here" "data"] 9 (#$ . 262)]) #@84 Get the data at MARKER. REST is passed to `sx--data-here'. (fn MARKER &rest REST) (defalias 'sx--marker-to-data #[385 "\212b\210\300\301\")\207" [apply sx--data-here] 5 (#$ . 1463)]) #@117 Throw a user-error if DATA is an unread question. If it's not a question, or if it is read, return DATA. (fn DATA) (defalias 'sx--error-if-unread #[257 "\300\236\203\301!\204\302\303!\207\207" [title sx-question--read-p sx-user-error "Question not yet read. View it before acting on it"] 3 (#$ . 1656)]) #@336 Refresh whatever is displayed in BUFFER or the current buffer. If BUFFER is not live, nothing is done. If SITE is given but ID isn't, only update if BUFFER appears to be a question-list displaying SITE. If both SITE and ID are given, only update if BUFFER appears to be a question matching SITE and ID. (fn &optional BUFFER SITE ID) (defalias 'sx--maybe-update-display #[768 "\206p\262\301!\205Xrq\210\302\303!\203-\203&\211?\205W\230\205W\304\305\306\"\202W\302\307!\205W\203T\211\205W\310\311!\312\236A\313\236AB\266\202\262B\232\205W\314\306!)\207" [sx-question-list--site buffer-live-p derived-mode-p sx-question-list-mode sx-question-list-refresh redisplay no-update sx-question-mode sx--data-here question site_par question_id sx-question-mode-refresh] 8 (#$ . 1974)]) #@94 Copy all fields of alist FORM onto TO. Only fields contained in TO are copied. (fn FROM TO) (defalias 'sx--copy-data #[514 "\211@\240\210\211A\241\207" [] 4 (#$ . 2784)]) #@349 Signal user-error if the user refuses to authenticate. Note that `sx-method-call' already does authentication checking. This function is meant to be used by commands that don't immediately perform method calls, such as `sx-ask'. This way, the unauthenticated user will be prompted before going through the trouble of composing an entire question. (defalias 'sx-ensure-authentication #[0 "\300\301!?\205\302\303!\203\304 \207\305\306!\207" [sx-cache-get auth y-or-n-p "This command requires authentication, would you like to authenticate? " sx-authenticate sx-user-error "This command requires authentication, please run `M-x sx-authenticate' and try again."] 2 (#$ . 2965)]) #@221 Return a function that runs BODY and updates display. `sx--maybe-update-display' is only called if the buffer where the function was created still exists. In that case, BODY is also run in this buffer. (fn &rest BODY) (defalias 'sx--make-update-callback '(macro . #[128 "\300\301\302\303\304\305\306\307\310\311\n\312\"BBBBBFE\207" [let ((buffer (current-buffer))) lambda (result) (ignore result) if (buffer-live-p buffer) with-current-buffer buffer append ((sx--maybe-update-display))] 13 (#$ . 3652)])) (put 'sx--make-update-callback 'edebug-form-spec t) #@234 Return a function that overwrites DATA and updates display. First, DATA is destructively overwritten with the car of the argument passed to the function. Then, `sx--maybe-update-display' is called in the original buffer. (fn DATA) (defalias 'sx--copy-update-callback #[257 "p\300\301#\207" [make-closure #[257 "\302\301!\203r\301q\210\211\203\303\304\234\300\"\210\305 )\207\211\205#\303\304\234\300\"\207" [V0 V1 buffer-live-p sx--copy-data 0 sx--maybe-update-display] 4 "\n\n(fn RESULT)"]] 6 (#$ . 4221)]) #@370 Visit DATA in a web browser. DATA can be a question, answer, or comment. Interactively, it is derived from point position. If copy-as-kill is non-nil, do not call `browse-url'. Instead, copy the link as a new kill with `kill-new'. Interactively, this is specified with a prefix argument. If DATA is a question, also mark it as read. (fn DATA &optional COPY-AS-KILL) (defalias 'sx-visit-externally #[513 "\300!\210\301\236A\302\236A;\204\303\304!\207\203\305\202\306!\210\307\310!\2031\2031\311\312\"\210\211\205@?\205@\313!\210\314 \207" [sx--ensure-site link title sx-message "Nothing to visit here." kill-new browse-url called-interactively-p any message "Copied: %S" sx-question--mark-read sx--maybe-update-display] 8 (#$ . 4747) (byte-code "\301 D\207" [current-prefix-arg sx--data-here] 2)]) #@101 Visit element given by LINK inside Emacs. Element can be a question, answer, or comment. (fn LINK) (defalias 'sx-open-link #[257 "\300\301\"\203 \302!\207\303!\304!\210\211\305\236A\306\236A\307\236A\310\267\202G\311\312\"\313\"\210\314\315\"\207\311\316\"\313\"\210\314\317\"\207\311\320\"\313\"\207\321\322\"\266\323\207" [string-match "\\`https?://chat\\." sx-visit-externally sx--link-to-data sx--ensure-site type site_par id #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (comment 37 answer 50 question 63)) sx-display-question sx-question-get-from-comment focus sx--find-in-buffer comment sx-question-get-from-answer answer sx-question-get-question error "Don't know how to open this link, please file a bug report: %s" nil] 10 (#$ . 5576) (byte-code "\300\301\302\"r\211q\210\303\304\"\216\212\305 \210)\306\307!*\262\310\311\312Q\313\211$C\207" [generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] yank thing-at-point url read-string "Link (" "): " nil] 6)]) #@275 Display object given by DATA. Interactively, display object under point. Object can be a question, an answer, or an inbox_item. This is meant for interactive use. In lisp code, use object-specific functions such as `sx-display-question' and the likes. (fn &optional DATA) (defalias 'sx-display #[256 "\300!\210\211\301\236A\302\236A\303\236A\304\236A\305\236A\306\236A\307\236A\310\236A\311 \236A\203J\203J\203J\204J\204J\312 \313\"\207\203e\312\314\"\313\"\210\203`\315\316\"\207\315\317\"\207\203|\312\320\n\"\313\"\210\205\234\315\316\"\207\203\215\312\321\"\313\"\210\315\316\"\207\203\225\322\323!\207\205\234\324!\207" [sx--ensure-site title question_id score item_type notification_type answer_id site_par comment_id link sx-display-question focus sx-question-get-from-answer sx--find-in-buffer comment answer sx-question-get-question sx-question-get-from-comment sx-message "Viewing notifications is not yet implemented" sx-open-link] 15 (#$ . 6674) (byte-code "\300 C\207" [sx--data-here] 1)]) #@303 Display question given by DATA, on WINDOW. Interactively, display question under point. When FOCUS is non-nil (the default when called interactively), also focus the relevant window. If WINDOW nil, the window is decided by `sx-question-mode-display-buffer-function'. (fn &optional DATA FOCUS WINDOW) (defalias 'sx-display-question #[768 "\301!\203 \302 \210\303\304\"!\262\205\"\305!\203\306!\207\307!\207" [sx-question-mode--buffer sx-question--mark-read sx--maybe-update-display get-buffer-window sx-question-mode--display window-live-p select-window switch-to-buffer] 7 (#$ . 7740) (byte-code "\300\301!\302D\207" [sx--data-here question t] 2)]) #@176 Favorite question given by DATA. Interactively, it is guessed from context at point. With the UNDO prefix argument, unfavorite the question instead. (fn DATA &optional UNDO) (defalias 'sx-favorite #[513 "\300\203\n\301\202 \302\303\304!$\207" [sx-method-post-from-data favorite/undo favorite :callback sx--copy-update-callback] 8 (#$ . 8410) (byte-code "\301\302\303!!D\207" [current-prefix-arg sx--error-if-unread sx--data-here question] 3)]) (defalias 'sx-star 'sx-favorite) #@170 Accept answer given by DATA. Interactively, it is guessed from context at point. With the UNDO prefix argument, unaccept the question instead. (fn DATA &optional UNDO) (defalias 'sx-accept #[513 "\300 \210\301!\203\302\303\"\262\304\203\305\202\306\307\310!$\207" [sx-ensure-authentication markerp sx--marker-to-data answer sx-method-post-from-data accept/undo accept :callback sx--copy-update-callback] 8 (#$ . 8902) (byte-code "\301\302!D\207" [current-prefix-arg sx--data-here answer] 2)]) #@220 Upvote an object given by DATA. DATA can be a question, answer, or comment. Interactively, it is guessed from context at point. With UNDO prefix argument, remove upvote instead of applying it. (fn DATA &optional UNDO) (defalias 'sx-upvote #[513 "\300\301?#\207" [sx-set-vote "upvote"] 6 (#$ . 9417) (byte-code "\301\302 !D\207" [current-prefix-arg sx--error-if-unread sx--data-here] 2)]) #@217 Downvote an object given by DATA. DATA can be a question or an answer. Interactively, it is guessed from context at point. With UNDO prefix argument, remove downvote instead of applying it. (fn DATA &optional UNDO) (defalias 'sx-downvote #[513 "\300\301?#\207" [sx-set-vote "downvote"] 6 (#$ . 9816) (byte-code "\301\302 !D\207" [current-prefix-arg sx--error-if-unread sx--data-here] 2)]) #@235 Set the DATA's vote TYPE to STATUS. DATA can be a question, answer, or comment. TYPE can be "upvote" or "downvote". STATUS is a boolean. Besides posting to the api, DATA is also altered to reflect the changes. (fn DATA TYPE STATUS) (defalias 'sx-set-vote #[771 "\300 \210\301?\205\f\302P\303\304!$\207" [sx-ensure-authentication sx-method-post-from-data "/undo" :callback sx--copy-update-callback] 9 (#$ . 10216)]) #@200 Delete an object given by DATA. DATA can be a question, answer, or comment. Interactively, it is guessed from context at point. With UNDO prefix argument, undelete instead. (fn DATA &optional UNDO) (defalias 'sx-delete #[513 "\300 \210\301\302\303\304\236A\305\236A\306\236A\203\266\307\202.\203'\266\310\202.\211\205,\311\266\203\262\"!\205K\312\203?\313\202@\314\315p\316\317#\262$\207" [sx-ensure-authentication y-or-n-p format "DELETE this %s? " comment_id answer_id question_id "comment" "answer" "question" sx-method-post-from-data delete/undo delete :callback make-closure #[257 "\302\301!\203r\301q\210\300\211@\300AB\241\210\300\303\240\210\304 )\207\300\211@\300AB\241\210\300\303\240\207" [V0 V1 buffer-live-p deleted sx--maybe-update-display] 4 "\n\n(fn RESULT)"]] 11 (#$ . 10646) (byte-code "\301\302 !D\207" [current-prefix-arg sx--error-if-unread sx--data-here] 2)]) #@293 Post a comment on DATA given by TEXT. DATA can be a question, an answer, or a comment. Interactively, it is guessed from context at point. If DATA is a comment, the comment is posted as a reply to it. TEXT is a string. Interactively, it is read from the minibufer. (fn DATA &optional TEXT) (defalias 'sx-comment #[513 "\301 \210\302!\203\303!\262\304\262\305!\210\306\236A\307\236A\310\236A\311\236A\312\236A\313\236A\314\236A\304=\203^\315\316\205I\317\320\321\n\"!\"\262 \322 \323\"\204^\315\324\n\"\262 \202L;\204h\325\326!\210\327\330\331\206v\206v\332\333\334\335\336\337\340\341\342\343BC&\211\205\254\344\345\346\347BC\350\234\"\203\246\351\n#\202\250\f\"\210\352 \207" [sx-browse-filter sx-ensure-authentication markerp sx--marker-to-data query sx--ensure-site comment_id owner post_id answer_id question_id site_par post_type read-string "Comment text: " substring-no-properties sx-user--format "%@ " sx--comment-valid-p silent "Comment text (between 16 and 600 characters): " error "Comment body must be a string" sx-method-call posts :id :submethod "comments/add" :auth warn :url-method post :filter :site :keywords body sx--add-comment-to-object sx--ensure-owner-in-object display_name "(You)" 0 sx--get-post sx--maybe-update-display] 27 (#$ . 11563) (byte-code "\300\301 !\302D\207" [sx--error-if-unread sx--data-here query] 2)]) #@231 Non-nil if TEXT fits stack exchange comment length limits. If TEXT is nil, use `buffer-string'. Must have more than 15 and less than 601 characters. If SILENT is nil, message the user about this limit. (fn &optional TEXT SILENT) (defalias 'sx--comment-valid-p #[512 "\300\206\301 !\302W\203\211\303W\203\304\207\204\305\306!\210\307\207" [string-width buffer-string 15 601 t message "Comments must be within 16 and 600 characters." nil] 5 (#$ . 12970)]) #@149 Find in the database a post identified by TYPE, SITE and ID. TYPE is `question' or `answer'. SITE is a string. ID is an integer. (fn TYPE SITE ID) (defalias 'sx--get-post #[771 " B\302\230\203 \211\202\303\230\205\304\305\306\307\310\311\"$\262\312\313\314#\"@\207" [sx-question-mode--data sx-question-list--dataset "question" "answer" apply cl-map list identity mapcar #[257 "\300\236A\207" [answers] 3 "\n\n(fn X)"] cl-member-if make-closure #[257 "\302!\210\211\303\236A\304\236A\305\236A\206\301\232\205\211\300\232\207" [V0 V1 sx--ensure-site answer_id question_id site_par] 7 "\n\n(fn X)"]] 11 (#$ . 13443)]) #@106 Add COMMENT to OBJECT's `comments' property. OBJECT can be a question or an answer. (fn COMMENT OBJECT) (defalias 'sx--add-comment-to-object #[514 "\300\236\211\203\211\301AC\"\241\266\207\211@AB\241\210\300D\240\266\207" [comments append] 7 (#$ . 14091)]) #@69 Add `owner' property with value OWNER to OBJECT. (fn OWNER OBJECT) (defalias 'sx--ensure-owner-in-object #[514 "\300\236\243\204\211@AB\241\210\211\300B\240\210\207" [owner] 5 (#$ . 14366)]) #@152 Start editing an answer or question given by DATA. DATA is an answer or question alist. Interactively, it is guessed from context at point. (fn DATA) (defalias 'sx-edit #[257 "\211C\300 \210\301\242!\203\211\302 \240\210\303\242!\210\211\242\304\236A\305\236Ap\306\307\242\205-\310C\311\312 #C$!\207" [sx-ensure-authentication markerp sx--data-here sx--ensure-site site_par comment_id pop-to-buffer sx-compose-create sx--comment-valid-p make-closure #[514 "\302\303\234\300\242\"\210\304\301!\207" [V0 V1 sx--copy-data 0 sx--maybe-update-display] 5 "\n\n(fn _ RES)"]] 15 (#$ . 14571) (byte-code "\300 C\207" [sx--data-here] 1)]) (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\207" [custom-declare-variable sx-default-site funcall function #[0 "\300\207" [#1="emacs"] 1 #1#] "Name of the site to use by default when listing questions." :type string :group sx] 8) #@28 Query the user for a site. (defalias 'sx--interactive-site-prompt #[0 "\206\303 !\210 \304\236A\211\262\262\206\n\305\306\307\"\310 \311\312\311\211&\207" [sx-question-list--site sx-question-mode--data sx-default-site sx--ensure-site site_par sx-completing-read format "Site (%s): " sx-site-get-api-tokens nil t] 9 (#$ . 15465)]) #@225 Get a site token conditionally in an interactive context. If ARG is non-nil, use `sx--interactive-site-prompt'. Otherwise, use `sx-question-list--site' if non-nil. If nil, use `sx--interactive-site-prompt' anyway. (fn ARG) (defalias 'sx--maybe-site-prompt #[257 "\211\203\301 \207\206 \301 \207" [sx-question-list--site sx--interactive-site-prompt] 2 (#$ . 15814)]) #@113 Start composing a question for SITE. SITE is a string, indicating where the question will be posted. (fn SITE) (defalias 'sx-ask #[257 "\300 \210p\301\302\303\211\304\305\"C$!\207" [sx-ensure-authentication pop-to-buffer sx-compose-create nil make-closure #[514 "\301\300!\207" [V0 sx--maybe-update-display] 4 "\n\n(fn B RES)"]] 10 (#$ . 16192) (byte-code "\300 C\207" [sx--interactive-site-prompt] 1)]) #@145 Start composing an answer for question given by DATA. DATA is a question alist. Interactively, it is guessed from context at point. (fn DATA) (defalias 'sx-answer #[257 "\211C\300 \210\301\242!\203\211\302 \240\210p\303\242!\210\242\304\236A\305\236A\306\307\310\311\312  \n\n%C$!\207" [sx-ensure-authentication markerp sx--data-here sx--ensure-site site_par question_id pop-to-buffer sx-compose-create nil make-closure #[514 "\304\305\234\300\242\"\210\306\301\302\303#\207" [V0 V1 V2 V3 sx--add-answer-to-question-object 0 sx--maybe-update-display] 6 "\n\n(fn _ RES)"]] 17 (#$ . 16607) (byte-code "\300\301\302!!C\207" [sx--error-if-unread sx--data-here question] 3)]) #@78 Add alist ANSWER to alist QUESTION in the right place. (fn ANSWER QUESTION) (defalias 'sx--add-answer-to-question-object #[514 "\300\236\211\203\211\301AC\"\241\210\202!\211@AB\241\210\300D\240\210\207" [answers append] 7 (#$ . 17300)]) (provide 'sx-interaction)