I've perused a few of the org-mode html-export keybinding shortcuts, i.e., ways to just have one key do, e.g., the entire long-winded C-c C-e h o. Unfortunately, there doesn't seem to be one fell swoop function like org-html-export-as-html to get the whole job done with what I'm using, namely, ox-tufte. I've located the (probably) germane section

(org-export-define-derived-backend 'tufte-html 'html
  '(?T "Export to Tufte-HTML"
       ((?T "To temporary buffer"
            (lambda (a s v b) (org-tufte-export-to-buffer a s v)))
        (?t "To file" (lambda (a s v b) (org-tufte-export-to-file a s v)))
        (?o "To file and open"
            (lambda (a s v b)
              (if a (org-tufte-export-to-file t s v)
                (org-open-file (org-tufte-export-to-file nil s v)))))))
  :translate-alist '((footnote-reference . org-tufte-footnote-reference)
                     (src-block . org-tufte-src-block)
                     (link . org-tufte-maybe-margin-note-link)
                     (quote-block . org-tufte-quote-block)
                 (verse-block . org-tufte-verse-block)))

but I'm not sure how to put together a custom function to accomplish the key shortcut of C-c C-e T t to F9. Any suggestions appreciated. Any suggested tutorial to understand what the above function is doing would also be appreciated.


If you don't care about setting the async, scope, or visible-only options, then you can do something like this:

(defun my/org-tufte-export-direct-to-file ()
   (org-tufte-export-to-file nil nil nil))

(define-key org-mode-map (kbd "<f9>") #'my/org-tufte-export-direct-to-file)

i.e. call the function that the t key calls when you are in the export dispatcher. C-c C-e T t says invoke the export dispatcher (C-c C-e) which brings up the menu where you can set some options, but principally where you can select which exporter to use. The T then selects the Tufte exporter (I presume - I don't have it installed) and the t dispatches to org-tufte-export-to-file as shown by the snippet of code you posted.

Another possibility is to define a keyboard macro, save it and assign it to a key. See the "Keyboard Macros" chapter in the Emacs manual (C-h i g(emacs)Keyboard macros).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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