Added EmacsConfigurationAndHelp directory
[temp.git] / site-lisp / clisp-ffi.el
blob8cd8a4737d853385aefabbe74c41acd511516b91
1 ;;; syntax highlighting for CLISP FFI forms
2 ;;; Load this file from ~/.emacs or ~/.emacs.el
4 (font-lock-add-keywords
5 'lisp-mode
6 '(("(\\(def-\\(\\(call\\(\\s_\\|\\sw\\)*\\)\\|\\(c-const\\)\\|\\(c-var\\)\\|\\(c-enum\\|c-struct\\|c-type\\)\\)\\)\\>[ \t'\(]*\\(\\(\\s_\\|\\sw\\)*\\)"
7 (1 font-lock-keyword-face)
8 (8 (cond ((match-beginning 3) font-lock-function-name-face)
9 ((match-beginning 5) font-lock-variable-name-face)
10 (t font-lock-type-face)) nil t))))
12 ;; convert between lisp-style-symbols and ICantReadThis
14 (defun cantread-to-lisp-1 (name)
15 "Convert ICantReadThis to i-cant-read-this"
16 (let ((case-fold-search nil))
17 (while (string-match "\\([a-z]\\)\\([A-Z]\\)" name)
18 (setq name (replace-match "\\1-\\2" t nil name))))
19 (downcase name))
20 (defun cantread-to-lisp (&optional point)
21 "Convert the symbol-at-point from ICantReadThis to i-cant-read-this"
22 (interactive "d")
23 (goto-char point)
24 (let* ((bounds (bounds-of-thing-at-point 'symbol))
25 (name (buffer-substring-no-properties (car bounds) (cdr bounds))))
26 (delete-region (car bounds) (cdr bounds))
27 (insert (cantread-to-lisp-1 name))))
29 (defun lisp-to-cantread-1 (name)
30 "Convert i-cant-read-this to ICantReadThis"
31 (delete ?\- (capitalize name)))
32 (defun lisp-to-cantread (&optional point)
33 "Convert the symbol-at-point from i-cant-read-this to ICantReadThis"
34 (interactive "d")
35 (goto-char point)
36 (let* ((bounds (bounds-of-thing-at-point 'symbol))
37 (name (buffer-substring-no-properties (car bounds) (cdr bounds))))
38 (delete-region (car bounds) (cdr bounds))
39 (insert (lisp-to-cantread-1 name))))