 ;;;;;;;;;;;;;;
 
 (custom-set-variables
- '(speedbar-show-unknown-files t)) ; Show unknown file types in speedbar as well
+ '(speedbar-show-unknown-files t))
+;; Show unknown file types in speedbar as well
 
 ;; no startup msg  
 (setq inhibit-startup-message t)   ; Disable startup message


(setq make-project-args "")
(defun make-project ()
  "Run make. Automatically searches for a dixrectory containing a Makefile first"
  (interactive)
  (let ((orig-dir (parent-directory (expand-file-name (buffer-file-name)))))
    (let ((make-dir (find-dir-containing orig-dir "Makefile")))

(add-hook 'racer-mode-hook #'eldoc-mode)
(add-hook 'racer-mode-hook #'company-mode)

(setq my-cargo-args "")
(defun cargo-args-prompt ()
  "Run cargo build after modifying the arguments to the command."
  (interactive)
  (setq my-cargo-args (read-from-minibuffer "cargo args: "
                                                my-cargo-args))
  (setq cargo-process--command-build (concat "build " my-cargo-args))
  (setq cargo-process--command-run (concat "run " my-cargo-args))
  (setq cargo-process--command-check (concat "check " my-cargo-args))
  (setq cargo-process--command-clippy (concat "clippy " my-cargo-args)))

(require 'rust-mode)
(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
;(define-key toml-mode-map [f5] #'cargo-process-build)
;(define-key toml-mode-map [(shift f5)] #'cargo-process-run)
(define-key rust-mode-map [f5] #'cargo-process-build)
(define-key rust-mode-map [(shift f5)] #'cargo-args-prompt)
(define-key rust-mode-map [f6] #'cargo-process-run)
(define-key rust-mode-map [f7] #'cargo-process-clippy)
(define-key rust-mode-map [f8] #'cargo-process-check)
(setq company-tooltip-align-annotations t)

(setq company-idle-delay .3)
