From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: Kokor Hekkus <originaltruelove@googlemail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: +1 char strings as open-bracket/close-bracket
Date: Fri, 26 Jun 2009 08:38:06 +0200 [thread overview]
Message-ID: <4A446CCE.1090801@easy-emacs.de> (raw)
In-Reply-To: <c3ca0846-dda7-4ba8-a559-45ae0c330131@n4g2000vba.googlegroups.com>
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!
>
>
prev parent reply other threads:[~2009-06-26 6:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A446CCE.1090801@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--cc=help-gnu-emacs@gnu.org \
--cc=originaltruelove@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).