Hello OP, It seems you don't mind digging in to elisp code. 1. Put the following snippet (see below) in to your .emacs. 2. Restart emacs 3. C-x C-f somefile.txt 4. M-x add-file-local-variable RET hi-lock-patterns-file RET "somefile.patterns" 5. C-x C-v 6. Highlight some strings here and there 7. Make some modifications to the file 8. C-x C-s Now, 1. C-x C-f somefile.txt. 2. You should see the highlights. When you highlight some text, the buffer is considered as *not* modified. So after-save-hook will not be called if there are no actual modifications in the current session. In that case, you can force a write of the patterns file with M-x hi-lock-file-save-patterns See the attached sample files for what I mean. ---------------------------------------------------------------- (add-hook 'find-file-hook 'hi-lock-find-file-hook) (add-hook 'after-save-hook 'hi-lock-file-save-patterns) (defun hi-lock-find-file-hook () (when (and (boundp 'hi-lock-patterns-file) (file-readable-p hi-lock-patterns-file)) (let ((patterns (with-current-buffer (find-file-noselect hi-lock-patterns-file) (goto-char (point-min)) (prog1 (ignore-errors (read (current-buffer))) (kill-buffer))))) (setq hi-lock-interactive-patterns patterns) (font-lock-add-keywords nil hi-lock-interactive-patterns t)))) (defun hi-lock-file-save-patterns () (interactive) (when (boundp 'hi-lock-patterns-file) (let ((patterns (append hi-lock-file-patterns hi-lock-interactive-patterns))) (with-current-buffer (find-file-noselect hi-lock-patterns-file) (erase-buffer) (insert (pp-to-string patterns)) (save-buffer 0))))) ----------------------------------------------------------------