Emacs minor mode for Cilk source code editing.
This package provides cilk-mode
, a minor mode that can be activated in
buffers with major mode c-mode
, c++-mode
, or derived modes. The
cilk-mode
minor mode enables the features listed in the following
table and described below.
Feature | Function | Auto-enable variable |
---|---|---|
Cilk keyword indentation | cilk-mode-cc-keywords |
cilk-mode-enable-cc-keywords |
Cilk keyword highlighting | cilk-mode-font-lock |
cilk-mode-enable-font-lock |
Flycheck with OpenCilk | cilk-mode-flycheck-opencilk |
cilk-mode-enable-flycheck-opencilk |
By default, all features are activated/deactivated together with
cilk-mode
.
- To explicitly enable, disable, or toggle a feature, use the
corresponding function in the table above. The functions do not
require
cilk-mode
to be active (but it must be loaded, of course). - To prevent a feature from being automatically enabled in
cilk-mode
, set the corresponding auto-enable variable tonil
.
in c-mode , before cilk-mode-cc-keywords |
after cilk-mode-cc-keywords |
Cilk keywords are fontified with the cilk-mode-parallel-keyword
face.
By default, the latter is the same as font-lock-keyword-face
but can
be customized without affecting the "regular" C/C++ keywords.
before cilk-mode-font-lock |
after cilk-mode-font-lock (customized face) |
The path to the OpenCilk compiler is set in
cilk-mode-flycheck-opencilk-executable
. This feature requires the flycheck
package and works with the flycheck-mode
minor mode.
before cilk-mode-flycheck-opencilk |
after cilk-mode-flycheck-opencilk |
Download cilk-mode.el
and add the following to your .emacs
file:
(add-to-list 'load-path "/path/to/cilk-mode-parent-dir")
(require 'cilk-mode)
Users of GNU Emacs (version 24.1 or greater) can install cilk-mode
via
MELPA. To use the MELPA repository, make sure
you have the following in your .emacs
file:
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
Then, run M-x package-list-packages
to find and install cilk-mode
.
For more information, see the MELPA Getting Started Guide.
In .doom.d/packages.el
:
(package! cilk-mode
:recipe (:host github :repo "ailiop/cilk-mode"))
In your .emacs
file:
;; load package
(add-to-list 'load-path "/path/to/cilk-mode-parent-dir") ; if necessary
(require 'cilk-mode)
;; automatically enable cilk-mode within c-mode and c++-mode
(dolist (h '('c-mode-hook 'c++-mode-hook))
(add-hook h #'cilk-mode))
;; customize Cilk keyword face
(set-face-attribute 'cilk-mode-parallel-keyword nil
:foreground "#FDA900") ; mustard color
;; customize path to the OpenCilk compiler (for use with flycheck)
(setq cilk-mode-opencilk-executable "/opt/opencilk-2/bin/clang")
In .doom.d/config.el
:
(use-package! cilk-mode
:command cilk-mode
:config
(set-face-attribute 'cilk-mode-parallel-keyword nil
:foreground "#FDA900") ; mustard color
(setq cilk-mode-opencilk-executable "/opt/opencilk-2/bin/clang"))
(add-hook! '(c-mode c++-mode) #'cilk-mode)