Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 818de31

Browse files
committed
Don't talk about indentation-mode as a thing
There is now a single default Indentation mode, enabled automatically
1 parent c9d0e40 commit 818de31

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

tutorial.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,11 @@ A piece of advice: most of the times when you need to write something in Emacs,
106106

107107
Before continuing, note that `haskell-mode` has many more features and options that the ones we are going to talk about. You can learn more about them in [its wiki](https://github.com/haskell/haskell-mode/wiki).
108108

109-
### Indentation modes
110-
111-
In order to use `haskell-mode`, you need to select one of the three [indentation modes](https://github.com/haskell/haskell-mode/wiki/Indentation) that it provides. The indentation mode specifies how Enter and Tab will be treated when working with Haskell code. The most advanced one is called `haskell-indentation`. To enable it:
112-
* Open your personal configuration file. Remember, to do so press `M-:`, then write `(find-file user-init-file)` and finally press Enter.
113-
* Add a new line containing `(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)`.
114-
* Save the file with `C-x C-s`.
115-
* Apply the changes with `M-x eval-buffer RET`, or restart Emacs.
116-
117109
It is time to open a Haskell file! You can do it by issuing `C-x C-f` and then writing the path to either a new or an existing file. It is required that the extension is `.hs` or `.lhs` for Emacs to recognize that it is a Haskell file and enable the newly-installed `haskell-mode`.
118110

119-
If you write Haskell code now, it should be syntax highlighted. If you press Tab in the file, `haskell-indentation` will take care of the layout rule and indent your code as needed. But let's use some time to look at the bottom of the screen: after the file name, you should notice that `Haskell Ind` is written. This tells you about the major and minor mode of this file, an important concept in Emacs:
111+
If you write Haskell code now, it should be syntax highlighted. If you press Tab in the file, `haskell-mode` will take care of the layout rule and indent your code as needed. But let's use some time to look at the bottom of the screen: after the file name, you should notice that `Haskell` is written. This tells you about the major mode of this file, an important concept in Emacs:
120112
* A major mode, in this case `Haskell`, defines the global way of interacting with the file. Each file has one major mode associated with it, usually related to the programming language in which the file is written.
121-
* In addition, any amount of minor modes can be enabled. Those define smaller interactions which complement the major one. In this case, we have `Ind`, related to indentation. In many cases, you will have a great deal of minor modes enabled per file.
122-
123-
There is also an external package, called _haskell-indentation 2n try_, or simply [`hi2`](https://github.com/errge/hi2), which provides some changes from `haskell-indentation` to make it easier to use. The package is available in MELPA, so you can get it easily from the repository. As a reminder, installing a package is done by pressing `M-x`, then `package-install`, and finally writing the name of the package, in this case `hi2`. To activate the indentation mode for Haskell files, you need to insert the following text in the configuration file:
124-
```lisp
125-
(add-hook 'haskell-mode-hook 'turn-on-hi2)
126-
```
127-
Note that adding this extra indentation mode is not strictly necessary: in many cases, the built-in `haskell-indentation` works perfectly.
113+
* In addition, any amount of minor modes can be enabled. Those define smaller interactions which complement the major one. In many cases, you will have a great deal of minor modes enabled per file.
128114

129115
For re-indenting parts of your code in an appropiate style, you might look at the [`hindent`](https://github.com/chrisdone/hindent) from Chris Done. You can get it from MELPA, using the package name `hindent`. You will also need to install the corresponding package using `cabal install hindent` (wait for the next section to get more information about installation of Haskell libraries). Finally, in your configuration file add the following text:
130116
```lisp

0 commit comments

Comments
 (0)