-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
126 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#+title: Concurrency | ||
#+weight: 15 | ||
#+weight: 80 | ||
#+hugo_cascade_type: docs | ||
#+math: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#+title: Emacs configuration | ||
|
||
First use your package manager or the [[https://www.gnu.org/software/emacs/download.html][official website]] to install Emacs. | ||
|
||
For example if you are using Fedora, you can install Emacs trough [[https://docs.fedoraproject.org/en-US/quick-docs/dnf/][dnf]] : | ||
#+begin_src shell | ||
sudo dnf install emacs | ||
#+end_src | ||
|
||
*** Clone this documentation | ||
You need to clone this repository. | ||
You can use this command to clone: | ||
|
||
#+begin_src sh | ||
git clone https://github.com/Pismice/HEIG_ZIG.git | ||
#+end_src | ||
|
||
*** Using Emacs | ||
To use Emacs with this documentation, you need to follow these instructions. | ||
|
||
Launch Emacs and you will have a welcome window. | ||
To navigate to this documentation, you need to use the following shortcut: ~C-x C-f~ (~ctrl-x ctrl-f~). | ||
This will open a command in the bottom left corner. | ||
With this command, you can select the path of the file you want to open. | ||
|
||
If you want to open the introduction file, you need in the first place enter the directory path where you have cloned this documentation. | ||
When you are in the root directory of the documentation, you can find all the documentation files in the directory: | ||
#+begin_example sh | ||
./content/docs/* | ||
#+end_example | ||
|
||
And this introduction file can be found in : | ||
#+begin_example sh | ||
./content/docs/introduction.org | ||
#+end_example | ||
|
||
More Emacs documentation can be found [[https://www.gnu.org/software/emacs/tour/][here]] if you want to further tweak your configuration or do other specific things. | ||
|
||
Now that we have opened the file, we can then start installing the necessary plugins to use the documentation with Literate programming. | ||
|
||
1. _Install Zig emacs org babel plugin_ | ||
To install the plugins that will be used to interact with the example codes, you need to follow the different steps. | ||
|
||
Open this =introduction.org= file with Emacs. | ||
Below, you will find instructions to create your Emacs configuration. | ||
This configuration will be built interactively. | ||
|
||
1.1. _First step_ | ||
Place your cursor in the code block below and use ~C-c C-c~ (~ctrl-c ctrl-c~) to evaluate the code below. | ||
It will add a shell interpreter inside org-babel configuration, it will be used when shell commands are evaluated. | ||
#+begin_src emacs-lisp | ||
(add-to-list 'org-babel-load-languages '(shell . t)) | ||
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages) | ||
#+end_src | ||
|
||
1.2. _Second step_ | ||
The shell command will clone an org babel [[https://github.com/samuel-schlaeppy/ob-zig.el.git][zig plugin]] necessary to execute some Zig examples directly in Emacs with Org babel. | ||
|
||
The ~HEADER~ parameter below (in the code block) configures the directory path by default. | ||
You can change the directory where the plugin will be installed (change the argument after the ~:dir~ -> ~/CHANGE-ME~). | ||
|
||
Once you have changed the ~HEADER~ parameter, you can place your cursor in the code block below and use ~C-c C-c~ (~ctrl-c ctrl-c~) to evaluate the code below. | ||
#+HEADER: :dir ~/CHANGE-ME | ||
#+begin_src shell | ||
git clone https://github.com/samuel-schlaeppy/ob-zig.el.git | ||
#+end_src | ||
|
||
2. _Create an emacs configuration file_ | ||
In the last section, the plugin =Ob-Zig= has been installed, this plugin will help to evaluate Zig example codes. | ||
To use correctly this plugin, in the code block below, you need to change the string ~./PATH-WHERE-THE-OB-ZIG-PLUGIN-IS-INSTALLED/ob-zig.el~ where you have cloned the plugin =ob-zig.el=. | ||
In addition, you need to change in the code block the string =PATH-TO-THE-ZIG-EXECUTABLE= to insert the path of the Zig executable. | ||
|
||
After that, the following command ~C-c C-v t~ (~ctrl-c ctrl-v t~) will produce a ~zigIterativeProgramming.el~ file. | ||
This file can be loaded from your emacs configuration (see section below). | ||
#+begin_src emacs-lisp :tangle zigIterativeProgramming.el | ||
(setq base_dir "~/PATH-WHERE-THE-ZIG-PLUGIN-IS-INSTALLED/ob-zig.el") | ||
(setq org-babel-zig-compiler "PATH-TO-THE-ZIG-EXECUTABLE") | ||
#+end_src | ||
|
||
#+begin_src emacs-lisp :tangle zigIterativeProgramming.el | ||
(require 'package) | ||
(add-to-list 'package-archives | ||
'("melpa" . "https://melpa.org/packages/")) | ||
(package-initialize) | ||
(package-refresh-contents) | ||
|
||
(defun install-custom-pkg (pck) | ||
(if (featurep pck) | ||
(message "The package %s is already installed !" pck) | ||
(package-install pck) | ||
)) | ||
|
||
(install-custom-pkg 'zig-mode) | ||
(install-custom-pkg 'lsp-mode) | ||
(require 'lsp-mode) | ||
(add-hook 'zig-mode-hook #'lsp) | ||
|
||
(let ((local-file-path (expand-file-name "ob-zig.el" base_dir))) | ||
(setq org-babel-zig-compiler local-file-path) | ||
(load-file local-file-path) | ||
) | ||
|
||
(custom-set-variables | ||
;; custom-set-variables was added by Custom. | ||
;; If you edit it by hand, you could mess it up, so be careful. | ||
;; Your init file should contain only one such instance. | ||
;; If there is more than one, they won't work right. | ||
'(org-babel-load-languages '((C . t) (emacs-lisp . t) (shell . t)))) | ||
#+end_src | ||
|
||
3. _Execute the configuration file from the configuration_ | ||
You can put the code below in your ~init.el~ it will load the file produced before and load the necessary package to learn Zig with literate programming. | ||
But you need the specify the directory path of the ~zigIterativeProgramming.el~ file (first line below). | ||
(the ~init.el~ can be found in ~~/.emacs.d/~ or can be created in ~~/.config/emacs/~ | ||
#+begin_src emacs-lisp | ||
(let ((file_dir "~/PATH-TO-THE-zigIterativeProgramming-file")) | ||
(load-file (expand-file-name "zigIterativeProgramming.el" file_dir))) | ||
#+end_src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#+title: Web | ||
#+weight: 16 | ||
#+weight: 90 | ||
#+hugo_cascade_type: docs | ||
#+math: true | ||
|
||
|