Uso - ative ou desative localmente com: M-x smilingbuddha-mode
Para ativar smilingbuddha-mode
globalmente , descomente (global-smilingbuddha-mode)
e reinicie; ou digite M-x global-smilingbuddha-mode
(que permanecerá em vigor até você reiniciar).
Por favor, sinta-se livre para modificar o regexp para atender às suas necessidades pessoais.
(define-minor-mode smilingbuddha-mode
"Minor mode for highlighting numbers."
:group 'smilingbuddha
:lighter " :)"
(cond
(smilingbuddha-mode
(when (not (or font-lock-mode global-font-lock-mode))
(font-lock-mode 1))
(font-lock-add-keywords nil
(list (list "\([0-9]+\)" '(0 'smilingbuddha-pink-face t)) ))
(message "Turned ON 'smilingbuddha-mode'."))
((not smilingbuddha-mode)
(font-lock-remove-keywords nil
(list (list "\([0-9]+\)" '(0 'smilingbuddha-pink-face t)) ))
(font-lock-fontify-buffer)
(message "Turned OFF 'smilingbuddha-mode'."))))
(defgroup smilingbuddha nil
"Highlight numbers."
:version "0.1"
:group 'smilingbuddha)
(defface smilingbuddha-pink-face
'((t (:foreground "black" :background "pink")))
"Face for 'smilingbuddha-pink-face'."
:group 'smilingbuddha)
(defun turn-on-smilingbuddha-mode ()
(interactive)
(smilingbuddha-mode 1))
(defun turn-off-smilingbuddha-mode ()
(interactive)
(smilingbuddha-mode -1))
(define-globalized-minor-mode global-smilingbuddha-mode
smilingbuddha-mode turn-on-smilingbuddha-mode)
;; (global-smilingbuddha-mode)