(defvar dojo-core-window-js-mode-line-string "" "The custom mode line string used for js windows.") (defun dojo-core-window-initialize-side-windows () ; (let* ((symbol-buffer (get-buffer-create "*Symbols*")) ; (symbols-window (display-buffer-in-side-window ; symbol-buffer ; '((:side bottom) ; (:slot 0) ; (:window-height fit-window-to-buffer))))) ; (set-window-parameter symbols-window 'no-delete-other-windows t))) (let* ((parameters '(window-parameters . ((no-delete-other-windows . t))))) (setq display-buffer-alist `(("\\*Symbols\\*" display-buffer-in-side-window (side . bottom) (slot . 0) (window-height . fit-window-to-buffer) ,parameters) ("\\**Log\\*" display-buffer-in-side-window (side . bottom) (slot . 0) (window-height . 0.5) ,parameters) ("\\*Tree\\*" display-buffer-in-side-window (side . right) (slot . 0) (window-width . 50) ; See also dojo-js-tree, regarding window-width ,parameters) ) ) )) (defun dojo-core-window-get-symbols-buffer () (let* ((symbols-buffer (get-buffer-create "*Symbols*"))) (if (not dojo-js-symbols-activated) (with-current-buffer symbols-buffer (dojo-symbols-mode))) symbols-buffer)) (defun dojo-core-window-show-symbols-buffer () (interactive) (dojo-core-window-delete-side-windows) (let* ((symbols-buffer (dojo-core-window-get-symbols-buffer))) (display-buffer symbols-buffer) symbols-buffer)) (defun dojo-core-window-get-tree-buffer () (let* ((tree-buffer (get-buffer-create "*Tree*"))) (if (not dojo-js-tree-activated) (with-current-buffer tree-buffer (dojo-tree-mode))) tree-buffer)) (defun dojo-core-window-show-tree-buffer () (interactive) (dojo-core-window-delete-side-windows) (let* ((tree-buffer (dojo-core-window-get-tree-buffer))) (display-buffer tree-buffer) tree-buffer)) (defun dojo-core-window-show-log-buffer (buffer) (interactive "bLog buffer: ") (dojo-core-window-delete-side-windows) (display-buffer (get-buffer-create buffer))) (defun dojo-core-window-show-api-log () (interactive) (dojo-core-window-show-log-buffer "*Js API Log*")) (defun dojo-core-window-show-assignments-log () (interactive) (dojo-core-window-show-log-buffer "*Extract Assignments Log*")) (defun dojo-core-window-show-blueprint-completion-log () (interactive) (dojo-core-window-show-log-buffer "*Blueprint Completion Log*")) (defun dojo-core-window-show-blueprint-parse-log () (interactive) (dojo-core-window-show-log-buffer "*Blueprint Parse Log*")) (defun dojo-core-window-show-completion-log () (interactive) (dojo-core-window-show-log-buffer "*Completion Generation Log*")) (defun dojo-core-window-show-css-log () (interactive) (dojo-core-window-show-log-buffer "*CSS Log*")) (defun dojo-core-window-show-data-log () (interactive) (dojo-core-window-show-log-buffer "*Data Log*")) (defun dojo-core-window-show-dependency-log () (interactive) (dojo-core-window-show-log-buffer "*Dependency Log*")) (defun dojo-core-window-show-extract-log () (interactive) (dojo-core-window-show-log-buffer "*Extract Js Log*")) (defun dojo-core-window-show-extract-prio-log () (interactive) (dojo-core-window-show-log-buffer "*Prio Log*")) (defun dojo-core-window-show-i18n-log () (interactive) (dojo-core-window-show-log-buffer "*I18n Log*")) (defun dojo-core-window-show-indentation-log () (interactive) (dojo-core-window-show-log-buffer "*Indendation Log*")) (defun dojo-core-window-show-inspect-log () (interactive) (dojo-core-window-show-log-buffer "*Inspect Log*")) (defun dojo-core-window-show-java-log () (interactive) (dojo-core-window-show-log-buffer "*Java Log*")) (defun dojo-core-window-show-key-log () (interactive) (dojo-core-window-show-log-buffer "*Key Log*")) (defun dojo-core-window-show-load-log () (interactive) (dojo-core-window-show-log-buffer "*Load Log*")) (defun dojo-core-window-show-save-log () (interactive) (dojo-core-window-show-log-buffer "*Save Log*")) (defun dojo-core-window-show-tree-log () (interactive) (dojo-core-window-show-log-buffer "*Tree Log*")) (defun dojo-core-window-show-user-log () (interactive) (dojo-core-window-show-log-buffer "*User Log*")) (defun dojo-core-window-show-workspace-log () (interactive) (dojo-core-window-show-log-buffer "*Workspace Inspection Log*")) (defun dojo-core-window-show-workspace-details-log () (interactive) (dojo-core-window-show-log-buffer "*Workspace Detail Log*")) (defun dojo-core-window-show-workloop-log () (interactive) (dojo-core-window-show-log-buffer "*Workloop Log*")) (defun dojo-core-window-delete-side-windows () (interactive) (dolist (window (window-list)) (let* ((window-side (window-parameter window 'window-side))) (if window-side (delete-window window))))) (defun dojo-core-window-adjust-buffer-side-window-height (&optional buffer max-height) (interactive) (if (null buffer) (setq buffer (current-buffer))) (let* ((window-list (get-buffer-window-list buffer))) (dolist (window window-list) (let* ((window-side (window-parameter window 'window-side))) (if window-side (progn (fit-window-to-buffer window max-height) (goto-char 0) )))))) (defun dojo-core-window-update-js-mode-line () (let* ((uwsgi-project dojo-uwsgi-project) (workspace-timer dojo-process-workspace-timer) (priority-string (dojo-core-window-get-mode-line-priority-string))) (setq dojo-core-window-js-mode-line-string (concat (if (null workspace-timer) "timer:off " "timer:on ") (if (null uwsgi-project) "uwsgi:off " (concat "uwsgi:" uwsgi-project " ")) priority-string)))) (defun dojo-core-window-get-mode-line-priority-string () (let* ((priority-to-resource-to-count (dojo-workspace-priority-to-resource-to-count dojo-current-workspace)) (result-string "prio:(") (priority-list ()) (token-count 0) (surplus-tokens 0)) (maphash (lambda (priority resource-to-count) (push (list priority (hash-table-count resource-to-count)) priority-list)) priority-to-resource-to-count) (setq priority-list (sort priority-list (lambda (list-one list-two) (< (nth 0 list-one) (nth 0 list-two))))) (dolist (priority-list-item priority-list) (let* ((priority (nth 0 priority-list-item)) (resource-count (nth 1 priority-list-item))) (if (< token-count 3) (setq result-string (concat result-string (format "%s%s=%s" (if (= token-count 0) "" " ") (number-to-string priority) resource-count))) (setq surplus-tokens (+ surplus-tokens resource-count))) (incf token-count))) (if (> surplus-tokens 0) (setq result-string (concat result-string (format " >=%s" surplus-tokens)))) (setq result-string (concat result-string ")")) result-string)) (defun dojo-core-window-trigger-redisplay () "Trigger (redisplay), but only if dojo-redisplay-interval has elapsed since the last time we did this using this function." (let* ((current-time (float-time))) (if (or (null dojo-last-redisplay-tist) (> current-time (+ dojo-last-redisplay-tist dojo-redisplay-interval))) (progn (setq dojo-last-redisplay-tist current-time) (redisplay))))) (provide 'dojo-core-window)