         (narf:workgroup-delete))
     (evil-window-delete)))
 
+;;;###autoload
+(defun narf/wg-autosave ()
+  (when (wg-current-session t)
+    (shut-up! (wg-save-session))))
 
 (provide 'defuns-workgroup)
 ;;; defuns-workgroup.el ends here

    (unless (memq wg narf-wg-names)
      (ignore-errors
        (let ((old-name (wg-workgroup-name wg))
              (base (f-filename (buffer-file-name))))
          (unless (string= base old-name)
            (wg-rename-workgroup base wg)))))))

;;;###autoload (autoload 'narf:switch-to-workgroup-left "defuns-workgroup" nil t)
(evil-define-command narf:switch-to-workgroup-left (count)
  (interactive "<c>")
  (narf/workgroup-update-names)
  (if count
      (wg-switch-to-workgroup-at-index (1- count))
    (wg-switch-to-workgroup-left))
  (narf/workgroup-display t))

;;;###autoload (autoload 'narf:switch-to-workgroup-right "defuns-workgroup" nil t)
(evil-define-command narf:switch-to-workgroup-right (count)
  (interactive "<c>")
  (narf/workgroup-update-names)
  (if count
      (wg-switch-to-workgroup-at-index (1- count))
    (wg-switch-to-workgroup-right))
  (narf/workgroup-display t))

;;;###autoload
(defun narf:switch-to-workgroup-at-index (index)

                   (wg-workgroup-list))))
      (if return-p
          output
        (message "%s%s" output (or message ""))))))

;;;###autoload
(defun narf/workgroup-update-names (&optional wg)
