emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/modus-operandi-theme e32ca7d 37/99: Refine Org block be


From: Stefan Monnier
Subject: [elpa] externals/modus-operandi-theme e32ca7d 37/99: Refine Org block beg/end line conditional styles
Date: Fri, 31 Jul 2020 09:25:21 -0400 (EDT)

branch: externals/modus-operandi-theme
commit e32ca7d2dfe00db58600553c1b0455efa014b1cf
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Refine Org block beg/end line conditional styles
    
    Now the ':extend t' attribute is introduced when either the "distinct
    blocks" or "rainbow src blocks" are enabled.
---
 modus-operandi-theme.el | 36 +++++++++++++++++++++++++-----------
 modus-vivendi-theme.el  | 36 +++++++++++++++++++++++++-----------
 2 files changed, 50 insertions(+), 22 deletions(-)

diff --git a/modus-operandi-theme.el b/modus-operandi-theme.el
index c722890..0c92e97 100644
--- a/modus-operandi-theme.el
+++ b/modus-operandi-theme.el
@@ -544,14 +544,28 @@ and the border.  FG is used when no block style is in 
effect."
       (list :background bgbox :foreground fgbox :box (list :color fgbox))
     (list :foreground fg)))
 
-(defun modus-operandi-theme-org-src-block (bgsrc bg)
-  "Conditionally set the styles of Org source blocks.
-BGSRC applies to a distinct background.  BG is used to keep
-blocks the same background as the rest of the buffer."
+(defun modus-operandi-theme-org-block (bgblk bg)
+  "Conditionally set the background of Org blocks.
+BGBLK applies to a distinct neutral background.  BG is used to
+keep blocks the same background as the rest of the buffer."
   (if modus-operandi-theme-distinct-org-blocks
-      (list :background bgsrc :extend t)
+      (append
+       (and (>= emacs-major-version 27) '(:extend t))
+       (list :background bgblk))
     (list :background bg)))
 
+(defun modus-operandi-theme-org-block-delim (bgext fgext bg fg)
+  "Conditionally set the styles of Org block delimiters.
+BGEXT and FGEXT apply a background and foreground colour
+respectively and set the `:extend' attribute where applicable.
+BG and FG should be a largely neutral colour combination."
+  (if (or modus-operandi-theme-distinct-org-blocks
+          modus-operandi-theme-rainbow-org-src-blocks)
+      (append
+       (and (>= emacs-major-version 27) '(:extend t))
+       (list :background bgext :foreground fgext))
+    (list :background bg :foreground fg)))
+
 (defun modus-operandi-theme-modeline-box (col3d col &optional btn int)
   "Control the box properties of the mode line.
 COL3D is the border that is intended for the three-dimensional
@@ -2799,12 +2813,12 @@ Also bind `class' to ((class color) (min-colors 89))."
                                    :foreground ,fg-special-mild
                                    ,@(modus-operandi-theme-scale 
modus-operandi-theme-scale-3))))
    `(org-archived ((,class :background ,bg-alt :foreground ,fg-alt)))
-   `(org-block ((,class ,@(modus-operandi-theme-org-src-block bg-dim bg-main)
+   `(org-block ((,class ,@(modus-operandi-theme-org-block bg-dim bg-main)
                         :inherit fixed-pitch :foreground ,fg-main)))
-   `(org-block-begin-line ((,class ,@(and (>= emacs-major-version 27)
-                                          
modus-operandi-theme-distinct-org-blocks
-                                          '(:extend t))
-                                   :inherit fixed-pitch :background ,bg-alt 
:foreground ,fg-special-mild)))
+   `(org-block-begin-line ((,class ,@(modus-operandi-theme-org-block-delim
+                                      bg-active fg-special-cold
+                                      bg-alt fg-special-mild)
+                                   :inherit fixed-pitch)))
    `(org-block-end-line ((,class :inherit org-block-begin-line)))
    `(org-checkbox ((,class :box (:line-width 1 :color ,bg-active)
                            :background ,bg-inactive :foreground ,fg-active)))
@@ -2880,7 +2894,7 @@ Also bind `class' to ((class color) (min-colors 89))."
    `(org-mode-line-clock-overrun ((,class :inherit modus-theme-active-red)))
    `(org-priority ((,class ,@(modus-operandi-theme-org-todo-block 
magenta-nuanced-bg magenta-nuanced magenta)
                            ,@(modus-operandi-theme-heading-foreground magenta 
magenta-alt-other))))
-   `(org-quote ((,class ,@(modus-operandi-theme-org-src-block bg-dim bg-main)
+   `(org-quote ((,class ,@(modus-operandi-theme-org-block bg-dim bg-main)
                         :foreground ,fg-special-cold :slant 
,modus-theme-slant)))
    `(org-scheduled ((,class :foreground ,fg-special-cold)))
    `(org-scheduled-previously ((,class :foreground ,fg-special-warm)))
diff --git a/modus-vivendi-theme.el b/modus-vivendi-theme.el
index 88caf8d..cb90582 100644
--- a/modus-vivendi-theme.el
+++ b/modus-vivendi-theme.el
@@ -544,14 +544,28 @@ and the border.  FG is used when no block style is in 
effect."
       (list :background bgbox :foreground fgbox :box (list :color fgbox))
     (list :foreground fg)))
 
-(defun modus-vivendi-theme-org-src-block (bgsrc bg)
-  "Conditionally set the styles of Org source blocks.
-BGSRC applies to a distinct background.  BG is used to keep
-blocks the same background as the rest of the buffer."
+(defun modus-vivendi-theme-org-block (bgblk bg)
+  "Conditionally set the background of Org blocks.
+BGBLK applies to a distinct neutral background.  BG is used to
+keep blocks the same background as the rest of the buffer."
   (if modus-vivendi-theme-distinct-org-blocks
-      (list :background bgsrc :extend t)
+      (append
+       (and (>= emacs-major-version 27) '(:extend t))
+       (list :background bgblk))
     (list :background bg)))
 
+(defun modus-vivendi-theme-org-block-delim (bgext fgext bg fg)
+  "Conditionally set the styles of Org block delimiters.
+BGEXT and FGEXT apply a background and foreground colour
+respectively and set the `:extend' attribute where applicable.
+BG and FG should be a largely neutral colour combination."
+  (if (or modus-vivendi-theme-distinct-org-blocks
+          modus-vivendi-theme-rainbow-org-src-blocks)
+      (append
+       (and (>= emacs-major-version 27) '(:extend t))
+       (list :background bgext :foreground fgext))
+    (list :background bg :foreground fg)))
+
 (defun modus-vivendi-theme-modeline-box (col3d col &optional btn int)
   "Control the box properties of the mode line.
 COL3D is the border that is intended for the three-dimensional
@@ -2799,12 +2813,12 @@ Also bind `class' to ((class color) (min-colors 89))."
                                    :foreground ,fg-special-mild
                                    ,@(modus-vivendi-theme-scale 
modus-vivendi-theme-scale-3))))
    `(org-archived ((,class :background ,bg-alt :foreground ,fg-alt)))
-   `(org-block ((,class ,@(modus-vivendi-theme-org-src-block bg-dim bg-main)
+   `(org-block ((,class ,@(modus-vivendi-theme-org-block bg-dim bg-main)
                         :inherit fixed-pitch :foreground ,fg-main)))
-   `(org-block-begin-line ((,class ,@(and (>= emacs-major-version 27)
-                                          
modus-vivendi-theme-distinct-org-blocks
-                                          '(:extend t))
-                                   :inherit fixed-pitch :background ,bg-alt 
:foreground ,fg-special-mild)))
+   `(org-block-begin-line ((,class ,@(modus-vivendi-theme-org-block-delim
+                                      bg-active fg-special-cold
+                                      bg-alt fg-special-mild)
+                                   :inherit fixed-pitch)))
    `(org-block-end-line ((,class :inherit org-block-begin-line)))
    `(org-checkbox ((,class :box (:line-width 1 :color ,bg-active)
                            :background ,bg-inactive :foreground ,fg-active)))
@@ -2880,7 +2894,7 @@ Also bind `class' to ((class color) (min-colors 89))."
    `(org-mode-line-clock-overrun ((,class :inherit modus-theme-active-red)))
    `(org-priority ((,class ,@(modus-vivendi-theme-org-todo-block 
magenta-nuanced-bg magenta-nuanced magenta)
                            ,@(modus-vivendi-theme-heading-foreground magenta 
magenta-alt-other))))
-   `(org-quote ((,class ,@(modus-vivendi-theme-org-src-block bg-dim bg-main)
+   `(org-quote ((,class ,@(modus-vivendi-theme-org-block bg-dim bg-main)
                         :foreground ,fg-special-cold :slant 
,modus-theme-slant)))
    `(org-scheduled ((,class :foreground ,fg-special-cold)))
    `(org-scheduled-previously ((,class :foreground ,fg-special-warm)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]