dotfiles

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

commit 27c0223cece3c1cbd4b9c060f36545e45d03e591
parent 651e8297d75fa150555107fe1682995866093d4f
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Thu, 20 Dec 2018 19:54:29 +0100

Add binding to compile from project root folder

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

diff --git a/.emacs b/.emacs @@ -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)