unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* jumping to peer parenthesis/brace
@ 2006-06-22  8:17 Pawel
  2006-06-22  8:31 ` Peter Dyballa
       [not found] ` <mailman.3162.1150965073.9609.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Pawel @ 2006-06-22  8:17 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: jumping to peer parenthesis/brace
       [not found] <mailman.3160.1150964235.9609.help-gnu-emacs@gnu.org>
@ 2006-06-22  8:30 ` nico
  2006-06-22 14:59 ` Andreas Roehler
  1 sibling, 0 replies; 7+ messages in thread
From: nico @ 2006-06-22  8:30 UTC (permalink / raw)


hello,

Pawel a écrit :

> Hallo group members
>
> Could You tell me ow to do the following thing:
>
> {<------ my pointer is here and I want to jump there
> .....                                           |
> ...[.......]                                    |
> }<-----------------------------------------------
>
C-M b
or
C-M f

nicolas

> highlight-paren-mode is not enough when block is larger than screen
> 
> Greetings

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: jumping to peer parenthesis/brace
  2006-06-22  8:17 jumping to peer parenthesis/brace Pawel
@ 2006-06-22  8:31 ` Peter Dyballa
       [not found] ` <mailman.3162.1150965073.9609.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2006-06-22  8:31 UTC (permalink / raw)
  Cc: emacs mailing list


Am 22.06.2006 um 10:17 schrieb Pawel:

> Could You tell me ow to do the following thing:

Forward-sexp. And there is also backward-sexp.

--
Greetings

   Pete

“One cannot live by television, video games, top ten CDs, and dumb  
movies alone”
       (Amiri Baraka 1999)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: jumping to peer parenthesis/brace
       [not found] <mailman.3160.1150964235.9609.help-gnu-emacs@gnu.org>
  2006-06-22  8:30 ` nico
@ 2006-06-22 14:59 ` Andreas Roehler
  2006-06-22 15:20   ` Jay Belanger
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Roehler @ 2006-06-22 14:59 UTC (permalink / raw)


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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: jumping to peer parenthesis/brace
  2006-06-22 14:59 ` Andreas Roehler
@ 2006-06-22 15:20   ` Jay Belanger
  0 siblings, 0 replies; 7+ messages in thread
From: Jay Belanger @ 2006-06-22 15:20 UTC (permalink / raw)
  Cc: belanger


Andreas Roehler <andreas.roehler@online.de> writes:
...
> 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 %."
...
> (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.

In that case, you can quote the `%':
  C-q %
to insert it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: jumping to peer parenthesis/brace
       [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
  0 siblings, 1 reply; 7+ messages in thread
From: Colin S. Miller @ 2006-06-22 19:14 UTC (permalink / raw)


Peter Dyballa wrote:
> 
> Am 22.06.2006 um 10:17 schrieb Pawel:
> 
>> Could You tell me ow to do the following thing:
> 
> Forward-sexp. And there is also backward-sexp.
> 
> -- 
> Greetings
> 
>   Pete
> 
> “One cannot live by television, video games, top ten CDs, and dumb 
> movies alone”
>       (Amiri Baraka 1999)
> 
> 
> 
> 
> 

What is the difference between C-M-n (forward-list) and C-M-f (forward-sexp) ?

-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: jumping to peer parenthesis/brace
  2006-06-22 19:14   ` Colin S. Miller
@ 2006-06-22 21:57     ` Peter Dyballa
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2006-06-22 21:57 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 22.06.2006 um 21:14 schrieb Colin S. Miller:

> Peter Dyballa wrote:
>> Am 22.06.2006 um 10:17 schrieb Pawel:
>>> Could You tell me ow to do the following thing:
>> Forward-sexp. And there is also backward-sexp.
>> --  
>
> What is the difference between C-M-n (forward-list) and C-M-f  
> (forward-sexp) ?
>

For/Backward-sexp works always. A "sexp" is a "balanced expression."  
I do not understand this concept completely, but as examples I've  
seen it work over {} and [] and () balanced blocks, as long as the  
point is at the block but outside of it. If there is none such, the  
sexp is a word, because it's "balanced" by white space or  
punctuation? In any case some movement happens.

For/Backward-list moves over the block *plus* the characters between  
the point and the end or beginning of the block. When inside a block,  
it produces an error, at least in TeX code -- which I really do not  
like.

--
Greetings

   Pete

"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
      -Benjamin Franklin, Historical Review of Pennsylvania.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-06-22 21:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-22  8:17 jumping to peer parenthesis/brace 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
     [not found] <mailman.3160.1150964235.9609.help-gnu-emacs@gnu.org>
2006-06-22  8:30 ` nico
2006-06-22 14:59 ` Andreas Roehler
2006-06-22 15:20   ` Jay Belanger

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).