Added: recursivly find build and start command
This commit is contained in:
parent
1422b94e7a
commit
d7a1224578
|
|
@ -49,8 +49,6 @@
|
||||||
(startup-redirect-eln-cache
|
(startup-redirect-eln-cache
|
||||||
(convert-standard-filename rhjr/paths/eln-cache)))
|
(convert-standard-filename rhjr/paths/eln-cache)))
|
||||||
|
|
||||||
(load-theme 'misterioso)
|
|
||||||
|
|
||||||
;;; rhjr/defaults
|
;;; rhjr/defaults
|
||||||
(setq-default
|
(setq-default
|
||||||
initial-major-mode 'text-mode
|
initial-major-mode 'text-mode
|
||||||
|
|
@ -234,12 +232,16 @@
|
||||||
;;; rhjr/programming
|
;;; rhjr/programming
|
||||||
(defconst rhjr/c-style
|
(defconst rhjr/c-style
|
||||||
`((c-basic-offset . 2)
|
`((c-basic-offset . 2)
|
||||||
|
(c-hanging-braces-alist . ((defun-open)))
|
||||||
(c-offsets-alist .((statement . 0)
|
(c-offsets-alist .((statement . 0)
|
||||||
(statement-cont . 0)
|
(statement-cont . 0)
|
||||||
(substatement-open . 0)
|
(substatement-open . 0)
|
||||||
(arglist-intro . 2)
|
(arglist-intro . 2)
|
||||||
(case-label . 2)
|
(case-label . 2)
|
||||||
(label . 0)))))
|
(label . 0)
|
||||||
|
|
||||||
|
;; functions
|
||||||
|
(func-decl-cont . 0)))))
|
||||||
|
|
||||||
(defun rhjr/set-c-style ()
|
(defun rhjr/set-c-style ()
|
||||||
""
|
""
|
||||||
|
|
@ -255,6 +257,51 @@
|
||||||
(setq-default show-trailing-whitespace t)
|
(setq-default show-trailing-whitespace t)
|
||||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||||
|
|
||||||
|
;;rhjr/comp
|
||||||
|
(setq compilation-directory-locked nil)
|
||||||
|
|
||||||
|
(defun find-project-directory-recursive (command)
|
||||||
|
"Recursively search upward until COMMAND exists."
|
||||||
|
(if (file-exists-p command)
|
||||||
|
t
|
||||||
|
(let ((parent (file-name-directory (directory-file-name default-directory))))
|
||||||
|
(unless (or (null parent) (string= parent default-directory))
|
||||||
|
(cd parent)
|
||||||
|
(find-project-directory-recursive command)))))
|
||||||
|
|
||||||
|
(defun lock-compilation-directory ()
|
||||||
|
(interactive)
|
||||||
|
(setq compilation-directory-locked t)
|
||||||
|
(message "Compilation directory is locked."))
|
||||||
|
|
||||||
|
(defun unlock-compilation-directory ()
|
||||||
|
(interactive)
|
||||||
|
(setq compilation-directory-locked nil)
|
||||||
|
(message "Compilation directory is roaming."))
|
||||||
|
|
||||||
|
(defun find-project-directory (command)
|
||||||
|
(let ((start-dir default-directory))
|
||||||
|
(switch-to-buffer-other-window "*compilation*")
|
||||||
|
(if compilation-directory-locked
|
||||||
|
(cd last-compilation-directory)
|
||||||
|
(cd start-dir)
|
||||||
|
(find-project-directory-recursive command)
|
||||||
|
(setq last-compilation-directory default-directory))))
|
||||||
|
|
||||||
|
(defun run-project-command (command)
|
||||||
|
"Run COMMAND from the project root without prompting."
|
||||||
|
(interactive)
|
||||||
|
(find-project-directory command)
|
||||||
|
(compile command)
|
||||||
|
(other-window 1))
|
||||||
|
|
||||||
|
(global-set-key [f1] (lambda () (interactive)
|
||||||
|
(run-project-command "./build.sh")))
|
||||||
|
|
||||||
|
(global-set-key [f2] (lambda () (interactive)
|
||||||
|
(run-project-command "./start.sh")))
|
||||||
|
|
||||||
|
|
||||||
;;rhjr/fix
|
;;rhjr/fix
|
||||||
(setq minibuffer-prompt-properties ;; cursor in minibuffer-prompt
|
(setq minibuffer-prompt-properties ;; cursor in minibuffer-prompt
|
||||||
'(read-only t cursor-intangible t face minibuffer-prompt))
|
'(read-only t cursor-intangible t face minibuffer-prompt))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user