Changeset - 60f558557e46
[Not reviewed]
0 2 0
Sergey Pashinin - 12 years ago 2013-06-29 10:46:07
sergey@pashinin.com
removed incorrect "fontify"- syntax
2 files changed with 42 insertions and 31 deletions:
0 comments (0 inline, 0 general)
Makefile
Show inline comments
 
@@ -7,6 +7,8 @@ TRAVIS_FILE = .travis.yml
 

	
 
# Compile with noninteractive and relatively clean environment.
 
BATCHFLAGS = -batch -q --no-site-file
 

	
 
test:
 
	${EMACS} -L src $(BATCHFLAGS) -f batch-byte-compile $(TEST_DIR)/*.el
 
# wg-mode-line-string
 
	${EMACS} -L src -batch -l workgroups-functions.el --eval '(message (wg-mode-line-string))'
src/workgroups-functions.el
Show inline comments
 
@@ -46,19 +46,24 @@ FACEKEY must be a key in `wg-face-abbrevs'."
 

	
 
(defmacro wg-fontify (&rest specs)
 
  "A small fontification DSL.
 
The results of all SPECS are `concat'd together.
 
If a spec is a cons with a keyword car, apply `wg-add-face' to it.
 
Other conses get evaluated, and should produce a strings.
 
It a spec is a string it is used unmodified.
 
If a spec is a string it is used unmodified.
 
Anything else is formatted with %s to produce a string."
 
  (declare (indent defun))
 
  `(concat
 
    ,@(wg-docar (spec specs)
 
        (cond ((and (consp spec) (keywordp (car spec)))
 
        (cond ((and (consp spec)
 
                    (keywordp (car spec)))
 
               `(wg-add-face ,@spec))
 
              ;;((listp spec) (cdr (eval spec)))
 
              ;;((listp spec)
 
              ;; ;;(prin1-to-string (nth 1 (eval spec)))
 
              ;; )
 
              ((consp spec) spec)
 
              ((stringp spec) spec)
 
              (t `(format "%s" ,spec))))))
 

	
 
(defun wg-barf-on-active-minibuffer ()
 
  "Throw an error when the minibuffer is active."
 
@@ -1578,36 +1583,39 @@ for display by `other-buffer' in the current workgroup."
 

	
 
(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 " "
 
                (:div wg-mode-line-decor-left-brace)
 
                (:mode (wg-workgroup-name wg))
 
                ;;(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
 
                      (:div wg-mode-line-decor-divider)
 
                      (:mode (wg-mode-line-buffer-association-indicator wg))
 
                      (:div wg-mode-line-decor-divider)
 
                      (:mode (if (window-dedicated-p)
 
                      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))
 
                      (:div wg-mode-line-decor-divider)
 
                      (:mode (if (wg-session-modified (wg-current-session))
 
                               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))
 
                      (:mode (if (wg-workgroup-modified wg)
 
                                 wg-mode-line-decor-workgroup-modified
 
                               wg-mode-line-decor-workgroup-unmodified))))
 
                (:div wg-mode-line-decor-right-brace)))
 
                               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 " "
 
                     (:div wg-mode-line-decor-left-brace)
 
                     (:mode wg-nowg-string)
 
                     (:div wg-mode-line-decor-right-brace)))
 
                     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)
 
    (let ((format '(wg-mode-line-display-on (:eval (wg-mode-line-string))))
 
@@ -1722,39 +1730,40 @@ current and previous workgroups."
 
   (if wg-center-rotate-buffer-list-display
 
       (wg-center-rotate-list buffer-list) buffer-list)))
 

	
 
(defun wg-buffer-list-filter-display (&optional workgroup blf-id)
 
  "Return a buffer-list-filter display string from WORKGROUP and BLF-ID."
 
  (wg-fontify
 
    (:div "(")
 
    (:msg (wg-workgroup-name (wg-get-workgroup workgroup)))
 
    (:div ":")
 
    (:msg (wg-get-buffer-list-filter-val blf-id 'indicator))
 
    (:div ")")))
 
    "("
 
    (wg-workgroup-name (wg-get-workgroup workgroup))
 
    ":"
 
    (wg-get-buffer-list-filter-val blf-id 'indicator)
 
    ")"))
 

	
 
(defun wg-buffer-list-filter-prompt (prompt &optional workgroup blf-id)
 
  "Return a prompt string from PROMPT indicating WORKGROUP and BLF-ID."
 
  (wg-fontify
 
    (:cmd prompt) " "
 
    prompt " "
 
    (wg-buffer-list-filter-display workgroup blf-id)
 
    (:msg ": ")))
 
    ": "))
 

	
 
(defun wg-buffer-command-display (&optional buffer-list)
 
  "Return the buffer command display string."
 
  (concat
 
   (wg-buffer-list-filter-display) ": "
 
   (wg-buffer-list-display (or buffer-list (wg-filtered-buffer-list)))))
 

	
 
(defun wg-timeline-display (position length)
 
  "Return a timeline visualization string from POSITION and LENGTH."
 
  (wg-fontify
 
    (:div "-<{")
 
    (:other (wg-make-string (- length position) "-" "="))
 
    (:cur "O")
 
    (:other (wg-make-string (1+ position) "-" "="))
 
    (:div "}>-")))
 
    ;;(cons :div "-<{")
 
    "-<{"
 
    (wg-make-string (- length position) "-" "=")
 
    "O"
 
    (wg-make-string (1+ position) "-" "=")
 
    "}>-"))
 

	
 
(defun wg-undo-timeline-display (workgroup)
 
  "Return WORKGROUP's undo timeline string."
 
  (wg-with-undo workgroup (state undo-pointer undo-list)
 
    (wg-timeline-display undo-pointer (length undo-list))))
 

	
0 comments (0 inline, 0 general)