Advertisement
Guest User

Untitled

a guest
Aug 1st, 2012
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. Emacs hl-line: change color locally
  2. (add-hook 'gnus-summary-mode-hook 'gnus-hl-line)
  3. (add-hook 'gnus-group-mode-hook 'gnus-hl-line)
  4.  
  5. (defun gnus-hl-line ()
  6. (hl-line-mode 1)
  7. (set (make-local-variable 'line-move-visual) nil)
  8. (setq cursor-type nil))
  9.  
  10. ;; From emacs-wiki:
  11. (defun shade-color (intensity)
  12. "print the #rgb color of the background, dimmed according to intensity"
  13. (interactive "nIntensity of the shade : ")
  14. (apply 'format "#%02x%02x%02x"
  15. (mapcar (lambda (x)
  16. (if (> (lsh x -8) intensity)
  17. (- (lsh x -8) intensity)
  18. 0))
  19. (color-values (cdr (assoc 'background-color (frame-parameters)))))))
  20.  
  21. ;; Default hl
  22. (global-hl-line-mode t)
  23. (make-variable-buffer-local 'global-hl-line-mode)
  24. (set-face-background hl-line-face (shade-color 08))
  25.  
  26. (defface hl-line-highlight-face
  27. '((t :inherit highlight))
  28. "Face for highlighting the current line with `hl-line-fancy-highlight'."
  29. :group 'hl-line)
  30.  
  31. (defun hl-line-fancy-highlight ()
  32. (set (make-local-variable 'hl-line-face) 'hl-line-highlight-face)
  33. ;; (set (make-local-variable 'line-move-visual) nil)
  34. ;; (set (make-local-variable 'cursor-type) nil)
  35. (setq global-hl-line-mode nil)
  36. (hl-line-mode))
  37.  
  38. (add-hook 'org-agenda-mode-hook 'hl-line-fancy-highlight)
  39. (add-hook 'gnus-summary-mode-hook 'hl-line-fancy-highlight)
  40. (add-hook 'gnus-group-mode-hook 'hl-line-fancy-highlight)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement