Platform-independent path (in LaTex and Elisp)?

I have a setting at the top of my . Emacs the tests the OS, and sets a CONST pointing to the the root directory of the path accordingly. Then, within the configurations, I just reference the variable within my path statements.

Just tested on OS X and Windows 7 Here's some examples: (defconst HOME_DIR (if (eq system-type 'darwin) (concat "/Users/" (getenv "USER")) (concat "c:/cygwin/home/" (getenv "USER"))) "Home directory. I could rely on the HOME environment variable, but I'm being retentive. ") (defconst EMACS_PKGS (concat HOME_DIR "/emacs-pkgs") "Directory for the emacs pkgs and configuration files.

Default uses `HOME_DIR' as a prefix") ;; isolate customize settings (setq custom-file (concat EMACS_PKGS "/emacs-custom. El")).

I have a setting at the top of my . Emacs the tests the OS, and sets a CONST pointing to the the root directory of the path accordingly. Then, within the configurations, I just reference the variable within my path statements.

Just tested on OS X and Windows 7. Here's some examples: (defconst HOME_DIR (if (eq system-type 'darwin) (concat "/Users/" (getenv "USER")) (concat "c:/cygwin/home/" (getenv "USER"))) "Home directory. I could rely on the HOME environment variable, but I'm being retentive.") (defconst EMACS_PKGS (concat HOME_DIR "/emacs-pkgs") "Directory for the emacs pkgs and configuration files.

Default uses `HOME_DIR' as a prefix") ;; isolate customize settings (setq custom-file (concat EMACS_PKGS "/emacs-custom. El")).

That's pretty much what I was looking for. Definitely works for elisp, might even work for latex. Thanks.

– Thorsten Mar 9 at 18:37 After fiddling around with this solution I encountered a few issues. 1. When staring emacs as root for some admin work,the (getenv "USER") causes problems, since the user is root.2.

Putting my own directories at front of load-path didn't work any more, since add-to-list apparently inerpreted the list (concat HOMR_DIR "/my-dir/") as 'element' and as an argument for 'append' at the same time, and therefore appended the directories. By giving only a string as 'element', like "~/my-dir/, 'append' was nil again and the dirs put in front. – Thorsten Mar 10 at 23:15 @Thorsten I'm not seeing that using this format: (add-to-list 'my-list (concat EMACS_PKGS "/1")) (add-to-list 'my-list (concat EMACS_PKGS "/2")) (add-to-list 'my-list (concat EMACS_PKGS "/3")) Also, you can use tramp to load a file as root in a running emacs session with the following format (using /etc/hosts as an example): C-x C-f /su::/etc/hosts See this for details – Chris McMahan Mar 14 at 18:34.

My experience with Emacs on Windows is that ~ is not at C:\Users\yourusername. For me, it's in C:\Users\rafe\AppData\Roaming. So, for the case of Emacs, if you drop files in, say, %HOME%\AppData\Roaming (or, in Windows Emacs, ~), you'll have access to those files.

That's where my . Emacs was by default, at least. The path might be different on your system, so see where Emacs takes you when you try to find a file and type ~/.

That setting might be configurable, but I've never cared enough to change it. As for LaTeX, sadly I can't help.

Interactively, ~/ brings me to c:/Users/me inside Emacs on my Win7 machine (because I configured the 'home' variable). But using ~/latexProject/myfile inside a . Tex file causes an error on the Win7 machine (not in Ubuntu).

And I had a problem with ~/ in elisp files too on my Win7 machine (in relation to Symlinks? ), unfortunately I don't remember exactly. Would be nice to have something thats more independent from emacs, like a generic way to address HOME.

– Thorsten 7 ma0 at 17:46.

Looks interesting, there is even a hint for dropbox users. I'll check it out. – Thorsten Mar 9 at 18:34.

You can use any path separator in Java, it will work on both Unix and Windows. If you still want to use the system path separator there is the File. Separator property which will give you the right one depending on the current system.

For the root, you can use listRoots() which gives you an array of root, there will be only one element on Unix systems, and as many as you have drives on Windows.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions