|
| From: | Kevin Rodgers |
| Subject: | Re: subsitute for current file name in buffer in emacs |
| Date: | Wed, 30 Jan 2008 22:35:26 -0700 |
| User-agent: | Thunderbird 2.0.0.9 (Macintosh/20071031) |
shankarrg wrote:
suppose i need to use the file name which is currently present in buffer opened before me in emacs ..now suppose it is a .cpp file say abc.cppnow to compile this file i have to use ...\g++ abc.cpp now instead for putting abc.cpp is there a variable or command whichsubstitutes itself as the file name in current buffer when used ?
Even better, perhaps:
(add-hook 'find-file-hook
(lambda ()
(when (string-match "\\.cpp\\'" buffer-file-name)
(set (make-local-variable 'compile-command)
(format "g++ %s"
(file-name-nondirectory buffer-file-name))))))
--
Kevin Rodgers
Denver, Colorado, USA
| [Prev in Thread] | Current Thread | [Next in Thread] |