From 38abbb97cc3de9768b1b8fe8c8da20141087b944 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sat, 7 Dec 2019 14:50:01 +0100 Subject: Add a bunch of project-wide commands As well as a function to generate them. --- .emacs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to '.emacs') 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) -- cgit v1.2.3