summaryrefslogtreecommitdiffstats
path: root/2023/talks/flat.md
blob: 6afcd8cc0da9135d376fb5469f1fd52d457b62e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
[[!meta title="A modern Emacs look-and-feel without pain"]]
[[!meta copyright="Copyright © 2023 Pedro A. Aranda"]]
[[!inline pages="internal(2023/info/flat-nav)" raw="yes"]]

<!-- Initially generated with emacsconf-publish-talk-page and then left alone for manual editing -->
<!-- You can manually edit this file to update the abstract, add links, etc. --->


# A modern Emacs look-and-feel without pain
Pedro A. Aranda (he)

[[!template id="help"
summary="main talk does not have captions"
tags="help_with_main_captions"
message="""This talk does not have captions yet.
Would you like to help [caption this talk](/captioning)?
You may be able to start with these [autogenerated captions](/2023/captions/emacsconf-2023-flat--a-modern-emacs-lookandfeel-without-pain--pedro-a-aranda--main.vtt)."""]]

[[!inline pages="internal(2023/info/flat-before)" raw="yes"]]

In my talk I will show how to enrich themes without having to write them
from scratch, using the flat-button style. This gives you the possibility
of creating a nice Emacs GUI with minimal extra ELISP.

About the speaker:

Pedro A. Aranda is a 30+ year Emacs user, who started on an HP mainframe
and soon started using the DJGPP port of emacs on a 386 at home. Currently
lecturing at a university in Madrid, he uses emacs for most of his teaching
activities.

# Discussion

## Questions and answers

-   Q: Do you plan to upstream this style into core Emacs?
    -   A: It's in core emacs
-   Q: How difficult is it to modify face styles like this internally?
    -   A: It's very simple, just set the :style of the :box face
        attribute.
-   Q: How much work was involved in implementing this style internally
    in Emacs core?
    -   A: About a 20-line patch.
-   Q: Could you please share the code for copy and paste? Thx!
    -   A:  
        ```
        (defun flat-style (theme &rest args)  
          (custom-set-faces  
           `(mode-line  
             ((t (:inherit mode-line  
                           :box (:line-width ,mode-line-height :style  
                                             flat-button)))) t)  
           `(mode-line-inactive  
             ((t (:inherit mode-line-inactive  
                           :box (:line-width ,mode-line-height :style  
                                             flat-button)))) t)))  
        (advice-add 'load-theme :after #'flat-style)  
        ```
    - **Important change 2 years later.**
      CHANGES IN EMACS MASTER make the code above CRASH. Emacs,
      The new flat-style function uses set-face-attribute:  
      ```
      (defvar mode-line-height 8 "Size of the box arounf the mode line")
      (defun lat-style (theme &rest _)
        (set-face-attribute 'mode-line nil
                            :box (list :line-width mode-line-height :style 'flat-button))
        (set-face-attribute 'mode-line-inactive nil
                            :box (list :line-width mode-line-height :style 'flat-button)))
      ```

-   Q: Do you teach Emacs to any of your university students?
    -   A: No teaching, but a lot of introdcuing ;-)

## Notes

-   It looks great, thanks for upstreaming it in GNU Emacs core as well!


[[!inline pages="internal(2023/info/flat-after)" raw="yes"]]

[[!inline pages="internal(2023/info/flat-nav)" raw="yes"]]