Skip to content

Commit e4f557d

Browse files
committedFeb 9, 2025
🔧 Massive redesign
- Switch to my fork of Nord theme instead of nano theme. - Drop nano-splash. - Use latest experimental nano-modeline. - Many style tweaks and improvements. Signed-off-by: Alexander Kurbatov <[email protected]>
1 parent b42c7e0 commit e4f557d

20 files changed

+299
-1545
lines changed
 

‎README.md

+2-7
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,13 @@ configuration.
4444
brew install emacs-plus@30 \
4545
--with-imagemagick \
4646
--with-savchenkovaleriy-big-sur-icon \
47-
--with-xwidgets \
48-
--with-poll
47+
--with-xwidgets
4948
```
5049

5150
- Additional fonts
5251

5352
```bash
54-
brew install \
55-
homebrew/cask/font-roboto \
56-
homebrew/cask/font-roboto-slab \
57-
homebrew/cask/font-jetbrains-mono \
58-
homebrew/cask/font-jetbrains-mono-nerd-font
53+
brew install homebrew/cask/font-jetbrains-mono
5954
```
6055

6156
- `coreutls` (`Mac OS` only) for better listing in `Dired`

‎init.el

+4-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
;; GNU Emacs / N Λ N O Modeline
9393
(straight-use-package
94-
'(nano-modeline :type git :host github :repo "rougier/nano-modeline"))
94+
'(nano-modeline :type git :host github :repo "rougier/nano-modeline" :branch "rewrite"))
9595

9696
;; Special case for pdf-tools that has recently (2022) changed maintainer
9797
(straight-use-package
@@ -147,6 +147,9 @@
147147
(straight-use-package
148148
'(gotest-ts :type git :host github :repo "chmouel/gotest-ts.el"))
149149

150+
(straight-use-package
151+
'(nord-theme :type git :host github :repo "alkurbatov/nord-theme"))
152+
150153
;; Load settings
151154
(require 'nano)
152155

‎lisp/nano-appearance.el

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
;;; nano-appearance.el --- Theme and faces settings -*- lexical-binding: t; -*-
2+
3+
;; GNU Emacs / N Λ N O - Emacs made simple
4+
;; Copyright (C) 2023-2024 - N Λ N O developers
5+
6+
;; This program is free software; you can redistribute it and/or modify
7+
;; it under the terms of the GNU General Public License as published by
8+
;; the Free Software Foundation, either version 3 of the License, or
9+
;; (at your option) any later version.
10+
11+
;; This program is distributed in the hope that it will be useful,
12+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
;; GNU General Public License for more details.
15+
16+
;; You should have received a copy of the GNU General Public License
17+
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
;;; Commentary:
20+
21+
;;; Code:
22+
23+
;; Theme
24+
(require 'nord-theme)
25+
(nord-load-theme)
26+
27+
(defface nano-critical `((t (:foreground ,nord13 :weight normal)))
28+
"Critical face is for information that requires immediate action.
29+
It should be of high contrast when compared to other faces. This
30+
can be realized (for example) by setting an intense background
31+
color, typically a shade of red. It must be used scarcely."
32+
:group nil)
33+
34+
(defface nano-faded `((t (:foreground ,nord-comment)))
35+
"Faded face is for information that are less important.
36+
It is made by using the same hue as the default but with a lesser
37+
intensity than the default. It can be used for comments,
38+
secondary information and also replace italic (which is generally
39+
abused anyway)."
40+
:group 'nano)
41+
42+
(defface nano-faded-i `((t (:foreground ,nord0 :background ,nord-comment)))
43+
"Faded face inversed."
44+
:group nil)
45+
46+
(defface nano-popout `((t (:foreground ,nord12)))
47+
"Popout face is used for information that needs attention.
48+
To achieve such effect, the hue of the face has to be
49+
sufficiently different from other faces such that it attracts
50+
attention through the popout effect."
51+
:group 'nano)
52+
53+
(defface nano-popout-i `((t (:foreground ,nord0 :background ,nord12)))
54+
"Popout face inversed."
55+
:group 'nano)
56+
57+
(defface nano-salient `((t (:foreground ,nord9)))
58+
"Salient face is used for information that are important.
59+
To suggest the information is of the same nature but important,
60+
the face uses a different hue with approximately the same
61+
intensity as the default face. This is typically used for links."
62+
:group 'nano)
63+
64+
(defface nano-subtle `((t (:foreground ,nord2)))
65+
"Subtle face is used to suggest a physical area on the screen.
66+
It is important to not disturb too strongly the reading of
67+
information and this can be made by setting a very light
68+
background color that is barely perceptible."
69+
:group nil)
70+
71+
;; Apply fonts
72+
(custom-theme-set-faces 'nord
73+
`(default ((t (:foreground ,nord6
74+
:weight ,(face-attribute 'nano-mono :weight)
75+
:height ,(face-attribute 'nano-mono :height)
76+
:family ,(face-attribute 'nano-mono :family)))))
77+
`(italic ((t (:foreground ,nord6
78+
:weight ,(face-attribute 'nano-italic :weight)
79+
:height ,(face-attribute 'nano-italic :height)
80+
:slant ,(face-attribute 'nano-italic :slant)
81+
:family ,(face-attribute 'nano-italic :family))))))
82+
83+
;; Line spacing (in pixels)
84+
(setq line-spacing 1.2)
85+
86+
;; Customize indent-bars mode
87+
(with-eval-after-load 'indent-bars
88+
;; Enable TreeSitter support
89+
(setq indent-bars-treesit-support t)
90+
(setq indent-bars-treesit-ignore-blank-lines-types '("module"))
91+
92+
;; Make the indent-bars package decide when to use the stipple attribute
93+
;; Stripple doesn't work on most macOS and Windows builds.
94+
(setq indent-bars-prefer-character
95+
(if (memq initial-window-system '(pgtk ns)) t))
96+
97+
(setq
98+
indent-bars-color '(nano-faded-i :face-bg t :blend 0.55)
99+
indent-bars-pattern "..."
100+
indent-bars-width-frac 0.1
101+
indent-bars-pad-frac 0.1
102+
indent-bars-zigzag nil
103+
indent-bars-color-by-depth nil
104+
indent-bars-highlight-current-depth nil
105+
indent-bars-display-on-blank-lines nil))
106+
107+
;; Customize hl-todo colors
108+
(with-eval-after-load 'hl-todo
109+
(setq hl-todo-highlight-punctuation ":"
110+
hl-todo-keyword-faces
111+
`(("TODO" . nano-popout)
112+
("XXX" . nano-popout)
113+
("CRUTCH" . nano-popout)
114+
("FIXME" . nano-critical)
115+
("NB" . nano-salient)
116+
("NOTE" . nano-salient))))
117+
118+
(provide 'nano-appearance)
119+
;;; nano-appearance.el ends here

‎lisp/nano-bindings.el

+5-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
;; Close frame if not the last, kill Emacs else
3737
(defun nano--delete-frame-or-kill-emacs ()
38-
"Delete frame or kill Emacs if there is only one frame."
38+
"Delete frame or kill Emacs if there is only one frame left."
3939
(interactive)
4040
(condition-case nil (delete-frame) (error (save-buffers-kill-terminal))))
4141
(bind-key* "C-x C-c" #'nano--delete-frame-or-kill-emacs)
@@ -56,15 +56,10 @@ The DWIM behavior of this command is as follows:
5656
- When the Completions buffer is selected, close it.
5757
- In every other case use the regular `keyboard-quit'."
5858
(interactive)
59-
(cond
60-
((region-active-p)
61-
(keyboard-quit))
62-
((derived-mode-p 'completion-list-mode)
63-
(delete-completion-window))
64-
((> (minibuffer-depth) 0)
65-
(abort-recursive-edit))
66-
(t
67-
(keyboard-quit))))
59+
(cond ((region-active-p) (keyboard-quit))
60+
((derived-mode-p 'completion-list-mode) (delete-completion-window))
61+
((> (minibuffer-depth) 0) (abort-recursive-edit))
62+
(t (keyboard-quit))))
6863
(bind-key "C-g" #'nano--keyboard-quit-dwim)
6964

7065
;; Don't press shift when undoing things

‎lisp/nano-calendar.el

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
;;; Code:
2222
(require 'calendar)
23+
(require 'nano-modeline)
2324
(require 'russian-holidays)
2425

2526
;; Set Russian names, abbrevs and holidays
@@ -41,5 +42,7 @@
4142
;; Highlight holidays by default
4243
(setq calendar-mark-holidays-flag t)
4344

45+
(add-hook 'calendar-mode-hook #'(lambda () (nano-modeline nano-modeline-format-calendar)))
46+
4447
(provide 'nano-calendar)
4548
;;; nano-calendar.el ends here

‎lisp/nano-defaults.el

+9-2
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,19 @@
9797
;; Completion style, see
9898
;; gnu.org/software/emacs/manual/html_node/emacs/Completion-Styles.html
9999
(setq completion-styles '(substring orderless basic)
100-
orderless-component-separator 'orderless-escapable-split-on-space
100+
orderless-component-separator "[ &]" ; press & to type another query in company popup
101101
completion-category-overrides '((file (styles basic partial-completion)))
102102
read-file-name-completion-ignore-case t
103103
read-buffer-completion-ignore-case t
104104
completion-ignore-case t)
105105

106+
;; Improve appearance for several orderless queries.
107+
;; See https://github.com/oantolin/orderless?tab=readme-ov-file#company
108+
(defun just-one-face (fn &rest args)
109+
(let ((orderless-match-faces [completions-common-part]))
110+
(apply fn args)))
111+
(advice-add 'company-capf--candidates :around #'just-one-face)
112+
106113
;; TAB cycle if there are only few candidates
107114
(setq completion-cycle-threshold 3)
108115

@@ -222,7 +229,7 @@
222229
;; Save abbreviations whenever files are saved
223230
(setq save-abbrevs 'silently)
224231

225-
;; Tell emacs where to read abbrev definitions from
232+
;; Tell Emacs where to read abbrev definitions from
226233
(setq abbrev-file-name "~/.emacs.d/abbrev_defs")
227234

228235
;; Enable embedded abbrev mode

‎lisp/nano-font.el

+21
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@
2121
;;; Code:
2222
(require 'ligature)
2323

24+
;; Nerd font for glyph icons
25+
(let ((jetbrains-nerd (font-spec :name "JetBrains Mono")))
26+
(if (find-font jetbrains-nerd)
27+
(set-fontset-font t '(#xe000 . #xffdd) jetbrains-nerd)
28+
(message "JetBrains Mono font has not been found on your system")))
29+
30+
(defface nano-mono
31+
'((t (:family "JetBrains Mono"
32+
:height 130
33+
:weight light)))
34+
"Default monospaced font (JetBrains Mono Light, 13pt)."
35+
:group 'nano-fonts)
36+
37+
(defface nano-italic
38+
'((t (:family "JetBrains Mono"
39+
:slant italic
40+
:height 130
41+
:weight regular)))
42+
"Default italic font (JetBrains Mono Italic Light, 13pt)."
43+
:group 'nano-fonts)
44+
2445
;; Enable font ligatures
2546
(defconst nano-jetbrains-ligatures
2647
'("-->" "//" "/**" "/*" "*/" "<!--" ":=" "->>" "<<-" "->" "<-"

‎lisp/nano-git.el

+2-17
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
;;; Code:
2525
(require 'diff-hl)
26-
(require 'nano-modeline)
2726
(require 's)
2827

2928
;; Taken from: https://www.youtube.com/watch?v=yP3mgt5hMyI&list=WL&index=15
@@ -41,9 +40,8 @@
4140
(setq magit-save-repository-buffers 'dontask)
4241

4342
;; Show the diff indicators in the margin when in TUI mode
44-
(unless (display-graphic-p)
45-
(add-hook 'prog-mode-hook #'diff-hl-margin-mode)
46-
(add-hook 'text-mode-hook #'diff-hl-margin-mode))
43+
(add-hook 'prog-mode-hook #'diff-hl-margin-mode)
44+
(add-hook 'text-mode-hook #'diff-hl-margin-mode)
4745

4846
;; Integrate diff-hl with magit
4947
(add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh)
@@ -53,19 +51,6 @@
5351
(add-hook 'git-commit-setup-hook #'git-commit-turn-on-flyspell)
5452
(add-hook 'git-commit-setup-hook #'nano-auto-insert-jira-ticket-into-commit-msg)
5553

56-
;; Improve display of nano-modeline in magit buffers, see:
57-
;; See: https://github.com/rougier/nano-modeline/issues/8
58-
(defun nano-modeline-magit-mode (orig-fun input)
59-
"Nano modeline for magit mode."
60-
(funcall nano-modeline-position
61-
`((nano-modeline-buffer-status) " "
62-
(nano-modeline-buffer-name) " "
63-
,(concat "(" input ")"))
64-
'((nano-modeline-cursor-position)
65-
(nano-modeline-window-dedicated))))
66-
67-
(advice-add 'magit-set-header-line-format :around #'nano-modeline-magit-mode)
68-
6954
(with-eval-after-load 'magit-blame
7055
(setq magit-blame-styles '((headings
7156
(heading-format . "%.8H - %a, %C • %s\12"))

0 commit comments

Comments
 (0)