tlh / workgroups.el

workgroups for windows -- sexy window management for emacs
242 stars 30 forks source link

setq-default mode-line-format #32

Open dwdreisigmeyer opened 12 years ago

dwdreisigmeyer commented 12 years ago

Emacs : 24.0.92 from http://emacsformacosx.com/builds workgroups.el installed with el-get

A line (setq-default mode-line-format (list "some_list_here")) with (workgroups-mode 1) gives a warning: "Wrong type argument: number-or-marker-p, nil". This did not fix the problem: (setq wg-mode-line-on nil).

dwdreisigmeyer commented 12 years ago

This fixed the problem:

; Comment out: ; (wg-mode-line-add-display) ; (wg-mode-line-remove-display) ; at the bottom of workgroups.el. Recompile.

Thanks for the fantastic work!

-Dave

vwood commented 12 years ago

This issue is due to assuming mode-line-position will be in the mode-line-format. I'm getting this problem to, because I wanted to customise my mode-line. Setting wg-mode-line-on to nil doesn't solve this issue, as workgroups still tries to add itself to the mode-line!

Rather than commenting out those lines, I suggest you (fset 'wg-mode-line-add-display (lambda () nil)) and same for wg-mode-line-remove-display, at least until wg-mode-line-on actually works as an option.

redguardtoo commented 11 years ago

Seem this bug is already reported, Here is my patch:

diff --git a/site-lisp/workgroups.el/workgroups.el b/site-lisp/workgroups.el/workgroups.el
index 4dccd65..542bc9e 100644
--- a/site-lisp/workgroups.el/workgroups.el
+++ b/site-lisp/workgroups.el/workgroups.el
@@ -1447,11 +1447,12 @@ Query to overwrite if a workgroup with the same name exists."

 (defun wg-mode-line-add-display ()
   "Add Workgroups' mode-line format to `mode-line-format'."
-  (unless (assq 'wg-mode-line-on mode-line-format)
-    (let ((format `(wg-mode-line-on (:eval (wg-mode-line-string))))
-          (pos (1+ (position 'mode-line-position mode-line-format))))
-      (set-default 'mode-line-format
-                   (wg-insert-elt format mode-line-format pos)))))
+  (if wg-mode-line-on
+      (unless (assq 'wg-mode-line-on mode-line-format)
+        (let ((format `(wg-mode-line-on (:eval (wg-mode-line-string))))
+              (pos (1+ (position 'mode-line-position mode-line-format))))
+          (set-default 'mode-line-format
+                       (wg-insert-elt format mode-line-format pos))))))

 (defun wg-mode-line-remove-display ()
   "Remove Workgroups' mode-line format from `mode-line-format'."