1

I am trying to create a bash alias to open emacs with a calendar from terminal. To do so I am using calfw with use-package like so:

(use-package calfw
  :ensure ;TODO:
  :config
  (require 'calfw)
  (require 'calfw-org)
  (setq cfw:org-overwrite-default-keybinding t)
  (require 'calfw-ical)
  :bind ("C-c q" . 'cfw:open-org-calendar))

When I try to do

em --eval "(execute-extended-command (cfw:open-org-calendar))"

it opens with the calendar open, but it waits for a M-x command

enter image description here

Not sure what I am doing wrong.

Thx!

1 Answer 1

1

Look at the help for execute-extended-command (via C-h f execute-extended-command):

It is bound to , , M-x.

(execute-extended-command PREFIXARG &optional COMMAND-NAME TYPED)

This function is for interactive use only; in Lisp code use ‘command-execute’ instead.

Read a command name, then read the arguments and call the command. To pass a prefix argument to the command you are invoking, give a prefix argument to ‘execute-extended-command’.

This tells us that execute-extended-command is for interactively prompting the user for the name of a command to run. It is the command that is run when you enter M-x, so it makes sense that your client opens with the M-x prompt waiting for you.

If you want to execute a function in elisp, you just need to call that function, you don't need to wrap it in execute-extended-command:

em --eval "(cfw:open-org-calendar)"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.