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

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

[elpa] externals/modus-vivendi-theme b5dba7a 081/110: Internal: use defu


From: Stefan Monnier
Subject: [elpa] externals/modus-vivendi-theme b5dba7a 081/110: Internal: use defun for conditional Org src blocks
Date: Wed, 29 Apr 2020 21:40:12 -0400 (EDT)

branch: externals/modus-vivendi-theme
commit b5dba7a832e60d55f4bc68ab3b0e1abf45f211b5
Author: Protesilaos Stavrou <address@hidden>
Commit: Protesilaos Stavrou <address@hidden>

    Internal: use defun for conditional Org src blocks
    
    Just to make things a bit more abstract.  In the future this function
    may be generalised further to accept more parameters (will depend on the
    needs of the project).
---
 modus-operandi-theme.el | 12 +++++++++---
 modus-vivendi-theme.el  | 12 +++++++++---
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/modus-operandi-theme.el b/modus-operandi-theme.el
index 55450b8..8d48aa0 100644
--- a/modus-operandi-theme.el
+++ b/modus-operandi-theme.el
@@ -445,6 +445,14 @@ 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."
+  (if modus-operandi-theme-distinct-org-blocks
+      (list :background bgsrc :extend t)
+    (list :background bg)))
+
 (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 modeline.
@@ -2388,9 +2396,7 @@ AMOUNT is a customisation option."
                                              :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 (,@(and (>= emacs-major-version 27) '(:extend t))
-                         :background ,(if 
modus-operandi-theme-distinct-org-blocks bg-dim bg-main)
-                         :foreground ,fg-main))))
+   `(org-block ((,class (,@(modus-operandi-theme-org-src-block bg-dim bg-main) 
:foreground ,fg-main))))
    `(org-block-begin-line ((,class (,@(and (>= emacs-major-version 27)
                                            
modus-operandi-theme-distinct-org-blocks
                                            '(:extend t))
diff --git a/modus-vivendi-theme.el b/modus-vivendi-theme.el
index 720f3ae..e308e81 100644
--- a/modus-vivendi-theme.el
+++ b/modus-vivendi-theme.el
@@ -445,6 +445,14 @@ 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."
+  (if modus-vivendi-theme-distinct-org-blocks
+      (list :background bgsrc :extend t)
+    (list :background bg)))
+
 (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 modeline.
@@ -2388,9 +2396,7 @@ AMOUNT is a customisation option."
                                              :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 (,@(and (>= emacs-major-version 27) '(:extend t))
-                         :background ,(if 
modus-vivendi-theme-distinct-org-blocks bg-dim bg-main)
-                         :foreground ,fg-main))))
+   `(org-block ((,class (,@(modus-vivendi-theme-org-src-block bg-dim bg-main) 
:foreground ,fg-main))))
    `(org-block-begin-line ((,class (,@(and (>= emacs-major-version 27)
                                            
modus-vivendi-theme-distinct-org-blocks
                                            '(:extend t))



reply via email to

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