I want to be able to use typopunct minor mode globally.

I have tried to add (global-typopunct-mode 1) to my init file, like so

;; Typopunct mode
(require 'typopunct)
(typopunct-change-language 'english t)
(global-typopunct-mode 1)

but I get this error: Symbol's function definition is void: global-typopunct-mode. Then I thought that the problem could be something similar to this post, but I have package-initalize on my init.el file (as shown below)

;; MELPA controls
(when (>= emacs-major-version 24)  
  (require 'package)
  (setq package-enable-at-startup nil)
  ;; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/")) 
  (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) ;; install it manually
  ;;(add-to-list 'package-archives '("ox-odt" . "https://kjambunathan.github.io/elpa/"))

which makes me believe that typopunct was not meant to be activated globally... Thanks in advance for any help.

  • 3
    You might want to try making this minor mode global yourself. Take a look at docstrings for define-globalized-minor-mode and define-global-minor-mode.
    – user12563
    Jun 18, 2019 at 18:37
  • Are you sure you really want it to be "global" though? This might cause annoying results with various programming languages. :) Jun 18, 2019 at 20:21

1 Answer 1


I think I got it. Note: I am a newbie to elisp so any comments/corrections are most welcome. Just add the following line to the typopunct.el file after the define-minor-mode typopunct-mode

(define-globalized-minor-mode global-typopunct-mode typopunct-mode (lambda () (typopunct-mode 1)))

From the documentation I should also define a non-globalized version, so that people can use (or disable) it in individual buffers, but that is beyond me at this point :-). If anyone wants to add it please go ahead!


As suggested by Tobias this more selective version avoids messing up with programming modes.

(define-globalized-minor-mode global-typopunct-mode typopunct-mode (lambda () (when (null (derived-mode-p 'prog-mode)) (typopunct-mode))))
  • 1
    You've already got a non-globalized version: typopunct-mode. To disable it, you would do (add-hook 'c-mode #'(lambda () (typopunct-mode -1))) (e.g., to disable it for C files). Jun 18, 2019 at 20:20
  • 1
    One could be a bit more selective, e.g.: (lambda () (when (null (derived-mode-p 'prog-mode)) (typopunct-mode))).
    – Tobias
    Jun 18, 2019 at 22:03

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.