From 3f60e40f40c1d385c0005d5794505fce8932bccd Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Mon, 14 Oct 2019 01:23:54 +0200 Subject: [PATCH] Add lang/faust module (#1898) --- init.example.el | 1 + modules/README.org | 1 + modules/lang/faust/README.org | 46 ++++++++++++++++++++++++++++++++++ modules/lang/faust/autoload.el | 12 +++++++++ modules/lang/faust/config.el | 29 +++++++++++++++++++++ modules/lang/faust/doctor.el | 5 ++++ modules/lang/faust/packages.el | 4 +++ 7 files changed, 98 insertions(+) create mode 100644 modules/lang/faust/README.org create mode 100644 modules/lang/faust/autoload.el create mode 100644 modules/lang/faust/config.el create mode 100644 modules/lang/faust/doctor.el create mode 100644 modules/lang/faust/packages.el diff --git a/init.example.el b/init.example.el index 83577a451..698e0e023 100644 --- a/init.example.el +++ b/init.example.el @@ -109,6 +109,7 @@ ;;elm ; care for a cup of TEA? emacs-lisp ; drown in parentheses ;;ess ; emacs speaks statistics + ;;faust ; dsp, but you get to keep your soul ;;fsharp ; ML stands for Microsoft's Language ;;go ; the hipster dialect ;;(haskell +intero) ; a language that's lazier than I am diff --git a/modules/README.org b/modules/README.org index 4281fddd4..da193e85a 100644 --- a/modules/README.org +++ b/modules/README.org @@ -118,6 +118,7 @@ Modules that bring support for a language or group of languages to Emacs. + emacs-lisp: + erlang: + [[file:lang/ess/README.org][ess]]: ++ [[file:lang/faust/README.org][faust]]: + [[file:lang/go/README.org][go]] =+lsp=: + [[file:lang/haskell/README.org][haskell]] =+intero +dante +lsp=: + hy: diff --git a/modules/lang/faust/README.org b/modules/lang/faust/README.org new file mode 100644 index 000000000..227c7dc1a --- /dev/null +++ b/modules/lang/faust/README.org @@ -0,0 +1,46 @@ +#+TITLE: lang/faust +#+DATE: July 23, 2019 +#+SINCE: v2.1.0 +#+STARTUP: inlineimages + +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#plugins][Plugins]] +- [[#features][Features]] + +* Description +Add support to Faust language inside emacs. + ++ Faust code syntax hightlighting and indentation ++ Project-based (inter-linked Faust files) ++ Build/compile with output window ++ Graphic diagrams generation and vizualisation in the (default) browser ++ Browse generated C++ code inside Emacs ++ Inter-linked files/buffers : + + From "component" to Faust file + + From "include" to Faust library file ++ From error to file:line number ++ From function name to online documentation ++ Fully configurable (build type/target/architecture/toolkit, keyboard shortcuts, etc.) ++ Automatic keyword completion (if Auto-Complete is installed) ++ Automatic objets (functions, operators, etc.) template insertion with default sensible values (if Yasnippet is installed) ++ Modeline indicator of the state of the code + +** Plugins ++ [[https://bitbucket.org/yphil/faustine][faustine]] + +* Features +Keybindings + +| Binding | Description | +|-------------------+----------------------| +| ~ b~ | ~build~ | +| ~ c~ | ~syntax check~ | +| ~ d~ | ~diagram~ | +| ~ h~ | ~online dock~ | +| ~ RET~ | ~mdoc~ | +| ~ o~ | ~toggle output buffer~ | +| ~ s~ | ~source code~ | +| ~ r~ | ~run~ | +| ~ S-b~ | ~build all~ | +| ~ S-d~ | ~diagram all~ | diff --git a/modules/lang/faust/autoload.el b/modules/lang/faust/autoload.el new file mode 100644 index 000000000..f3711d143 --- /dev/null +++ b/modules/lang/faust/autoload.el @@ -0,0 +1,12 @@ +;;; lang/faust/autoload.el -*- lexical-binding: t; -*- + +;;;###autoload +(defun +faust-company-backend (command &optional arg &rest ignored) + "`company-mode' completion back-end for `faust-mode'." + (interactive (list 'interactive)) + (cl-case command + (interactive (company-begin-backend '+faust-company-backend)) + (prefix (and (derived-mode-p 'faust-mode) + (not (company-in-string-or-comment)) + (or (company-grab-symbol-cons "\\." 1) 'stop))) + (candidates faust-keywords-all))) diff --git a/modules/lang/faust/config.el b/modules/lang/faust/config.el new file mode 100644 index 000000000..1c907043e --- /dev/null +++ b/modules/lang/faust/config.el @@ -0,0 +1,29 @@ +;;; lang/faust/config.el -*- lexical-binding: t; -*- + +(use-package! faustine + :mode ("\\.dsp\\'" . faustine-mode) + :config + + (set-company-backend! '(faust-mode faustine-mode) '+faust-company-backend) + + (defadvice! +faust--suppress-ac-warnings-a (orig-fn &rest args) + "Silence obnoxious 'You really should install and use auto-complete' warnings +when starting faust-mode *and* faustine-mode. You really should *not* install +nor use auto-complete." + :around '(faust-mode faustine-mode) + (let (ac-modes ac-sources) + (apply orig-fn args))) + + (map! :localleader + :map faustine-mode-map + "b" #'faustine-build + "c" #'faustine-syntax-check + "d" #'faustine-diagram + "h" #'faustine-online-doc + "RET" #'faustine-mdoc + "o" #'faustine-toggle-output-buffer + "s" #'faustine-source-code + "r" #'faustine-run + "S-b" #'faustine-build-all + "S-d" #'faustine-diagram-all + )) diff --git a/modules/lang/faust/doctor.el b/modules/lang/faust/doctor.el new file mode 100644 index 000000000..f8d61cebe --- /dev/null +++ b/modules/lang/faust/doctor.el @@ -0,0 +1,5 @@ +;; -*- lexical-binding: t; no-byte-compile: t; -*- +;;; lang/faust/doctor.el + +(unless (executable-find "faust") + (warn! "Couldn't find the faust compiler. faustine-mode won't work.")) diff --git a/modules/lang/faust/packages.el b/modules/lang/faust/packages.el new file mode 100644 index 000000000..30734e5e4 --- /dev/null +++ b/modules/lang/faust/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; lang/faust/packages.el + +(package! faustine)