Emacs LSL-mode; More Features and Customization

By Xah Lee. Date:

This page describes extra features and tips of Emacs LSL Mode for Linden Scripting Language.

Syntax Checking

To check lsl syntax, type 【Ctrl+c Ctrl+l】. This will call the emacs command “xlsl-syntax-check”, which in turn calls “lslint”.

For this feature to be available, you need to install lslint first, then set its path to the variable “xlsl-lslint-path”. For example, put the following in your emacs init file:

;; let emacs know the path for the LSL syntax checking program lslint
(setq xlsl-lslint-path "~/bin/lslint")

“lslint” is a command line tool by “W-Hat Corporation” that checks the syntax of your lsl source code. You can download it at http://w-hat.com/lslint/.

For some tips on installing lslint on OS X, see: lslint_install.txt

Customizing xlsl-mode

xlsl-mode follows emacs's convention in choices of keyboard shortcuts. Many of them are not very convenient. If you prefer easier keys, put the following code in your emacs init file “.emacs”.

(defun my-xlsl-mode-customizations ()
  "Some customization for xlsl-mode."
  (define-key xlsl-mode-map (kbd "<C-tab>") 'xlsl-complete-symbol)
  (define-key xlsl-mode-map (kbd "<f8>") 'xlsl-copy-all)
  (define-key xlsl-mode-map (kbd "<f9>") 'xlsl-lookup-lsl-ref)

(add-hook 'xlsl-mode-hook 'my-xlsl-mode-customizations)

You need to restart emacs.

If you would like emacs to display keyword completion suggestions using the color as shown in screenshot here, type 【Alt+x customize-group Enter completion Enter】. Then, emacs will show a GUI for you to tweak. Edit the “Completions Common Part”. After you are done, click on “Save for Future Sessions” then “Finish”. Emacs will add elisp code to your emacs init file. The following is my personal settings.

(show-paren-mode 1) ; highlight matching pairs
(setq show-paren-style 'expression) ; highlight all code inbetween
(cua-mode 1) ; Ctrl + x c v keys for Cut Copy Paste

  ;; custom-set-faces 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.
 '(completions-common-part ((t (:inherit default :foreground "red"))))
 '(show-paren-match ((((class color) (background light)) (:background "azure2")))))
Want to dash through walls?
Try Xah Tele-Dasher!