Howto:Syntax highlighting for Nasal: Difference between revisions

Jump to navigation Jump to search
→‎Emacs: Consolidate instructions
m (→‎Emacs: https://forum.flightgear.org/viewtopic.php?f=30&t=41115&p=409029#p409029)
(→‎Emacs: Consolidate instructions)
Line 22: Line 22:
[[File:Emacs-nasal-syntax-highlighting.png|400px|thumb|Nasal syntax highlighting in GNU Emacs]]
[[File:Emacs-nasal-syntax-highlighting.png|400px|thumb|Nasal syntax highlighting in GNU Emacs]]


There is a Emacs major mode for Nasal available here: https://github.com/andyross/nasal/blob/master/misc/nasal-mode.el
There is an Emacs major mode for Nasal available in SimGear, that is based on Andy Ross' [https://github.com/andyross/nasal/blob/master/misc/nasal-mode.el original version]. In order to use it, you can copy the {{simgear source
 
| path = simgear/nasal/misc/nasal-mode.el
Under Linux just drop the file where you have the rest of your manually installed packages and add the following to your .emacs file:
| text = nasal-mode.el
}} file where you have the rest of your manually installed packages and add the following line to your [https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html Emacs initialization file]:
  <nowiki>(require 'nasal-mode)</nowiki>
  <nowiki>(require 'nasal-mode)</nowiki>


If you don't have a directory to place your manually installed packages, put the file in the directory ''~/.emacs.d/lisp/'' (create it if it doesn't exist) and then put the following in your .emacs file before the ''require'':
In case you don't already have a directory to place your manually installed packages, put the file for instance in ''~/.emacs.d/manual-installs/'' (first create this directory if necessary) and insert the following in your Emacs initialization file before the above ''require'' line:
  <nowiki>;; Tell emacs where is your personal elisp lib dir
  <nowiki>;; Tell Emacs it can load ELisp files from there
(add-to-list 'load-path "~/.emacs.d/lisp/")</nowiki>
(add-to-list 'load-path "~/.emacs.d/manual-installs")</nowiki>


Reload .emacs via <code>'''M-x''' load-file</code> or by restarting Emacs.
Once this is done, restart Emacs, check that no error is reported and open a .nas file.


Update: 01/2023: Tip for Emacs users (installation of the Nasal support ELisp file present in SimGear):
Optional step: in order to speed up loading of nasal-mode.el, you can open it and choose ''Byte-compile this file'' from the ''Emacs-Lisp'' menu (or equivalently, run M-x byte-compile-file).


* copy https://sourceforge.net/p/flightgear/simgear/ci/next/tree/simgear/nasal/misc/nasal-mode.el to (for instance) ~/lisp/manual-installs/nasal-mode.el (or make the latter a symlink to simgear/nasal/misc/nasal-mode.el, assuming you have the SimGear repository checked out somewhere on your hard drive);
{{Tip|In case you have a clone of the {{simgear source
* add the following to your Emacs initialization file (e.g., ~/.emacs.d/init.el):
| text = SimGear repository
<code>
}} on your hard drive, you may create a symbolic link from ~/.emacs.d/manual-installs/nasal-mode.el to the file inside that repository; this way, you'll get automatic updates of nasal-mode.el when your SimGear repository is updated (Emacs will ignore the .elc file resulting from byte compilation if the corresponding .el file is more recent).}}
(add-to-list 'load-path "~/lisp/manual-installs")
(require 'nasal-mode)
</code>
* optionally: open ~/lisp/manual-installs/nasal-mode.el and choose Byte-compile this file from the Emacs-Lisp menu (or run M-x byte-compile-file);
* restart Emacs.


The '''true''' and '''false''' keywords introduced in 01/2023 are already supported.<ref>https://forum.flightgear.org/viewtopic.php?f=30&t=41115&p=409029#p409029</ref>
The '''true''' and '''false''' keywords introduced in January 2023 are already supported.<ref>https://forum.flightgear.org/viewtopic.php?f=30&t=41115&p=409029#p409029</ref>


== Geany ==
== Geany ==
377

edits

Navigation menu