From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ehud Karni" Newsgroups: gmane.emacs.help Subject: Re: a bit help with elisp bit Date: Mon, 23 Jan 2006 17:45:10 +0200 Organization: Mivtach-Simon Insurance agencies Message-ID: <200601231545.k0NFjAiY008054@beta.mvs.co.il> References: <001a01c6200e$b48bf560$1400000a@home> Reply-To: ehud@unix.mvs.co.il NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8-i Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1138040882 14664 80.91.229.2 (23 Jan 2006 18:28:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2006 18:28:02 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 23 19:27:58 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 1F16Q1-0000dL-Ag for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Jan 2006 19:27:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F16Sf-0007y0-MV for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Jan 2006 13:30:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F14cA-0002zK-Vk for help-gnu-emacs@gnu.org; Mon, 23 Jan 2006 11:32:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F14IA-0006ip-2A for help-gnu-emacs@gnu.org; Mon, 23 Jan 2006 11:11:46 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F13vH-0001Vc-HU for help-gnu-emacs@gnu.org; Mon, 23 Jan 2006 10:48:04 -0500 Original-Received: from [193.16.147.12] (helo=unix.mvs.co.il) by monty-python.gnu.org with esmtp (Exim 4.34) id 1F1402-0000zY-7B for help-gnu-emacs@gnu.org; Mon, 23 Jan 2006 10:52:58 -0500 Original-Received: from beta.mvs.co.il (beta [10.253.0.3]) by unix.mvs.co.il (8.13.0/8.13.0) with ESMTP id k0NFjBi1004998 for ; Mon, 23 Jan 2006 17:45:11 +0200 Original-Received: from beta.mvs.co.il (localhost [127.0.0.1]) by beta.mvs.co.il (8.13.4/8.13.4) with ESMTP id k0NFjAu7008062 for ; Mon, 23 Jan 2006 17:45:11 +0200 Original-Received: (from root@localhost) by beta.mvs.co.il (8.13.4/8.13.4/Submit) id k0NFjAiY008054; Mon, 23 Jan 2006 17:45:10 +0200 Original-To: eli_seg@bezeqint.net In-reply-to: <001a01c6200e$b48bf560$1400000a@home> (message from Eli Segal on Mon, 23 Jan 2006 13:18:15 +0200) X-Mailer: Emacs 21.3.1 rmail (send-msg 1.108) 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:32796 Archived-At: On Mon, 23 Jan 2006 13:18:15 +0200, Eli Segal wrote: > > I found this really great tip, > where the cursor on a paren, you press "%" and it goes to > the matching one. > but I want to change it, that when my point is one place > after the closing bracket % will work > how do I change it ? > still trying to grasp this lisp You might find the following code useful: (defun goto-matching-paren () "Jump to matching parenthesis (forward or backward) for ()[]{}. For \" & ' go forward if character before is space, else backward. If point is on space - search forward, if on non space - search backward" (interactive) (let ((ch (char-after (point))) (forl '( ?\( ?\[ ?\{ ? ?\n ?\t ))) (if (or (memq ch forl) (and (= ch ?\") (= (char-after (1- (point))) ? ))) (progn (forward-sexp 1) (backward-char 1)) (progn (forward-char 1) (backward-sexp 1))))) Also, you may want to use the `show-paren-mode` by adding: (require 'paren) (show-paren-mode 1) to your .emacs . Ehud. -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ GnuPG: 98EA398D Better Safe Than Sorry