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

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

[elpa] externals/nano-modeline 18c437b 04/24: Added TTY top/bottom case


From: ELPA Syncer
Subject: [elpa] externals/nano-modeline 18c437b 04/24: Added TTY top/bottom case
Date: Wed, 6 Oct 2021 17:57:32 -0400 (EDT)

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

    Added TTY top/bottom case
---
 README.md        |  2 +-
 nano-modeline.el | 40 +++++++++++++++++++++++-----------------
 2 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/README.md b/README.md
index 7d3c727..08552e8 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ A simple modeline. Best with [N Λ N O 
theme](https://github.com/rougier/nano-th
 Install with [straight.el](https://github.com/raxod502/straight.el):
 
 ```
-;; Optional
+;; Optional (N Λ N O theme)
 (straight-use-package '(nano-theme :type git :host github
                                    :repo "rougier/nano-theme"))
 
diff --git a/nano-modeline.el b/nano-modeline.el
index e0a7f4e..b88c8aa 100644
--- a/nano-modeline.el
+++ b/nano-modeline.el
@@ -47,10 +47,10 @@ Modeline is composed as:
 [ status | name (primary)                        secondary ]"
   :group 'nano-modeline)
 
-(defvar nano-modeline--selected-window (selected-window)
+(defvar nano-modeline--selected-window nil
   "Currently selected window")
 
-(defcustom nano-modeline-position 'top
+(defcustom nano-modeline-position 'bottom
   "Default position (top or bottom)"
   :type '(choice (const :tag "Top"    top)
                  (const :tag "Bottom" bottom))
@@ -578,29 +578,36 @@ Modeline is composed as:
                       :underline  'unspecified :overline   'unspecified
                       :box        'unspecified :inherit    'unspecified))
 
-(defun nano-modeline ()
+(defun nano-modeline (&optional position)
   "Install a header line whose content is dependend on the major mode"
   (interactive)
 
+  ;; Update selected window
+  (setq nano-modeline--selected-window (selected-window))
+  (setq nano-modeline-position (or position nano-modeline-position))
+  
   ;; "Box" effect is obtained through display property
-  (set-face-attribute 'mode-line nil :box nil)
-  (set-face-attribute 'mode-line-inactive nil :box nil)
+  (nano-modeline-face-clear 'mode-line)
+  (nano-modeline-face-clear 'mode-line-inactive)
+  (nano-modeline-face-clear 'header-line)
   (setq eshell-status-in-modeline nil)
-
-        ;; TTY Mode
-  (cond ((not (display-graphic-p))
-        (setq-default mode-line-format (list "%-"))
-        (nano-modeline-face-clear 'mode-line)
-        (nano-modeline-face-clear 'mode-line-inactive)
+  
+        ;; TTY mode top
+  (cond ((and (not (display-graphic-p) (eq nano-modeline-position 'top)))
+        (setq mode-line-format nil)
+        (setq-default mode-line-format nil)
         (set-face-attribute 'mode-line nil :inherit 'nano-modeline-active)
         (set-face-attribute 'mode-line-inactive nil :inherit 
'nano-modeline-inactive))
 
+       ;; TTY Mode bottom
+       ((and (not (display-graphic-p) (eq nano-modeline-position 'top)))
+        (setq header-line-format nil)
+        (setq-default header-line-format nil))
+       
        ;; Graphic mode, modeline at top
-       ((and (display-graphic-p) (eq nano-modeline-position 'top))
+       ((eq nano-modeline-position 'top)
+        (setq mode-line-format (list ""))
         (setq-default mode-line-format (list ""))
-        (nano-modeline-face-clear 'mode-line)
-        (nano-modeline-face-clear 'mode-line-inactive)
-        (nano-modeline-face-clear 'header-line)
         (set-face-attribute 'mode-line nil :inherit 'nano-modeline-active
                                            :height 0.1)
         (set-face-attribute 'mode-line-inactive nil :inherit 
'nano-modeline-inactive
@@ -608,6 +615,7 @@ Modeline is composed as:
         
        ;; Graphic mode, modeline at bottom
        (t
+        (setq header-line-format nil)
         (setq-default header-line-format nil)
         (set-face-attribute 'mode-line nil          :height (face-attribute 
'default :height))
         (set-face-attribute 'mode-line-inactive nil :height (face-attribute 
'default :height))))
@@ -649,6 +657,4 @@ Modeline is composed as:
 (add-hook 'post-command-hook
          (lambda () (setq nano-modeline--selected-window (selected-window))))
 
-(nano-modeline)
-
 (provide 'nano-modeline)



reply via email to

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