abo-abo / ace-window

Quickly switch windows in Emacs
970 stars 86 forks source link

Fix frame-parameter being nil sometimes #147

Closed caxiansheng closed 5 years ago

caxiansheng commented 5 years ago

Hello,

I get an error that looks a lot like Issue #138 when using Emacs-24.5.1. It occurs when installing ace-window from melpa or building from the latest github commit.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)                                    
  aw-window<(#<window 4 on *Backtrace*> #<window 1 on *scratch*>)                                             
  sort((#<window 1 on *scratch*>) aw-window<)                                                                 
  aw-window-list()                                                                                            
  aw-select(" Ace - Window" aw-switch-to-window)                                                              
  ace-select-window()                                                                                         
  ace-window(1)                                                                                               
  call-interactively(ace-window record nil)                                                                   
  command-execute(ace-window record)                                                                          
  execute-extended-command(nil "ace-window")                                                                  
  call-interactively(execute-extended-command nil nil)                                                        
  command-execute(execute-extended-command)  

It appears that (frame-parameter frame 'left) returns nil, thus (frame-position f1) is '(nil), and line 587 attempts to evaluate (< nil nil), giving rise to the error.

ace-window works for me after making the change in this pull request.

https://github.com/abo-abo/ace-window/blob/5b88de026cea5fc57e62bb490034392815be5f0f/ace-window.el#L569-L572

https://github.com/abo-abo/ace-window/blob/5b88de026cea5fc57e62bb490034392815be5f0f/ace-window.el#L587-L589

abo-abo commented 5 years ago

Thanks.