   (interactive)
   (message "running erlfmt")
   (when (or (string-match-p "/edt/" (buffer-file-name))
+            (string-match-p "/aefr/" (buffer-file-name))
+            (string-match-p "/aetag/" (buffer-file-name))
+            (string-match-p "/aerta/" (buffer-file-name))
+            (string-match-p "/aefr_eng/" (buffer-file-name))
             (string-match-p "/aecontent/" (buffer-file-name))
+            (string-match-p "/aepublish/" (buffer-file-name))
             (string-match-p "/aewatchdog/" (buffer-file-name))
+            (string-match-p "/aetrigger_eng/" (buffer-file-name))
+            (string-match-p "/ae_search_lib_common/" (buffer-file-name))
             (string-match-p "/aeextend/" (buffer-file-name)))
     (shell-command (concat "rebar3 fmt --write " (buffer-file-name)) nil nil)
     (with-current-buffer (buffer-name)
       (revert-buffer nil t))))
 
+(defun ensure-ends-with-dot (line)
+  "Add . suffix to a line and run in tmux"
+  (setq line
+        (cond ((string-suffix-p "," line) (string-remove-suffix "," line))
+              ((string-suffix-p "." line) (string-remove-suffix "." line))
+              (t line)))
+  (string-trim (concat line ".")))
+
+
 ;;; Tmux automatiion
+(defvar *emamux-last-line*
+  "Last erlang line run")
+
+(defun erl-emamux-copy-last-value ()
+  "Copy the last value from the erlang node connected to the tmux session"
+  (interactive)
+  (emamux-tmux-run-line "ae_erl_scripts:copy(v(-1))."))
+
+(defun erl-emamux-paste-last-value ()
+  "Paste the last value from the erlang node connected to the tmux session"
+  (interactive)
+  (shell-command "AWS_PROFILE=integration AWS_REGION=us-west-2 ~/bin/erl_pbcopy" (current-buffer)))
+
+(defun erl-emamux-forget-binding ()
+  "Forget the variable a the point"
+  (interactive)
+  (emamux-tmux-run-line (format "f(%s)." (string-trim (emamux-get-line)))))
+
+(defun emamux-edt-add-test-post-action ()
+  "Register the current module as an edt_post_action"
+  (interactive)
+  (emamux-tmux-run-line (format "edt_post_action:add({test, %s})." (erlang-module-name))))
+
 (defun erl-emamux-tmux-run-line()
-  "Add . suffix to a line and run in tmux"
-  (interactive)
-  (emamux:send-command
-   (let ((line (emamux-get-line)))
-     (setq line
-           (cond ((string-suffix-p "," line) (string-remove-suffix "," line))
-                 ((string-suffix-p "." line) (string-remove-suffix "." line))
-                 (t line)))
-     (concat line "."))))
+  "Run an erlang expression in the attached tmux console"
+  (interactive)
+  (let ((line (ensure-ends-with-dot (emamux-get-line))))
+    (setq *emamux-last-line* line)
+    (emamux-tmux-run-line line)))
+
+(defun erl-emamux-tmux-rerun-line()
+  "Rerun the last line run using erl-emamux-tmux-run-line "
+  (interactive)
+  (emamux-tmux-run-line *emamux-last-line*))
 
 (define-key erlang-mode-map (kbd "C-j") 'erl-emamux-tmux-run-line)
+(define-key erlang-mode-map (kbd "C-r") 'erl-emamux-tmux-rerun-line)
+(define-key erlang-mode-map (kbd "C-x f") 'erl-emamux-forget-binding)
 
 (defvar edt-docker-container
   nil

         (latest-test-file (car test-files)))
    (message (format "opening: %s" latest-test-file))
    (eww-other-window (to-file-url latest-test-file))))

(defun erl-connect-node (_ node-name)
  "Connect to an erlang node

  (set-window-point
   (get-buffer-window "*call graph*")
   (with-current-buffer (get-buffer "*call graph*") (search-forward "aerta_rules:expand_rta"))))

(defun erl-edt-ct-log-dir ()
  (cond
   ((string-match-p "_checkouts/" (buffer-file-name)) "../../../_build/test/logs")
   ('t "_build/test/logs/")))

(defun erl-eww-open-coverage-file ()
  "open the latest coverage file for a common test case"
  (interactive)
  (let* ((ct-log-dir (erl-edt-ct-log-dir))
         (module (erlang-module-name))
         (latest-test-dir (car (reverse (directory-files ct-log-dir nil "ct_run.")))))
    (eww-open-file (format "%s/%s/%s.COVER.html" ct-log-dir latest-test-dir module))))
