[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
elisp function to find pwd
From: |
Vijay Lakshminarayanan |
Subject: |
elisp function to find pwd |
Date: |
Thu, 13 Nov 2008 01:13:04 -0800 (PST) |
User-agent: |
G2/1.0 |
Hi
I'd like to know if there exists a simple elisp function that I can
call and just get the present working directory.
I tried (pwd) but it gives a prefix. For example:
(pwd)
"Directory C:\\emacs-22.2\\bin/"
Which prefixes "Directory" to the result. I could just strip that bit
out but I'd like to know if there's an easier way.
Another hack I tried is:
(defun get-pwd-hack ()
(let* ((buffer-name (buffer-name))
(buffer-file-name (buffer-file-name))
(bnl (length buffer-name))
(bfnl (length buffer-file-name)))
(substring buffer-file-name 0 (- bfnl (1+ bnl)))))
Which will fail if I'm in, say, the *scratch* buffer.
Thanks
Vijay
- elisp function to find pwd,
Vijay Lakshminarayanan <=