help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: showing matching {}[]() in lisp and slime mode


From: Jyrki Jaakkola
Subject: Re: showing matching {}[]() in lisp and slime mode
Date: Tue, 14 Mar 2006 17:17:54 GMT

>Give us more info about what you've done.
>Paren/backet/brace matching normally "just works" if you set the
>syntax-table properly.

First I tried editing lisp-mode.el.

from emacs-lisp/lisp-mode.el:
(defvar emacs-lisp-mode-syntax-table
  (let ((table (make-syntax-table)))
.
.
.
      (modify-syntax-entry ?\( "()  " table)
      (modify-syntax-entry ?\) ")(  " table)
      (modify-syntax-entry ?\[ "(]  " table)
      (modify-syntax-entry ?\] ")[  " table)
      (modify-syntax-entry ?\{ "(}  " table)
      (modify-syntax-entry ?\} "){  " table))
    table))

(defvar lisp-mode-syntax-table
  (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
    (modify-syntax-entry ?\[ "(]  " table)
    (modify-syntax-entry ?\] ")[  " table)
    (modify-syntax-entry ?\{ "(}  " table)
    (modify-syntax-entry ?\} "){  " table)
    (modify-syntax-entry ?# "' 14bn" table)
    (modify-syntax-entry ?| "\" 23b" table)
    table))

When those didn't work I tried adding a hook to slime mode

from site-lisp\slime.el:
(setq load-path (cons (lispbox-file "slime-20060110") load-path))
(setenv "SBCL_HOME" (lispbox-file "sbcl-0.9.7/lib/sbcl"))
(setenv "CCL_DEFAULT_DIRECTORY" (lispbox-file "openmcl-1.0"))
(require 'slime)
(slime-setup)

;; my own code starts here
(defun my-keybindings-hook ()
  ((modify-syntax-entry ?\[ "(]  " lisp-mode-syntax-table)
   (modify-syntax-entry ?\] ")[  " lisp-mode-syntax-table)
   (modify-syntax-entry ?\{ "(}  " lisp-mode-syntax-table)
   (modify-syntax-entry ?\} "){  " lisp-mode-syntax-table)))
(add-hook 'lisp-mode-hook 'my-keybindings-hook)
(add-hook 'slime-mode-hook 'my-keybindings-hook)
;; my own code ends here

(lispbox-find-lisps)

(provide 'lispbox)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]