powerline icon indicating copy to clipboard operation
powerline copied to clipboard

"Void-variable left" with latest version (powerline-20150312.2049)

Open fniessen opened this issue 9 years ago • 42 comments

Hello,

I did not change anything regarding my Powerline config. Though, just after updating this morning, I now have:

Error during redisplay: (eval (let* ((active (powerline-selected-window-active)) (mode-line (if active (quote mode-line) (quote mode-line-inactive))) (face1 (if active (quote powerline-active1) (quote powerline-inactive1))) (face2 (if active (quote powerline-active2) (quote powerline-inactive2))) (default-dictionary-face (if active (quote powerline-default-dictionary-active-face) (quote powerline-default-dictionary-inactive-face))) (other-dictionary-face (if active (quote powerline-other-dictionary-active-face) (quote powerline-other-dictionary-inactive-face))) (separator-left (intern (format "powerline-%s-%s" powerline-default-separator (car powerline-default-separator-dir)))) (separator-right (intern (format "powerline-%s-%s" powerline-default-separator (cdr powerline-default-separator-dir)))) (lhs (list (when (and (fboundp (quote vc-switches)) buffer-file-name vc-mode) (if (eq (vc-state buffer-file-name) (quote up-to-date)) (powerline-vc (quote powerline-normal-face) (quote r)) (powerline-vc (quote powerline-modified-face) (quote r)))) (when (and (not (fboundp (quote vc-switches))) buffer-file-name vc-mode) (powerline-vc face1 (quote r))) (when (and buffer-file-name vc-mode) (if (eq (vc-state buffer-file-name) (quote up-to-date)) (funcall separator-left (quote powerline-normal-face) mode-line) (funcall separator-left (quote powerline-modified-face) mode-line))) (if (not (buffer-modified-p)) (powerline-raw "%*" nil (quote l)) (powerline-raw "%*" (quote mode-line-emphasis) (quote l))) (powerline-raw mode-line-mule-info nil (quote l)) (powerline-buffer-id nil (quote l)) (when (and (boundp (quote which-func-mode)) which-func-mode) (powerline-raw which-func-format nil (quote l))) (powerline-raw " ") (funcall separator-left mode-line face1) (when (boundp (quote erc-modified-channels-object)) (powerline-raw erc-modified-channels-object face1 (quote l))) (powerline-major-mode face1 (quote l)) (powerline-process face1) (powerline-raw " " face1) (funcall separator-left face1 face2) (powerline-minor-modes face2 (quote l)) (powerline-narrow face2 (quote l)) (powerline-raw " " face2) (funcall separator-left face2 mode-line))) (rhs (list (powerline-raw global-mode-string mode-line (quote r)) (funcall separator-right mode-line face1) (powerline-raw "%l" face1 (quote l)) (powerline-raw ", " face1 (quote l)) (powerline-raw "%c" face1 (quote r)) (funcall separator-right face1 mode-line) (powerline-raw " ") (powerline-raw "%4p" nil (quote r)) (funcall separator-right mode-line face2) (powerline-buffer-size face2 (quote l)) (powerline-raw " " face2) (let ((dict (and (featurep (quote ispell)) (or ispell-local-dictionary ispell-dictionary)))) (cond (buffer-read-only (powerline-raw "%%%%  " default-dictionary-face (quote l))) ((null dict) (powerline-raw "--  " default-dictionary-face (quote l))) (t (powerline-raw (concat (substring dict 0 2) "  ") other-dictionary-face (quote l)))))))) (concat (powerline-render lhs) (powerline-fill mode-line (powerline-width rhs)) (powerline-render rhs)))) signaled (void-variable left) [5 times]

fniessen avatar Mar 13 '15 14:03 fniessen

interesting. what version of emacs? i think I know the problem but will need to try it.

milkypostman avatar Mar 13 '15 16:03 milkypostman

actually I guess that is not true, i'm not sure what the problem is. i can try to repro once I know your emacs version, you may also help me find the error by editing the powerline-default-theme and seeing if commenting some lines changes anything. At least knowing where the error is would be helpful.

milkypostman avatar Mar 13 '15 16:03 milkypostman

i'm using Emacs 24.4 on Windows. To be accurate: GNU Emacs 24.4.1 (i686-pc-mingw32) of 2014-10-20 on LEG570.

The "theme" is use is my own -- and I even would be pleased if it would be inserted as a "standard" theme in your package, btw -- and its code is between lines 1280 and 1388 in my Emacs-Leuven.el file (https://github.com/fniessen/emacs-leuven/blob/master/emacs-leuven.el).

fniessen avatar Mar 13 '15 18:03 fniessen

I have the same problem. Here's the output from emacs --debug-init:

Debugger entered--Lisp error: (void-variable left) powerline-reset() require(powerline) eval-buffer(#<buffer load-864861> nil "/home/sangkle/.emacs.d/modules/modeline.el" nil t) ; Reading at buffer position 21

sangkle avatar Mar 13 '15 19:03 sangkle

something must have changed in 24.4. I think it's the way the macro is being expanded. I need to look into it more.

milkypostman avatar Mar 13 '15 20:03 milkypostman

@sangkle are you on Windows too? I cannot repro this on mac or linux.

milkypostman avatar Mar 13 '15 23:03 milkypostman

I am on linux and using GNU Emacs 24.4.1

sangkle avatar Mar 14 '15 00:03 sangkle

can't figure out what is wrong. will try to get a copy of 24.4.1.

On Fri, Mar 13, 2015 at 5:27 PM Sangkle [email protected] wrote:

I am on linux and using GNU Emacs 24.4.1

— Reply to this email directly or view it on GitHub https://github.com/milkypostman/powerline/issues/79#issuecomment-79575933 .

milkypostman avatar Mar 14 '15 04:03 milkypostman

Same on FreeBSD with Emacs 24.4.1.

wunki avatar Mar 14 '15 08:03 wunki

Same here on Mac OS with emacs 24.4.1

Malie73 avatar Mar 14 '15 12:03 Malie73

I'm wondering if this is a 24.4.1 issue. Because I can't reproduce on the latest dev versions nor on 24.3 On Sat, Mar 14, 2015 at 05:35 Malie73 [email protected] wrote:

Same here on Mac OS with emacs 24.4.1

— Reply to this email directly or view it on GitHub https://github.com/milkypostman/powerline/issues/79#issuecomment-80416194 .

milkypostman avatar Mar 14 '15 14:03 milkypostman

Use emacs 25.0.50.1 in windowed mode here. Same issue. Commenting out lines 198 and 199 of the function powerline-reset solves the issue temporarily. It would appear that left and right are not always initialized.

;(pl/utf-8 left) ;(pl/utf-8 right)

I hope this helps

brunosabin avatar Mar 14 '15 19:03 brunosabin

Same problem here. I'm on Linux, Emacs 24.4.1. Here is the emacs --debug-init output:

Debugger entered--Lisp error: (void-variable left)
  powerline-reset()
  require(powerline nil t)
  (not (require (quote powerline) nil t))
  (if (not (require (quote powerline) nil t)) (message "Could not load package %s" "powerline") t)
  (progn (if (not (require (quote powerline) nil t)) (message "Could not load package %s" "powerline") t))
  (progn (progn (if (not (require (quote powerline) nil t)) (message "Could not load package %s" "powerline") t)) t)
  eval-buffer(#<buffer  *load*> nil "/home/choma/.emacs.d/init.el" nil t)  ; Reading at buffer position 13842
  load-with-code-conversion("/home/choma/.emacs.d/init.el" "/home/choma/.emacs.d/init.el" t t)
  load("/home/choma/.emacs.d/init" t t)
  #[0 "\205\262

UPDATE: @brunosabin solution works for me too :)

choma avatar Mar 14 '15 20:03 choma

Those are macro expansions. If you replace left and right with 'left and 'right does that work? On Sat, Mar 14, 2015 at 13:31 Matías Croce [email protected] wrote:

Same problem here. I'm on Emacs 24.4.1. Here is the emacs --debug-init output:

Debugger entered--Lisp error: (void-variable left) powerline-reset()

require(powerline nil t) (not (require (quote powerline) nil t)) (if (not (require (quote powerline) nil t)) (message "Could not load package %s" "powerline") t) (progn (if (not (require (quote powerline) nil t)) (message "Could not load package %s" "powerline") t)) (progn (progn (if (not (require (quote powerline) nil t)) (message "Could not load package %s" "powerline") t)) t) eval-buffer(# nil "/home/choma/.emacs.d/init.el" nil t) ; Reading at buffer position 13842 load-with-code-conversion("/home/choma/.emacs.d/init.el" "/home/choma/.emacs.d/init.el" t t) load("/home/choma/.emacs.d/init" t t) #[0 "\205\262

— Reply to this email directly or view it on GitHub https://github.com/milkypostman/powerline/issues/79#issuecomment-80706994 .

milkypostman avatar Mar 15 '15 04:03 milkypostman

@milkypostman

Those are macro expansions. If you replace left and right with 'left and 'right does that work?

It's error at emacs24.4 with mac

@brunosabin thinks for your temporarily solution.

jiahut avatar Mar 15 '15 05:03 jiahut

@milkypostman

I tried changing left and right to 'left and 'right and got powerline.el:163:1:Error: Wrong type argument: symbolp, (quote left) after trying to re-compile.

HTH Greg

gberenfield avatar Mar 15 '15 12:03 gberenfield

I can confirm @gberenfield report, I got same error when trying to recompile.

choma avatar Mar 15 '15 13:03 choma

This happened to me with Emacs 24.3.1 on GNU/Linux.

fgallina avatar Mar 15 '15 15:03 fgallina

@milkypostman there might be a couple of separate issues at play:

  • possibly a bad interaction between the "session" package and the new left and right pl/utf-8 macros. By moving aside my ~/.emacs.d/.emacs.session file, I get passed the error about left and right (line 198-199) and now get a different error resulting in an empty modeline.
  • the new error in the Messages buffer should hopefully be easy to reproduce with any of the emacs versions mentioned above. Here is how I did it: You can simply get a fresh emacs installation and remove your personal ~/.emacs.d stuff. Make a new ~/.emacs.d/init.el file which only loads powerline-default-theme as it is currently in melpa.

Result: on emacs startup, the modeline redisplay code trips on the undefined "powerline-selected-window" variable. I copy an extract of the error for reference at the end of this post.

The good news is that the following 1-liner patch seems to help, at least in my case. I have no warnings and not errors and all behaves great as far as I can see. However, I am by no means an elisp programmer, so beware in case I screwed it up monumentally.

*** d:/Users/johndoe/.emacs.d/elpa/powerline-20150312.2049/powerline.el~    Fri Mar 13 18:44:24 2015
--- d:/Users/johndoe/.emacs.d/elpa/powerline-20150312.2049/powerline.el Sun Mar 15 17:27:15 2015
***************
*** 462,467 ****
--- 462,469 ----

  (defvar pl/minibuffer-selected-window-list '())

+ (defvar powerline-selected-window (frame-selected-window))
+ 
  (defun pl/minibuffer-selected-window ()
    "Return the selected window when entereing the minibuffer."
    (when pl/minibuffer-selected-window-list

Diff finished.  Sun Mar 15 17:38:31 2015

I hope this helps narrow down what could have been an old issue somewhat recently highlighted. I'll keep an eye out to see what the final fix should have been. I wonder whether the first issue could be because session.el stored a stale variable from the previous version of powerline.el? Let me know if you need more details and maybe others in this thread can confirm that they too used session.el

Cheers, Bruno

Messages from a clean emacs installation with no special .emacs customizations:

For information about GNU Emacs and the GNU system, type C-h C-a. Error during redisplay: (eval (let* ((active (powerline-selected-window-active)) (mode-line (if active (quote mode-line) (quote mode-line-inactive))) (face1 (if active (quote powerline-active1) (quote powerline-inactive1))) (face2 (if active (quote powerline-active2) (quote powerline-inactive2))) (separator-left (intern (format "powerline-%s-%s" (powerline-current-separator) (car powerline-default-separator-dir)))) (separator-right (intern (format "powerline-%s-%s" (powerline-current-separator) (cdr powerline-default-separator-dir)))) (lhs (list (powerline-raw "%*" nil (quote l)) (powerline-buffer-size nil (quote l)) (powerline-raw mode-line-mule-info nil (quote l)) (powerline-buffer-id nil (quote l)) (when (and (boundp (quote which-func-mode)) which-func-mode) (powerline-raw which-func-format nil (quote l))) (powerline-raw " ") (funcall separator-left mode-line face1) (when (boundp (quote erc-modified-channels-object)) (powerline-raw erc-modified-channels-object face1 (quote l))) (powerline-major-mode face1 (quote l)) (powerline-process face1) (powerline-minor-modes face1 (quote l)) (powerline-narrow face1 (quote l)) (powerline-raw " " face1) (funcall separator-left face1 face2) (powerline-vc face2 (quote r)))) (rhs (list (powerline-raw global-mode-string face2 (quote r)) (funcall separator-right face2 face1) (unless window-system (powerline-raw (char-to-string 57505) face1 (quote l))) (powerline-raw "%4l" face1 (quote l)) (powerline-raw ":" face1 (quote l)) (powerline-raw "%3c" face1 (quote r)) (funcall separator-right face1 mode-line) (powerline-raw " ") (powerline-raw "%6p" nil (quote r)) (powerline-hud face2 face1)))) (concat (powerline-render lhs) (powerline-fill face2 (powerline-width rhs)) (powerline-render rhs)))) signaled (void-variable powerline-selected-window) You can run the command 'powerline-default-theme' with M-x po-d RET

brunosabin avatar Mar 15 '15 17:03 brunosabin

Reverting the quotes on lines 198,199 in my above comment and adding @brunosabin's patch worked for me. And that was with my normal .emacs.d directory with all my included libraries.

gberenfield avatar Mar 16 '15 00:03 gberenfield

rm *.elc from elpa/powerline fixes the problems.

ntcong avatar Mar 16 '15 07:03 ntcong

Same issue here. I have to use the workarounds the guys provided above to fix it temporarily.

seagle0128 avatar Mar 16 '15 08:03 seagle0128

@brunosabin Thanks for the fix, this helps, no more error messages!

Malie73 avatar Mar 16 '15 08:03 Malie73

Should be fixed with d9fc947bb1f245333832f762a054b10496adecc2

milkypostman avatar Mar 16 '15 18:03 milkypostman

could someone fill me in about how you're initializing powerline? Even with the new changes, in my init file after (package-initialize) I can put (powerline-default-theme) or (require 'powerline) and I never see this problem?

milkypostman avatar Mar 18 '15 03:03 milkypostman

I was seeing the same issue, and I was using powerline via smart-mode-line.

mdorman avatar Mar 18 '15 09:03 mdorman

I'm using smart-mode-line too, but I initialize powerline this way:

(use-package powerline
  :ensure powerline)
(add-hook 'after-change-major-mode-hook 'powerline-moe-theme)

As you can see, I use the great moe-theme :D

choma avatar Mar 18 '15 12:03 choma

@milkypostman I initialize powerline thus (ELPA version):

  (require 'package)
  (package-initialize)
  (load-theme 'leuven t)
  (powerline-default-theme)

@Funnnny reported above how to avoid the issue with the original code and that worked too: get rid of the byte-compiled files. If you only have the .el files present, all always worked. Howerver, when you download the package through ELPA you will get the .el byte-compiled to .elc and this is where the issue seem to have come from in my case at least. The defvar addition allowed me to keep the code and the byte-compiled files at once.

I confirm that the current version from ELPA (powerline-20150316.1142) works fine out of the box for me.

I hope this helps, ping if you need me to send my complete setup too

brunosabin avatar Mar 18 '15 23:03 brunosabin

I'm experiencing this bug too :|

GNU Emacs 24.4.1 (i686-pc-linux-gnu, GTK+ Version 3.14.7) of 2015-01-17 on bisson

Powerline version 20150316.1142.

As you can see here in my second code block I call powerline-center-theme and that's all...

shackra avatar Mar 19 '15 00:03 shackra

Do you do package-initialize before calling that? On Wed, Mar 18, 2015 at 17:06 Jorge Araya Navarro [email protected] wrote:

I'm experiencing this bug too :|

GNU Emacs 24.4.1 (i686-pc-linux-gnu, GTK+ Version 3.14.7) of 2015-01-17 on bisson

Powerline version 20150316.1142.

As you can see here https://github.com/shackra/.emacs.d/blob/master/emacs-init.org#emacs-no-hagas-%C3%A9stas-cosas-aka-sane-defaults in my second code block I call powerline-center-theme and that's all...

— Reply to this email directly or view it on GitHub https://github.com/milkypostman/powerline/issues/79#issuecomment-83229550 .

milkypostman avatar Mar 19 '15 00:03 milkypostman