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

Adds emacs mode for carbon #4874

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Conversation

samkhn
Copy link
Contributor

@samkhn samkhn commented Jan 31, 2025

Tested by opening examples/ and core/.

As the language is flushed out more, we can add more but deriving from cc-mode works for now.

Also adds elisp to license pre-commit hook.

Tested by opening examples/ and core/.

As the language is flushed out more, we can add more but deriving from
c-mode works for now. Going to roughly design it similar to cuda-mode.el
on emacswiki.

Also adds elisp to license pre-commit hook
@github-actions github-actions bot requested a review from zygoloid January 31, 2025 18:14
@github-actions github-actions bot added infrastructure utilities Utilities for working with Carbon code: syntax highlighting, editor plugins, etc. labels Jan 31, 2025
EMACS_MODULES=$HOME/.emacs.d/lisp

# Next line enforces that we run this test within the same directory.
cp ./carbon-mode.el $EMACS_MODULES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't do the right thing if the directory doesn't exist.

Suggested change
cp ./carbon-mode.el $EMACS_MODULES
mkdir -p $EMACS_MODULES
cp ./carbon-mode.el $EMACS_MODULES/

# Next line enforces that we run this test within the same directory.
cp ./carbon-mode.el $EMACS_MODULES

emacs --eval "(require 'carbon-mode)" ../../examples/sieve.carbon -f carbon-mode &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an "emacs: standard input is not a tty" error here.

Also, it doesn't make sense to put this in the background:

Suggested change
emacs --eval "(require 'carbon-mode)" ../../examples/sieve.carbon -f carbon-mode &
emacs --eval "(require 'carbon-mode)" ../../examples/sieve.carbon -f carbon-mode

2. add to config

```emacs-lisp
(require 'carbon-mode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These instructions assume that (push "~/.emacs.d/lisp" load-path) is in your .emacs file, and so should instruct people to add it if it is not already there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure utilities Utilities for working with Carbon code: syntax highlighting, editor plugins, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants