Get buffer file name without extension in .emacs

I'm trying to make shortcuts for portable emacs related to the LaTeX and R portable compiler for Sweave, but I know little about the language used in .emacs (is it Lisp?)

I am currently using fullpath-relative-to-current-file , obtained from http://xahlee.org/emacs/elisp_relative_path.html to get the path to .emacs (which is in USBDRIVE/Documents ), then get the relative path to the compiler and call it on buffer-file-name , which is the full path and file name, including the extension extension:

 (global-set-key (kbd "Cc s") (lambda () (interactive) (cond ((string-equal (file-name-extension (buffer-file-name)) "tex") (shell-command (concat (fullpath-relative-to-current-file "../PortableApps/miktex/miktex/bin/pdflatex ") buffer-file-name))) ) (cond ((string-equal (file-name-extension (buffer-file-name)) "Rnw") (shell-command (concat (fullpath-relative-to-current-file "../PortableApps/R/R-2.14.1/bin/R CMD Sweave ") buffer-file-name " --pdf"))) ) ) ) 

This allows me to use Cc s to launch LaTeX in the tex file and Sweave in the Rnw file. Now I would like to include calls in bibtex, but for this I need the file name and path to the tex file without the extension. How can i do this?

+7
source share
1 answer

Try file-name-sans-extension . See the File Name Components section of the manual for more information.

+22
source

All Articles