(require 'cl-lib) (defun hl-thingatpt--symbol-regexp (&rest them) "せっかく (bounds-of-thing-at-point 'symbol) してるんだから \\_<〜\\_>で囲もうぜ?" (if (use-region-p) (apply them) (cl-destructuring-bind (regexp &rest rest) (apply them) `(,(format "\\_<%s\\_>" regexp) ,@rest)))) (advice-add 'hl-thingatpt :around 'hl-thingatpt--symbol-regexp) (defun hl-add-highlight-overlays--fix-end-of-buffer (&rest them) "end of bufferのエラーがうざいので消す" (condition-case _ (apply them) (end-of-buffer nil))) (advice-add 'hl-add-highlight-overlays :around 'hl-add-highlight-overlays--fix-end-of-buffer) ;;; regionを指定したときに解除されないのを修正 (advice-add 'hl-highlight-thingatpt-local :after 'deactivate-mark) (advice-add 'hl-highlight-thingatpt-global :after 'deactivate-mark) ;;; ハイライト情報を保存・復元 (add-hook 'find-file-hook 'hl-restore-highlights) (add-hook 'kill-emacs-hook 'hl-save-highlights)