Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
On 1/30/11 8:10 PM, Brandon S Allbery KF8NH wrote: Aside from the comments, which go to end of line but got broken in this case, no; all that matters is the parens. I suspect it may depend strongly on what version of emacs you're running though. Thanks for your comments. After reading them I had subscribed to the emacs mailing list for my platform/version, but it seems to be really low traffic. Thank goodness this list came through for me. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
On 2/1/11 12:07 AM, Steven Collins wrote: The following elisp code works for me to change the focus to the GHCi buffer (window) after the C-c C-l command in Haskell Mode. Try this in your .emacs file. (defadvice inferior-haskell-load-file (after change-focus-after-load) "Change focus to GHCi window after C-c C-l command" (other-window 1)) (ad-activate 'inferior-haskell-load-file) This worked for me! Thank you so very much for taking the time to send this and include the explanation of how it works. Not only did I get this working with my emacs, but I also got Kazu Yamamoto's ghc-mod 0.5.3 working, so now I have Haskell Flymake in my haskell-mode too. Great! Thanks again. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
I'm using haskell-mode-2.8.0 and emacs 22.2.1 on Ubuntu 9.10 The following elisp code works for me to change the focus to the GHCi buffer (window) after the C-c C-l command in Haskell Mode. Try this in your .emacs file. (defadvice inferior-haskell-load-file (after change-focus-after-load) "Change focus to GHCi window after C-c C-l command" (other-window 1)) (ad-activate 'inferior-haskell-load-file) I have this after the haskell mode configuration section of my .emacs file. Remeber to go to the Emacs-lisp menu and 'Byte-compile and Load' after adding the above code to your .emacs file. To understand what the elisp code is doing you can go to the help menu in emacs, then drill down via 'Search Documentation ' , then 'Find any object by name'. Which will put you in the mini-buffer. Type in either defadvice or ad-activate to see the documentation for these functions. If you are a little rusty on elisp this documentation may be a little hard to understand. Basically this is what's happening. The function that is bound to the C-c C-l command is inferior-haskell-load-file. Which is an elisp function name and part of the elisp haskell mode code. The defadvice is kind of overloading this function. We are telling emacs that 'after' executing the 'inferior-haskell-load-file' function, execute our new function who's name is 'change-focus-after-load'. The body of our function is just one expression (other-window 1). This is the kind of stuff that makes it easy to modify (hack) the functionality of emacs to do what you want. I hope this helps and enjoy hacking in Haskell Steven ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/30/11 12:13 , JETkoten wrote: >> ;Default behaviour is to always >> jump to the GHCi window. >> ;Jump back automatically unless errors. >> (defadvice haskell-ghci-load-file >> (after name) >> (other-window 1)) >> (ad-activate 'haskell-ghci-load-file t) >> > I tried various combinations of moving the various lines around and nothing > works. Is the indentation significant in elisp? Aside from the comments, wich go to end of line but got broken in this case, no; all that matters is the parens. I suspect it may depend strongly on what version of emacs you're running though. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1GDB8ACgkQIn7hlCsL25XwUwCfTYktCZ2WuayLprACS79LS8gG td4AnR5WygspwmARIUUeNRm9E++cHOMa =1r0X -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
On 1/30/11 11:37 AM, Gwern Branwen wrote: On Sun, Jan 30, 2011 at 11:30 AM, JETkoten wrote: The way it defaults to now is that the cursor stays in the topmost editing half of the split screen, and I inevitably begin typing and mess up my code and have to do some backspacing and then mouse over to the bottom half. :) I checked on #haskell and #emacs last night, and someone suggested either "doing it with elisp" or keyboard macros, but I'm not sure how to do the first, and I think the second is not what I'm looking for. I'd like for haskell-mode to otherwise remain the same, and to still use the same C-c C-l key sequence, but I'd just like it to always be set up to add the step in the load sequence of jumping the cursor focus down to the lower half of the split for me. > From my .emacs; ;Default behaviour is to always jump to the GHCi window. ;Jump back automatically unless errors. (defadvice haskell-ghci-load-file (after name) (other-window 1)) (ad-activate 'haskell-ghci-load-file t) Thanks! However, this doesn't do anything at all after adding it to my .emacs. Or else maybe it's a problem with the formatting? It looks like parts of the code got line wrapped in replying to my first email. I tried various combinations of moving the various lines around and nothing works. Is the indentation significant in elisp? Anyone know how to get this working? (Gwern, sorry for the double post, I forgot to press Reply All the first time and only mailed my response to you) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
On Sun, Jan 30, 2011 at 11:30 AM, JETkoten wrote: > The way it defaults to now is that the cursor stays in the topmost editing > half of the split screen, and I inevitably begin typing and mess up my code > and have to do some backspacing and then mouse over to the bottom half. > > :) > > I checked on #haskell and #emacs last night, and someone suggested either > "doing it with elisp" or keyboard macros, but I'm not sure how to do the > first, and I think the second is not what I'm looking for. > > I'd like for haskell-mode to otherwise remain the same, and to still use the > same C-c C-l key sequence, but I'd just like it to always be set up to add > the step in the load sequence of jumping the cursor focus down to the lower > half of the split for me. >From my .emacs; ;Default behaviour is to always jump to the GHCi window. ;Jump back automatically unless errors. (defadvice haskell-ghci-load-file (after name) (other-window 1)) (ad-activate 'haskell-ghci-load-file t) -- gwern http://www.gwern.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Automatically move cursor focus in split window in haskell-mode in emacs on load (C-c C-l) command?
With the community server down it looks like I can't join the haskell-mode mailing list, and also I thought someone might have already done this, so I've posted here. I'm new to Haskell and emacs... and don't know any elisp at all! I'm trying to set up my haskell-mode so that when I've finished inputting code in a buffer that's in haskell-mode, and I then do C-c C-l to split the screen and load the code into ghci in the lower buffer, the cursor focus will automatically jump down to the bottom half of the split screen and I can instantly begin to interact with ghci. The way it defaults to now is that the cursor stays in the topmost editing half of the split screen, and I inevitably begin typing and mess up my code and have to do some backspacing and then mouse over to the bottom half. :) I checked on #haskell and #emacs last night, and someone suggested either "doing it with elisp" or keyboard macros, but I'm not sure how to do the first, and I think the second is not what I'm looking for. I'd like for haskell-mode to otherwise remain the same, and to still use the same C-c C-l key sequence, but I'd just like it to always be set up to add the step in the load sequence of jumping the cursor focus down to the lower half of the split for me. Any ideas? (Thanks in advance.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe