I just encountered this behavior of Emacs.

This works:

(require 'test)

But this doesn't

(require (make-symbol "test"))

Why is that and can I workaround it somehow?

  • 2
    maybe use intern instead of make-symbol? Why do you want make-symbol? – npostavs Sep 9 '15 at 20:50
  • Oh, I just saw your answer. Can you please explain to me with simple words what's the big difference between these two? – qwe Sep 9 '15 at 20:53
  • 1
    (equal 'test (intern "test")) => t, (equal 'test (make-symbol "test")) => nil, (equal (make-symbol "test") (make-symbol "test")) => nil. A symbol is not a name, a symbol has a name. – Jordon Biondo Sep 9 '15 at 21:02
  • Out of curiosity, what's the use case that you have in mind for this? – Dan Sep 9 '15 at 21:18
  • I want to modulize my Emacs init sequence, because I use Emacs on different machines for different purposes. So I'm just going to have a 'module' directory where I put all my init files (for example dedicated init file for auto-complete, init file with python settings, GNU/Linux settings, Windows settings, etc) and load just the modules I need. – qwe Sep 9 '15 at 23:20

OK, it looks like the symbol needs to be "interned". http://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Symbols.html

This works as expected:

(require (intern "test"))
  • 1
    Unless you have a file named "test", you're going to get (file-error "Cannot open load file" "test"). – Dan Sep 9 '15 at 21:17

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.