      (if (get-buffer ,name) (switch-to-buffer ,name)
        (shell-named ,name))))
 
-(defmacro hot-file (name)
-  `(lambda () (interactive) (find-file ,name)))
-
 (defmacro hot-buffer (name)
   `(lambda () (interactive) (switch-to-buffer ,name)))
-
-(defmacro hot-text (x)
-  `(lambda () (interactive) (insert ,x)))
 
 (global-set-key [(meta ?1)] (hot-shell "*shell1*"))
 (global-set-key [(meta ?2)] (hot-shell "*shell2*"))

(global-set-key [(meta ?9)] (hot-shell "*shell9*"))
(global-set-key [(meta ?0)] (hot-shell "*shell0*"))

(define-key osx-key-mode-map [(alt /) ?s] (hot-buffer "*scratch*"))
(define-key osx-key-mode-map [(alt /) ?e] (hot-file "~/Library/Preferences/Aquamacs Emacs/Preferences.el"))
(define-key osx-key-mode-map [(alt /) ?b] (hot-file "~/.bashrc"))

(define-key osx-key-mode-map [(alt \\) ?T] 'tramp-cleanup-all-connections)

(define-key osx-key-mode-map [(alt j)] 'jump-to-register)
(define-key osx-key-mode-map [(alt k)] 'point-to-register)

(define-key osx-key-mode-map [(alt \\) ?k] 'keep-lines)
(define-key osx-key-mode-map [(alt \\) ?d] 'delete-matching-lines)

(define-key osx-key-mode-map [(alt \\) ?t] 'toggle-truncate-lines)

(define-key osx-key-mode-map [(alt r)] 'revert-buffer)
(define-key osx-key-mode-map [(alt q)] 'erase-buffer)

(define-key osx-key-mode-map [(alt \()] 'kmacro-start-macro)
(define-key osx-key-mode-map [(alt \))] 'kmacro-end-macro)
(define-key osx-key-mode-map [(alt \\) ?a] 'apply-macro-to-region-lines)

(setq comint-process-echoes t)
(put 'erase-buffer 'disabled nil)

(defun duplicate-line ()
  (interactive)
  (let ((text (buffer-substring (line-beginning-position) (line-end-position))))

    (insert text)))
(define-key osx-key-mode-map [(alt p)] 'duplicate-line)

;; time stamp
(defun insert-day-stamp ()
  (interactive "*")
  (insert (format-time-string "%Y-%m-%d" (current-time))))
