From: Tim Vaughan Date: Fri, 12 Apr 2019 09:49:02 +0000 (+0200) Subject: Figuring out processes. X-Git-Tag: v1.0.0~89 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=4e8af883d7ef57fad6fbfa8b26ba20d42f4ff343;p=elpher.git Figuring out processes. --- diff --git a/betty.el b/betty.el deleted file mode 100644 index e339739..0000000 --- a/betty.el +++ /dev/null @@ -1,40 +0,0 @@ -;;; betty.el --- gopher client - -;;; Commentary: - -;; Simple gopher client in elisp. - -;;; Code: - -(defvar betty-mode-map nil "Keymap for gopher client.") -(define-key betty-mode-map (kbd "p") 'betty-quit) - -(define-derived-mode betty-mode special-mode "betty" - "Major mode for betty, an elisp gopher client. - - \\{betty-mode-map}") - -(defun betty () - "Start gopher client." - (interactive) - (switch-to-buffer "*betty*") - (betty-mode) - (let ((inhibit-read-only t) - (make-process - :name "ls" - :command "ls -l" - :filter)) - - ;; (address (read-from-minibuffer "Address of gopher server: "))) - (message "Connecting to '%s' ..." address) - (erase-buffer) - (insert (propertize "Hello, world." 'face '(foreground-color . "red"))) - (newline) - (insert (propertize "Hello, Tim." 'face '(foreground-color . "yellow"))))) - -(defun betty-quit () - (interactive) - (kill-buffer "*betty*")) - - -;;; betty.el ends here diff --git a/elopher.el b/elopher.el new file mode 100644 index 0000000..fd0e910 --- /dev/null +++ b/elopher.el @@ -0,0 +1,56 @@ +;;; elopher.el --- gopher client + +;;; Commentary: + +;; Simple gopher client in elisp. + +;;; Code: + +;; (defvar elopher-mode-map nil "Keymap for gopher client.") +;; (define-key elopher-mode-map (kbd "p") 'elopher-quit) + +;; (define-derived-mode elopher-mode special-mode "elopher" +;; "Major mode for elopher, an elisp gopher client.") + +(defvar my-marker nil) + +(defun my-filter (proc string) + (with-current-buffer (get-buffer "*elopher*") + (let ((marker (process-mark proc))) + (if (not (marker-position marker)) + (set-marker marker 0 (current-buffer))) + (save-excursion + (goto-char marker) + (insert (propertize string 'face '(foreground-color . "yellow"))) + (set-marker marker (point)))))) + + +(defun elopher () + "Start gopher client." + (interactive) + (switch-to-buffer-other-window "*elopher*") + (setq my-marker (make-marker)) + (erase-buffer) + (make-process + :name "date" + :command (list "/bin/ls" "-l" "/") + :filter #'my-filter)) + +(elopher) + + ;; (address (read-from-minibuffer "Address of gopher server: "))) + ;; (message "Connecting to '%s' ..." address) + ;; (erase-buffer) + ;; (insert (propertize "Hello, world." 'face '(foreground-color . "red"))) + ;; (newline) + ;; (insert (propertize "Hello, Tim." 'face '(foreground-color . "yellow")))) + +(defun elopher-quit () + (interactive) + (kill-buffer "*elopher*")) + +(start-process "ls" "*elopher*" "/bin/date") + +;;; elopher.el ends here + +(list-processes)