2

I'm using emacs with a large font, however I do not need the font to be too large on certain buffers and/or modes. For example, when I use neotree I use a different font and a smaller size, I do that like this:

(add-hook 'neotree-mode-hook '(lambda ()
                              (setq buffer-face-mode-face '(:family "Hack" :height 130 :width semi-condensed))
                              (buffer-face-mode)))

I want to achieve the same thing but for the org export dispatch ui, that is, the buffer that appears when exporting an Org file (by using org-export-dispatch). While this window is active I can not use the describe-mode or see the major-mode so I don't know for which mode I should apply the settings.

I've tried this with no effect:

(defun my-buffer-face-mode-fixed ()
   (interactive)
   (setq buffer-face-mode-face '(:family "Hack" :height 130 :width semi-condensed))
   (buffer-face-mode))

(add-hook 'org-export-before-parsing-hook 'my-buffer-face-mode-fixed)

As well as:

(add-hook 'org-export-stack-mode-hook 'my-buffer-face-mode-fixed)

It doesn't work.

What I was thinking was somehow set the font face for a buffer with a specific name, in that case the question is how to change the font face for the *Org Export Dispatcher* buffer?

While looking about how to change the font on a per name basis I found this on the emacswiki:

 (set-specifier (face-background (get-face 'default)) "blue"
                (get-buffer "*scratch*"))

However the set-specifier function is only available in XEmacs, how can I achieve the same thing in GNU Emacs 26.1?

1 Answer 1

3

A glance on org-export--dispatch-ui shows that org-export--dispatch-action is the action right after generating the dispatch buffer. The function org-export--dispatch-action already handles the key-presses for the export options. Therefore you have no other choice than to put the font setting function before org-export--dispatch-action with the help of an advice.

(defcustom org-export-dispatch-buffer-face '(:family "Hack" :height 130 :width semi-condensed)
  "The face specification used by `buffer-face-mode'.
It may contain any value suitable for a `face' text property,
including a face name, a list of face names, a face-attribute
plist, etc."
  :type '(choice (face)
         (repeat :tag "List of faces" face)
         (plist :tag "Face property list"))
  :group 'org-export)

(defun org-export-dispatch-set-font (&rest args)
  "Set font for Org Export Dispatch Buffer."
  (let ((buf (get-buffer "*Org Export Dispatcher*")))
    (when buf
      (with-current-buffer buf
        (apply #'buffer-face-set org-export-dispatch-buffer-face)))))

(advice-add 'org-export--dispatch-action :before #'org-export-dispatch-set-font)

Remark: You could send a feature-request asking for a hook right before org-export--dispatch-action with the Export Dispatch Buffer as current buffer to the org-mode mailing list.

3
  • 1
    Thanks, it worked beautifully. As suggested I asked at the mailing list to add this hook.
    – zzantares
    Commented Mar 21, 2019 at 23:20
  • @zzantares, did you ever hear back about this?
    – apc
    Commented Sep 30, 2022 at 15:42
  • @apc hard to remember, but sadly it seems I never got a reply back.
    – zzantares
    Commented Oct 2, 2022 at 19:02

Your Answer

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

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