Skip to content

Commit

Permalink
Add Powerline support to the tracking package.
Browse files Browse the repository at this point in the history
When the Powerline package is used, instead of modifying the
`mode-line-format', the mode-line needs to be updated in
`global-mode-string'.

Updated the documentation for tracking-position to indicate this
behavior.

Fixes #137.
  • Loading branch information
travisbhartwell committed Aug 19, 2015
1 parent 103648c commit 052f5ca
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tracking.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ see there for further explanation."
(defcustom tracking-position 'before-modes
"Where tracked buffers should appear in the mode line.
However, if powerline is enabled, the buffers are added to `global-mode-string' and
placed as specified in the powerline theme.
'before-modes
Before the mode indicators
'after-modes
After the mode indicators
'end
At the end of the mode line"
:type '(choice (const :tag "Before the Mode Indicators" before-modes)
(const :tag "Afterthe Mode Indicators" after-modes)
(const :tag "After the Mode Indicators" after-modes)
(const :tag "At the End of the Mode Line" end))
:group 'tracking)

Expand Down Expand Up @@ -159,6 +162,12 @@ line. The user can cycle through them using
(cond
(tracking-mode
(cond
((featurep 'powerline)
(when (not global-mode-string)
(setq global-mode-string '("")))
(when (not (memq 'tracking-mode-line-buffers global-mode-string))
(setq global-mode-string
(append global-mode-string '(tracking-mode-line-buffers)))))
((eq tracking-position 'before-modes)
(let ((head nil)
(tail (default-value 'mode-line-format)))
Expand Down Expand Up @@ -187,10 +196,13 @@ line. The user can cycle through them using
(add-hook 'window-configuration-change-hook
'tracking-remove-visible-buffers))
(t
(setq mode-line-misc-info (delq 'tracking-mode-line-buffers
mode-line-misc-info))
(setq-default mode-line-format (delq 'tracking-mode-line-buffers
(default-value 'mode-line-format)))
(if (featurep 'powerline)
(setq global-mode-string (delq 'tracking-mode-line-buffers
global-mode-string))
(setq mode-line-misc-info (delq 'tracking-mode-line-buffers
mode-line-misc-info))
(setq-default mode-line-format (delq 'tracking-mode-line-buffers
(default-value 'mode-line-format))))
(remove-hook 'window-configuration-change-hook
'tracking-remove-visible-buffers))))

Expand Down

0 comments on commit 052f5ca

Please # to comment.