Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs mode #128

Open
mikeshulman opened this issue Dec 20, 2021 · 7 comments
Open

Emacs mode #128

mikeshulman opened this issue Dec 20, 2021 · 7 comments

Comments

@mikeshulman
Copy link

For Emacs users like myself, it would be nice to have an Emacs mode for elpi. In fact, I haven't been able to find an Emacs mode for any kind of lambda-prolog that works on a modern Emacs. Does anyone know of such a thing? If not, I could probably throw together a bare-bones Emacs mode myself with a little time, perhaps by deriving from an ordinary prolog mode; would anyone be willing to help me get the syntax regexps and keyword lists correct?

@ThatDaleMiller
Copy link

I've been using the emacs code located at https://kamal.aboulhosn.org/lp/tey-emacs.html with the Teyjus implementation of lambda Prolog. Given its age and its explicit use of Teyjus, it would need to be updated for Elpi.

@mikeshulman
Copy link
Author

Thanks for the reply! I tried that, but wasn't able to get it to work in a modern Emacs. Any tips?

@ThatDaleMiller
Copy link

I use this code in Emacs 27.2 on a linux machine. I have the following lines in my .emacs file.

;;;;;;;;  Teyjus mode  ;;;;;;;
(setq auto-mode-alist
   (cons '("\\.mod\\'" . teyjus-edit-mode) 
    (cons '("\\.sig\\'" . teyjus-edit-mode)
     (cons '("\\.hc\\'" .  teyjus-edit-mode)
      (cons '("\\.def\\'" .  teyjus-edit-mode)
           auto-mode-alist)))))

(autoload 'teyjus           "~/emacs/teyjus"
          "Run an inferior Teyjus process." t)
(autoload 'teyjus-edit-mode "~/emacs/teyjus" 
          "Syntax Highlighting, etc. for Lambda Prolog" t)

The .hc and .def extensions not relevant to either Teyjus or Elpi. I am not, however, an expert in .el file contents so I don't have any additional tips. Hope this helps.

@mikeshulman
Copy link
Author

Interesting. On Emacs 26.1 I get (void-function full-copy-sparse-keymap).

@mikeshulman
Copy link
Author

Ah, interesting. I didn't find this before, but http://www.verycomputer.com/93_c0f1432ec52c4976_1.htm suggests just replacing full-copy-sparse-keymap with copy-keymap, and that seems to work.

Which of the differences between teyjus and elpi are relevant to an Emacs mode?

@ThatDaleMiller
Copy link

Most of my code compiles and runs on both Teyjus and Elpi. On these programs, syntax highlighting to the teyjus.el code works fine for me. Features related to compiling code, error messages, etc (such as M-x teyjus-compile) need to be updated if they are to be used with Elpi.

@gares
Copy link
Contributor

gares commented Dec 23, 2021

I'd be happy to merge a PR adding setup instructions for emacs (eg in the README). I am no Emacs user, so I would not be confident to write them right myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants