* Re: movement bindings in c-mode
2008-06-23 17:05 ` Alan Mackenzie
@ 2008-06-23 18:36 ` David Hansen
2008-06-23 18:40 ` Lennart Borgman (gmail)
2008-06-27 21:49 ` Alan Mackenzie
2008-06-23 18:45 ` Stefan Monnier
` (2 subsequent siblings)
3 siblings, 2 replies; 12+ messages in thread
From: David Hansen @ 2008-06-23 18:36 UTC (permalink / raw)
To: emacs-devel
On Mon, 23 Jun 2008 17:05:53 +0000 Alan Mackenzie wrote:
> Just one small point, though. The doc-string for
> beginning-of-defun-function recommends putting point at the { rather
> than the function header. I think this is unright. Stefan?
Actually I would prefer to have it in front of the `{'. If you just
want to read something around the b-o-d it doesn't matter.
But if you want to edit something it's far more likely that it is within
the body, e.g. adding a variable, than the header.
David
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: movement bindings in c-mode
2008-06-23 18:36 ` David Hansen
@ 2008-06-23 18:40 ` Lennart Borgman (gmail)
2008-06-27 21:50 ` Alan Mackenzie
2008-06-27 21:49 ` Alan Mackenzie
1 sibling, 1 reply; 12+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-23 18:40 UTC (permalink / raw)
To: emacs-devel
David Hansen wrote:
> On Mon, 23 Jun 2008 17:05:53 +0000 Alan Mackenzie wrote:
>
>> Just one small point, though. The doc-string for
>> beginning-of-defun-function recommends putting point at the { rather
>> than the function header. I think this is unright. Stefan?
>
> Actually I would prefer to have it in front of the `{'. If you just
> want to read something around the b-o-d it doesn't matter.
Does narrow-to-defun use beginning-of-defun-function?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: movement bindings in c-mode
2008-06-23 18:40 ` Lennart Borgman (gmail)
@ 2008-06-27 21:50 ` Alan Mackenzie
0 siblings, 0 replies; 12+ messages in thread
From: Alan Mackenzie @ 2008-06-27 21:50 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: emacs-devel
On Mon, Jun 23, 2008 at 08:40:34PM +0200, Lennart Borgman (gmail) wrote:
> David Hansen wrote:
> >On Mon, 23 Jun 2008 17:05:53 +0000 Alan Mackenzie wrote:
> >>Just one small point, though. The doc-string for
> >>beginning-of-defun-function recommends putting point at the { rather
> >>than the function header. I think this is unright. Stefan?
> >Actually I would prefer to have it in front of the `{'. If you just
> >want to read something around the b-o-d it doesn't matter.
> Does narrow-to-defun use beginning-of-defun-function?
Yes. Try C-x n d in a CC Mode mode file.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: movement bindings in c-mode
2008-06-23 18:36 ` David Hansen
2008-06-23 18:40 ` Lennart Borgman (gmail)
@ 2008-06-27 21:49 ` Alan Mackenzie
1 sibling, 0 replies; 12+ messages in thread
From: Alan Mackenzie @ 2008-06-27 21:49 UTC (permalink / raw)
To: emacs-devel
Hi, David!
On Mon, Jun 23, 2008 at 08:36:14PM +0200, David Hansen wrote:
> On Mon, 23 Jun 2008 17:05:53 +0000 Alan Mackenzie wrote:
> > Just one small point, though. The doc-string for
> > beginning-of-defun-function recommends putting point at the { rather
> > than the function header. I think this is unright. Stefan?
> Actually I would prefer to have it in front of the `{'. If you just
> want to read something around the b-o-d it doesn't matter.
It matters, I think, when you do C-x n d. Then you can see what
function you're within.
> But if you want to edit something it's far more likely that it is within
> the body, e.g. adding a variable, than the header.
I'd conjecture that any line within a defun is as likely to be edited as
any other. That you've got an extra 3 or 4 lines to move forward to
that point doesn't seem that critical.
But I think the critical reason is that the command is called
beginning-of-defun, not beginning-of-defun-block, and commands should do
what they say. It would be possible to modify b-o-d so that a bare
prefix (C-u) would go to the block rather than the header. But I don't
think it would be worth the extra complication.
> David
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: movement bindings in c-mode
2008-06-23 17:05 ` Alan Mackenzie
2008-06-23 18:36 ` David Hansen
@ 2008-06-23 18:45 ` Stefan Monnier
2008-06-24 2:32 ` Miles Bader
2008-06-27 21:41 ` Alan Mackenzie
3 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2008-06-23 18:45 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: bug-cc-mode, emacs-devel, Miles Bader
>> > I think beginning-of-defun-function should be passed the repeat count
>> > (naturally doing the right thing when that function can't take it).
>> Actually, I just looked at the place where beginning-of-defun-function
>> is called (in `beginning-of-defun-raw'), and it _does_ pass the repeat
>> count (with appropriate handling for old-style callees that don't expect
>> it).
> Well, so it does. I missed that change. Thanks, Stefan!
>> So then this should be simple, right?
> Right. I'll change it.
> Just one small point, though. The doc-string for
> beginning-of-defun-function recommends putting point at the { rather
> than the function header. I think this is unright. Stefan?
It's just a recommendation. It makes it unnecessary to define
end-of-defun-function. But in your case you probably don't want to
follow that recommendation, and define an appropriate
end-of-defun-function to find the end of the body.
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: movement bindings in c-mode
2008-06-23 17:05 ` Alan Mackenzie
2008-06-23 18:36 ` David Hansen
2008-06-23 18:45 ` Stefan Monnier
@ 2008-06-24 2:32 ` Miles Bader
2008-06-27 21:41 ` Alan Mackenzie
3 siblings, 0 replies; 12+ messages in thread
From: Miles Bader @ 2008-06-24 2:32 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: bug-cc-mode, Stefan Monnier, emacs-devel
Alan Mackenzie <acm@muc.de> writes:
> Just one small point, though. The doc-string for
> beginning-of-defun-function recommends putting point at the { rather
> than the function header. I think this is unright. Stefan?
I think for consistency with mark-defun it should probably go to the
"true" beginning of the function, not the brace.
[When this was changed a while back (it used to go to the brace), I found
the new behavior fairly disconcerting, but that was mostly because I was
very used to the old behavior. I can't say that either way is actually
more useful (sort of six-of-one-half-dozen-of-the-other); it might be
useful to have a separate go-to-beginning-of-outermost-function-block
command though...]
-Miles
--
Joy, n. An emotion variously excited, but in its highest degree arising from
the contemplation of grief in another.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: movement bindings in c-mode
2008-06-23 17:05 ` Alan Mackenzie
` (2 preceding siblings ...)
2008-06-24 2:32 ` Miles Bader
@ 2008-06-27 21:41 ` Alan Mackenzie
3 siblings, 0 replies; 12+ messages in thread
From: Alan Mackenzie @ 2008-06-27 21:41 UTC (permalink / raw)
To: Miles Bader, Stefan Monnier; +Cc: bug-cc-mode, emacs-devel
Hi, Miles and Stefan,
On Mon, Jun 23, 2008 at 05:05:53PM +0000, Alan Mackenzie wrote:
> Hi, Miles and Stefan,
> On Mon, Jun 23, 2008 at 11:09:56PM +0900, Miles Bader wrote:
> > Alan Mackenzie <acm@muc.de> writes:
> > > I think beginning-of-defun-function should be passed the repeat
> > > count (naturally doing the right thing when that function can't
> > > take it).
> > Actually, I just looked at the place where
> > beginning-of-defun-function is called (in `beginning-of-defun-raw'),
> > and it _does_ pass the repeat count (with appropriate handling for
> > old-style callees that don't expect it).
> Well, so it does. I missed that change. Thanks, Stefan!
> > So then this should be simple, right?
> Right. I'll change it.
Done.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 12+ messages in thread