im trying to write a function that will be used in dired where i would launch it on the file at point and it will convert it using pandoc. i have the following code chunk (warning: my coding skills are basiclly zero :))
(defun z/dired-shell-md2org ()
""
(interactive)
(shell-command (concat "pandoc -o OUTPUT.org" (dired-file-name-at-point))))
the original pandoc command i use succesfuly is this
pandoc -o EDA.org EDA.md
can anyone guide me on 2 things:
how does one get the current file variable (i think its
dired-file-name-at-point
) to be the last wordis there a way that instead of OUTPUT.org it will use the same filename (sans extension) of original file at point?
Basically i want the converted orf file to have the same name as the original md file
"pandoc -o OUTPUT.org"
to separate the file names in the shell command. If you useshell-command
you should also use quotes around file names, i.e."\"...\""
. Furthermore,file-name-sans-extension
is your friend and look up theformat
function in the emacs-lisp help.