all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* C - marking code between braces.
@ 2006-12-07  9:43 Pawel
  2006-12-07 16:36 ` Peter Dyballa
  2006-12-07 22:28 ` Kevin Rodgers
  0 siblings, 2 replies; 7+ messages in thread
From: Pawel @ 2006-12-07  9:43 UTC (permalink / raw)



Hallo group members.

Could You tell me whether is there command in emacs that is able to mark code between braces, but not braces themselves?

Regards
Pawel

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

* Re: C - marking code between braces.
  2006-12-07  9:43 C - marking code between braces Pawel
@ 2006-12-07 16:36 ` Peter Dyballa
  2006-12-07 22:28 ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2006-12-07 16:36 UTC (permalink / raw)
  Cc: emacs mailing list


Am 07.12.2006 um 10:43 schrieb Pawel:

> Could You tell me whether is there command in emacs that is able to  
> mark code between braces, but not braces themselves?

Yes: set-mark-command at begin and set-mark-command at end; or set- 
mark-command at end and set-mark-command at begin.

--
Greetings

   Pete

When confronted with actual numbers, a mathematician is at a loss.
                                          (Steffen Hokland)

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

* Re: C - marking code between braces.
  2006-12-07  9:43 C - marking code between braces Pawel
  2006-12-07 16:36 ` Peter Dyballa
@ 2006-12-07 22:28 ` Kevin Rodgers
  2006-12-08  9:33   ` Pawel
                     ` (2 more replies)
  1 sibling, 3 replies; 7+ messages in thread
From: Kevin Rodgers @ 2006-12-07 22:28 UTC (permalink / raw)


Pawel wrote:
> Could You tell me whether is there command in emacs that is able to
> mark code between braces, but not braces themselves?

C-x (					; kmacro-start-macro (Emacs 22)/
					; start-kbd-macro

C-M-u					; backward-up-list
C-@					; set-mark-command
C-M-f					; forward-sexp
C-b					; backward-char
C-x C-x					; exchange-point-and-mark
C-f					; forward-char

C-x )					; kmacro-end-macro (Emacs 22)/
					; end-kdb-macro

Now `C-x e' magically marks the text between the innermost parentheses
(or brackets or braces).

-- 
Kevin

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

* Re: C - marking code between braces.
  2006-12-07 22:28 ` Kevin Rodgers
@ 2006-12-08  9:33   ` Pawel
  2006-12-11  2:32   ` Dieter Wilhelm
       [not found]   ` <mailman.1734.1165804380.2155.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Pawel @ 2006-12-08  9:33 UTC (permalink / raw)
  Cc: help-gnu-emacs

Kevin, 
it does the job.
Thank You.
regards

Dnia 7-12-2006 o godz. 23:28 Kevin Rodgers napisał(a):
> Pawel wrote:
> > Could You tell me whether is there command in emacs that is able to
> > mark code between braces, but not braces themselves?
> 
> C-x (					; kmacro-start-macro (Emacs 22)/
> 					; start-kbd-macro
> 
> C-M-u					; backward-up-list
> C-@					; set-mark-command
> C-M-f					; forward-sexp
> C-b					; backward-char
> C-x C-x					; exchange-point-and-mark
> C-f					; forward-char
> 
> C-x )					; kmacro-end-macro (Emacs 22)/
> 					; end-kdb-macro
> 
> Now `C-x e' magically marks the text between the innermost parentheses
> (or brackets or braces).
> 
> -- 
> Kevin
> 
> 
> 
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> 

----------------------------------------------------
Zobacz fotogalerię z rozdania EUROPEJSKICH NAGRÓD FILMOWYCH. Kliknij:
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fefalink2.html&sid=959

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

* Re: C - marking code between braces.
  2006-12-07 22:28 ` Kevin Rodgers
  2006-12-08  9:33   ` Pawel
@ 2006-12-11  2:32   ` Dieter Wilhelm
       [not found]   ` <mailman.1734.1165804380.2155.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Dieter Wilhelm @ 2006-12-11  2:32 UTC (permalink / raw)
  Cc: help-gnu-emacs

Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Pawel wrote:
>> Could You tell me whether is there command in emacs that is able to
>> mark code between braces, but not braces themselves?
>
> C-x (					; kmacro-start-macro (Emacs 22)/
> 					; start-kbd-macro
>
> C-M-u					; backward-up-list
> C-@					; set-mark-command
> C-M-f					; forward-sexp
> C-b					; backward-char
> C-x C-x					; exchange-point-and-mark
> C-f					; forward-char
>
> C-x )					; kmacro-end-macro (Emacs 22)/
> 					; end-kdb-macro

C-M-u
C-M-SPC
C-f
C-x C-x
C-b

or for only *one* level of braces

C-M-u
C-f
C-s }
C-b 

but this sets (marks) only the proper region and does not activate
(highlight) it.

Another idea for one level could be

C-M-r [^{}]+
C-M-s

but to my astonishment C-M-r does not skip to the char behind {!


-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

* Re: C - marking code between braces.
       [not found]   ` <mailman.1734.1165804380.2155.help-gnu-emacs@gnu.org>
@ 2006-12-11 11:02     ` Johan Bockgård
  2006-12-12 22:49       ` C-M-r and C-M-s asymmetric [was: C - marking code between braces] Dieter Wilhelm
  0 siblings, 1 reply; 7+ messages in thread
From: Johan Bockgård @ 2006-12-11 11:02 UTC (permalink / raw)


Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:

> Another idea for one level could be
>
> C-M-r [^{}]+
> C-M-s
>
> but to my astonishment C-M-r does not skip to the char behind {!

I think the key is here:

,----[ C-h f search-backward-regexp RET ]
| [...]
| Search backward from point for match for regular expression REGEXP.
| Set point to the beginning of the match, and return point.
| The match found is the one starting last in the buffer
| and yet ending before the origin of the search.
| [...]
`----

-- 
Johan Bockgård

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

* C-M-r and C-M-s asymmetric [was: C - marking code between braces]
  2006-12-11 11:02     ` Johan Bockgård
@ 2006-12-12 22:49       ` Dieter Wilhelm
  0 siblings, 0 replies; 7+ messages in thread
From: Dieter Wilhelm @ 2006-12-12 22:49 UTC (permalink / raw)
  Cc: Johan Bockgård

bojohan+news@dd.chalmers.se (Johan Bockgård) writes:

> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>
>> Another idea for one level could be
>>
>> C-M-r [^{}]+
>> C-M-s
>>
>> but to my astonishment C-M-r does not skip to the char behind {!
>
> I think the key is here:
>
> ,----[ C-h f search-backward-regexp RET ]
> | [...]
> | Search backward from point for match for regular expression REGEXP.
> | Set point to the beginning of the match, and return point.
> | The match found is the one starting last in the buffer
> | and yet ending before the origin of the search.
> | [...]
> `----

Sorry Johan, I don't get it, the behaviour might be consistent with
the description above but the fact is that + should be greedy.  Please
search with C-M-s for "o.*o" in the following line

hans otto otto otto hans

When you C-M-r wouldn't you expect to find the same matches?  This is
clearly not the case and I can't imagine why.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

end of thread, other threads:[~2006-12-12 22:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07  9:43 C - marking code between braces Pawel
2006-12-07 16:36 ` Peter Dyballa
2006-12-07 22:28 ` Kevin Rodgers
2006-12-08  9:33   ` Pawel
2006-12-11  2:32   ` Dieter Wilhelm
     [not found]   ` <mailman.1734.1165804380.2155.help-gnu-emacs@gnu.org>
2006-12-11 11:02     ` Johan Bockgård
2006-12-12 22:49       ` C-M-r and C-M-s asymmetric [was: C - marking code between braces] Dieter Wilhelm

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.