Browse files

+Fix the modeline extension desktop support.

When the Sunrise pane buffer is being restored, the other one might
still not be (the naïve use of 0.1s timer is no solution (besides
being totally misguided, as the desktop functionality tried to call
the minor mode function, and thus `sr-modeline-toggle', right away
anyway)) and trying to use the usual pane/window switching functions
is going to result in an error. Meanwhile, `sr-modeline-refresh' does
all that is needed for a single pane.
  • Loading branch information...
1 parent e9c427c commit 9654559b8dabf787d77beb3f8c154b6b32dff684 @stepnem stepnem committed Nov 22, 2011
Showing with 8 additions and 6 deletions.
  1. +8 −6 sunrise-x-modeline.el
@@ -315,12 +315,14 @@ the Sunrise Commander, after module installation."
;;; ============================================================================
;;; Desktop support:
-(defun sr-modeline-desktop-restore-buffer (desktop-buffer-file-name
- desktop-buffer-name
- desktop-buffer-misc)
- "Activate the mode line when restoring Sunrise buffers using desktop."
- (run-with-timer 0.1 nil 'sr-modeline-toggle 1))
-(add-to-list 'sr-desktop-restore-handlers 'sr-modeline-desktop-restore-buffer)
+(add-to-list 'desktop-minor-mode-table '(sr-modeline nil))
+(defun sr-modeline-desktop-restore-function (&rest _)
+ "Call this instead of `sr-modeline' when restoring a desktop."
+ (sr-modeline-refresh))
+(add-to-list 'desktop-minor-mode-handlers
+ '(sr-modeline . sr-modeline-desktop-restore-function))
(provide 'sunrise-x-modeline)
;;;###autoload (require 'sunrise-x-modeline)

0 comments on commit 9654559

Please sign in to comment.