Changeset - 811d54617711
[Not reviewed]
0 2 0
Sergey Pashinin - 12 years ago 2013-09-25 19:28:45
sergey@pashinin.com
new variable wg-mode-line-disable + powerline fix

wg-mode-line-disable is by default (featurep 'powerline)
2 files changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/workgroups-functions.el
Show inline comments
 
@@ -1575,99 +1575,100 @@ for display by `other-buffer' in the current workgroup."
 
  (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."
 
  (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)
 
                wg-mode-line-decor-left-brace
 
                (wg-workgroup-name wg)
 
                (if (not wg-mode-line-only-name)
 
                    (progn
 
                      wg-mode-line-decor-divider
 
                      (wg-mode-line-buffer-association-indicator wg)
 
                      wg-mode-line-decor-divider
 
                      (if (window-dedicated-p)
 
                                 wg-mode-line-decor-window-dedicated
 
                               wg-mode-line-decor-window-undedicated)
 
                      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)))
 
                wg-mode-line-decor-right-brace))
 
          (t (if wg-display-nowg
 
                 (progn
 
                   (wg-fontify " "
 
                     wg-mode-line-decor-left-brace
 
                     wg-nowg-string
 
                     wg-mode-line-decor-right-brace))
 
               "")))))
 

	
 
(defun wg-add-mode-line-display ()
 
  "Add Workgroups' mode-line format to `mode-line-format'."
 
  (unless (assq 'wg-mode-line-display-on 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 (wg-position 'mode-line-position mode-line-format)))
 
          (pos (or (wg-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
 

	
 
;; FIXME: add `wg-display-max-lines' to chop long display strings at max-line
 
;; and element-name boundaries
 

	
 
(defun wg-element-display (elt elt-string &optional current-elt-p previous-elt-p)
 
  "Return display string for ELT."
 
  (cond ((and current-elt-p (funcall current-elt-p elt))
 
         (wg-fontify (:cur (concat wg-list-display-decor-current-left
 
                                   elt-string
 
                                   wg-list-display-decor-current-right))))
 
        ((and previous-elt-p (funcall previous-elt-p elt))
 
         (wg-fontify (:prev (concat wg-list-display-decor-previous-left
 
                                    elt-string
 
                                    wg-list-display-decor-previous-right))))
 
        (t (wg-fontify (:other elt-string)))))
 

	
 
(defun wg-workgroup-display (workgroup index)
 
  "Return display string for WORKGROUP at INDEX."
 
  (if (not workgroup) wg-nowg-string
 
    (wg-element-display
 
     workgroup
src/workgroups-variables.el
Show inline comments
 
@@ -554,96 +554,101 @@ probably don't want to change this.  See
 
Values lower than 1 are invalid."
 
  :type 'integer
 
  :group 'workgroups)
 

	
 
(defcustom wg-morph-vsteps 3
 
  "Rows/iteration to step window edges during `wg-morph'.
 
Values lower than 1 are invalid."
 
  :type 'integer
 
  :group 'workgroups)
 

	
 
(defcustom wg-morph-terminal-hsteps 3
 
  "Used instead of `wg-morph-hsteps' in terminal frames.
 
If nil, `wg-morph-hsteps' is used."
 
  :type 'integer
 
  :group 'workgroups)
 

	
 
(defcustom wg-morph-terminal-vsteps 1
 
  "Used instead of `wg-morph-vsteps' in terminal frames.
 
If nil, `wg-morph-vsteps' is used."
 
  :type 'integer
 
  :group 'workgroups)
 

	
 
(defcustom wg-morph-truncate-partial-width-windows t
 
  "Bound to `truncate-partial-width-windows' during `wg-morph'.
 
Non-nil, this prevents weird-looking continuation line behavior,
 
and can speed up morphing a little.  Lines jump back to their
 
wrapped status when `wg-morph' is complete."
 
  :type 'boolean
 
  :group 'workgroups)
 

	
 

	
 
;; mode-line customization
 

	
 
(defcustom wg-mode-line-display-on t
 
  "Toggles Workgroups' mode-line display."
 
  :type 'boolean
 
  :group 'workgroups
 
  :set (lambda (sym val)
 
         (custom-set-default sym val)
 
         (force-mode-line-update)))
 

	
 
(defcustom wg-mode-line-use-faces nil
 
  "Non-nil means use faces in the mode-line display.
 
It can be tricky to choose faces that are visible in both active
 
and inactive mode-lines, so this feature defaults to off."
 
  :type 'boolean
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-disable (featurep 'powerline)
 
  "Do not do any modeline modifications."
 
  :type 'boolean
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-only-name t
 
  "Display only workgroup name in modeline without any flags."
 
  :type 'boolean
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-left-brace "("
 
  "String displayed at the left of the mode-line display."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-right-brace ")"
 
  "String displayed at the right of the mode-line display."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-divider ":"
 
  "String displayed between elements of the mode-line display."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-strongly-associated
 
  #("@" 0 1 (help-echo "This buffer is strongly associated with the \
 
current workgroup"))
 
  "Indicates that a buffer is strongly associated with the current workgroup."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-weakly-associated
 
  #("~" 0 1 (help-echo "This buffer is weakly associated with the \
 
current workgroup"))
 
  "Indicates that a buffer is weakly associated with the current workgroup."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-unassociated
 
  #("-" 0 1 (help-echo "This buffer is unassociated with the \
 
current workgroup"))
 
  "Indicates that a buffer is unassociated with the current workgroup."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-window-dedicated
 
  #("#" 0 1 (help-echo "This window is dedicated to its buffer."))
 
  "Indicates that the window is dedicated to its buffer."
 
  :type 'string
 
  :group 'workgroups)
 

	
 
(defcustom wg-mode-line-decor-window-undedicated
0 comments (0 inline, 0 general)