all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Martin Stjernholm <mast@lysator.liu.se>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc.
Date: Fri, 01 Oct 2004 18:48:18 +0200	[thread overview]
Message-ID: <5b1xgimlkd.fsf@lister.roxen.com> (raw)
In-Reply-To: <a9tfz61bxhu.fsf@nemi.ping.uio.no> (Carl Henrik Lunde's message of "Wed, 01 Sep 2004 21:27:41 +0200")

Carl Henrik Lunde <chlunde+bugs@ifi.uio.no> wrote:

> currently C-M-[fbk] seems to only work with <>, (), [] and {}, it would be
> nice if it could be extended to support #ifdef and /* */-comments.
> (It's something I miss from the '%'-command as an old VIM user, but
> not a big problem.)

It doesn't even work with <> all the time since the code that analyzes
whether they are operators or parens covers far from all cases.


Regarding #ifdef and its likes, I don't think it's a good idea to
combine those into the same keys as the other parens. That since cpp
directives and parens have different structures and don't nest inside
each other. Consider:

  static void init_gc(void)
  {
  #ifdef PIKE_DEBUG
    if (!gc_is_watching) {
  #endif
      if (marker_hash_table) cleanup_markers();
      if (!marker_hash_table)
        low_init_marker_hash(num_objects);
      get_marker(rec_list.data);
  #ifdef PIKE_DEBUG
    }
  #endif
  }

Clearly, the proper mate for the "{" on the fourth line is the "}"
further down and not the "#endif" on the next line. I fear that
combined movement keys which still handles this separation would be
confusing to use. CC Mode provides separate keys to navigate cpp
directives, namely C-c C-n, C-c C-p and C-c C-u.


/* */ comments are another matter since they do nest. So it might be a
nice feature to extend C-M-[fbu@dknp] etc for comments. If so, I think
they should handle string literals too (C-f and C-b does, but not e.g.
C-u and C-d). (The underlying functions can't be changed, however,
since much elisp code depends on their behavior.)

Anyway, this is not really a CC Mode issue since these keys are bound
globally in Emacs. I therefore cc the discussion to the emacs-devel
list.

       reply	other threads:[~2004-10-01 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a9tfz61bxhu.fsf@nemi.ping.uio.no>
2004-10-01 16:48 ` Martin Stjernholm [this message]
2004-10-03 14:33   ` Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc Richard Stallman
2004-10-05 19:22     ` Martin Stjernholm

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

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

  git send-email \
    --in-reply-to=5b1xgimlkd.fsf@lister.roxen.com \
    --to=mast@lysator.liu.se \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 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.