summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs17
1 files changed, 11 insertions, 6 deletions
diff --git a/.emacs b/.emacs
index dcc0a7d..ef76191 100644
--- a/.emacs
+++ b/.emacs
@@ -101,6 +101,14 @@
(call-process-shell-command command nil t)
(kill-new (buffer-string))))
+(defun my/make-project-wide (f)
+ "Make a function which will run F from the project's root directory."
+ (lambda ()
+ (:documentation (format "Run `%s' from the project's root directory." f))
+ (interactive)
+ (let ((default-directory (my/project-root)))
+ (call-interactively f))))
+
(global-set-key (kbd "C-c c") 'compile)
(global-set-key (kbd "C-c e f") 'auto-fill-mode)
(global-set-key (kbd "C-c i t") (my/make-toggle-input-method 'TeX))
@@ -109,7 +117,9 @@
(global-set-key (kbd "C-c k |") 'my/kill-ring-pipe-region)
(global-set-key (kbd "C-c k !") 'my/kill-ring-shell)
(global-set-key (kbd "C-c m") 'man)
-(global-set-key (kbd "C-c p c") 'my/project-compile)
+(global-set-key (kbd "C-c p c") (my/make-project-wide 'compile))
+(global-set-key (kbd "C-c p !") (my/make-project-wide 'shell-command))
+(global-set-key (kbd "C-c p &") (my/make-project-wide 'async-shell-command))
(global-set-key (kbd "C-c p f") 'project-find-file)
(global-set-key (kbd "C-c t") 'toggle-truncate-lines)
(global-set-key (kbd "C-c v") 'visual-line-mode)
@@ -332,11 +342,6 @@
(let ((project (my/project-name)))
(concat (when project (format "[%s] " project)) "%b")))))
-(defun my/project-compile ()
- (interactive)
- (let ((default-directory (my/project-root)))
- (call-interactively 'compile)))
-
(setq-default paragraph-start (concat "[ ]*- \\|" paragraph-start))
;; TODO: decruftify mode-line (e.g. remove superflous parens)