* +1 char strings as open-bracket/close-bracket
@ 2009-06-25 11:13 Kokor Hekkus
2009-06-25 11:19 ` Joost Kremers
2009-06-26 6:38 ` Andreas Röhler
0 siblings, 2 replies; 3+ messages in thread
From: Kokor Hekkus @ 2009-06-25 11:13 UTC (permalink / raw)
To: help-gnu-emacs
Any way of modifying the syntax table to identify a string of more
than one character as an open-bracket or a close-bracket character.
For instance, you might do:
(modify-syntax-entry ?^ "($")
(modify-syntax-entry ?$ ")^")
...to make ^ and $ match each other (from EmacsWiki). How would I
make the two character strings '#>' and '<#' match in the same way?
The above doesn't work.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: +1 char strings as open-bracket/close-bracket
2009-06-25 11:13 +1 char strings as open-bracket/close-bracket Kokor Hekkus
@ 2009-06-25 11:19 ` Joost Kremers
2009-06-26 6:38 ` Andreas Röhler
1 sibling, 0 replies; 3+ messages in thread
From: Joost Kremers @ 2009-06-25 11:19 UTC (permalink / raw)
To: help-gnu-emacs
Kokor Hekkus wrote:
> Any way of modifying the syntax table to identify a string of more
> than one character as an open-bracket or a close-bracket character.
> For instance, you might do:
>
> (modify-syntax-entry ?^ "($")
> (modify-syntax-entry ?$ ")^")
>
> ...to make ^ and $ match each other (from EmacsWiki). How would I
> make the two character strings '#>' and '<#' match in the same way?
> The above doesn't work.
if i do C-h f modify-syntax-entry RET, somewhere in the help buffer, it
says:
"Only single-character comment start and end sequences are represented thus.
Two-character sequences are represented as described below."
i guess that would be a starting point for you to look at.
--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: +1 char strings as open-bracket/close-bracket
2009-06-25 11:13 +1 char strings as open-bracket/close-bracket Kokor Hekkus
2009-06-25 11:19 ` Joost Kremers
@ 2009-06-26 6:38 ` Andreas Röhler
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Röhler @ 2009-06-26 6:38 UTC (permalink / raw)
To: Kokor Hekkus; +Cc: help-gnu-emacs
Kokor Hekkus wrote:
> Any way of modifying the syntax table to identify a string of more
> than one character as an open-bracket or a close-bracket character.
> For instance, you might do:
>
> (modify-syntax-entry ?^ "($")
> (modify-syntax-entry ?$ ")^")
>
> ...to make ^ and $ match each other (from EmacsWiki). How would I
> make the two character strings '#>' and '<#' match in the same way?
>
AFAIU relying on syntax-tables will fail if constructs are nested.
In this case have a look at beg-end.el and thingatpt-utils-base.el at
https://code.launchpad.net/s-x-emacs-werkstatt/
There detecting nested comments for example is realised that way:
(put 'comment 'beginning-op-at
(lambda ()
(if (string= "" comment-end)
(beginning-of-form-base comment-start comment-end
(line-beginning-position) t nil t)
(beginning-of-form-base comment-end nil t nil t))))
(put 'comment 'end-op-at
(lambda ()
(if (string= "" comment-end)
(when (looking-at comment-start)
(end-of-line))
(end-of-form-base comment-start comment-end nil t nil t))))
Replace comment-start/end here by your form,
write "(put 'MY-Form... " it should work.
Afterwards you may define a jump-function similar to match-paren.
HTH
Andreas
> The above doesn't work.
>
> Thanks!
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-26 6:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-25 11:13 +1 char strings as open-bracket/close-bracket Kokor Hekkus
2009-06-25 11:19 ` Joost Kremers
2009-06-26 6:38 ` Andreas Röhler
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).