Skip to content

Breaks in Emacs 23 #36

Closed
purcell opened this Issue Jan 23, 2014 · 14 comments

3 participants

@purcell
purcell commented Jan 23, 2014

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" ...))
  smex()
  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.

Cheers,

-Steve

@purcell purcell referenced this issue in purcell/emacs.d Jan 23, 2014
Closed

Init error? #160

@nonsequitur
Owner

Do you happen to use a emacsformacosx.com 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.

@purcell
purcell commented Jan 23, 2014

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

@purcell
purcell commented Jan 23, 2014

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.

@nonsequitur
Owner

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?

@purcell
purcell commented Jan 23, 2014

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

(when (eq (cons 1 1)
          (ignore-errors
            (subr-arity (symbol-function 'execute-extended-command))))
  (error "Your emacs has a non-elisp version `execute-extended-command', which is incompatible with smex"))
@purcell
purcell commented Jan 23, 2014

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

@purcell
purcell commented Jan 23, 2014

Okay, this works:

(when (equal (cons 1 1)
         (ignore-errors
           (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 added a commit that closed this issue Jan 31, 2014
@nonsequitur Warn when Smex is loaded on incompatible Emacsen
Fixes #36

Thanks to Steve Purcell for suggesting this patch
ab59af5
@Niluge-KiWi

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.

@purcell
purcell commented Apr 8, 2014

"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?

@Niluge-KiWi

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.

@purcell
purcell commented Apr 9, 2014

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

@Niluge-KiWi

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

@purcell
purcell commented Apr 10, 2014

Okay, cool -- I have an Emacs 23.3, which also produces the warning message, but it's a quirky emacsformacosx.com 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.

@purcell purcell added a commit to purcell/smex that referenced this issue Apr 10, 2014
@purcell purcell Note lack of support for Emacs 23, and depend on Emacs 24 virtual pac…
…kage

See #36
3da9709
@purcell
purcell commented Apr 10, 2014

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.