[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request: match #ifdefs and /* comments */ w/ forward-sexp et

From: Martin Stjernholm
Subject: Re: Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc.
Date: Fri, 01 Oct 2004 18:48:18 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/20.7 (gnu/linux)

Carl Henrik Lunde <address@hidden> 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) {
      if (marker_hash_table) cleanup_markers();
      if (!marker_hash_table)
  #ifdef PIKE_DEBUG

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 address@hidden 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]