How can I create a keyboard macro where a file myfile
is opened by executing M-x openmyfile
. The main part should look like
(fset 'openmyfile
[?\C-x ?\C-f <dir of myfile> return])
but I don't want to enter the whole dir to myfile by writing every single char using ?/ ?d ?i ?r ...
and so on. How to insert the dir string into the macro definition?
(string-to-vector (kbd "C-x C-f /path/to/you/thing <return>"))
would work. Or, simpler(read-kbd-macro "C-x C-f /path/... <return>")
(defun openmyfile () "Your doc string comes here." (interactive) (find-file "<path of myfile>"))
instead.