emacs-symfony-cli

elisp-http.el at [78426e9593]
Login

File elisp-http.el artifact af6086a51c part of check-in 78426e9593


(load "~/glibc/dark_c/emacs-symfony-cli/http-content.el")
(load "~/glibc/dark_c/emacs-symfony-cli/elisp-http-style.el")
(load "~/glibc/dark_c/emacs-symfony-cli/elisp-http-prompt.el")
;;;;(global-set-key (kbd "M-m") #'(lambda () (interactive) (elisp-http) (monitor-http-buffer)))

;;(setq http-content (elisp-http-register-content))
;;(setq http-content (elisp-http-make-content))
;;(setq http-content (elisp-http-login-content))

http-content


(defun elisp-http ()
  (interactive)
  (make-network-process
   :name "elisp-post"
   :host "localhost"
   :service 8080
   :buffer "*X*"
   :nowait t
   :filter (lambda (process-name output-data)
             (with-current-buffer (process-buffer process-name)
			   (unless (bound-and-true-p already-scaled)
				 (setq-local already-scaled t)
				 (text-scale-increase 4))
               (goto-char (point-max))
               (insert output-data)))
   :sentinel (lambda (proc event)
			   (when (string= event "open\n")
				 (process-send-string
				  proc
				  http-content
				  )))))

(defvar monitor-http-buffer--timer nil)


(defun monitor-http-buffer ()
  (setq monitor-http-buffer--timer
        (run-at-time 1 1
                     (lambda ()
                       (let ((buf (get-buffer "*X*")))
                         (when (and (buffer-live-p buf)
                                    (> (buffer-size buf) 0))
                           (psysho-log "[ELISP-HTTP] Пришли данные. Смотрим...")
                           (display-buffer buf)
                           (when (timerp monitor-http-buffer--timer)
                             (cancel-timer monitor-http-buffer--timer))))))))