-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
‘reload’ doesn't restart Yi #515
Comments
#160 is somewhat related. |
|
Hm, I just tried Regarding that compile error, it sounds like you have an old install there, I just checked and any Yi.Prelude mentions were removed from any relevant Haskell files. |
I had the same issue and ran Yi with --debug/tailed it: cody@cody-G46VW:~/source/yi/yi/src$ tail -f ~/.yi.dbg
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 3 >>> interactively
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 3 <<<
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 3 >>> interactively
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 3 <<<
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 10 startXs: [] 0 []
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:09 UTC ThreadId 10 startXs: [] 0 []
Tue, 11 Mar 2014 04:40:26 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:26 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 9 <<<
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 9 <<<
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 9 <<<
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 10 startXs: [0] 17 []
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:28 UTC ThreadId 10 startXs: [0] 17 []
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 <<<
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 startXs: [0] 17 []
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 <<<
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 startXs: [0] 17 []
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 <<<
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 startXs: [0] 17 []
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 9 <<<
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 time to render
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 refreshing screen.
Tue, 11 Mar 2014 04:40:29 UTC ThreadId 10 startXs: [0] 17 []
Tue, 11 Mar 2014 04:40:31 UTC ThreadId 9 pending events:
Tue, 11 Mar 2014 04:40:31 UTC ThreadId 9 >>> interactively
Tue, 11 Mar 2014 04:40:32 UTC ThreadId 9 errorEditor: Maybe.fromJust: Nothing Then the list of places fromJust is used:
My hunch is that Yi/Dynamic.hs is working with vim for some reason but not emacs, however it's unfounded. I'll be debugging this further later... have to get up for work early :/ |
I just replaced all of the above instances with lablelled calls to gfromJust :: [Char] -> Maybe a -> a
gfromJust _info (Just h) = h
gfromJust info Nothing = error $ "gfromJust " ++ info ++ " Nothing" And still get
So it must be in an imported library somewhere |
Oh, that sucks a whole lot. I'm guessing it's in dyre somewhere such as |
Yep, getMasterBinary is returning Nothing On Fri, Mar 21, 2014 at 3:04 PM, Mateusz Kowalczyk <notifications@github.com
|
I have spent some time digging through this, and it does not make sense. The bug can be enabled / disabled by switch from the Vim keybindings to the emacs one. I added some With the vim keymap I get the following
With the emacs keymap I get the following
The two Nothing's printed out in getValue are attempts to cast the value to a String and to a FilePath It seems that in the emacs case trying to reference the return value from |
It seems that the vim case gets
twice, perhaps emacs simply gives up and vim keeps trying until something changes (binary becomes ready or something? Just a guess). It is quite strange… |
No, thats just an artifact of my quickndirty logging. The one is on ontry On Fri, Mar 21, 2014 at 10:07 PM, Mateusz Kowalczyk <
|
I believe the difference is in whether the reload command is run via
In case (2) something seems to hang. Making the following change diff --git a/yi/src/library/Yi/Keymap/Emacs.hs b/yi/src/library/Yi/Keymap/Emacs.hs
index 1113456..99f60cd 100644
--- a/yi/src/library/Yi/Keymap/Emacs.hs
+++ b/yi/src/library/Yi/Keymap/Emacs.hs
@@ -15,6 +15,7 @@ module Yi.Keymap.Emacs (keymap,
completionCaseSensitive
) where
+import {-# source #-} Yi.Boot (reload)
import Control.Applicative
import Control.Lens
import Data.Prototype
@@ -277,5 +278,6 @@ emacsKeys univArg =
, char 'r' ?>> rectangleFuntions
, char 'u' ?>>! repeatingArg undoB
, char 'v' ?>>! repeatingArg shrinkWinE
+ , char 'R' ?>>! reload
, optMod ctrl (char 't') >> tabFunctions
] Would allow testing the same difference in the emacs key bindings. This time |
I was hoping that the following change would fix this. Unfortunately, it doesn't. Something along these lines may work. diff --git a/yi/src/library/Yi/Eval.hs b/yi/src/library/Yi/Eval.hs
index ed49df0..693dddb 100644
--- a/yi/src/library/Yi/Eval.hs
+++ b/yi/src/library/Yi/Eval.hs
@@ -28,6 +28,7 @@ import Data.Typeable
import Data.Binary
import Data.Default
import qualified Language.Haskell.Interpreter as LHI
+import qualified Language.Haskell.Interpreter.Unsafe as LHI
import System.Directory(doesFileExist)
import qualified Data.HashMap.Strict as M
@@ -94,7 +95,7 @@ ghciEvaluator = Evaluator{..} where
execEditorActionImpl s = do
contextFile <- Yi.Paths.getEvaluatorContextFilename
haveUserContext <- io $ doesFileExist contextFile
- res <- io $ LHI.runInterpreter $ do
+ res <- io $ LHI.unsafeRunInterpreterWithArgs ["-no-user-package-db", "-package-db=.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d/"] $ do
LHI.set [LHI.searchPath LHI.:= []]
LHI.set [LHI.languageExtensions LHI.:= [LHI.OverloadedStrings,
LHI.NoImplicitPrelude -- use Yi prelude instead. |
On further investigation the above changes to |
Applying your patch results in it working for the C-x R variant, but not I was pretty sure it was related to how it is called, but I am still I suspect there are processes being forked which then violate the Dyre Alan On Sat, Mar 22, 2014 at 3:22 AM, Ben Armston notifications@github.comwrote:
|
I'm confused as to the exact point it fails too. I've just tested this with yi installed outside of a cabal sandbox. I had the same result as when yi is inside a cabal sandbox: |
Just for completeness, I am testing the long way by doing a cabal install I suspect it is related to some thread related processing in the minibuffer On Sat, Mar 22, 2014 at 10:38 AM, Ben Armston notifications@github.comwrote:
|
If all else fails, we can resort to this: diff --git a/yi/src/library/Yi/Eval.hs b/yi/src/library/Yi/Eval.hs
index ed49df0..b2b20d4 100644
--- a/yi/src/library/Yi/Eval.hs
+++ b/yi/src/library/Yi/Eval.hs
@@ -32,6 +32,7 @@ import System.Directory(doesFileExist)
import qualified Data.HashMap.Strict as M
import Yi.Config.Simple.Types
+import {-# source #-} Yi.Boot
import Yi.Core
import Yi.File
import Yi.Hooks
@@ -91,6 +92,7 @@ exists, it is imported unqualified.
ghciEvaluator :: Evaluator
ghciEvaluator = Evaluator{..} where
execEditorActionImpl :: String -> YiM ()
+ execEditorActionImpl "reload" = reload
execEditorActionImpl s = do
contextFile <- Yi.Paths.getEvaluatorContextFilename
haveUserContext <- io $ doesFileExist contextFile |
This does have the advantage of solving the problem :) My 5c, I also think that reload is a very special case. On Sat, Mar 22, 2014 at 12:27 PM, Dmitry Ivanov notifications@github.comwrote:
|
I'll +1 the workaround if everyone gives up on searching for the fault |
@alanz when you say: "My 5c, I also think that reload is a very special case." I am looking at Yi as a replacement for Emacs (with a more powerful extension language) and was planning to write a lot of extensions for it. For me and others who planned on doing the same, reload would be a very common case unless I misunderstand something. For reference I got this error while doing this simple Yi extension tutorial: |
The special case I mean is that it is pretty much unique in all the As such, treating it as a special case makes sense, as it is in a class of So use would be common, the code would only require a single special case. On Sat, Mar 22, 2014 at 7:49 PM, codygman notifications@github.com wrote:
|
I've committed the workaround for now. |
On my system, calling
reload
hangs Yi for a while (it's probably compiling config) and then kills it. I'd expect Yi to get restarted at this point but it doesn't.32-bit Linux.
Does it work for anyone? Did it ever?
The text was updated successfully, but these errors were encountered: