@@ -227,36 +227,25 @@ be set to the preferred literate style."
227
227
;;;### autoload
228
228
(defvar haskell-mode-map
229
229
(let ((map (make-sparse-keymap )))
230
- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
231
- ; ; For inferior haskell mode, use the below bindings
232
- ; ; (define-key map [?\M-C-x] 'inferior-haskell-send-defun)
233
- ; ; (define-key map [?\C-x ?\C-e] 'inferior-haskell-send-last-sexp)
234
- ; ; (define-key map [?\C-c ?\C-r] 'inferior-haskell-send-region)
235
- (define-key map [?\C -x ?\C -d] 'inferior-haskell-send-decl )
236
- (define-key map [?\C -c ?\C -z] 'switch-to-haskell )
237
- (define-key map [?\C -c ?\C -l] 'inferior-haskell-load-file )
238
- ; ; I think it makes sense to bind inferior-haskell-load-and-run to C-c
239
- ; ; C-r, but since it used to be bound to `reload' until June 2007, I'm
240
- ; ; going to leave it out for now.
241
- ; ; (define-key map [?\C-c ?\C-r] 'inferior-haskell-load-and-run)
242
- (define-key map [?\C -c ?\C -b] 'switch-to-haskell )
243
- ; ; (define-key map [?\C-c ?\C-s] 'inferior-haskell-start-process)
244
- ; ; That's what M-; is for.
245
- ; ; (define-key map "\C-c\C-c" 'comment-region)
246
- (define-key map (kbd " C-c C-t" ) 'inferior-haskell-type )
247
- (define-key map (kbd " C-c C-i" ) 'inferior-haskell-info )
248
- (define-key map (kbd " C-c M-." ) 'inferior-haskell-find-definition )
249
- (define-key map (kbd " C-c C-d" ) 'inferior-haskell-find-haddock )
250
- (define-key map [?\C -c ?\C -v] 'haskell-check )
251
-
252
230
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253
231
; ; Editing-specific commands
254
232
(define-key map (kbd " C-c C-." ) 'haskell-mode-format-imports )
255
233
(define-key map [remap delete-indentation] 'haskell-delete-indentation )
256
-
234
+ (define-key map (kbd " C-c C-l" ) 'haskell-mode-enable-process-minor-mode )
235
+ (define-key map (kbd " C-c C-b" ) 'haskell-mode-enable-process-minor-mode )
236
+ (define-key map (kbd " C-c C-v" ) 'haskell-mode-enable-process-minor-mode )
237
+ (define-key map (kbd " C-c C-t" ) 'haskell-mode-enable-process-minor-mode )
238
+ (define-key map (kbd " C-c C-i" ) 'haskell-mode-enable-process-minor-mode )
257
239
map)
258
240
" Keymap used in Haskell mode." )
259
241
242
+ (defun haskell-mode-enable-process-minor-mode ()
243
+ " Tell the user to choose a minor mode for process interaction."
244
+ (interactive )
245
+ (error " You tried to do an indentation command, but an interaction mode has not been enabled yet.
246
+
247
+ Run M-x describe-variable haskell-mode-hook for a list of such modes. " ))
248
+
260
249
(easy-menu-define haskell-mode-menu haskell-mode-map
261
250
" Menu for the Haskell major mode."
262
251
; ; Suggestions from Pupeno <[email protected] >:
@@ -267,8 +256,8 @@ be set to the preferred literate style."
267
256
[" Indent region" indent-region mark-active]
268
257
[" (Un)Comment region" comment-region mark-active]
269
258
" ---"
270
- [" Start interpreter" switch-to-haskell ]
271
- [" Load file" inferior- haskell-load-file]
259
+ [" Start interpreter" haskell-process-switch ]
260
+ [" Load file" haskell-process -load-file]
272
261
" ---"
273
262
[" Load tidy core" ghc-core-create-core]
274
263
" ---"
@@ -407,27 +396,47 @@ May return a qualified name."
407
396
(defcustom haskell-mode-hook nil
408
397
" Hook run after entering `haskell-mode' .
409
398
410
- Some of the supported modules that can be activated via this hook:
399
+ You may be looking at this documentation because you haven't
400
+ configured indentation or process interaction.
411
401
412
- `haskell-decl-scan' , Graeme E Moss
413
- Scans top-level declarations, and places them in a menu.
414
-
415
- `haskell-doc' , Hans-Wolfgang Loidl
416
- Echoes types of functions or syntax of keywords when the cursor is idle.
402
+ Indentation modes:
417
403
418
- `haskell-indentation' , Kristof Bastiaensen
404
+ `haskell-indentation-mode ' , Kristof Bastiaensen
419
405
Intelligent semi-automatic indentation Mk2
420
406
421
- `haskell-indent' , Guy Lapalme
407
+ `haskell-indent-mode ' , Guy Lapalme
422
408
Intelligent semi-automatic indentation.
423
409
424
- `haskell-simple-indent' , Graeme E Moss and Heribert Schuetz
410
+ `haskell-simple-indent-mode ' , Graeme E Moss and Heribert Schuetz
425
411
Simple indentation.
426
412
427
- Module X is activated using the command `turn-on-X' . For example,
428
- `haskell-doc' is activated using `turn-on-haskell-doc' .
429
- For more information on a specific module, see the help for its `X-mode'
430
- function. Some modules can be deactivated using `turn-off-X' .
413
+ Interaction modes:
414
+
415
+ `interactive-haskell-mode'
416
+ Interact with per-project GHCi processes through a REPL and
417
+ directory-aware sessions.
418
+
419
+ `inf-haskell-mode'
420
+ Interact with a GHCi process using comint-mode. Deprecated.
421
+
422
+ Other modes:
423
+
424
+ `haskell-decl-scan-mode' , Graeme E Moss
425
+ Scans top-level declarations, and places them in a menu.
426
+
427
+ `haskell-doc-mode' , Hans-Wolfgang Loidl
428
+ Echoes types of functions or syntax of keywords when the cursor is idle.
429
+
430
+ To activate a minor-mode, simply run the interactive command. For
431
+ example, `M-x haskell-doc-mode'. Run it again to disable it.
432
+
433
+ To enable a mode for every haskell-mode buffer, add a hook in
434
+ your Emacs configuration. For example, to enable
435
+ haskell-indent-mode and interactive-haskell-mode, use the
436
+ following:
437
+
438
+ (add-hook 'haskell-mode-hook 'haskell-indent-mode)
439
+ (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
431
440
432
441
See Info node `(haskell-mode)haskell-mode-hook' for more details.
433
442
@@ -737,8 +746,11 @@ To be added to `flymake-init-create-temp-buffer-copy'."
737
746
738
747
(defun haskell-mode-suggest-indent-choice ()
739
748
" Ran when the user tries to indent in the buffer but no indentation mode has been selected.
740
- Brings up the documentation for haskell-mode-hook."
741
- (describe-variable 'haskell-mode-hook ))
749
+ Explains what has happened and suggests reading docs for `haskell-mode-hook' ."
750
+ (interactive )
751
+ (error " You tried to do an interaction command, but an indentation mode has not been enabled yet.
752
+
753
+ Run M-x describe-variable haskell-mode-hook for a list of such modes. " ))
742
754
743
755
(defun haskell-mode-format-imports ()
744
756
" Format the imports by aligning and sorting them."
0 commit comments