Changeset - 474e343b4812
[Not reviewed]
0 1 0
Naoto Yokoyama - 12 years ago 2014-02-28 15:19:39
builtinnya@gmail.com
Fixed the mode-line indicators to be displayed
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/workgroups-functions.el
Show inline comments
 
@@ -1357,104 +1357,104 @@ the form produced by `(car (window-tree))'."
 
        (setq wg-buffer-workgroup workgroup))
 
    (dolist (w (cddr window-or-emacs-window-tree))
 
      (when w (wg-associate-buffers workgroup w)))))
 

	
 
(defun wg-associate-frame-buffers ()
 
  "Associate the buffers visible in the current frame with the
 
current workgroup (unless it is currently being deactivated)."
 
  (wg-awhen (wg-current-workgroup :noerror)
 
    (unless (member it wg-deactivation-list)
 
      (wg-associate-buffers it (car (window-tree))))))
 

	
 
(defun wg-associate-all-frame-buffers ()
 
  "Associate all visible buffers with the current
 
workgroup (unless it is currently being deactivated)."
 
  (mapcar 'wg-associate-frame-buffers (frame-list)))
 

	
 
(defun wg-buffer-predicate (buffer)
 
  "Return t iff the given BUFFER should be considered a candidate
 
for display by `other-buffer' in the current workgroup."
 
  (or (not wg-associate-buffers)
 
      (wg-awhen (wg-current-workgroup :noerror)
 
        (with-current-buffer buffer
 
          (eq wg-buffer-workgroup it)))))
 

	
 
(defun wg-after-make-frame (frame)
 
  (set-frame-parameter frame 'buffer-predicate
 
                       'wg-buffer-predicate))
 

	
 
;;; mode-line
 

	
 
(defun wg-mode-line-buffer-association-indicator (workgroup)
 
  "Return a string indicating `current-buffer's association-type in WORKGROUP."
 
  (cl-case (wg-workgroup-bufobj-association-type workgroup (current-buffer))
 
    (strong wg-mode-line-decor-strongly-associated)
 
    (weak wg-mode-line-decor-weakly-associated)
 
    (otherwise wg-mode-line-decor-unassociated)))
 

	
 
(defun wg-mode-line-string ()
 
  "Return the string to be displayed in the mode-line."
 
  (let ((wg (wg-current-workgroup t))
 
        (wg-use-faces wg-mode-line-use-faces))
 
    (cond (wg (wg-fontify " "
 
                ;;(consp (cons :div wg-mode-line-decor-left-brace))
 
                ;;(keywordp (car (cons :div wg-mode-line-decor-left-brace)))
 
                ;;(:div wg-mode-line-decor-left-brace)
 
                (:brace wg-mode-line-decor-left-brace)
 
                (:mode (wg-workgroup-name wg))
 
                (if (not wg-mode-line-only-name)
 
                    (progn
 
                      (:div wg-mode-line-decor-divider)
 
                    (concat
 
                     (wg-add-face :div wg-mode-line-decor-divider)
 
                     (wg-mode-line-buffer-association-indicator wg)
 
                      (:div wg-mode-line-decor-divider)
 
                     (wg-add-face :div wg-mode-line-decor-divider)
 
                     (if (window-dedicated-p)
 
                         wg-mode-line-decor-window-dedicated
 
                       wg-mode-line-decor-window-undedicated)
 
                      (:div wg-mode-line-decor-divider)
 
                     (wg-add-face :div wg-mode-line-decor-divider)
 
                     (if (wg-session-modified (wg-current-session))
 
                         wg-mode-line-decor-session-modified
 
                       wg-mode-line-decor-session-unmodified)
 
                     (if (wg-workgroup-modified wg)
 
                         wg-mode-line-decor-workgroup-modified
 
                       wg-mode-line-decor-workgroup-unmodified)))
 
                (:brace wg-mode-line-decor-right-brace)))
 
          (t (if wg-display-nowg
 
                 (progn
 
                   (wg-fontify " "
 
                     (:brace wg-mode-line-decor-left-brace)
 
                     (:mode wg-nowg-string)
 
                     (:brace wg-mode-line-decor-right-brace)))
 
               "")))))
 

	
 
(defun wg-add-mode-line-display ()
 
  "Add Workgroups' mode-line format to `mode-line-format'."
 
  (unless (or (assq 'wg-mode-line-display-on mode-line-format)
 
              wg-mode-line-disable)
 
    (let ((format '(wg-mode-line-display-on (:eval (wg-mode-line-string))))
 
          (pos (or (cl-position 'mode-line-position mode-line-format) 10)))
 
      (set-default 'mode-line-format
 
                   (wg-insert-after format mode-line-format pos))
 
      (force-mode-line-update))))
 

	
 
(defun wg-remove-mode-line-display ()
 
  "Remove Workgroups' mode-line format from `mode-line-format'."
 
  (wg-awhen (assq 'wg-mode-line-display-on mode-line-format)
 
    (set-default 'mode-line-format (remove it mode-line-format))
 
    (force-mode-line-update)))
 

	
 

	
 

	
 
;;; messaging
 

	
 
(defun wg-message (format-string &rest args)
 
  "Call `message' with FORMAT-STRING and ARGS.
 
Also save the msg to `wg-last-message'."
 
  (setq wg-last-message (apply #'message format-string args)))
 

	
 
(defmacro wg-fontified-message (&rest format)
 
  "`wg-fontify' FORMAT and call `wg-message' on it."
 
  (declare (indent defun))
 
  `(wg-message (wg-fontify ,@format)))
 

	
 

	
 

	
 
;;; fancy displays
0 comments (0 inline, 0 general)