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

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

[elpa] externals/nano-modeline 93c78fd956 12/26: Renamed faces to name/p


From: ELPA Syncer
Subject: [elpa] externals/nano-modeline 93c78fd956 12/26: Renamed faces to name/primary/secondary
Date: Fri, 2 Jun 2023 03:59:07 -0400 (EDT)

branch: externals/nano-modeline
commit 93c78fd9567c0ccd90f994033a2891cb419f0d46
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>

    Renamed faces to name/primary/secondary
---
 README.md        | 15 +++++++-----
 nano-modeline.el | 69 +++++++++++++++++++++++++++++---------------------------
 2 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/README.md b/README.md
index 04b6daae79..71c9adae8a 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,16 @@
 ## N Λ N O Modeline
 
 Nano modeline is a an alterntive to the GNU/Emacs modeline. It can be
-displayed at the bottom (mode-line) or at the top (header-line)
-depending on nano-modeline-position custom setting. There are several
-modelines that can be installed on a per-mode basis or be made the
-default one. Currently, only the prog and text mode are generic enough
-to be made the default.
+displayed at the bottom (mode-line) or at the top (header-line). It is
+roughly organized as:
 
-You can also design your own modeline using the various elements composing a 
modeline. See sources for several example.
+`[ status | name (primary)                               secondary ]`
+
+There are several modelines that can be installed on a per-mode basis
+or be made the default one. Currently, only the prog and text mode are
+generic enough to be made the default. You can also design your own
+modeline using the various elements composing a modeline. See sources
+for several example.
 
 ### Installation
 
diff --git a/nano-modeline.el b/nano-modeline.el
index 11e9511b93..6d6f5c525e 100644
--- a/nano-modeline.el
+++ b/nano-modeline.el
@@ -142,8 +142,9 @@
     (status-RO-active   . (nano-modeline-status))
     (status-**-active   . (nano-modeline-status
                            ,(when (facep 'nano-popout-i) 'nano-popout-i)))
-    (bold-active        . (bold))
-    (faded-active       . (,(when (facep 'nano-faded) 'nano-faded))))
+    (name-active        . (bold))
+    (primary-active     . ())
+    (secondary-active   . (,(when (facep 'nano-faded) 'nano-faded))))
   "Nano line faces.
 
 Each face defined here is used by the modeline depending on the current state 
(active / inactive). It is ok to define a face for a single state. In such 
case, the alternative state will use defaults."
@@ -250,10 +251,10 @@ made DEFAULT."
   "Buffer name"
   
   (propertize
-   (cond (name                name)
+   (cond (name name)
          ((buffer-narrowed-p) (format"%s [narrow]" (buffer-name)))
-         (t                   (buffer-name)))
-   'face (nano-modeline-face 'bold)))
+         (t (buffer-name)))
+   'face (nano-modeline-face 'name)))
 
 (defun nano-modeline-buffer-status (&optional status padding)
   "Generic prefix to indicate buffer STATUS with vertical PADDING (top . 
bottom)"
@@ -279,7 +280,7 @@ made DEFAULT."
             (file-size (file-attribute-size file-attributes))
             (file-size (file-size-human-readable file-size)))
       (propertize (format "(%s)" file-size)
-                  'face (nano-modeline-face))
+                  'face (nano-modeline-face 'primary))
     ""))
 
 (defun nano-modeline-cursor-position (&optional format)
@@ -287,7 +288,7 @@ made DEFAULT."
 
   (let ((format (or format "%l:%c ")))
     (propertize (format-mode-line format)
-                'face (nano-modeline-face 'faded))))
+                'face (nano-modeline-face 'secondary))))
 
 (defun nano-modeline-buffer-line-count ()
   "Buffer total number of lines"
@@ -296,29 +297,29 @@ made DEFAULT."
     (goto-char (point-max))
     (propertize     
      (format-mode-line "(%l lines)")
-     'face (nano-modeline-face))))
+     'face (nano-modeline-face 'primary))))
 
 (defun nano-modeline-window-dedicated (&optional symbol)
   "Pin symbol when window is dedicated"
   
   (propertize (if (window-dedicated-p) (or symbol " ") "")
-              'face (nano-modeline-face)))
+              'face (nano-modeline-face 'secondary)))
 
 (defun nano-modeline-git-info (&optional symbol)
   "Git information as (branch, file status)"
   
-  (if vc-mode
+  (when vc-mode
       (when-let* ((file (buffer-file-name))
                   (branch (substring-no-properties vc-mode 5))
                   (state (vc-state file)))
         (propertize (format "(%s%s, %s)" (or symbol " ") branch state)
-                    'face (nano-modeline-face)))
-    (propertize "" 'face (nano-modeline-face))))
+                    'face (nano-modeline-face 'primary)))))
+
 
 (defun nano-modeline-mu4e-search-filter ()
   "Mu4e current search"
   
-  (propertize (mu4e-last-query) 'face (nano-modeline-face 'bold)))
+  (propertize (mu4e-last-query) 'face (nano-modeline-face 'name)))
 
 (defun nano-modeline-mu4e-context ()
   "Mu4e current context"
@@ -326,21 +327,23 @@ made DEFAULT."
   (let* ((context (mu4e-context-current))
          (name (if context (mu4e-context-name context) "none")))
     (propertize (format "[%s] " name)
-                'face (nano-modeline-face))))
+                'face (nano-modeline-face 'secondary))))
 
 (defun nano-modeline-mu4e-message-subject ()
   "Mu4e message subject"
   
   (let* ((msg (mu4e-message-at-point))
          (subject (mu4e-message-field msg :subject)))
-    (propertize (format "%s" subject)  'face (nano-modeline-face 'bold))))
+    (propertize (format "%s" subject)
+                'face (nano-modeline-face 'name))))
 
 (defun nano-modeline-mu4e-message-date ()
   "Mu4e message date"
   
   (let* ((msg (mu4e-message-at-point))
          (date (mu4e-message-field msg :date)))
-    (propertize (format-time-string " %d/%m " date) 'face 
(nano-modeline-face))))
+    (propertize (format-time-string " %d/%m " date)
+                'face (nano-modeline-face 'secondary))))
  
 (defun nano-modeline-pdf-page ()
   "PDF view mode page number / page total"
@@ -348,20 +351,20 @@ made DEFAULT."
   (let ((page-current (image-mode-window-get 'page))
         (page-total (pdf-cache-number-of-pages)))
     (propertize (format "%d/%d " page-current page-total)
-                'face (nano-modeline-face))))
+                'face (nano-modeline-face 'secondary))))
 
 (defun nano-modeline-elfeed-entry-status ()
   "Elfeed entry status"
   
-  (let* ((feed         (elfeed-entry-feed elfeed-show-entry))
-         (feed-title   (plist-get (elfeed-feed-meta feed) :title)))
+  (let* ((feed (elfeed-entry-feed elfeed-show-entry))
+         (feed-title (plist-get (elfeed-feed-meta feed) :title)))
     (nano-modeline-buffer-status feed-title)))
 
 (defun nano-modeline-elfeed-entry-title ()
   "Elfeed entry title"
   
   (let* ((title (elfeed-entry-title elfeed-show-entry)))
-    (propertize title 'face (nano-modeline-face 'bold))))
+    (propertize title 'face (nano-modeline-face 'name))))
 
 (defun nano-modeline-elfeed-search-filter ()
   "Elfeed search filter"
@@ -375,7 +378,7 @@ made DEFAULT."
      (cond (elfeed-search-filter-active "")
            ((string-match-p "[^ ]" elfeed-search-filter) elfeed-search-filter)
            (t "")))
-   'face (nano-modeline-face 'bold)))
+   'face (nano-modeline-face 'name)))
 
 (defun nano-modeline-elfeed-search-count ()
   "Elfeed search statistics"
@@ -383,27 +386,27 @@ made DEFAULT."
   (propertize (cond ((zerop (elfeed-db-last-update)) "")
                     ((> (elfeed-queue-count-total) 0) "")
                     (t (concat (elfeed-search--count-unread) " ")))
-   'face (nano-modeline-face)))
+   'face (nano-modeline-face 'secondary)))
 
 (defun nano-modeline-elpher-protocol ()
   "Elpher protocol"
   
   (propertize (format "(%s)"
    (elpher-address-protocol (elpher-page-address elpher-current-page)))
-   'face (nano-modeline-face)))
+   'face (nano-modeline-face 'primary)))
 
 (defun nano-modeline-elpher-title ()
   "Elpher protocol"
 
   (propertize
    (elpher-page-display-string elpher-current-page)
-   'face (nano-modeline-face 'bold)))
+   'face (nano-modeline-face 'name)))
 
 (defun nano-modeline-date (&optional date format)
   "Date using given FORMAT and DATE"
 
   (propertize (format-time-string (or format "%A %-e %B %Y") date) 
-              'face (nano-modeline-face)))
+              'face (nano-modeline-face 'secondary)))
 
 (defun nano-modeline-org-agenda-date (&optional format)
   "Date at point in org agenda  using given FORMAT"
@@ -416,13 +419,13 @@ made DEFAULT."
               (year (nth 2 date))
               (date (encode-time 0 0 0 day month year)))
     (propertize (format-time-string (or format "%A %-e %B %Y") date) 
-                'face (nano-modeline-face))))
+                'face (nano-modeline-face 'secondary))))
 
 (defun nano-modeline-term-shell-name ()
   "Term shell name"
 
   (propertize shell-file-name
-              'face (nano-modeline-face 'bold)))
+              'face (nano-modeline-face 'name)))
 
 (defun nano-modeline-term-shell-mode ()
   "Term shell mode"
@@ -430,7 +433,7 @@ made DEFAULT."
   (propertize (if (term-in-char-mode)
                   "(char mode)"
                 "(line mode)")
-               'face (nano-modeline-face)))
+               'face (nano-modeline-face 'primary)))
 
 (defun nano-modeline-eat-shell-mode ()
   "Eat shell mode"
@@ -438,7 +441,7 @@ made DEFAULT."
   (propertize (if eat--char-mode
                   "(char mode)"
                 "(line mode)")
-               'face (nano-modeline-face)))
+               'face (nano-modeline-face 'primary)))
 
 (defun nano-modeline-default-directory (&optional max-length)
   "Term current directory"
@@ -454,13 +457,13 @@ made DEFAULT."
       (setq path (cdr path)))
     (when path
       (setq output (concat "…/" output)))
-    (propertize output 'face (nano-modeline-face))))
+    (propertize output 'face (nano-modeline-face 'secondary))))
 
 (defun nano-modeline-xwidget-uri ()
   "xwidget URI"
   
   (propertize (xwidget-webkit-uri (xwidget-at (point-min)))
-              'face (nano-modeline-face 'bold)))
+              'face (nano-modeline-face 'name)))
 
 (defun nano-modeline-org-buffer-name (&optional name)
   "Org buffer name"
@@ -475,14 +478,14 @@ made DEFAULT."
                    (or (org-get-heading 'no-tags) "-")))))
           (t
            (buffer-name)))
-   'face (nano-modeline-face 'bold)))
+   'face (nano-modeline-face 'name)))
 
 (defun nano-modeline-org-capture-description ()
   "Org capture descrioption"
   
   (propertize (format "(%s)"
                       (substring-no-properties (org-capture-get :description)))
-              'face (nano-modeline-face)))
+              'face (nano-modeline-face 'primary)))
 
 (defun nano-modeline-prog-mode (&optional default)
   "Nano line for prog mode. Can be made DEFAULT mode."



reply via email to

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