Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Breaks in Emacs 23 #36

purcell opened this Issue · 14 comments

3 participants


Running, for example, M-x find-library results in:

Debugger entered--Lisp error: (wrong-number-of-arguments execute-extended-command 2)
  execute-extended-command(nil "find-library")
  smex-read-and-run(("toggle-debug-on-error" "find-library" "package-list-packages" "magit-remote-update" "toggle-truncate-lines" "color-theme-sanityinc-tomorrow-day" "package-install" "normal-mode" "gnus" "eval-buffer" "backward-up-sexp" "rgrep" "describe-face" "ag" "dark" "light" "color-theme-sanityinc-tomorrow-night" "find-function" "describe-text-properties" "delete-this-file" "load-library" "compile" "color-theme-sanityinc-tomorrow-bright" "revert-buffer" "describe-char" "load-file" "re-search-forward" "magit-interactive-rebase" "auto-complete" "color-theme-sanityinc-tomorrow-eighties" "rename-this-file-and-buffer" "set-default-font" "byte-recompile-directory" "pop-to-mark-command" "shell-command-on-region" "reverse-region" "whitespace-cleanup" "auto-complete-mode" "font-lock-fontify-buffer" "ffap" "paredit-wrap-square" "apropos" "align-regexp" "scratch" "eval-region" "ruby-toggle-hash-syntax" "package-list-packages-no-fetch" "fundamental-mode" "byte-compile-file" "goto-char" ...))
  call-interactively(smex nil nil)

describe-function gives the following for execute-extended-command:

execute-extended-command is an interactive built-in function in `C
source code'.

It is remapped to `smex', which is bound to <execute>, <menu>, C-x
RET, M-x.

(execute-extended-command PREFIXARG)

Read function name, then read its arguments and call it.

To pass a numeric argument to the command you are invoking with, specify
the numeric argument to this command.

Noninteractively, the argument PREFIXARG is the prefix argument to
give to the command you invoke, if it asks for an argument.

I have Emacs 23.3.1, which I just use for occasional backwards-compatibility testing.



@purcell purcell referenced this issue in purcell/emacs.d

Init error? #160


Do you happen to use a build?

Until version 24.3 they seem to ship the old non-elisp execute-extended-command. (For reasons unknown.)
This has been reported before; I might add a note to the README.


Ah, yes, it probably is from there. I wonder if the problem could be detected and/or worked around by inspecting execute-extended-command using subr-arity...


Indeed, in a broken emacs, (subr-arity (symbol-function 'execute-extended-command)) returns (1 . 1), whereas an error is raised when execute-extended-command is not a subr.


I wonder if the problem could be detected and/or worked around

Then I would have to resurrect the old custom execute-extended-command code that I was happy to get rid of.
(4 additions and 60 deletions, relevant commit)
Do you think that's worth it?


Hell no, but perhaps add something like the following at the top-level:

(when (eq (cons 1 1)
            (subr-arity (symbol-function 'execute-extended-command))))
  (error "Your emacs has a non-elisp version `execute-extended-command', which is incompatible with smex"))

Ugh, hang on -- need to compare the cons as a sequence, not with eq.


Okay, this works:

(when (equal (cons 1 1)
           (subr-arity (symbol-function 'execute-extended-command))))
  (error "Your emacs has a non-elisp version of `execute-extended-command', which is incompatible with smex"))

Perhaps even point to this issue.

@nonsequitur nonsequitur closed this issue from a commit
@nonsequitur Warn when Smex is loaded on incompatible Emacsen
Fixes #36

Thanks to Steve Purcell for suggesting this patch

It's indeed broken in emacs 23, but the README says it works with 23 and higher: in the Changelog for v3.0:
"This breaks support for Emacs versions older than 23".

The README should be updated.


"This breaks support for Emacs versions older than 23".

That only implies that Emacs 22.x and lower will not work.

AFAIK, smex is otherwise expected to work with Emacs 23.

So what do you mean by "broken"? Can you provide more info about what's going wrong for you, perhaps even a backtrace after you've enabled debug-on-error?


I have exactly the error reported initially on this issue: in emacs 23 execute-extended-command takes only one optional argument, it reads the command from the minibuffer, not as an argument.

I have emacs 23.1.1 from ubuntu 10.04 (yes it's old...). I had to revert 3dd03c0 to get smex (and thus M-x) working again.


@Niluge-KiWi So you don't see the "Your Emacs has a non-elisp version of `execute-extended-command'" message? That's odd.


@purcell The check introduced by ab59af5 does work: it calls error. So smex is not compatible with emacs 23. This is what the initial issue reported.
However the README says smex should work with emacs 23.


Okay, cool -- I have an Emacs 23.3, which also produces the warning message, but it's a quirky build, so I couldn't tell whether Emacs 23 on other platforms would also trigger the message.

Seems like @nonsequitur should update the README, and add a Package-Requires header to smex.el. I'll file a corresponding PR.


Done: see #39.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.