From: reader@newsguy.com
To: help-gnu-emacs@gnu.org
Subject: Re: jump between if-fi
Date: Tue, 01 Jan 2008 09:47:35 -0600 [thread overview]
Message-ID: <87bq85czu0.fsf@newsguy.com> (raw)
In-Reply-To: 4778285B.8020204@gmail.com
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> reader@newsguy.com wrote:
>> I hope this isn't one of those things that is just plain obvious to
>> lookup in emacs but I'm striking out with M-x apropos
>>
>> How can I make emacs do something similar with if-fi constructs as it
>> does with parens?
>>
>> Even better I'd like the kind of behaviour one can get in vim with
>> parens, where not only does the syntax coloring show the other paren
>> but you can jump there with a Ctrl-%
>
> Maybe you mean %, not C-%?
>
> You can in Emacs too, using Viper. But see
>
> http://www.emacswiki.org/cgi-bin/wiki/ViKeys
> http://www.emacswiki.org/cgi-bin/wiki/ViAndEmacs
>
Sorry I missed it in that first link you provided but
Turns out to be right in the emacs FAQ. I repost it here incase
people searching these forms should hit this thread.
I didn't really like the idea of turning on a whole vi like mode and I
guess a good number of others didn't either.
From the emacs FAQ
* Here is some Emacs Lisp that will make the <%> key show the
matching parenthesis, like in `vi'. In addition, if the cursor
isn't over a parenthesis, it simply inserts a % like normal.
;; By an unknown contributor
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
next prev parent reply other threads:[~2008-01-01 15:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-30 23:02 jump between if-fi reader
2007-12-30 23:23 ` Lennart Borgman (gmail)
2007-12-31 6:29 ` reader
2007-12-31 8:12 ` Thierry Volpiatto
2007-12-31 14:41 ` reader
2008-01-01 15:47 ` reader [this message]
[not found] ` <mailman.5533.1199082573.18990.help-gnu-emacs@gnu.org>
2008-01-09 5:40 ` Stefan Monnier
2007-12-31 16:24 ` Alan Mackenzie
2008-01-01 2:29 ` reader
2008-01-01 14:18 ` Alan Mackenzie
2008-01-01 15:39 ` reader
2008-01-01 15:53 ` Torturedly threaded .emacs portability. [Was: jump between if-fi] Alan Mackenzie
2008-01-01 15:53 ` reader
2008-01-02 5:00 ` Mike Mattie
2008-01-05 18:33 ` jump between if-fi reader
2008-01-09 9:43 ` Arnaldo Mandel
[not found] <mailman.5524.1199055779.18990.help-gnu-emacs@gnu.org>
2008-01-01 18:12 ` Xah Lee
2008-01-01 19:12 ` Alan Mackenzie
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=87bq85czu0.fsf@newsguy.com \
--to=reader@newsguy.com \
--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.
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).