Changes between Version 23 and Version 24 of Emacs

Oct 8, 2013 12:31:20 PM (4 years ago)



  • Emacs

    v23 v24  
    8080(global-set-key (kbd "<f11>") 'global-linum-mode)
     83== Jump to first error
     85'''Description''': Allows you to jump to the first error in compiled or interpreted code.
     87'''How to enable''':
     89(global-set-key (kbd "M-g M-f") 'first-error)
     92On my setup, this won't work the first time a file is loaded into GHCi. I just try to load the file a second time, and then I'm set for the rest of the session.
    8394== Always display column number in mode line
    159170= GHC-specific
    161 ''TODO: Richard, can you please fill in this section?''
     172It can be helpful to have a few commands specific to working on GHC. For these to work, Emacs must know where your local GHC tree is.
     175(setq ghc-location "~/ghc") ;; change as necessary
     178If you switch between active trees, you must use a `setq` to change this variable, with, say, M-: `(setq ghc-location "~/other-ghc")` <Enter>.
    163180== Searching the GHC source tree with a hotkey
    165 '''Description''':
    167 '''How to enable''':
     182'''Description''': Even with hasktags, sometimes you need to search within the source tree. `rgrep` does this job well, but it asks too many redundant questions. So, the following code optimizes for a search just within the `compiler` directory:
     184'''How to enable''': The following code binds this search to M-c, but you may want your own key combination. Note that it uses `ghc-location`, set above.
     186  ;; search withing GHC compiler code
     187(defun rgrep-ghc (regexp)
     188  (interactive (list (progn (grep-compute-defaults) (grep-read-regexp))))
     189  (rgrep regexp "*hs" (concat ghc-location "/compiler/")))
     190(global-set-key (kbd "M-c") 'rgrep-ghc)
    169193== Building GHC with a hotkey
    171 '''Description''':
    173 '''How to enable''':
     195'''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`.
     197'''How to enable''':
     199(defun compile-ghc ()
     200  (interactive)
     201  (let ((compile-command (if (boundp 'ghc-compile)
     202                             (concat "cd " ghc-location "; " ghc-compile)
     203                             (concat "cd " ghc-location "/ghc; make 2"))))
     204    (compile compile-command))
     205  (set-buffer "*compilation*")
     206  (setq default-directory ghc-location))
     208(defun set-compile-ghc ()
     209  (local-set-key (kbd "C-q") 'compile-ghc))
     211(add-hook 'haskell-mode-hook 'set-compile-ghc)
     214A few things to note here:
     215* The above code binds C-q (perhaps a bad combination, as I've accidentally quit Emacs from my Mac with the wrong modifier key!) to compiling GHC from ''any'' Haskell file, even those unrelated to GHC. But, when I'm working outside of GHC, I tend to use C-c C-l to load into GHCi, so this works out OK.
     216* 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.