[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Loading a file vs evaluating its buffer
From: |
Thorsten Jolitz |
Subject: |
Loading a file vs evaluating its buffer |
Date: |
Mon, 06 Oct 2014 09:40:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi List,
when I try to store the installation directory of an app while loading
its init file "A.el" with this code
#+BEGIN_SRC emacs-lisp
(defvar my-installation-directory ""
"My installation directory.")
(setq my-installation-directory
(file-name-directory
(directory-file-name
(file-name-directory
(buffer-file-name)))))
#+END_SRC
I get
,----
| Load error for /home/tj/junk/el/A.el:
| (wrong-type-argument stringp nil)
`----
but doing M-x eval-buffer in buffer "A.el" works as expected:
,----[ C-h v my-installation-directory RET ]
| my-installation-directory is a variable defined in `A.el'.
| Its value is "/home/tj/junk/"
|
| Documentation:
| My installation directory.
`----
How can I get the same result when loading the file?
--
cheers,
Thorsten
- Loading a file vs evaluating its buffer,
Thorsten Jolitz <=