all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ehud Karni" <ehud@unix.mvs.co.il>
Cc: help-gnu-emacs@gnu.org
Subject: Re: a bit help with elisp bit
Date: Mon, 23 Jan 2006 17:45:10 +0200	[thread overview]
Message-ID: <200601231545.k0NFjAiY008054@beta.mvs.co.il> (raw)
In-Reply-To: <001a01c6200e$b48bf560$1400000a@home> (message from Eli Segal on Mon, 23 Jan 2006 13:18:15 +0200)

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 <http://www.keyserver.net/>    Better Safe Than Sorry

      reply	other threads:[~2006-01-23 15:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-23 11:18 a bit help with elisp bit Eli Segal
2006-01-23 15:45 ` Ehud Karni [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601231545.k0NFjAiY008054@beta.mvs.co.il \
    --to=ehud@unix.mvs.co.il \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.