unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* jump next previous - tag bookmark or search
@ 2006-05-28 15:36 Adam
  2006-05-28 16:04 ` Albert Reiner
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Adam @ 2006-05-28 15:36 UTC (permalink / raw)


My file of code is long and getting longer. So I would like to jump either
forward or backward to the next or previous section start, with a single
keystroke, such as F7 (previous) and F8 (next). 

I would be happy to comment each section start with a signifier-comment,
such as  ;; **    whereas all other comments would start ;;; or ; 

So, which would be more applicable to bind to F7 F8 for this ?  

Tags,  where it would be handy I suppose to collect the comment text on just
that line. 

Bookmarks,  although the need for an individual Bookmark name is
undesirable. 

or a backward or forwards search for ";;** " 

While it would seem the Search method most appropriate, I would be
interested in hearing any thoughts, comments or recommendations. 

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

* Re: jump next previous - tag bookmark or search
  2006-05-28 15:36 Adam
@ 2006-05-28 16:04 ` Albert Reiner
  2006-05-28 16:20 ` Drew Adams
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Albert Reiner @ 2006-05-28 16:04 UTC (permalink / raw)


[Adam <nospam@example.com>, Mon, 29 May 2006 03:36:44 +1200]:
> My file of code is long and getting longer. So I would like to jump either
> forward or backward to the next or previous section start, with a single
> keystroke, such as F7 (previous) and F8 (next). 
> 
> I would be happy to comment each section start with a signifier-comment,
> such as  ;; **    whereas all other comments would start ;;; or ; 

This sounds like a case for outline-mode or outline-minor-mode to me.
You probably have to adjust some regexp to recognize your sections.

Albert.

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

* RE: jump next previous - tag bookmark or search
  2006-05-28 15:36 Adam
  2006-05-28 16:04 ` Albert Reiner
@ 2006-05-28 16:20 ` Drew Adams
  2006-05-28 16:30 ` Bastien
  2006-05-28 18:04 ` Stefan Monnier
  3 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2006-05-28 16:20 UTC (permalink / raw)


    I would like to jump either forward or backward to the next or
    previous section start, with a single keystroke, such as F7 and F8.

    I would be happy to comment each section start with a signifier-comment,
    such as  ;; **    whereas all other comments would start ;;; or ;
    So, which would be more applicable to bind to F7 F8 for this ?

    - Tags,  where it would be handy I suppose to collect the comment
      text on just that line.
    - Bookmarks,  although the need for an individual Bookmark name is
      undesirable.
    - or a backward or forwards search for ";;** "

Libraries commonly use a page separator (^L) for major sections. Then, you
can navigate among pages using `C-x ]' (forward-page) and `C-x ['
(backward-page). You can of course bind F7 and F8 to these commands.

To insert a Control-L character (^L), use `C-q C-l'.

Be aware that a page separator can also affect printing.

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

* Re: jump next previous - tag bookmark or search
  2006-05-28 15:36 Adam
  2006-05-28 16:04 ` Albert Reiner
  2006-05-28 16:20 ` Drew Adams
@ 2006-05-28 16:30 ` Bastien
  2006-05-28 18:04 ` Stefan Monnier
  3 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2006-05-28 16:30 UTC (permalink / raw)


Adam <nospam@example.com> writes:

> I would be happy to comment each section start with a signifier-comment,
> such as  ;; **    whereas all other comments would start ;;; or ; 
>
> So, which would be more applicable to bind to F7 F8 for this ?  

Maybe you just need to add a page break with `C-q C-l' then jump from
one page to another with `C-x ]'.

-- 
Bastien

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

* Re: jump next previous - tag bookmark or search
  2006-05-28 15:36 Adam
                   ` (2 preceding siblings ...)
  2006-05-28 16:30 ` Bastien
@ 2006-05-28 18:04 ` Stefan Monnier
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2006-05-28 18:04 UTC (permalink / raw)


> My file of code is long and getting longer.  So I would like to jump
> either forward or backward to the next or previous section start, with
> a single keystroke, such as F7 (previous) and F8 (next).

Checkout outline-minor-mode.

> I would be happy to comment each section start with a signifier-comment,
> such as  ;; **    whereas all other comments would start ;;; or ; 

The Elisp coding conventions say that ";;;" starts a section heading (which
is recognized by outline-minor-mode).  I.e. normal comments should use ";;"
or ";" but not ";;;".


        Stefan

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

* RE: jump next previous - tag bookmark or search
       [not found] <mailman.2370.1148833261.9609.help-gnu-emacs@gnu.org>
@ 2006-05-29  5:41 ` Adam
  2006-05-29 19:46   ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Adam @ 2006-05-29  5:41 UTC (permalink / raw)


Thank you Drew.

Your page-break is probably what I'm looking for, as its quick and simple,
and print formatting is not an issue now. 

I'm only just getting used to outline-minor-mode, C-c @ c-t,  C-c @ c-a,
etc, as per 30.8 of the Emacs manual. 

Invoking outline-minor-mode by itself seems to switch off the highlighting
of Lisp-mode.  There are no equivalent outline functions in slime-mode. So
I have been turning lisp-mode back on after initiating outline-minor-mode. 

Perhaps something like this would be necessary for a local variables list,
at the top of my page; 

     ;;; Local Variables: ***
     ;;; mode:outline-minor ***
     ;;; mode:slime ***
     ;;; mode:lisp ***
     ;;; End: *** 



> Libraries commonly use a page separator (^L) for major sections. Then, you
> can navigate among pages using `C-x ]' (forward-page) and `C-x ['
> (backward-page). You can of course bind F7 and F8 to these commands.
> 
> To insert a Control-L character (^L), use `C-q C-l'.
> 
> Be aware that a page separator can also affect printing.

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

* Re: jump next previous - tag bookmark or search
  2006-05-29  5:41 ` jump next previous - tag bookmark or search Adam
@ 2006-05-29 19:46   ` Stefan Monnier
  2006-05-29 22:02     ` Adam
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2006-05-29 19:46 UTC (permalink / raw)


>      ;;; Local Variables: ***
>      ;;; mode:outline-minor ***
>      ;;; mode:slime ***
>      ;;; mode:lisp ***
>      ;;; End: *** 

Use only ";;" rather than ";;;" since ";;;" is used for outline headings.


        Stefan

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

* Re: jump next previous - tag bookmark or search
  2006-05-29 19:46   ` Stefan Monnier
@ 2006-05-29 22:02     ` Adam
  2006-05-30  0:27       ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Adam @ 2006-05-29 22:02 UTC (permalink / raw)


Thanks Stefan, good point. 

This is how they are presented in 57.3.4 Local Variables in Files in the Gnu
Emacs Manual, although that section takes some reading for me to somewhat
understand. Like; 

- The Local Variables list goes later in the document, or at the end; so as
not to interfere with other programs expectations about contents of the
first few lines, and

- in 57.3.4 example, comment-start and comment-end have been defined as ;;;
and ***  but probably just for example. Hence your reply.    
  

However my point was that, turning on outline-minor-mode seems to deselect
Lisp-mode (the high-lighting goes), I'm uncertain what happens to
Slime-mode, and it would seem that a specific order for turning on the
three modes seems necessary. In this case; 
- outline-minor-mode (first)
- slime-mode
- lisp-mode

And that just seems strange to me. Suddenly almost requiring a Local
Variables list. It appears these modes can alter or switch off each other,
depending upon which order they're initiated. 

Thanks for your comment.  I'll keep plugging away. 




Stefan Monnier wrote:

>>      ;;; Local Variables: ***
>>      ;;; mode:outline-minor ***
>>      ;;; mode:slime ***
>>      ;;; mode:lisp ***
>>      ;;; End: ***
> 
> Use only ";;" rather than ";;;" since ";;;" is used for outline headings.
> 
> 
>         Stefan

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

* Re: jump next previous - tag bookmark or search
  2006-05-29 22:02     ` Adam
@ 2006-05-30  0:27       ` Stefan Monnier
  2006-05-30 22:16         ` Adam
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2006-05-30  0:27 UTC (permalink / raw)


> Thanks Stefan, good point.
> This is how they are presented in 57.3.4 Local Variables in Files in the
> Emacs Manual,

Very good point.  I've just fixed the manual so as not to give such bad
advice any more (in the past the use of ;;; for normal commments was
considered OK, even though it clashed with outline-minor-mode and lisp-mnt,
this has only been adjusted recently).

But note that my remark wasn't just about convention: since the local
variables are used to set the outline-minor-mode, clearly you want to follow
outline's conventions and thus avoid ";;;" even if such comments were
usually considered perfectly acceptable.

> However my point was that, turning on outline-minor-mode seems to deselect
> Lisp-mode (the high-lighting goes), I'm uncertain what happens to
> Slime-mode, and it would seem that a specific order for turning on the
> three modes seems necessary. In this case; 
> - outline-minor-mode (first)
> - slime-mode
> - lisp-mode

> And that just seems strange to me. Suddenly almost requiring a Local
> Variables list. It appears these modes can alter or switch off each other,
> depending upon which order they're initiated.

Yes, the `mode' settings was mostly meant for major modes, not minor modes.
Activating a major mode resets most minor modes, so the order is important:
lisp-mode should be activated first (which seems to be obtained
unintuitively by placing it at the end).


        Stefan

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

* Re: jump next previous - tag bookmark or search
  2006-05-30  0:27       ` Stefan Monnier
@ 2006-05-30 22:16         ` Adam
  0 siblings, 0 replies; 10+ messages in thread
From: Adam @ 2006-05-30 22:16 UTC (permalink / raw)


Very many thanks,  Stefan. 

This query came about as an Emacs novice just wishing to quickly jump
between particular points in his code. Points or positions which; 

- are not pagebreaks (although they can be)

- are not Tags as such, 

- can be tagged by a special comment line (and this is probably preferable)

- it would be handy to see in hide-body of outline mode (if thats easily
done). 

- it would be wise to observe a consistent Commenting format for


So the replies have given me good options to look at and try. 

Thanks for the change to the Manual, and keeping it alive. 

OT:  Even a key-binding to switch into those particular modes, in that
particular order, might not be such a bad option. 

Thank you again, 

Adam. 

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

end of thread, other threads:[~2006-05-30 22:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2370.1148833261.9609.help-gnu-emacs@gnu.org>
2006-05-29  5:41 ` jump next previous - tag bookmark or search Adam
2006-05-29 19:46   ` Stefan Monnier
2006-05-29 22:02     ` Adam
2006-05-30  0:27       ` Stefan Monnier
2006-05-30 22:16         ` Adam
2006-05-28 15:36 Adam
2006-05-28 16:04 ` Albert Reiner
2006-05-28 16:20 ` Drew Adams
2006-05-28 16:30 ` Bastien
2006-05-28 18:04 ` Stefan Monnier

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