all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc.
       [not found] <a9tfz61bxhu.fsf@nemi.ping.uio.no>
@ 2004-10-01 16:48 ` Martin Stjernholm
  2004-10-03 14:33   ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Stjernholm @ 2004-10-01 16:48 UTC (permalink / raw)
  Cc: bug-cc-mode, emacs-devel

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.

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

* Re: Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc.
  2004-10-01 16:48 ` Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc Martin Stjernholm
@ 2004-10-03 14:33   ` Richard Stallman
  2004-10-05 19:22     ` Martin Stjernholm
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2004-10-03 14:33 UTC (permalink / raw)
  Cc: bug-cc-mode, chlunde+bugs, emacs-devel

    /* */ comments are another matter since they do nest.

Actually they don't nest.   /* foo /* bar */ is one comment.

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

* Re: Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc.
  2004-10-03 14:33   ` Richard Stallman
@ 2004-10-05 19:22     ` Martin Stjernholm
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Stjernholm @ 2004-10-05 19:22 UTC (permalink / raw)
  Cc: bug-cc-mode, chlunde+bugs, emacs-devel

Richard Stallman <rms@gnu.org> wrote:

>     /* */ comments are another matter since they do nest.
>
> Actually they don't nest.   /* foo /* bar */ is one comment.

Sorry, I was vague. I meant that they nest wrt parens, in the sense
that "( /* )( */ )" is one paren sexp and not two.

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <a9tfz61bxhu.fsf@nemi.ping.uio.no>
2004-10-01 16:48 ` Feature request: match #ifdefs and /* comments */ w/ forward-sexp etc Martin Stjernholm
2004-10-03 14:33   ` Richard Stallman
2004-10-05 19:22     ` Martin Stjernholm

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.