highlight-parentheses.el 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. (require 'highlight-parentheses)
  2. (add-hook 'emacs-lisp-mode-hook 'highlight-parentheses-mode)
  3. ; Use naquadah colors
  4. (setq hl-paren-colors
  5. (list
  6. (naquadah-get-colors 'gradient-1)
  7. (naquadah-get-colors 'gradient-2)
  8. (naquadah-get-colors 'gradient-3)
  9. (naquadah-get-colors 'gradient-4)
  10. (naquadah-get-colors 'gradient-5)
  11. (naquadah-get-colors 'gradient-6)
  12. (naquadah-get-colors 'gradient-7)
  13. (naquadah-get-colors 'gradient-8)
  14. (naquadah-get-colors 'gradient-9)
  15. (naquadah-get-colors 'gradient-10)
  16. (naquadah-get-colors 'gradient-11)
  17. ))
  18. ;(add-hook 'highlight-parentheses-mode-hook
  19. ; '(lambda ()
  20. ; (setq autopair-handle-action-fns
  21. ; (append
  22. ; (if autopair-handle-action-fns
  23. ; autopair-handle-action-fns
  24. ; '(autopair-default-handle-action))
  25. ; '((lambda (action pair pos-before)
  26. ; (hl-paren-color-update)))))))
  27. (define-globalized-minor-mode global-highlight-parentheses-mode
  28. highlight-parentheses-mode
  29. (lambda ()
  30. (highlight-parentheses-mode t)))
  31. (global-highlight-parentheses-mode t)
  32. ;; show-paren-mode
  33. (setq show-paren-delay 0)
  34. (setq blink-matching-paren t)
  35. (setq show-paren-style 'mixed)
  36. ;(setq electric-pair-mode 1)
  37. (set-face-background 'show-paren-match "cyan")
  38. (set-face-foreground 'show-paren-match "#000000")
  39. (defadvice show-paren-function
  40. (after show-matching-paren-offscreen activate)
  41. "If the matching paren is offscreen, show the matching line in the
  42. echo area. Has no effect if the character before point is not of
  43. the syntax class ')'."
  44. (interactive)
  45. (let* ((cb (char-before (point)))
  46. (matching-text (and cb
  47. (char-equal (char-syntax cb) ?\) )
  48. (blink-matching-open))))
  49. (when matching-text (message matching-text))))