Skip to content

Instantly share code, notes, and snippets.

@Nyoho
Last active April 7, 2025 14:38
Show Gist options
  • Save Nyoho/365c729c4eb4c5dc684b274e8d28b18e to your computer and use it in GitHub Desktop.
Save Nyoho/365c729c4eb4c5dc684b274e8d28b18e to your computer and use it in GitHub Desktop.
org-modernを改造しようとしていた途中の残骸
(leaf org-modern
...
:custom-face
;; (org-modern-date-active . '((t (:background "#373844" :foreground "#f8f8f2" :height 0.75 :weight light :width condensed))))
;; (org-modern-time-active . '((t (:background "#44475a" :foreground "#f8f8f2" :height 0.75 :weight light :width condensed))))
;; (org-modern-date-inactive . '((t (:background "#373844" :foreground "#b0b8d1" :height 0.75 :weight light :width condensed))))
;; (org-modern-time-inactive . '((t (:background "#44475a" :foreground "#b0b8d1" :height 0.75 :weight light :width condensed))))
;; (org-modern-tag . '((t (:background "#44475a" :foreground "#b0b8d1" :height 0.75 :weight light :width condensed))))
;; (org-modern-statistics . '((t (:foreground "#6272a4" :weight light :width condensed))))
:config
(global-org-modern-mode)
(define-fringe-bitmap 'org-modern--block-begin (vconcat (make-vector 7 0) [#x0F #x10] (make-vector 7 #x20)) nil nil 'top)
(define-fringe-bitmap 'org-modern--block-end (vconcat (make-vector 7 #x20) [#x10 #x0F] (make-vector 7 0)) nil nil 'bottom)
(define-fringe-bitmap 'org-modern--block-inner (make-vector 1 #x10) nil nil '(top t))
(define-fringe-bitmap 'org-modern--block-begin (vconcat (make-vector 7 0) [#x1F] (make-vector 8 #x10)) nil nil 'top)
(define-fringe-bitmap 'org-modern--block-end (vconcat (make-vector 8 #x10) [#x1F] (make-vector 7 0)) nil nil 'bottom)
;; このへんを2022/3/5以降にcommit
(defun my-org-modern--block-fringe ()
"Prettify blocks with fringe bitmaps."
(save-excursion
(goto-char (match-beginning 0))
(overlay-put
;; (make-overlay (point) (min (1+ (line-end-position)) (point-max)))
(make-overlay (point) (point))
'before-string (propertize
"x" 'display
`(left-fringe org-modern--block-begin org-block-begin-line)))
(forward-line)
(while
(cond
((eobp) nil)
((save-excursion
(let ((case-fold-search t))
(re-search-forward
"^[ \t]*#\\+end_" (line-end-position) 'noerror)))
(overlay-put
(make-overlay (point) (min (1+ (line-end-position)) (point-max)))
'before-string (propertize
"x" 'display
`(left-fringe org-modern--block-end org-block-begin-line)))
nil)
(t
(overlay-put
(make-overlay (point) (point))
'before-string (propertize
"x" 'display
`(left-fringe org-modern--block-inner org-block-begin-line)))
(forward-line)
;; O: wrapped line 対策に、forward-line の代わりに line-move-visual 1 を使いたいがうまくいかない
;; (line-move-visual 1 t)
t)))))
:advice
(:override org-modern--block-fringe my-org-modern--block-fringe)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment