dotfiles

🎜 Clone'em, tweak'em, stick'em in your $HOME 🎝
git clone https://git.kevinlegouguec.net/dotfiles
Log | Files | Refs | README

commit 38abbb97cc3de9768b1b8fe8c8da20141087b944
parent 507426a6c981cf64529687f70b91bb005a112572
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Sat,  7 Dec 2019 14:50:01 +0100

Add a bunch of project-wide commands

As well as a function to generate them.

Diffstat:
M.emacs | 17+++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git 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)