unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))
@ 2013-03-26 20:12 Andrew Pennebaker
  2013-03-26 20:18 ` Andrew Pennebaker
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrew Pennebaker @ 2013-03-26 20:12 UTC (permalink / raw)
  To: Emacs Help


[-- Attachment #1.1: Type: text/plain, Size: 288 bytes --]

I can't insert important C++ characters into my code (attached). When I
press ; or { Emacs shows an error in the minibuffer:

"Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"

Major mode is c++-mode.

Using Emacs 24.2.1.

-- 
Cheers,

Andrew Pennebaker
www.yellosoft.us

[-- Attachment #1.2: Type: text/html, Size: 560 bytes --]

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

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <numeric>

#ifdef ASYNC
#include <future>
#endif

using namespace std;

string fizzy(int n) {
  int a = n % 3, b = n % 5;

  if (a == 0 && b == 0) {
    return "FizzBuzz";
  }
  else if (a == 0) {
    return "Fizz";
  }
  else if (b == 0) {
    return "Buzz";
  }
  else {
    stringstream out;
    out << n;
    return out.str();
  }
}

void fizzbuzz() {
  vector<int> range(100, 0);

#ifdef ASYNC
  iota(range.begin(), range.end(), 0);
#endif

  vector<string> strings(range.size(), "");

#ifdef ASYNC
  vector<future<void>> futures;
#endif

#ifdef AUTO
  for (auto i : range) {
#elsif
  int i;
  for (i = 0; i < range.size(); i++) {
#endif
#ifdef ASYNC
    futures.emplace_back(
      std::async(
        launch::async,
        [&]() {
#endif
          strings[i] = fizzy(i + 1);

#ifdef ASYNC
        }
      )
    );
#endif
  }

  for (auto s : strings) {
    cout << s << endl;
  }
}

int main() { fizzbuzz(); }

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

* Re: c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))
  2013-03-26 20:12 c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Andrew Pennebaker
@ 2013-03-26 20:18 ` Andrew Pennebaker
  2013-03-27  6:43 ` Leo Liu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Andrew Pennebaker @ 2013-03-26 20:18 UTC (permalink / raw)
  To: Emacs Help

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

Updated<https://github.com/mcandre/mcandre/tree/4b8512cf84c4e3553d43182a8a5c72f6f37566f8/cpp/fizzy>code
example. I had to copy and paste `i` and `{` on lines 48 and 49,
because Emacs kept complaining

"Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"


On Tue, Mar 26, 2013 at 4:12 PM, Andrew Pennebaker <
andrew.pennebaker@gmail.com> wrote:

> I can't insert important C++ characters into my code (attached). When I
> press ; or { Emacs shows an error in the minibuffer:
>
> "Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"
>
> Major mode is c++-mode.
>
> Using Emacs 24.2.1.
>
> --
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
>



-- 
Cheers,

Andrew Pennebaker
www.yellosoft.us

[-- Attachment #2: Type: text/html, Size: 1574 bytes --]

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

* Re: c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))
  2013-03-26 20:12 c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Andrew Pennebaker
  2013-03-26 20:18 ` Andrew Pennebaker
@ 2013-03-27  6:43 ` Leo Liu
  2013-03-27 12:16   ` Andrew Pennebaker
       [not found] ` <mailman.22894.1364329129.855.help-gnu-emacs@gnu.org>
  2013-03-27 12:37 ` c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Stefan Monnier
  3 siblings, 1 reply; 6+ messages in thread
From: Leo Liu @ 2013-03-27  6:43 UTC (permalink / raw)
  To: help-gnu-emacs

On 2013-03-27 04:12 +0800, Andrew Pennebaker wrote:
> "Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"

more like a screwup in your setup. ad-Orig-c-parse-state suggests you
have advised c-parse-state.

Leo




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

* Re: c++-mode: Invalid function: (setq ad-return-value?(ad-Orig-c-parse-state))
       [not found] ` <mailman.22894.1364329129.855.help-gnu-emacs@gnu.org>
@ 2013-03-27 11:07   ` Alan Mackenzie
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2013-03-27 11:07 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, Andrew.
Andrew Pennebaker <andrew.pennebaker@gmail.com> wrote:
> [-- text/plain, encoding 7bit, charset: ISO-8859-1, 34 lines --]

> Updated<https://github.com/mcandre/mcandre/tree/4b8512cf84c4e3553d43182a8a5c72f6f37566f8/cpp/fizzy>code
> example. I had to copy and paste `i` and `{` on lines 48 and 49,
> because Emacs kept complaining

> "Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"


> On Tue, Mar 26, 2013 at 4:12 PM, Andrew Pennebaker <
> andrew.pennebaker@gmail.com> wrote:

>> I can't insert important C++ characters into my code (attached). When I
>> press ; or { Emacs shows an error in the minibuffer:

>> "Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"

>> Major mode is c++-mode.

>> Using Emacs 24.2.1.

>> --
>> Cheers,

>> Andrew Pennebaker
>> www.yellosoft.us

Like Leo suggested, it looks like somebody's put a `defadvice' on
c-parse-state, though I've no idea why that should produce an "Invalid
function" error.  The code for advice has changed somewhat between Emacs
24.2 and 24.3.

Can you say why c-parse-state was advised?  Possibly for debugging?  In
that context, I would strongly advise you upgrade your Emacs to 24.3.  In
Emacs 24.2, c-parse-state was buggy, and now it is, well, less buggy.  ;-)


> -- 
> Cheers,

> Andrew Pennebaker
> www.yellosoft.us

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))
  2013-03-27  6:43 ` Leo Liu
@ 2013-03-27 12:16   ` Andrew Pennebaker
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Pennebaker @ 2013-03-27 12:16 UTC (permalink / raw)
  To: Emacs Help

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

I have not used advise myself, but maybe one of the packages I am using has.

My .emacs:

https://github.com/mcandre/dotfiles/blob/master/emacs


On Wed, Mar 27, 2013 at 2:43 AM, Leo Liu <sdl.web@gmail.com> wrote:

> On 2013-03-27 04:12 +0800, Andrew Pennebaker wrote:
> > "Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"
>
> more like a screwup in your setup. ad-Orig-c-parse-state suggests you
> have advised c-parse-state.
>
> Leo
>
>
>


-- 
Cheers,

Andrew Pennebaker
www.yellosoft.us

[-- Attachment #2: Type: text/html, Size: 1186 bytes --]

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

* Re: c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))
  2013-03-26 20:12 c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Andrew Pennebaker
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.22894.1364329129.855.help-gnu-emacs@gnu.org>
@ 2013-03-27 12:37 ` Stefan Monnier
  3 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-03-27 12:37 UTC (permalink / raw)
  To: help-gnu-emacs

> "Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"

My crystal ball says you have some advice somewhere which has
"(ad-do-it)" instead of "ad-do-it".


        Stefan




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

end of thread, other threads:[~2013-03-27 12:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26 20:12 c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Andrew Pennebaker
2013-03-26 20:18 ` Andrew Pennebaker
2013-03-27  6:43 ` Leo Liu
2013-03-27 12:16   ` Andrew Pennebaker
     [not found] ` <mailman.22894.1364329129.855.help-gnu-emacs@gnu.org>
2013-03-27 11:07   ` c++-mode: Invalid function: (setq ad-return-value?(ad-Orig-c-parse-state)) Alan Mackenzie
2013-03-27 12:37 ` c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Stefan Monnier

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).