4

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?

Drew
  • 77,472
  • 10
  • 114
  • 243
qwe
  • 243
  • 1
  • 8
  • 2
    maybe use intern instead of make-symbol? Why do you want make-symbol? – npostavs Sep 09 '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 09 '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 09 '15 at 21:02
  • Out of curiosity, what's the use case that you have in mind for this? – Dan Sep 09 '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 09 '15 at 23:20
  • OK, this is my .emacs now, it looks very clean by me. Each piece of extra functionality is provided by automatically loaded modules. https://github.com/ydm/dotFiles/blob/master/emacs/_emacs – qwe Sep 10 '15 at 23:48

1 Answers1

4

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"))
Iqbal Ansari
  • 7,558
  • 1
  • 29
  • 31
qwe
  • 243
  • 1
  • 8
  • 1
    Unless you have a file named "test", you're going to get (file-error "Cannot open load file" "test"). – Dan Sep 09 '15 at 21:17