Implement flycheck-package advice

Partially. I still have to improve some documentation.
hello-test
Allard Hendriksen 2018-07-17 09:58:25 +02:00
parent f3e695dbea
commit aae8f4e082
1 changed files with 11 additions and 10 deletions

View File

@ -7,7 +7,8 @@
;; Keywords: literate programming, interactive shell, tmux ;; Keywords: literate programming, interactive shell, tmux
;; URL: https://github.com/ahendriksen/ob-tmux ;; URL: https://github.com/ahendriksen/ob-tmux
;; Version: 0.1.1 ;; Version: 0.1.1
;; Package-Requires: ((emacs "25.1") (seq "2.3")) ;; Package-version: 0.1.1
;; Package-Requires: ((emacs "25.1") (seq "2.3") (s "1.9.0"))
;; This file is NOT part of GNU Emacs. ;; This file is NOT part of GNU Emacs.
@ -31,16 +32,16 @@
;; Heavily inspired by 'eev' from Eduardo Ochs and ob-screen.el from ;; Heavily inspired by 'eev' from Eduardo Ochs and ob-screen.el from
;; Benjamin Andresen. ;; Benjamin Andresen.
;; ;;
;; Adding :terminal as header arguments ;; See documentation on https://github.com/ahendriksen/ob-tmux
;; :terminal must support the -T (title) and -e (command) parameter
;; or allow for the command to be added after '--'
;; ;;
;; You can test the default setup. (gnome-terminal) with ;; You can test the default setup with
;; M-x org-babel-tmux-test RET ;; M-x org-babel-tmux-test RET
;;; Code: ;;; Code:
(require 'ob) (require 'ob)
(require 'seq) (require 'seq)
(require 's)
(defvar org-babel-tmux-location "tmux" (defvar org-babel-tmux-location "tmux"
"The command location for tmux. "The command location for tmux.
@ -103,7 +104,7 @@ explicitly named in an org session.")
socket) socket)
(defun ob-tmux--from-org-session (org-session &optional socket) (defun ob-tmux--from-org-session (org-session &optional socket)
"Creates a new ob-tmux-session object from org-session specification." "Create a new ob-tmux-session object from org-session specification."
(defun -tmux-session (org-session) (defun -tmux-session (org-session)
(let* ((session (car (split-string org-session ":")))) (let* ((session (car (split-string org-session ":"))))
(concat org-babel-tmux-session-prefix (concat org-babel-tmux-session-prefix
@ -158,7 +159,7 @@ Returns stdout as a string."
(s-join " " args))))) (s-join " " args)))))
(defun ob-tmux--start-terminal-window (ob-session terminal) (defun ob-tmux--start-terminal-window (ob-session terminal)
"Starts a terminal window with tmux attached to session." "Start a terminal window with tmux attached to session."
(let* ((process-name (concat "org-babel: terminal"))) (let* ((process-name (concat "org-babel: terminal")))
(unless (ob-tmux--socket ob-session) (unless (ob-tmux--socket ob-session)
(if (string-equal terminal "xterm") (if (string-equal terminal "xterm")
@ -177,7 +178,7 @@ Returns stdout as a string."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ob-tmux--create-session (ob-session) (defun ob-tmux--create-session (ob-session)
"Creates a tmux session if it does not yet exist." "Create a tmux session if it does not yet exist."
(unless (ob-tmux--session-alive-p ob-session) (unless (ob-tmux--session-alive-p ob-session)
(ob-tmux--execute ob-session (ob-tmux--execute ob-session
;; TODO: set socket ;; TODO: set socket
@ -188,7 +189,7 @@ Returns stdout as a string."
"-n" (ob-tmux--window-default ob-session)))) "-n" (ob-tmux--window-default ob-session))))
(defun ob-tmux--create-window (ob-session) (defun ob-tmux--create-window (ob-session)
"Creates a tmux window in session if it does not yet exist." "Create a tmux window in session if it does not yet exist."
(unless (ob-tmux--window-alive-p ob-session) (unless (ob-tmux--window-alive-p ob-session)
(ob-tmux--execute ob-session (ob-tmux--execute ob-session
;; TODO: set socket ;; TODO: set socket
@ -269,7 +270,7 @@ If no window is specified in org-session, returns 't."
(buffer-substring (point-min) (point-max)))) (buffer-substring (point-min) (point-max))))
(defun ob-tmux--test () (defun ob-tmux--test ()
"Test if the default setup works. The terminal should shortly flicker." "Test if the default setup works. The terminal should shortly flicker."
(interactive) (interactive)
(let* ((random-string (format "%s" (random 99999))) (let* ((random-string (format "%s" (random 99999)))
(tmpfile (org-babel-temp-file "ob-tmux-test-")) (tmpfile (org-babel-temp-file "ob-tmux-test-"))