Refactor narf:build & narf:switch-to-workgroup-at-index

This commit is contained in:
Henrik Lissner 2016-02-26 09:40:49 -05:00
parent 7ea2d45f88
commit 665eec4aea
2 changed files with 11 additions and 7 deletions

View file

@ -20,11 +20,12 @@ If ARG is nil this function calls `recompile', otherwise it calls
(when (null narf--build-command)
(user-error "No build command was set"))
(let ((build-file (cdr narf--build-command))
(build-cmd (car narf--build-command)))
(if (or (null build-file) (narf/project-has-files build-file))
(build-cmd (car narf--build-command))
(default-directory (narf/project-root)))
(if (or (null build-file) (file-exists-p build-file))
(if (symbolp build-cmd)
(call-interactively build-cmd)
(compile (format "cd '%s' && %s" (narf/project-root) (format build-cmd (or arg "")))))
(compile (format build-cmd (or arg ""))))
(error "Could not build!"))))
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;

View file

@ -154,10 +154,13 @@
(defun narf:switch-to-workgroup-at-index (index)
(interactive)
(narf/workgroup-update-names)
(let ((wgs (wg-workgroup-list-or-error)))
(unless (eq (nth index wgs) (wg-current-workgroup t))
(wg-switch-to-workgroup-at-index index)))
(narf/workgroup-display t))
(let ((wg (nth index (wg-workgroup-list-or-error)))
msg)
(if wg
(unless (eq wg (wg-current-workgroup t))
(wg-switch-to-workgroup-at-index index))
(setq msg (format "No tab #%s" (1+ index))))
(narf/workgroup-display t nil msg)))
;;;###autoload
(defun narf/undo-window-change ()