Refactor narf:build & narf:switch-to-workgroup-at-index
This commit is contained in:
parent
7ea2d45f88
commit
665eec4aea
2 changed files with 11 additions and 7 deletions
|
@ -20,11 +20,12 @@ If ARG is nil this function calls `recompile', otherwise it calls
|
||||||
(when (null narf--build-command)
|
(when (null narf--build-command)
|
||||||
(user-error "No build command was set"))
|
(user-error "No build command was set"))
|
||||||
(let ((build-file (cdr narf--build-command))
|
(let ((build-file (cdr narf--build-command))
|
||||||
(build-cmd (car narf--build-command)))
|
(build-cmd (car narf--build-command))
|
||||||
(if (or (null build-file) (narf/project-has-files build-file))
|
(default-directory (narf/project-root)))
|
||||||
|
(if (or (null build-file) (file-exists-p build-file))
|
||||||
(if (symbolp build-cmd)
|
(if (symbolp build-cmd)
|
||||||
(call-interactively 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!"))))
|
(error "Could not build!"))))
|
||||||
|
|
||||||
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
|
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -154,10 +154,13 @@
|
||||||
(defun narf:switch-to-workgroup-at-index (index)
|
(defun narf:switch-to-workgroup-at-index (index)
|
||||||
(interactive)
|
(interactive)
|
||||||
(narf/workgroup-update-names)
|
(narf/workgroup-update-names)
|
||||||
(let ((wgs (wg-workgroup-list-or-error)))
|
(let ((wg (nth index (wg-workgroup-list-or-error)))
|
||||||
(unless (eq (nth index wgs) (wg-current-workgroup t))
|
msg)
|
||||||
(wg-switch-to-workgroup-at-index index)))
|
(if wg
|
||||||
(narf/workgroup-display t))
|
(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
|
;;;###autoload
|
||||||
(defun narf/undo-window-change ()
|
(defun narf/undo-window-change ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue