Last active
November 30, 2022 07:59
-
-
Save gongzhitaao/8030400 to your computer and use it in GitHub Desktop.
hideshow config for emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defface collapsed-face '((t (:background "#e0cf9f" :foreground "#5f5f5f"))) "Collapsed Overlay") | |
(defvar collapsed-face 'collapsed-face) | |
(define-fringe-bitmap 'hs-marker [0 24 24 126 126 24 24 0]) | |
(defun display-code-line-counts (ov) | |
(when (eq 'code (overlay-get ov 'hs)) | |
(let* ((marker-string "*fringe-dummy*") | |
(marker-length (length marker-string)) | |
(display-string | |
(format " (%d)... " | |
(count-lines (overlay-start ov) (overlay-end ov))))) | |
(overlay-put ov 'help-echo "C-` to toggle") | |
(put-text-property 0 marker-length 'display | |
(list 'left-fringe 'hs-marker 'fringe-face) | |
marker-string) | |
(overlay-put ov 'before-string marker-string) | |
(put-text-property 1 (1- (length display-string)) | |
'face 'collapsed-face display-string) | |
(overlay-put ov 'display display-string)))) | |
(setq hs-set-up-overlay 'display-code-line-counts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment