diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2018-12-20 19:54:29 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2018-12-20 19:54:29 +0100 |
| commit | 27c0223cece3c1cbd4b9c060f36545e45d03e591 (patch) | |
| tree | 6752d8718cac46236e8fad58bac7c4f4aa2b8d16 /.emacs | |
| parent | 651e8297d75fa150555107fe1682995866093d4f (diff) | |
| download | dotfiles-27c0223cece3c1cbd4b9c060f36545e45d03e591.tar.xz | |
Add binding to compile from project root folder
Diffstat (limited to '.emacs')
| -rw-r--r-- | .emacs | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -44,6 +44,7 @@ (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 f") 'project-find-file) (global-set-key (kbd "C-c t") 'toggle-truncate-lines) (global-set-key (kbd "C-c v") 'visual-line-mode) @@ -277,9 +278,12 @@ ;; Font stuff (🤷 🤦) (set-fontset-font "fontset-default" nil (font-spec :name "Symbola") nil 'append) +(defun my/project-root () + (when-let ((project (project-current))) + (car (project-roots project)))) + (defun my/project-name () - (when-let* ((project (project-current)) - (root (car (project-roots project)))) + (when-let* ((root (my/project-root))) (when (not (file-equal-p root "~")) (file-name-nondirectory (string-trim-right root "/"))))) @@ -289,5 +293,10 @@ (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))) + ;; TODO: fringe fun: hideshowvis, git gutter… ;; TODO: decruftify mode-line (e.g. remove superflous parens) |
