all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#10941: [24.0.93.3] cc-mode: error in message buffer when "typing fast", characters eaten
@ 2012-03-04 18:14 Paul Pogonyshev
  2012-03-29 21:48 ` Alan Mackenzie
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Pogonyshev @ 2012-03-04 18:14 UTC (permalink / raw)
  To: 10941

[-- Attachment #1: Type: Text/Plain, Size: 918 bytes --]

Sometimes (quite often) when opening a different syntax region --- a
quoted string, or block comment --- in C++ mode, the first character
after it gets eaten with some error message shown in the echo area.  I
managed to create a surefire (at least here) way to reproduce it.

* save the attached file as 'test.cpp' (it is quite large, but when I
  tried to shorten it substantially, error disappeared);

* start Emacs as 'emacs -Q test.cpp';

* issue Elisp command right at the start of the buffer with M-: (this
  emulates fast typing):

      (progn (insert "/*") (insert " "))

  note that two separate inserts are essential, with one "/* " error
  is not triggered;

* observer the following error:

      Debugger entered--Lisp error: (error "Invalid search bound
      (wrong side of point)")

Full Emacs version: GNU Emacs 24.0.93.3 (x86_64-unknown-linux-gnu,
GTK+ Version 2.24.10) of 2012-02-25 on gonzo

Paul

[-- Attachment #2: test.cpp --]
[-- Type: text/x-c++src, Size: 3990 bytes --]

namespace mct
{

  // Templated structure specifying how given type could be used by its container (in
  // broad sense), i.e. "externally".  Default is no external use; it can be enabled by
  // specializing the structure.
  template <typename Type, typename = void>
  struct external_use
  { };


  template <typename Type, typename = Type>
  struct supports_external_use : impl::false_type
  { };

  template <typename Type>
  struct supports_external_use <Type, typename external_use <Type>::type> : impl::true_type
  { };


  template <typename Type, typename Value, Value Type::* field,
            bool direct_access = (impl::is_integral <Value>::value
                                  && !impl::is_same <Value, bool>::value),
            bool recurse       = supports_external_use <Value>::value>
  struct extern_use_field;

  template <typename Type, typename Value, Value Type::* field>
  struct extern_use_field <Type, Value, field, true, false>
  {
    typedef  Type   type;
    typedef  Value  value_type;

    static  const value_type&
    get (const type& structure)
    {  return structure.*field;  }

    static  void
    set (type& structure, const value_type& value)
    {  structure.*field = value;  }
  };

  template <typename Type, typename Value, Value Type::* field>
  struct extern_use_field <Type, Value, field, false, true>
  {
    typedef  Type                                       type;
    typedef  typename external_use <Value>::value_type  value_type;

    static  const value_type&
    get (const type& structure)
    {
      return external_use <Value>::get (structure.*field);
    }

    static  void
    set (type& structure, const value_type& value)
    {
      external_use <Value>::set (structure.*field, value);
    }
  };


  template <typename First, typename Second>
  struct external_use <std::pair <First, Second>,
                       typename impl::enable_if <supports_external_use <First>::value>::type>
    : extern_use_field <std::pair <First, Second>, First, &std::pair <First, Second>::first>
  { };

  template <typename First, typename Second>
  struct external_use <std::pair <First, Second>,
                       typename impl::enable_if <supports_external_use <Second>::value
                                                 && !supports_external_use <First>::value>::type>
    : extern_use_field <std::pair <First, Second>, Second, &std::pair <First, Second>::second>
  { };


  namespace impl
  {

    // By default the structure is empty.  'intrusive_storage' below makes sure to never
    // use it when it's empty, i.e. of size 1.
    template <typename type, typename = void>
    struct extern_use_wrapper
    { };


# if 0

    // Ideally we'd want this, but see comment in the preprocessor-enabled branch.
    template <typename type>
    struct extern_use_wrapper <type, typename impl::enable_if <std::is_class <type>::value>::type>
      : type
    // ...

# else

    // We currently specialize 'extern_use_wrapper' very conservatively.  At least GCC up
    // to 4.6 doesn't provide 'std::is_class', so there is no reliable way to determine if
    // 'type' is subclassable without requiring a recent compiler.  The most important
    // case, especially for maps, is 'std::pair', so we limit ourselves to that for now.
    template <typename First, typename Second>
    struct extern_use_wrapper <std::pair <First, Second> > : std::pair <First, Second>
    {
      typedef  std::pair <First, Second>  base_type;

      char  _unused;

      extern_use_wrapper&
      operator= (const extern_use_wrapper& that)
      {
        return static_cast <extern_use_wrapper&> (base_type::operator= (that));
      }

#   if MCT_CXX0X_SUPPORTED

      extern_use_wrapper&
      operator= (extern_use_wrapper&& that)
      {
        return static_cast <extern_use_wrapper&> (base_type::operator=
                                                  (std::forward <base_type> (that)));
      }

#   endif
    };

# endif

  }

}

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

end of thread, other threads:[~2012-04-11 18:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-04 18:14 bug#10941: [24.0.93.3] cc-mode: error in message buffer when "typing fast", characters eaten Paul Pogonyshev
2012-03-29 21:48 ` Alan Mackenzie
2012-03-29 22:11   ` Paul Pogonyshev
2012-03-30 22:19     ` Alan Mackenzie
2012-03-31 20:27       ` Paul Pogonyshev
2012-04-11 18:19   ` Alan Mackenzie

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.