Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'remotes/stsquad/compile-history' into c…

…ompile-history-merge
  • Loading branch information...
commit 4e83aa73b88f1ce0d63f69a8288344e957ca8e50 2 parents 61e4a67 + 1e1761d
@jrockway authored
Showing with 70 additions and 8 deletions.
  1. +70 −0 contrib/eproject-compile.el
  2. +0 −8 eproject-extras.el
View
70 contrib/eproject-compile.el
@@ -0,0 +1,70 @@
+;;; eproject-compile.el --- eproject compilation extensions
+
+;; Copyright (C) 2009 Jonathan Rockway
+;; (C) 2012 Alex Bennée
+
+;; Author: Jonathan Rockway <jon@jrock.us>
+;; Keywords: eproject
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This extension to eproject adds the ability to compile projects
+;; using meta-data defined in your project. For example:
+;;
+;; (define-project-type rockbox
+;; (generic-git)
+;; (look-for "../rockbox.git/rbutil")
+;; :common-compiles ("make" "make install" "make fullzip"))
+;;
+;; Now when you you call eproject-compile you will be presented with
+;; a prompt with history pre-filled with your favourite compile sequences.
+
+;;; Code:
+
+(require 'eproject)
+
+; Build and maintain a compile-history for each project root
+(defun* eproject--build-new-history (&optional (buffer (current-buffer)))
+ "Return a list of potential compile commands suitable for use as a
+compile history"
+ (eproject--do-in-buffer
+ (buffer)
+ (let ((potential-compiles (eproject-attribute :common-compiles))
+ (new-compile-history (list ())))
+ (if potential-compiles
+ (mapcar
+ '(lambda (c)
+ (format "cd %s && %s" (eproject-root) c))
+ potential-compiles)
+ (list (format "cd %s && make -k" (eproject-root)))))))
+
+;;;###autoload
+(defun eproject-compile ()
+ "Run `compile' in the project root. This uses a computed history
+based on any eproject settings as well as existing compile-history
+and finally compile-command which may have been locally set by a
+mode."
+ (interactive)
+ (let* ((default-directory (eproject-root))
+ (ehistory (append (eproject--build-new-history) compile-history))
+ (ecompile (read-shell-command
+ "eCompile command: " compile-command 'ehistory)))
+ (compile ecompile)))
+
+(define-key eproject-mode-map (kbd "C-c C-k") #'eproject-compile)
+
+(provide 'eproject-compile)
+;;; eproject-compile.el ends here
View
8 eproject-extras.el
@@ -294,16 +294,8 @@ With the prefix arg LOOK-IN-INVISIBLE-BUFFERS looks in buffers that are not curr
eshell-buffer))))) ;; returns eshell-buf so you can focus
;; the window if you want
-;;;###autoload
-(defun eproject-compile ()
- "Run `compile-command' in the project root."
- (interactive)
- (let ((default-directory (eproject-root)))
- (call-interactively #'compile)))
-
(define-key eproject-mode-map (kbd "C-c C-f") #'eproject-find-file)
(define-key eproject-mode-map (kbd "C-c C-b") #'eproject-ibuffer)
-(define-key eproject-mode-map (kbd "C-c C-k") #'eproject-compile)
(provide 'eproject-extras)
;;; eproject-extras.el ends here
Please sign in to comment.
Something went wrong with that request. Please try again.