Changes between Version 34 and Version 35 of Emacs


Ignore:
Timestamp:
Aug 5, 2015 10:10:48 AM (4 years ago)
Author:
adamse
Comment:

better lint and compile command

Legend:

Unmodified
Added
Removed
Modified
  • Emacs

    v34 v35  
    223223'''Description''': By having GHC be built with a hotkey, working on GHC becomes much more interactive. In a typical session, though, I have to change the actual compilation command based on my needs. So, by default, "compiling GHC" means fast-building the stage-2 compiler, but I do frequently change `ghc-compile`.
    224224
    225 {{{#!box info
    226 TODO: the description below does not make use of `(haskell-compile)`, nor the use of `-ferror-spans`, which provide a much better experience than the vanilla `(compile)`-mode
    227 }}}
    228 
    229225'''How to enable''':
    230226{{{#!elisp
     
    248244* By default, as said above, this will compile the stage 2 compiler for the GHC at `ghc-location`. If you set `ghc-compile` with, say, M-: `(setq ghc-compile "cd compiler; make 1")` <Enter>, then this will build the stage 1 compiler.
    249245
     246=== Alternative compile command with `-ferror-spans`
     247
     248{{{#!elisp
     249(defun compile-ghc ()
     250  (interactive)
     251  (save-some-buffers (not compilation-ask-about-save)
     252                     (if (boundp 'compilation-save-buffers-predicate) ;; since Emacs 24.1(?)
     253                         compilation-save-buffers-predicate))
     254  (let ((compile-command
     255         (concat "EXTRA_HC_OPTS=-ferror-spans "
     256                 (if (boundp 'ghc-compile)
     257                     (concat "cd " ghc-location "; " ghc-compile)
     258                   (concat "cd " ghc-location "/ghc; make 2")))))
     259    (compilation-start compile-command 'haskell-compilation-mode))
     260  (set-buffer "*haskell-compilation*")
     261  (setq default-directory ghc-location))
     262}}}
     263
    250264== Lint GHC
    251265
     
    255269(defun lint-ghc ()
    256270  (interactive)
    257   (compile (concat "cd " ghc-location "; " "arc lint --output compiler --rev master"))
     271  (let ((revision (if (boundp 'ghc-revision)
     272                      (ghc-revision)
     273                    ("master"))))
     274    (compile (concat "cd " ghc-location "; " "arc lint --output compiler --rev " revision)))
    258275  (set-buffer "*compilation*")
    259276  (setq default-directory ghc-location))
    260 }}}
     277
     278}}}
     279
     280If you are not working of off `master` you can `setq` `ghc-revision` to lint against your choosen commit.
    261281
    262282== Make the quotes in GHC error messages display nicely ==