Domanda

I added this to my init.el in emacs:

(add-hook 'emacs-startup-hook
  (lambda ()
    (kill-buffer "*scratch*")
    (ido-mode t)
    (global-visual-line-mode 1)))

(add-hook 'clojure-mode-hook
 (lambda ()
    (rainbow-delimiters-mode 1)))

Now emacs automatically turns the word lambda into the symbol lambda but I don't know if that is the issue. When I startup emacs, it reports:

(lambda (line) ...) quoted with ' rather than with #'

But I am not quoting the lambda. If I remove the above lines of code, the error goes away.

Why does it give me that error?

È stato utile?

Soluzione

This isn't a bug in your code, but in some code provided with Emacs that is called by one of the functions you're calling. It is quite possibly Emacs bug #11357.

Your code is appropriate, except that as sds noted you're overcomplicating things with emacs-startup-hook. Most things can be done right when your .emacs is being loaded.

(ido-mode t)
(global-visual-line-mode 1)
(add-hook 'emacs-startup-hook
  (lambda ()
    (kill-buffer "*scratch*")))

The only reason I can think of to use emacs-startup-hook the way you did is if you frequently reload your .emacs and you frequently change ido-mode or global-visual-line-mode and don't want them to be reverted when you reload .emacs.

For alternate ways of getting more out of Emacs than killing *scratch*, see Automatically closing the scratch buffer and Prevent unwanted buffers from opening.

Altri suggerimenti

  1. The lambda in the warning has a line argument; your hooks do not. Either you have a different quoted lambda in your init file, or this is a bug in the byte compiler.

  2. There is no reason to quote lambdas at all; you are doing it right.

  3. I don't think that you are using emacs-startup-hook the right way; just put (ido-mode t) and (global-visual-line-mode 1) in the init file as is.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top