unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andreas Roehler <andreas.roehler@online.de>
Subject: Re: jumping to peer parenthesis/brace
Date: Thu, 22 Jun 2006 16:59:06 +0200	[thread overview]
Message-ID: <e7eb12$sn2$1@online.de> (raw)
In-Reply-To: mailman.3160.1150964235.9609.help-gnu-emacs@gnu.org

Pawel wrote:

> Hallo group members
> 
> Could You tell me ow to do the following thing:
> 
> {<------ my pointer is here and I want to jump there
> .....                                           |
> ...[.......]                                    |
> }<-----------------------------------------------
> 
> highlight-paren-mode is not enough when block is larger than
> screen
> 
> Greetings
Somewhere I picked `match-paren': it allows you to jump to and fro
without changing the key:

(defun match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\\s\(")
         (forward-list 1)
         (if (eq 0 (string-match "XEmacs" (version)))
             (backward-char 1)
           (when (eq 41 (char-before))
             (backward-char 1))))
        ((looking-at "\\s\)")
         (forward-char 1) (backward-list 1))
        (t (self-insert-command (or arg 1)))))

with

(global-set-key "%" 'match-paren)
or better
(define-key emacs-lisp-mode-map "%" 'match-paren)

Attention: If editing format strings, it might happen you are
over a `(' while inserting a `%' is in your mind. That's an
occasion, `match-paren' will not DTRT.

So choose an other key to call match-paren eventually.

__
Andreas Roehler

PS.: Posting this I see, `match-paren' could do better by handling
brackets and braces also. Maybe someone will enhance it after
reading this? Maybe in paredit.el is the enhancment already?

  parent reply	other threads:[~2006-06-22 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3160.1150964235.9609.help-gnu-emacs@gnu.org>
2006-06-22  8:30 ` jumping to peer parenthesis/brace nico
2006-06-22 14:59 ` Andreas Roehler [this message]
2006-06-22 15:20   ` Jay Belanger
2006-06-22  8:17 Pawel
2006-06-22  8:31 ` Peter Dyballa
     [not found] ` <mailman.3162.1150965073.9609.help-gnu-emacs@gnu.org>
2006-06-22 19:14   ` Colin S. Miller
2006-06-22 21:57     ` Peter Dyballa

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='e7eb12$sn2$1@online.de' \
    --to=andreas.roehler@online.de \
    /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).