unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Teemu.Parkkinen@patria.fi
Subject: New feature proposal for Emacs
Date: Thu, 5 Feb 2004 10:38:02 +0200	[thread overview]
Message-ID: <OF582F9178.BC3F5A77-ONC2256E31.002B7DDA@patria.fi> (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

             reply	other threads:[~2004-02-05  8:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-05  8:38 Teemu.Parkkinen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-02-05 10:19 New feature proposal for Emacs Teemu.Parkkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF582F9178.BC3F5A77-ONC2256E31.002B7DDA@patria.fi \
    --to=teemu.parkkinen@patria.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).