;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%\207" [require cl-lib url-util simple-httpd htmlize custom-declare-group impatient-mode nil "Serve buffers live over HTTP." :group comm] 6) #@28 Keymap for impatient-mode. (defvar impatient-mode-map (make-sparse-keymap) (#$ . 316)) #@115 The delay in seconds between a keypress and the buffer being reloaded in the browser. Set to nil for no delay (defvar impatient-mode-delay nil (#$ . 410)) #@72 A timer that goes off after impatient-mode-delay seconds of inactivity (defvar imp--idle-timer nil (#$ . 575)) (make-variable-buffer-local 'imp--idle-timer) #@45 Per buffer html-producing function by user. (defvar imp-user-filter 'imp-htmlize-filter (#$ . 738)) (make-variable-buffer-local 'imp-user-filter) #@55 List of client processes watching the current buffer. (defvar imp-client-list nil (#$ . 890)) (make-variable-buffer-local 'imp-client-list) #@24 State sequence number. (defvar imp-last-state 0 (#$ . 1036)) (make-variable-buffer-local 'imp-last-state) #@46 Files that seem to be related to this buffer (defvar imp-related-files nil (#$ . 1148)) (make-variable-buffer-local 'imp-related-files) #@63 If non-nil, buffer has been modified but not sent to clients. (defvar imp--buffer-dirty-p nil (#$ . 1290)) (make-variable-buffer-local 'imp--buffer-dirty-p) #@63 Alist indicating which filter should be used for which modes. (defvar imp-default-user-filters '((html-mode) (web-mode)) (#$ . 1453)) #@97 Non-nil if impatient mode is enabled. Use the command `impatient-mode' to change this variable. (defvar impatient-mode nil (#$ . 1593)) (make-variable-buffer-local 'impatient-mode) #@587 Serves the buffer live over HTTP. This is a minor mode. If called interactively, toggle the `impatient mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `impatient-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. (fn &optional ARG) (defalias 'impatient-mode #[256 "\302 \303=\203 ?\202\247\203\304W\203\305\202\306\307\301!\2031\310\300 \"\2031\300 B\204A\311 \210\312\313\314\306#\210\202R\315\316\311\305\306$\210\315\313\314\305\306$\210\317 \210\320\321\203\\\322\202]\323\"\210\324\325!\203\302 \203q\211\302 \232\203\326\327\203{\330\202|\331\332#\210\210\333 \210\207" [impatient-mode local-minor-modes current-message toggle 1 nil t boundp delq imp--cleanup-timer remove-hook after-change-functions imp--on-change add-hook kill-buffer-hook imp-remove-user-filter run-hooks impatient-mode-hook impatient-mode-on-hook impatient-mode-off-hook called-interactively-p any message "impatient mode %sabled%s" "en" "dis" " in current buffer" force-mode-line-update] 7 (#$ . 1781) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar impatient-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\313\310\211%\207" [impatient-mode-map impatient-mode-hook variable-documentation put "Hook run after entering or leaving `impatient-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode impatient-mode " imp"] 6) #@50 Location of data files needed by impatient-mode. (defvar imp-shim-root (file-name-directory load-file-name) (#$ . 3731)) #@196 Sets a user-defined filter for this buffer. FUNCTION should accept one argument, the buffer to be filtered, and will be evaluated with the output buffer set as the current buffer. (fn FUNCTION) (defalias 'imp-set-user-filter #[257 "\211 T\302 \207" [imp-user-filter imp-last-state imp--notify-clients] 2 (#$ . 3859) "aCustom filter: "]) #@62 Sets the user-defined filter for this buffer to the default. (defalias 'imp-remove-user-filter #[0 "\303 \"\211\203\304A!\266\202\305\306!\266\nT\307 \207" [major-mode imp-default-user-filters imp-last-state assoc imp-set-user-filter kill-local-variable imp-user-filter imp--notify-clients] 3 (#$ . 4205) nil]) #@64 Htmlization of buffers before sending to clients. (fn BUFFER) (defalias 'imp-htmlize-filter #[257 "\300 \301\302\"\216\303!)\262\304!\210\305!\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] htmlize-buffer insert-buffer-substring kill-buffer] 5 (#$ . 4531)]) #@27 Toggle htmlize of buffer. (defalias 'imp-toggle-htmlize #[0 "\301=\203\n\302\303!\207\302\301!\207" [imp-user-filter imp-htmlize-filter imp-set-user-filter nil] 2 (#$ . 4842) nil]) #@32 Visit the buffer in a browser. (defalias 'imp-visit-buffer #[0 "\301 \210\302\303\304\305 \306\307 !$!\207" [httpd-port impatient-mode browse-url format "http://%s:%d/imp/live/%s/" system-name url-hexify-string buffer-name] 7 (#$ . 5031) nil]) #@61 Return t if buffer has impatient-mode enabled. (fn BUFFER) (defalias 'imp-buffer-enabled-p #[257 "\211\205\fr\301!q\210)\207" [impatient-mode get-buffer] 3 (#$ . 5282)]) #@49 List of all buffers with impatient-mode enabled (defalias 'imp--buffer-list #[0 "\300\301\302 \"\207" [cl-remove-if-not imp-buffer-enabled-p buffer-list] 3 (#$ . 5462)]) #@70 True if the path should be stamped with a no-cache header (fn PATH) (defalias 'imp--should-not-cache-p #[257 "\300\301!!\211\302\235\207" [httpd-get-mime file-name-extension ("text/css" "text/html" "text/xml" "text/plain" "text/javascript")] 4 (#$ . 5638)]) #@50 Serve up static files. (fn PROC PATH QUERY REQ) (defalias 'httpd/imp/static #[1028 "\301!\302\"\303!\203\304#\207\305\306\"\207" [imp-shim-root file-name-nondirectory expand-file-name file-exists-p httpd-send-file httpd-error 404] 10 (#$ . 5904)]) #@47 Serve a list of published buffers. (fn PROC) (defalias 'imp-serve-buffer-list #[257 "\211\304\305\306\"r\211q\210\307\310\"\216\311p\312c\210\313c\210\314c\210\315c\210\316c\210\317 \211\203A\211@\320\321\322\323!!\324\323!!#c\210A\266\202\202%\210\325c\210\326c\210\327c\210* ?\205V\330\331\332#*\207" [major-mode httpd-current-proc standard-output httpd--header-sent generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] httpd-buffer "\n" "impatient-mode buffer list\n" "\n" "

Public Buffers

\n
" "\n
" "Enable impatient-mode in buffers to publish them." "" httpd-send-header "text/html; charset=utf-8" 200] 11 (#$ . 6171)]) #@25 (fn PROC BUFFER-NAME) (defalias 'imp--private #[514 "\300\301\302\303\"#\207" [httpd-error 403 format "Buffer %s is private or doesn't exist."] 8 (#$ . 7096)]) #@80 Serve up the shim that lets us watch a buffer change (fn PROC PATH QUERY REQ) (defalias 'httpd/imp/live #[1028 "\302\303\"\304\305\"A\3068\307\310\311\312\233\305#!\313!\314!\211\205\"\315!\315\n!\316\232\2034\317  \305P\"\207\320!\204A\321 \"\207\322\230\204\246\211\203\246\302\"\323\324!!\325\326\327\"\330 \"rq\210 \235\204k B)\211\203\236\331\332\333\"r\211q\210\326\334\"\216\335@!\210\336!\203\224\337\340\341\342%\202\234\337\340\341\343%*\207\344 #\207\320!\210\344 \n#\207" [imp-shim-root imp-related-files expand-file-name "index.html" split-string "/" 2 httpd-clean-path mapconcat identity 3 get-buffer buffer-file-name file-name-directory "/imp/live/" httpd-redirect imp-buffer-enabled-p imp--private "./" httpd-get-mime file-name-extension cl-remove-if-not make-closure #[257 "\300\301!\232\207" [V0 buffer-file-name] 4 "\n\n(fn BUF)"] imp--buffer-list generate-new-buffer " *temp*" t #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-buffer-substring imp--should-not-cache-p httpd-send-header 200 :Cache-Control "no-cache" "max-age=60, must-revalidate" httpd-send-file] 21 (#$ . 7266)]) #@26 (fn PROC PATH &rest _) (defalias 'httpd/imp #[642 "\300\267\202\301\302\"\207\303!\207\304\305\306\307\"#\207" [#s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data ("/imp" 6 "/imp/" 11)) httpd-redirect "/imp/" imp-serve-buffer-list httpd-error 403 format "%s not found"] 9 (#$ . 8452)]) #@13 (fn PROC) (defalias 'imp--send-state #[257 "\302! p\303\304\305\"r\211q\210\306\307\"\216\203!\210\202!\310!\210\311\312\313\314\315\316\n&*\207" [imp-last-state imp-user-filter number-to-string generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-buffer-substring httpd-send-header "text/html" 200 :Cache-Control "no-cache" :X-Imp-Count] 13 (#$ . 8791)]) #@13 (fn PROC) (defalias 'imp--send-state-ignore-errors #[257 "\3001 \301!0\207\302\207" [(error) imp--send-state nil] 3 (#$ . 9233)]) (defalias 'imp--notify-clients #[0 "\205\301\211A\242!\210\202\207" [imp-client-list imp--send-state-ignore-errors] 3]) #@48 Destroy any timer associated with this buffer. (defalias 'imp--cleanup-timer #[0 "\205\f\301A!\210\302\211\207" [imp--idle-timer cancel-timer nil] 2 (#$ . 9500)]) #@45 Start/update the idle timer as appropriate. (defalias 'imp--start-idle-timer #[0 "\204 ?\206G\204 \203\302 A!\210\303\211\207\2031 \2041p\304\305\306\307\"#B\211\207\310 @\"?\205G\311 A\305#\210 \211\240\262\207" [impatient-mode-delay imp--idle-timer cancel-timer nil run-with-idle-timer :repeat make-closure #[0 "r\300q\210\301 )\207" [V0 imp--after-timeout] 1] eql timer-set-idle-time] 7 (#$ . 9673)]) #@50 Hook for `after-change-functions'. (fn &rest _) (defalias 'imp--on-change #[128 "\302 \210\203 \303\211\207\304 \207" [impatient-mode-delay imp--buffer-dirty-p imp--start-idle-timer :dirty imp--update-buffer] 3 (#$ . 10106)]) #@57 Executes after impatient-mode-delay seconds of idleness (defalias 'imp--after-timeout #[0 "\203\301 \210\302 \207" [imp--buffer-dirty-p imp--update-buffer imp--start-idle-timer] 1 (#$ . 10342)]) #@36 Update this buffer in the browser. (defalias 'imp--update-buffer #[0 "\303 T\304 \210\305p!\306 \211\205(\211@r\211q\210\n\235\203 \304 \210)A\266\202\202 \207" [imp--buffer-dirty-p imp-last-state imp-related-files nil imp--notify-clients buffer-file-name imp--buffer-list] 5 (#$ . 10546)]) #@72 Servlet that accepts long poll requests. (fn PROC PATH QUERY &rest _) (defalias 'httpd/imp/buffer #[899 "\302!\303!\304\305\306\"A@\206\307!\310!\2032rq\210\211\232\203, B\211\2020\311!)\207\312\"\207" [imp-last-state imp-client-list file-name-nondirectory get-buffer string-to-number assoc "id" "0" imp-buffer-enabled-p imp--send-state-ignore-errors imp--private] 10 (#$ . 10850)]) (provide 'impatient-mode)