0

Following this guide, I have setup an org-mode project "foo" that I want to (frequently) publish using a single keyboard short.

Currently I have defined

(global-set-key (kbd "C-c C-1") 'org-publish) 

so after typing C-c C-1, I still have to fill the prompt with the specific project I want to publish, here for example "foo".

How do I setup a shortcut that automatically publishes the project "foo" without additional prompts?

1 Answer 1

1

The documentation for org-publish says:

(org-publish PROJECT &optional FORCE ASYNC)

Publish PROJECT.

PROJECT is either a project name, as a string, or a project alist (see `org-publish-project-alist' variable).

(define-key org-mode-map (kbd "C-c C-1") (lambda () (interactive) (org-publish "foo"))) 
4
  • It does not work for me: "eval-region: Wrong number of arguments: ... ". Commented Mar 25, 2015 at 9:25
  • 3
    I would bind a function specific to a mode to that mode map so that it doesn't pollute the global key binding space. (define-key org-mode-map (kbd "C-c C-1") (lambda () (interactive) (org-publish "foo"))) Commented Mar 25, 2015 at 10:18
  • 1
    emacswiki.org/emacs/InteractiveKeybinding When passing arguments to a function in a binding, you need to wrap them up first in an interactive wrapper function or a temporary function lambda with interactive. Commented Mar 25, 2015 at 10:23
  • @kaushalmodi This works, thank you! Would you mind either editing this answer or posting a new one so that I can accept it? Commented Mar 25, 2015 at 10:48

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.