I am new to elisp and am trying to write an Elisp function that calls
org-pandoc-export-to-html5-pdf-and-open
.org-pandoc-export-to-html5-pdf-and-open
is an interactive function that will write to a file, and when called viaM-x
, it prompts the user for a filename to enter in the minibuffer.I want to pass a default value for the filename so that the user does not have to enter the name manually. The file and its path is
/tmp/tmp.html
.
What is the simplest way for me to do this?
I want to acknowledge that many versions of this question have been asked before, if someone automatically marks this as a duplicate. Below is a table, with some comments.
I think question 4 comes closest in spirit to this question, but it wasn't answered, and marked as a duplicate of a question which is similar in the way that australiopithecus is similar to homo sapiens sapiens - similar at root level but there is a meaningful difference.
Otherwise, my question is one of approach:
- Qs 1,6 suggest
minibuffer-setup
usage - Q 7 suggests
thing-at-point
. - I have tried various combinations of
funcall
,commandp
,command-execute
, but the user prompt remains. - I have read some of the manual describing interactive calls here, and have done
C-h f
on the function at hand, but can't quite translate what little I understand from the manual to the desired functionality.
Question | Function/topic | Resolved? (And probable solution?) | Useful in this case? |
---|---|---|---|
1. Call a function and insert text in minibuffer prompt | ivy-switch-buffer insert yank into minibuffer |
Yes, (add-hook 'minibuffer-setup-hook 'foo) |
Maybe |
2. Call function interactively and set initial content | Default value when calling find-file |
Yes, let ((default-directory "/home/") |
No |
3. How to call an interactive function and pass arguments to it from within Elisp? | Use call-interactively or command-execute for describe-package , pass value xref |
Yes-ish - wrong argument type passed | No |
4. Call an interactive function without asking for user input [duplicate] | Call e.g. projectile-test-project with a predefined argument, without user asking anything |
No, marked as duplicate of 5 | Maybe - same question, unresolved |
5. How to use 'interactive' arguments when calling the command from code | Call an interactive function which takes user input | Yes, trivially: (call-interactively 'test) |
No, and not sure how it answers 4! |
6. Inserting Text into an Active Minibuffer | Insert text into minibuffer after external command is run (like Q1) | Yes, (add-hook 'minibuffer-setup-hook 'foo) |
Maybe - statement that minbuffer-setup-hook is the "idiomatic way" |
7. emacs interactive commands with default value | Default values for interactive commands, thing-at-point |
Yes | Maybe - thing-at-point-usage ? |
8. call write-file interactively with prompting | Use write-file with default file name |
Yes, condition-case-nil to fallback to default value |
Maybe, another answer suggests (call-interactively 'write-file (vector path)) |
9. emacs how to use call-interactively with parameter | Call wg-save , then switch window config |
Yes, with (call-interactively 'my-fn t (vector arg1 arg2)) |
Maybe |
ox-pandoc
library and this function definition uses(interactive)
, and when a function does not handle its interactive inputs via its owninteractive
form then you will need to find out where those prompts are actually coming from -- there's no standard answer in that situation; it will simply depend on what that particular code happens to be doing. I suggest you setdebug-on-quit
, call the command in question, typeC-g
at the interactive prompt, and check the backtrace to figure out where you've ended up and how you got there.