unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Loading a file vs evaluating its buffer
@ 2014-10-06  7:40 Thorsten Jolitz
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2014-10-06  7:40 UTC (permalink / raw)
  To: help-gnu-emacs


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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-06  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.10550.1412581277.1147.help-gnu-emacs@gnu.org>
2014-10-06  8:15 ` Loading a file vs evaluating its buffer Pascal J. Bourguignon
2014-10-06  8:33   ` Thorsten Jolitz
2014-10-06  7:40 Thorsten Jolitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).