* showing matching {}[]() in lisp and slime mode
@ 2006-03-12 21:34 Jyrki Jaakkola
2006-03-13 7:29 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Jyrki Jaakkola @ 2006-03-12 21:34 UTC (permalink / raw)
Hello!
I have been trying to add parentheses matching for square brackets as well
as round bracket besides normally available parentheses in lisp mode. I'm
using lispbox from http://www.gigamonkeys.com/book/lispbox. I need bracket
matching because I'm trying to use meta parser from
http://home.pipeline.com/~hbaker1/Prag-Parse.html.
I have tried changing lisp-mode-syntax-table as well as
emacs-lisp-mode-syntax-table from lisp-mode.el. Tried to add a hook to
change syntax table when going to lisp-mode or slime-mode. I have also
tried mic-paren.el (and I'm currently using it) to get it highlight
matching brackets but in vain.
Anybody care to share some information how I could get it working? I would
really appreciate it. Thanks in advance.
Yours sincerely,
Jyrki Jaakkola
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-12 21:34 showing matching {}[]() in lisp and slime mode Jyrki Jaakkola
@ 2006-03-13 7:29 ` Stefan Monnier
2006-03-14 17:17 ` Jyrki Jaakkola
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Stefan Monnier @ 2006-03-13 7:29 UTC (permalink / raw)
> Anybody care to share some information how I could get it working?
> I would really appreciate it. Thanks in advance.
Give us more info about what you've done.
Paren/backet/brace matching normally "just works" if you set the
syntax-table properly.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-13 7:29 ` Stefan Monnier
@ 2006-03-14 17:17 ` Jyrki Jaakkola
2006-03-15 6:04 ` Stefan Monnier
2006-03-15 13:40 ` Johan Bockgård
2006-03-16 18:43 ` Jyrki Jaakkola
2006-03-18 16:19 ` Jyrki Jaakkola
2 siblings, 2 replies; 11+ messages in thread
From: Jyrki Jaakkola @ 2006-03-14 17:17 UTC (permalink / raw)
>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)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-14 17:17 ` Jyrki Jaakkola
@ 2006-03-15 6:04 ` Stefan Monnier
2006-03-15 13:47 ` Johan Bockgård
2006-03-15 13:40 ` Johan Bockgård
1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2006-03-15 6:04 UTC (permalink / raw)
> First I tried editing lisp-mode.el.
Bad idea.
> 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)))
Why "lisp-mode-syntax-table"?
> (add-hook 'lisp-mode-hook 'my-keybindings-hook)
> (add-hook 'slime-mode-hook 'my-keybindings-hook)
In what way does it not work? Have you tried it in Lisp-mode and/or in
Slime mode? My guess is that you only tried it in Slime-mode, where it
probably didn't work because slime mode uses another syntax-table than
lisp-mode-syntax-table (presumably it's called slime-mode-syntax-table).
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-14 17:17 ` Jyrki Jaakkola
2006-03-15 6:04 ` Stefan Monnier
@ 2006-03-15 13:40 ` Johan Bockgård
2006-03-15 16:56 ` Jyrki Jaakkola
1 sibling, 1 reply; 11+ messages in thread
From: Johan Bockgård @ 2006-03-15 13:40 UTC (permalink / raw)
Jyrki Jaakkola <jjkola@email.com> writes:
> (defun my-keybindings-hook ()
> ((modify-syntax-entry ?\[ "(] " lisp-mode-syntax-table)
^^
What's up with this??
--
Johan Bockgård
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-15 6:04 ` Stefan Monnier
@ 2006-03-15 13:47 ` Johan Bockgård
0 siblings, 0 replies; 11+ messages in thread
From: Johan Bockgård @ 2006-03-15 13:47 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> In what way does it not work? Have you tried it in Lisp-mode and/or
> in Slime mode? My guess is that you only tried it in Slime-mode,
> where it probably didn't work because slime mode uses another
> syntax-table than lisp-mode-syntax-table (presumably it's called
> slime-mode-syntax-table).
Slime mode is a minor mode.
--
Johan Bockgård
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-15 13:40 ` Johan Bockgård
@ 2006-03-15 16:56 ` Jyrki Jaakkola
2006-03-15 18:41 ` Kevin Rodgers
[not found] ` <mailman.69.1142448657.9686.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 11+ messages in thread
From: Jyrki Jaakkola @ 2006-03-15 16:56 UTC (permalink / raw)
bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:
>Jyrki Jaakkola <jjkola@email.com> writes:
>
>> (defun my-keybindings-hook ()
>> ((modify-syntax-entry ?\[ "(] " lisp-mode-syntax-table)
> ^^
>What's up with this??
I thought that maybe loading slime mode changed key bindings so I
tried adding a hook to change them to my liking but apparently it
didn't help.
Jyrki Jaakkola
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-15 16:56 ` Jyrki Jaakkola
@ 2006-03-15 18:41 ` Kevin Rodgers
[not found] ` <mailman.69.1142448657.9686.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 11+ messages in thread
From: Kevin Rodgers @ 2006-03-15 18:41 UTC (permalink / raw)
Jyrki Jaakkola wrote:
> bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:
>>Jyrki Jaakkola <jjkola@email.com> writes:
>>>(defun my-keybindings-hook ()
>>> ((modify-syntax-entry ?\[ "(] " lisp-mode-syntax-table)
>>
>> ^^
>>What's up with this??
>
> I thought that maybe loading slime mode changed key bindings so I
> tried adding a hook to change them to my liking but apparently it
> didn't help.
Johan is referring to the fact that "((" yields an invalid function.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
[not found] ` <mailman.69.1142448657.9686.help-gnu-emacs@gnu.org>
@ 2006-03-15 22:02 ` Jyrki Jaakkola
0 siblings, 0 replies; 11+ messages in thread
From: Jyrki Jaakkola @ 2006-03-15 22:02 UTC (permalink / raw)
Kevin Rodgers <ihs_4664@yahoo.com> wrote:
>Jyrki Jaakkola wrote:
>> bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:
>>>Jyrki Jaakkola <jjkola@email.com> writes:
>>>>(defun my-keybindings-hook ()
>>>> ((modify-syntax-entry ?\[ "(] " lisp-mode-syntax-table)
>>>
>>> ^^
>>>What's up with this??
>>
>> I thought that maybe loading slime mode changed key bindings so I
>> tried adding a hook to change them to my liking but apparently it
>> didn't help.
>
>Johan is referring to the fact that "((" yields an invalid function.
Ah, ok. I corrected it but now slime doesn't start anymore. So I had
to remove those hooks.
Jyrki Jaakkola
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-13 7:29 ` Stefan Monnier
2006-03-14 17:17 ` Jyrki Jaakkola
@ 2006-03-16 18:43 ` Jyrki Jaakkola
2006-03-18 16:19 ` Jyrki Jaakkola
2 siblings, 0 replies; 11+ messages in thread
From: Jyrki Jaakkola @ 2006-03-16 18:43 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> Anybody care to share some information how I could get it working?
>> I would really appreciate it. Thanks in advance.
>
>Give us more info about what you've done.
>Paren/backet/brace matching normally "just works" if you set the
>syntax-table properly.
There is
(set-syntax-table lisp-mode-syntax-table)
in different slime modes. And I tried to change lisp-mode-syntax-table
with no effect.
As I'm quite new at customizing emacs, so could somebody provide at
least some pointers what and where I should check so that I could try
on my own?
Jyrki Jaakkola
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: showing matching {}[]() in lisp and slime mode
2006-03-13 7:29 ` Stefan Monnier
2006-03-14 17:17 ` Jyrki Jaakkola
2006-03-16 18:43 ` Jyrki Jaakkola
@ 2006-03-18 16:19 ` Jyrki Jaakkola
2 siblings, 0 replies; 11+ messages in thread
From: Jyrki Jaakkola @ 2006-03-18 16:19 UTC (permalink / raw)
When I checked syntax table mappings in slime mode I got this:
[ _ which means: symbol
] .. _ _ which means: symbol
{ _ which means: symbol
} .. DEL _ which means: symbol
and then
The parent syntax table is:
[ (] which means: open, matches ]
] )[ which means: close, matches [
{ (} which means: open, matches }
} ){ which means: close, matches {
So it seems like somewhere it changes the syntax table but I can't
understand where.
Jyrki Jaakkola
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-03-18 16:19 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-12 21:34 showing matching {}[]() in lisp and slime mode Jyrki Jaakkola
2006-03-13 7:29 ` Stefan Monnier
2006-03-14 17:17 ` Jyrki Jaakkola
2006-03-15 6:04 ` Stefan Monnier
2006-03-15 13:47 ` Johan Bockgård
2006-03-15 13:40 ` Johan Bockgård
2006-03-15 16:56 ` Jyrki Jaakkola
2006-03-15 18:41 ` Kevin Rodgers
[not found] ` <mailman.69.1142448657.9686.help-gnu-emacs@gnu.org>
2006-03-15 22:02 ` Jyrki Jaakkola
2006-03-16 18:43 ` Jyrki Jaakkola
2006-03-18 16:19 ` Jyrki Jaakkola
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).