Resultados 1 al 3 de 3

Tema: Instalar modulo Haskell en Emacs para WinXP

  1. #1
    Vive aquí
    Madrid 2020

    Predeterminado Instalar modulo Haskell en Emacs para WinXP

    Pues tengo instalado el emacs en mi Windows XP y esta funcionando correctamente pero ahora quiero añadirle el "modulo" para el lenguaje de programacion funcional Haskell. Y no tengo ni idea de como hacerlo.

    Ya me he bajado un archivo que se llama haskell.mode-2.1 y que contiene muchos archivos, la mayoria con la extension .el. Pero no se que tengo que hacer o donde ponerlo para que el emacs lo reconozca y ya funcione dicho modulo.

    La siguiente installation-guide viene, a ver si alguien que use emacs en windows puede decirme algo al respecto

    Haskell Mode for Emacs: Installation Guide

    When Emacs is started up, it normally runs a file called ~/.emacs located in your home directory. This file should contain all of your personal customisations written as a series of Elisp commands. In order to install the Haskell mode, you have to tell Emacs where to find it. This is done by adding some commands to the init file.

    * If you are using XEmacs, the haskell-mode package should be available for installation through the XEmacs package UI.
    * If you are using Debian, you can install the package haskell-mode with a command like "apt-get install haskell-mode".


    * Download and unpack the basic mode and modules into a suitable directory, e.g. ~/lib/emacs where ~ stands for your home directory.

    Assuming you have placed the basic mode haskell-mode.el and the modules you want to use in the directory ~/lib/emacs, add the following command to your init file (~/.emacs):

    (load "~/lib/emacs/haskell-site-file")

    adding the following lines according to which modules you want to use:

    (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
    (add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
    (add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)

    Note that the two indentation modules are mutually exclusive - add at most one. Note that the line of code for simple indentation is commented out (using a preceeding in preference for the more advanced indentation module. Installation is now complete!

    The other modules are automatically loaded when needed in the following way:
    o Font locking: just turn it on via global-font-lock-mode or do

    (add-hook 'haskell-mode-hook 'font-lock-mode)

    o Declaration scanning: just use M-x imenu or bind imenu to a key. E.g.

    (global-set-key [(control meta down-mouse-3)] 'imenu)

    or you can also add it to the menubar with

    (add-hook 'haskell-mode-hook 'imenu-add-menubar-index)

    o Interaction with inferior Haskell interpreter: just hit C-c C-z or C-c C-l.

    For those interested, each command above shall now be explained.


    We must ensure that the directory containing haskell-mode.el is on the load-path of Emacs. You can examine the value of the load-path by typing C-h v load-path in an Emacs session. Supposing that you've placed haskell-mode.el in the directory ~/lib/emacs, if this directory is not on the load-path we add it with:

    (setq load-path (cons "~/lib/emacs" load-path))

    The function setq sets the value of a variable, and the function cons takes an element and a list and creates a new list with the former as head and the latter as tail, as in Haskell.

    It is possible (and desirable) for Emacs to enter a specific mode according to the name of the file being edited/visited. The variable auto-mode-alist tells Emacs what mode to run according to which regular expression matches the filename. We wish to run the Haskell mode on all files ending in .hs, .hi (interface file) and .gs (Gofer file), and to run the Haskell mode for literate scripts on all files ending in .lhs and .lgs. To do this, we need to add pairs of the form (regexp . mode-function). We use the function append to append a list of three such pairs to the end of the value of auto-mode-alist. A list in Elisp is written within round parantheses with elements separated by whitespace. A list is treated as a function application unless it is quoted with ', which is what we do.

    In order for Emacs to know where to find the definition of our mode functions, haskell-mode and literate-haskell-mode, we must use the function autoload. Both mode functions can be found in the file haskell-mode.el which was downloaded in the first installation step (the .el extension is left off and assumed by Emacs). As we have already ensured that this file is on the load-path we need only give the filename and not the directory. Its use is quite straightforward but for further information, see its documentation by entering C-h f autoload in an Emacs session.

    Each function turn-on-haskell-module turns on the corresponding module. Adding such a function as a hook to the Haskell mode will turn on that module when the mode is used. Note that each of these modules may slow down Emacs, especially for large files.

  2. #2

    Predeterminado Re: Instalar modulo Haskell en Emacs para WinXP

    No se como ayudarte, pero yo me instalaría el Hugs98 y listo!

    1.- 3200+/A8N-E/2x256@333/X700SE@450/620
    2.- Ahtec Signal 400M X27

  3. #3
    Vive aquí
    Madrid 2020

    Predeterminado Re: Instalar modulo Haskell en Emacs para WinXP

    No si el hugs y el ghc ya los tengo instalados. El emacs sirve para editar los archivos de texto .hs de forma muy facil. Ya que teoricamente cargando el modulo de Haskell las palabras reservadas te aparecen de otro color.

    Es que es un coñazo hacer los archivos .hs con el notepad o wordpad porque te acabas volviendo loco con los sangriados. El emacs solo lo quiero como editor de texto pero adaptado al lenguaje Haskell.

    Gracias de todos modos.

Permisos de publicación

  • No puedes crear nuevos temas
  • No puedes responder temas
  • No puedes subir archivos adjuntos
  • No puedes editar tus mensajes