diff --git a/emacs-lisp/hello-world/.exercism/config.json b/emacs-lisp/hello-world/.exercism/config.json new file mode 100644 index 0000000..1f39c96 --- /dev/null +++ b/emacs-lisp/hello-world/.exercism/config.json @@ -0,0 +1,25 @@ +{ + "authors": [ + "canweriotnow" + ], + "contributors": [ + "benreyn", + "konrad", + "kytrinyx", + "vermiculus" + ], + "files": { + "solution": [ + "hello-world.el" + ], + "test": [ + "hello-world-test.el" + ], + "example": [ + ".meta/example.el" + ] + }, + "blurb": "The classical introductory exercise. Just say \"Hello, World!\".", + "source": "This is an exercise to introduce users to using Exercism", + "source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program" +} diff --git a/emacs-lisp/hello-world/.exercism/metadata.json b/emacs-lisp/hello-world/.exercism/metadata.json new file mode 100644 index 0000000..9280bea --- /dev/null +++ b/emacs-lisp/hello-world/.exercism/metadata.json @@ -0,0 +1 @@ +{"track":"emacs-lisp","exercise":"hello-world","id":"cc423d14697547f3bb31a57ef9da699d","url":"https://exercism.org/tracks/emacs-lisp/exercises/hello-world","handle":"Nebucatnetzer","is_requester":true,"auto_approve":false} \ No newline at end of file diff --git a/emacs-lisp/hello-world/HELP.md b/emacs-lisp/hello-world/HELP.md new file mode 100644 index 0000000..6206528 --- /dev/null +++ b/emacs-lisp/hello-world/HELP.md @@ -0,0 +1,82 @@ +# Help + +## Running the tests + +Tests can be run several ways. + +## Interactively from within Emacs + +1. Open test file, `M-x eval-buffer RET` +2. Interactively and individually, with `M-x ert RET test-name RET` +3. Interactively and all at once, with `M-x ert RET t RET` + Note that this will run all tests currently loaded into Emacs! +4. Rerun `M-x eval-buffer RET` before testing whenever you've made changes + +To only execute the tests in the current buffer you can add this to your `.emacs` or `init.el`: + +```elisp +(defun my-eval-and-run-all-tests-in-buffer () + "Deletes all loaded tests from the runtime, evaluates the current buffer and runs all loaded tests with ert." + (interactive) + (ert-delete-all-tests) + (eval-buffer) + (ert 't)) +``` + +After restarting Emacs: + +1. Open test file +2. `M-x my-eval-and-run-all-tests-in-buffer RET` + +## From the terminal + +To run run all tests from the terminal, in batch mode, execute `emacs -batch -l ert -l *-test.el -f ert-run-tests-batch-and-exit` + +The above command is a bit unwieldy, so if you like: + +1. Create a file on your `$PATH` (probably in `~/bin`) called `ert-run` +2. The contents of the file should be as follows: + ```sh + #!/usr/bin/env sh + emacs -batch -l ert -l $1 -f ert-run-tests-batch-and-exit + ``` +3. Make the file executable with `chmod +x ert-run` + +You should be able to simply call `ert-run *-test.el` and run the tests +in batch mode. + +## Other options + +Other options can be found in the docs, `C-h i m ert RET`. + +## Submitting your solution + +You can submit your solution using the `exercism submit hello-world.el` command. +This command will upload your solution to the Exercism website and print the solution page's URL. + +It's possible to submit an incomplete solution which allows you to: + +- See how others have completed the exercise +- Request help from a mentor + +## Need to get help? + +If you'd like help solving the exercise, check the following pages: + +- The [Emacs Lisp track's documentation](https://exercism.org/docs/tracks/emacs-lisp) +- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5) +- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) + +Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. + +To get help if you're having trouble, you can use one of the following resources: + +- [The Emacs Wiki](http://emacswiki.org/) is invaluable. Spend lots of time here. +- [The Emacs Editor](http://www.gnu.org/software/emacs/manual/html_node/emacs/index.html) is the official manual for GNU Emacs. +- IRC - there are [Libera.Chat](https://libera.chat/) channels for `#emacs`, `#org-mode`, and many Emacs + packages, and many helpful folks around. And with emacs, IRC is as close as + `M-x erc`. +- Matrix - on [Matrix](https://matrix.org/) there are rooms for [emacs](https://matrix.to/#/#emacs:matrix.org), [org-mode](https://matrix.to/#/#org-mode:matrix.org), and other Emacs packages. + You can [join the Emacs Matrix space](https://matrix.to/#/#emacs-space:matrix.org) to get an overview of the available channels. + To join Matrix from within Emacs you can use the [Ement.el](https://github.com/alphapapa/ement.el) package. +- [StackOverflow](http://stackoverflow.com/questions/tagged/elisp) and [Emacs StackExchange](https://emacs.stackexchange.com/questions/tagged/elisp) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. \ No newline at end of file diff --git a/emacs-lisp/hello-world/README.md b/emacs-lisp/hello-world/README.md new file mode 100644 index 0000000..2b92ade --- /dev/null +++ b/emacs-lisp/hello-world/README.md @@ -0,0 +1,38 @@ +# Hello World + +Welcome to Hello World on Exercism's Emacs Lisp Track. +If you need help running the tests or submitting your code, check out `HELP.md`. + +## Instructions + +The classical introductory exercise. +Just say "Hello, World!". + +["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment. + +The objectives are simple: + +- Modify the provided code so that it produces the string "Hello, World!". +- Run the test suite and make sure that it succeeds. +- Submit your solution and check it at the website. + +If everything goes well, you will be ready to fetch your first real exercise. + +[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program + +## Source + +### Created by + +- @canweriotnow + +### Contributed to by + +- @benreyn +- @konrad +- @kytrinyx +- @vermiculus + +### Based on + +This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program \ No newline at end of file diff --git a/emacs-lisp/hello-world/hello-world-test.el b/emacs-lisp/hello-world/hello-world-test.el new file mode 100644 index 0000000..c0d7254 --- /dev/null +++ b/emacs-lisp/hello-world/hello-world-test.el @@ -0,0 +1,16 @@ +;;; hello-world-test.el --- Tests for Hello World (exercism) -*- lexical-binding: t; -*- + +;;; Commentary: +;; Common test data version: 1.1.0 be3ae66 + +;;; Code: + +(load-file "hello-world.el") +(declare-function hello "hello-world.el") + +(ert-deftest hello-world-test () + (should (string= (hello) "Hello, World!"))) + +(provide 'hello-world-test) + +;;; hello-world-test.el ends here diff --git a/emacs-lisp/hello-world/hello-world.el b/emacs-lisp/hello-world/hello-world.el new file mode 100644 index 0000000..0bb9246 --- /dev/null +++ b/emacs-lisp/hello-world/hello-world.el @@ -0,0 +1,9 @@ +;;; hello-world.el --- Hello World exercise (exercism) -*- lexical-binding: t; -*- + +;;; Commentary: + +(defun hello () + "Goodbye, Mars!") + +(provide 'hello-world) +;;; hello-world.el ends here