unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* New feature proposal for Emacs
@ 2004-02-05  8:38 Teemu.Parkkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Teemu.Parkkinen @ 2004-02-05  8:38 UTC (permalink / raw)



Hi everyone!

I have an idea what would be quite helpful when editing long source-code
files.
I'm not sure if this is already implemented, but anyway:

Consider a long source-file. It is difficult to edit, because you have to
flip pages
often to see other parts of the file. Below, we have a c-file that has some
code in it.

---------------- Begin example code ----------------------

/* includes */
#include <stdio.h>
#include "someOther.h"
...


/* system initialization function */
int initSystem(int* params)
{

      /* check parameter values */
      if ( param[0] == 1 )
            return ILLEGAL_VALUE;
      if ( param[1] == 1 )
            return ILLEGAL_VALUE;
      if ( param[2] == 1 )
            return ILLEGAL_VALUE;
      if ( param[3] == 1 )
            return ILLEGAL_VALUE;
      if ( param[4] == 1 )
            return ILLEGAL_VALUE;

      /* process input parameters */
      if (params[0] == 1)
            do_things();
      if (params[1] == 2)
            do_Something_else();

      /* copy parameter tables */
      for (int i=0; i<paramlength; i++)
      {
            variables[i] = params[i];
      }

      /* check hardware status */
      for (int i=0; i<HW_PORTS; i++)
      {
            /* read value from hw-port */
            value = readHwPort(i);
            /* check that the value was within allowed range */
            if (value > MAX)
                  return HW_ERROR;
            if (value < MIN)
                  return HW_ERROR;
      }

}

-----------  end example code -------------


When editing real source files, you often want to see only a small part of
the code
when other parts are meaningless at that time. It would be enough to see
only a comment
line of those meaningless blocks that says what that block does. (And very
often one
comments the blocks already this way).

So here is the idea:

Would it be possible to hide certain blocks of code (or hide all and show
only those you wish
to see) by some way? When a block is hidden, only the first comment of it
is shown.


Let me illustrate this with the example code:

We wish to edit only the part that processes the input parameters. We
select "show-this-block"
and Emacs expands that block. At this time the source code would look like
this:

---------------- Begin example code2 ----------------------

/* includes */

/* system initialization function */
int initSystem(int* params)
{

      /* check parameter values */

      /* process input parameters */
      if (params[0] == 1)
            do_things();
      if (params[1] == 2)
            do_Something_else();

      /* copy parameter tables */

      /* check hardware status */
}

-----------  end example code2 -------------

This example code is small and very simple, but if one could hide certain
blocks from
bigger (and more complicated) file, the programmer could more easily see
what the code
really does. Very often I get confused if there are several lines of code
which does only
some very simple thing. It would be enought to see only a brief explanation
that says what is
done at this point. One could also hide entire functions, if those are not
needed at that time.

I hope you get the point what I'm trying to say. I would like to hear if
this is already implemented
(it very well may be). If it isn't, do you think this feature would be
helpful?

-Teemu

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

* Re: New feature proposal for Emacs
@ 2004-02-05 10:19 Teemu.Parkkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Teemu.Parkkinen @ 2004-02-05 10:19 UTC (permalink / raw)



The feature is already implemented. Thanks for Kai for pointing this out.

-Teemu



----- Forwarded by Teemu Parkkinen/AVI/PATRIA on 02/05/04 12:13 PM -----
                                                                                                                          
                      Kai Grossjohann                                                                                     
                      <kai@emptydomain.        To:       Teemu.Parkkinen@patria.fi                                        
                      de>                      cc:                                                                        
                                               Subject:  Re: New feature proposal for Emacs                               
                      02/05/04 11:44 AM                                                                                   
                                                                                                                          
                                                                                                                          




Teemu.Parkkinen@patria.fi writes:

> Would it be possible to hide certain blocks of code (or hide all and
> show only those you wish to see) by some way? When a block is
> hidden, only the first comment of it is shown.

See hideshow.el (or hide-show.el?).  M-x hs-minor-mode RET.

Kai

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

end of thread, other threads:[~2004-02-05 10:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-05 10:19 New feature proposal for Emacs Teemu.Parkkinen
  -- strict thread matches above, loose matches on Subject: below --
2004-02-05  8:38 Teemu.Parkkinen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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