Allow dots plus header mode
Removed origami-fold-display-mode; instead display is controlled via new customs origami-show-fold-header and origami-fold-replacement. Replacement text can be customized, or set to “” to effectively disable.
This commit is contained in:
parent
47b4e2830e
commit
d372bd1af1
44
origami.el
44
origami.el
@ -39,26 +39,32 @@
|
|||||||
|
|
||||||
;;; fold display mode and faces
|
;;; fold display mode and faces
|
||||||
|
|
||||||
(defcustom origami-fold-display-mode 'dots
|
(defcustom origami-fold-replacement "..."
|
||||||
"Display mode for folded areas.
|
"Show this string instead of the folded text."
|
||||||
By default, a traditional \"...\" format is used. A highlighted
|
:type 'string
|
||||||
header is also available."
|
|
||||||
:tag "Display mode for folds"
|
|
||||||
:type '(choice (const :tag "Three dots" dots)
|
|
||||||
(const :tag "Highlighted header" header))
|
|
||||||
:group 'origami)
|
:group 'origami)
|
||||||
|
|
||||||
(defface origami-fold-header
|
(defcustom origami-show-fold-header t
|
||||||
|
"Highlight the line the fold start on."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'origami)
|
||||||
|
|
||||||
|
(defface origami-fold-header-face
|
||||||
'((t (:box (:line-width 1 :color "#050")
|
'((t (:box (:line-width 1 :color "#050")
|
||||||
:background "#001500")))
|
:background "#001500")))
|
||||||
"Face used to display fold headers.")
|
"Face used to display fold headers.")
|
||||||
|
|
||||||
(defface origami-fold-fringe
|
(defface origami-fold-fringe-face
|
||||||
'((t (:inherit highlight)))
|
'((t ()))
|
||||||
"Face used to display fringe contents.")
|
"Face used to display fringe contents.")
|
||||||
|
|
||||||
(defgroup origami '((origami-fold-header custom-face)
|
(defface origami-fold-replacement-face
|
||||||
(origami-fold-fringe custom-face))
|
'((t :foreground "#555"))
|
||||||
|
"Face used to display the fold replacement text.")
|
||||||
|
|
||||||
|
(defgroup origami '((origami-fold-header-face custom-face)
|
||||||
|
(origami-fold-fringe-face custom-face)
|
||||||
|
(origami-fold-replacement-face custom-face))
|
||||||
"Origami: A text folding minor mode for Emacs, by Greg Sexton.")
|
"Origami: A text folding minor mode for Emacs, by Greg Sexton.")
|
||||||
|
|
||||||
;;; overlay manipulation
|
;;; overlay manipulation
|
||||||
@ -98,12 +104,10 @@ header is also available."
|
|||||||
(defun origami-hide-overlay (ov)
|
(defun origami-hide-overlay (ov)
|
||||||
;; TODO: make more of this customizable
|
;; TODO: make more of this customizable
|
||||||
(overlay-put ov 'invisible 'origami)
|
(overlay-put ov 'invisible 'origami)
|
||||||
(case origami-fold-display-mode
|
(overlay-put ov 'display origami-fold-replacement)
|
||||||
('dots
|
(overlay-put ov 'face 'origami-fold-replacement-face)
|
||||||
(overlay-put ov 'display "...")
|
(if origami-show-fold-header
|
||||||
(overlay-put ov 'face 'font-lock-comment-delimiter-face))
|
(origami-activate-header (overlay-get ov 'header-ov))))
|
||||||
('header
|
|
||||||
(origami-activate-header (overlay-get ov 'header-ov)))))
|
|
||||||
|
|
||||||
(defun origami-show-overlay (ov)
|
(defun origami-show-overlay (ov)
|
||||||
(overlay-put ov 'invisible nil)
|
(overlay-put ov 'invisible nil)
|
||||||
@ -121,12 +125,12 @@ header is also available."
|
|||||||
|
|
||||||
(defun origami-activate-header (ov)
|
(defun origami-activate-header (ov)
|
||||||
(overlay-put ov 'origami-header-active t)
|
(overlay-put ov 'origami-header-active t)
|
||||||
(overlay-put ov 'face 'origami-fold-header)
|
(overlay-put ov 'face 'origami-fold-header-face)
|
||||||
(overlay-put ov 'before-string
|
(overlay-put ov 'before-string
|
||||||
(propertize
|
(propertize
|
||||||
"…"
|
"…"
|
||||||
'display
|
'display
|
||||||
'(left-fringe empty-line origami-fold-fringe))))
|
'(left-fringe empty-line origami-fold-fringe-face))))
|
||||||
|
|
||||||
(defun origami-deactivate-header (ov)
|
(defun origami-deactivate-header (ov)
|
||||||
(overlay-put ov 'origami-header-active nil)
|
(overlay-put ov 'origami-header-active nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user