From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Roehler Newsgroups: gmane.emacs.help Subject: Re: jumping to peer parenthesis/brace Date: Thu, 22 Jun 2006 16:59:06 +0200 Organization: 1&1 Internet AG Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: sea.gmane.org 1150990882 12862 80.91.229.2 (22 Jun 2006 15:41:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 22 Jun 2006 15:41:22 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 22 17:41:21 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FtRIh-0006Lx-Sp for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jun 2006 17:41:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FtRIh-0001bO-Ef for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Jun 2006 11:40:59 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-NNTP-Posting-Host: p54be8047.dip0.t-ipconnect.de Original-X-Trace: online.de 1150988130 29410 84.190.128.71 (22 Jun 2006 14:55:30 GMT) Original-X-Complaints-To: abuse@einsundeins.com Original-NNTP-Posting-Date: Thu, 22 Jun 2006 14:55:30 +0000 (UTC) User-Agent: KNode/0.9.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:139975 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35599 Archived-At: 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?