2

I would like my minor mode to set the buffer font, but not the frame font (the font contains special characters I need, but the hinting is abysmal). I got to this point:

(define-minor-mode transcribe-mode 
    "A minor mode for transkription of old prints and manuscripts."
    :light "Transcribe mode"
    :keymap (let 
    ((map (make-sparse-keymap)))

    (define-key map (kbd "M-e") (kbd "ͤ"))  ;; superscript e
    (define-key map (kbd "M-n") (kbd "̃"))  ;; superscript tilde (for nasalization)
    (define-key map (kbd "M-r") (kbd "ꝛ"))  ;; r rotunda
    (define-key map (kbd "M-s") (kbd "ſ"))  ;; long s
    (define-key map (kbd "M-d n") (kbd ""))    ;; duplicate n
    (define-key map (kbd "M-d m") (kbd ""))    ;; duplicate m

    ;; map variants of German letters to their location on a German keyboard
    (define-key map (kbd "M-'") (kbd ""))  ;; a umlaut with superscript e
    (define-key map (kbd "M-;") (kbd ""))  ;; a umlaut with superscript e
    (define-key map (kbd "M-[") (kbd ""))  ;; a umlaut with superscript e
    (define-key map (kbd "M-u") (kbd "ů"))  ;; u with superscript o
    (define-key map (kbd "M--") (kbd "ß"))  ;; sharp s, sz ligature

    map)

    ;; turn on abbrev mode globally
    (setq-default abbrev-mode t)

    (setq-default auto-fill-function 'do-auto-fill)

    (visual-line-mode t)
    (setq-default word-wrap t)
)

(defun transcription-font-variable ()
        (interactive)
        (setq buffer-face-mode-face '(:family "Andron Scriptor Web" :height 100))
        (buffer-face-mode)
)

(add-hook 'transcribe-hook 'transcription-font-variable)

(add-hook 'text-mode-hook 'transcribe-mode)

(provide 'transcribe-mode)

Everything works fine except the font change, and no errors or warnings are being displayed. The font is installed, setting it globally works. I'm using Emacs 24.

2

The hook is called transcribe-mode-hook, not transcribe-hook.

To see what the define-minor-mode macro actually does, place point after the last closing paren and call pp-macro-expand-last-sexp. Reading through the results you'll see the name of the hook. This is also documented in the manual.

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.