1

I've got this from a YouTube video about Evil mode but I can't see the entire init file, so I think it's incomplete because it gives me an error.

The idea is to disable Evil mode in some modes. This is the code:

(defcustom dotemacs-evil-emacs-state-modes
  '(special-mode
    eshell-mode
    comint-mode
    project-explorer-mode
    git-commit-mode
    diff-mode
    custom-mode
    dired-mode
    calendar-mode
    help-mode)
  `Doc...
  :type '(repeat (symbol))
  :group 'dotemacs)

(dolist (mode dotemacs-evil-emacs-state-modes)
  (evil-set-initial-state mode 'emacs))

When I run it, it says Error: invalid syntax ")" and it's referring to this block:

  '(special-mode
    eshell-mode
    comint-mode
    project-explorer-mode
    git-commit-mode
    diff-mode
    custom-mode
    dired-mode
    calendar-mode
    help-mode)

What's wrong with this variable?

*** The final solution:

(defcustom dotemacs-evil-emacs-state-modes
  '(special-mode
    eshell-mode
    comint-mode
    project-explorer-mode
    git-commit-mode
    diff-mode
    custom-mode
    dired-mode
    calendar-mode
    help-mode)
  "Documentation..."
  :type '(repeat (symbol))
  :group 'dotemacs)

(dolist (mode dotemacs-evil-emacs-state-modes)
  (evil-set-initial-state mode 'emacs))

I changed the DOC to a string variable and made sure that the STANDARD variable is properly spaced with white spaces.

Also, the ")" syntax error was just some package telling me I miss-typed it not an actual run-time error.

2

When I run it, it says Error: Doc string is missing which I don't understand.

It means that defcustom expects a documentation string but you did not provide one. Use C-h f defcustom RET to learn where the doc-string is supposed to go and then add it.

| improve this answer | |
  • Thanks, I managed to deal with the DOC string but now it says that the second variable '(special-mode eshell-mode comint-mode project-explorer-mode git-commit-mode diff-mode custom-mode dired-mode calendar-mode help-mode) has invalid syntax and is missing a closing parentheses. – Rtsne42 Jan 1 '17 at 12:38
  • 1
    That's not the correct syntax for a doc-string (or any string for that matter), read the documentation again. It's supposed to look like "Doc...", not `Doc... – tarsius Jan 1 '17 at 12:46
  • 1
    Well, I suppose you could just look at any elisp file that you know contains a defcustom form to see how this is done. Or consult the elisp info manual. Also I am not aware of any programming language where strings look like `string but many languages where they look like "string". – tarsius Jan 1 '17 at 12:52
  • 1
    You are welcome, but may I suggest that you do read at least the basic parts of the elisp manual. If you don't, then it will always be trail and error, with a focus on the latter ;-) – tarsius Jan 1 '17 at 12:55
  • 1
    By the way, here is the node about defcustom (from the emacs manual): gnu.org/software/emacs/manual/elisp.html#Variable-Definitions. It does contain an example. – tarsius Jan 1 '17 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.