 ;;; term-conf.el -- Settings for term-mode.
+;;; Commentary:
+;;; Code:
+(eval-when-compile
+  (require 'term))
 
-(eval-when-compile
-  (require 'term)
-  (require 'projectile)
-  (require 'elscreen))
+;; Dependencies:
+(require 'projectile)
+(require 'elscreen)
+
+;; Remove some warnings:
+(defvar pjones:z-map nil "Defined in keys.el.")
 
 ;; Settings for term-mode:
 (custom-set-variables

    (goto-char (process-mark proc))))

(defun pjones:term-send-control-c ()
  "Send a C-c to the terminal."
  (interactive)
  (term-send-raw-string (make-string 1 ?\C-c)))

(defun pjones:remove-dead-term (&rest args)
  "Clean up after a dead terminal."
  (let ((buffer (current-buffer)))
    (kill-buffer buffer)))

(defun pjones:term-quoted-insert (count)
  "Read next input character and send it directly to the terminal."
  (interactive "*p")
  (let ((char (read-char)))
    (term-send-raw-string (make-string count char))))

(defun pjones:term-mode-hook ()
  "Hook run after a terminal starts"

  ;; Some variables that term-mode doesn't initialize but uses :(
  (setq term-ansi-at-dir default-directory
        term-ansi-at-host (system-name)
        term-ansi-at-user (user-real-login-name))

  ;; Variables for configuration:
  (setq term-prompt-regexp "❯ "
        mode-line-format '("  " mode-line-buffer-identification
                           "    [term" mode-line-process "]"))

  ;; Keep things Emacs-like:
  (term-set-escape-char ?\C-x)

 '(term-input-ignoredups nil)
 '(term-scroll-to-bottom-on-output nil)
 '(term-scroll-show-maximum-output nil)

 ;; WARNING: setting this to `t' triggers a bug where the shell will
 ;; barf text all over the screen.
 '(term-suppress-hard-newline nil))

(defun pjones:term-rename ()
  "Rename a terminal using the current project name."
