summaryrefslogtreecommitdiff
path: root/emacs_init/dot_emacs.org
blob: 1b0ebb01461aca8bb713fd9208b094f4ab2cf61f (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
;; -*- lexical-binding: t; -*-
#+startup: content
#+title: Emacs literate configuration
#+author: yaidel
#+date: [2022-12-08 Thu]

* Interface tweaks

First of all, avoid the output of =custom-set-variables= to the =~/.emacs.d/init.el= file. This some times writes there some customization which interferes with those made in this file. I have had some rough times debugging stuffs because they were defined automatically by Emacs in the =custom-set-variables= section of the =init= file.

#+begin_src emacs-lisp
(setq-default custom-file null-device)
#+end_src

Then, inhibit the startup bottom buffer. If someone like it just comment the following block.

#+begin_src emacs-lisp
  (setq inhibit-startup-message t) 
#+end_src

Disable menubar, scrollbar, toolbar and fringe:

#+begin_src emacs-lisp
  (menu-bar-mode -1)
  (tool-bar-mode -1)
  ;; (fringe-mode -1)
  (scroll-bar-mode -1)
  (customize-set-variable 'scroll-bar-mode nil)
  (customize-set-variable 'horizontal-scroll-bar-mode nil)
#+end_src

Some key-bindings I use (see [[https://www.emacswiki.org/emacs/LineNumbers][this page]] for line-numbers configuration)

#+begin_src emacs-lisp
  (global-set-key (kbd "<f5>") 'revert-buffer)
  (global-set-key (kbd "<f8>") 'eshell)
  (global-set-key (kbd "<f1>") 'display-line-numbers-mode)
#+end_src

Show line numbers by default in programming mode

#+begin_src emacs-lisp
  ;; (add-hook 'prog-mode-hook #'display-line-numbers-mode)
#+end_src

Use spaces instead of TABS

#+begin_src emacs-lisp
(setq-default indent-tabs-mode nil)
#+end_src

** Window startup geometry

Here the frame can start maximized with the following option

#+begin_src emacs-lisp
 ;; (add-hook 'window-setup-hook 'toggle-frame-maximized t)
#+end_src

Or it can be set to a certain geometry with the following options

#+begin_src emacs-lisp
  (setq default-frame-alist
        '((top . 60) (left . 150)
          (width . 160) (height . 42)))
#+end_src

** Theme

One theme I used for a long time was Leuven which can be loaded with ~(load-theme 'leuven t)~, however [[https://protesilaos.com/][Protesilaos]]' themes are really nice alternatives which have been gratefully welcomed in the Emacs comunity. In my case I am using the =ef-themes= because they are really colorful (in a balanced maner). Other Prot's packages complement the theme:

#+begin_src emacs-lisp
  (use-package ef-themes
    :ensure t
    :init
    (mapc #'disable-theme custom-enabled-themes)
    :config
    (setq ef-themes-mixed-fonts t
	  ef-themes-variable-pitch-ui t)
    ;; Load the theme of choice:
    (load-theme 'ef-light :no-confirm)
    )
#+end_src

#+begin_src emacs-lisp
  (use-package spacious-padding
    :ensure t
    :config
    (spacious-padding-mode 1)
    )
#+end_src

The following code was provided by Prot, and it is needed to make =spacious-padding= remove the black borders it creates when Emacs is run with the daemon.

#+begin_src emacs-lisp
  (defun my-spacious-padding-remove-borders (_)
    (spacious-padding-modify-frame-parameters nil)
    (spacious-padding-set-invisible-dividers nil))

  (add-hook 'after-make-frame-functions #'my-spacious-padding-remove-borders)
#+end_src

#+begin_src emacs-lisp
  (use-package fontaine
    :ensure t
    :config
    (setq fontaine-latest-state-file
          (locate-user-emacs-file "fontaine-latest-state.eld"))
  
    (setq fontaine-presets
          '((tiny
             :default-family "Iosevka Comfy Wide Fixed"
             :default-height 70)
            (small
             :default-family "Iosevka Comfy Fixed"
             :default-height 90)
            (regular
             :default-height 130)
            (medium
             :default-height 150)
            (large
             :default-weight semilight
             :default-height 170
             :bold-weight extrabold)
            (presentation
             :default-weight semilight
             :default-height 170
             :bold-weight extrabold)
            (jumbo
             :default-weight semilight
             :default-height 220
             :bold-weight extrabold)
            (t
             ;; I keep all properties for didactic purposes, but most can be
             ;; omitted.  See the fontaine manual for the technicalities:
             ;; <https://protesilaos.com/emacs/fontaine>.
             :default-family "Iosevka Comfy"
             :default-weight regular
             :default-height 100
             :fixed-pitch-family nil ; falls back to :default-family
             :fixed-pitch-weight nil ; falls back to :default-weight
             :fixed-pitch-height 1.0
             :fixed-pitch-serif-family nil ; falls back to :default-family
             :fixed-pitch-serif-weight nil ; falls back to :default-weight
             :fixed-pitch-serif-height 1.0
             :variable-pitch-family "Iosevka Comfy Duo"
             :variable-pitch-weight nil
             :variable-pitch-height 1.0
             :bold-family nil ; use whatever the underlying face has
             :bold-weight bold
             :italic-family nil
             :italic-slant italic
             :line-spacing nil)))

    ;; Recover last preset or fall back to desired style from
    ;; `fontaine-presets'.
    (fontaine-set-preset (or (fontaine-restore-latest-preset) 'regular))

    ;; The other side of `fontaine-restore-latest-preset'.
    (add-hook 'kill-emacs-hook #'fontaine-store-latest-preset)
    )
#+end_src

#+begin_src emacs-lisp
  (use-package pulsar
    :ensure t
    :config
    (setq pulsar-pulse t)
    (setq pulsar-delay 0.075)
    (setq pulsar-iterations 10)
    (setq pulsar-face 'pulsar-magenta)
    (setq pulsar-highlight-face 'pulsar-yellow)

    (pulsar-global-mode 1)
    )
#+end_src

#+BEGIN_SRC emacs-lisp
  (use-package lin
    :ensure t
    :config
    (setq lin-face 'lin-mac-override-fg)
    (setq lin-mode-hooks (append lin-mode-hooks '(prog-mode-hook org-mode-hook)))
    (lin-global-mode 1)
    )
#+END_SRC

** UTF-8 encoding:

#+BEGIN_SRC emacs-lisp
  (setq locale-coding-system 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (set-keyboard-coding-system 'utf-8)
  (set-selection-coding-system 'utf-8)
  (prefer-coding-system 'utf-8)
#+END_SRC

** Change 'yes or no' prompts to 'y or n':

#+BEGIN_SRC emacs-lisp
  (fset 'yes-or-no-p 'y-or-n-p)
#+END_SRC

** Auto-fill-mode for text based buffers

We could use only the following block to achieve auto fill. This would, however, automatically break the line and start a new one when column =fill-column= is reached. I used to use this for some time, but afterwards I needed to move the text to another application, and it was all filled with line breaks which I had to remove by hand. There is probably a smart and convenient way to remove those end-of-line, but I am not aware of it.

#+begin_src emacs-lisp
  ;; (add-hook 'text-mode-hook 'auto-fill-mode)
#+end_src

Instead of actually changing the text of the buffer by introducing end-of-lines when using =auto-fill-mode=, it is possible to use the option =visual-line-mode=. This mode will take the text in the edge and simulate as if there were a end-of-line, i.e. the line will be broken, but in reality it is just a visual effect, the line in the underlying file has not end-of-line. =visual-line-mode= comes built in Emacs, and I call it when loading the packages where I want it to be present, like org-mode, for example. Next code line activates =visual-line-mode= globally in case you find it fancy:

#+begin_src emacs-lisp
  ;; (global-visual-line-mode 1)
#+end_src

The behavior achieved by =visual-line-mode= can be extended to be more like =auto-fill-mode=, i.e. to restrict the column to which the text is displayed as maximum. That can be achieved with the package =visual-fill-column=. [[https://github.com/joostkremers/visual-fill-column][This package]] makes possible that instead of wrapping lines at the window edge, which is the standard behavior of =visual-line-mode=, it wraps lines at =fill-column=. Just what one may want:

#+begin_src emacs-lisp
  (use-package visual-fill-column
    :ensure t
    )
#+end_src

#+begin_src emacs-lisp
  (global-set-key (kbd "<f6>") 'visual-fill-column-mode)
#+end_src

Next we set the columns number where to cut

#+begin_src emacs-lisp
  (setq-default fill-column 110)
  (setq column-number-mode t)
#+end_src

However, I have noticed that =visual-fill-column= *has some conflicts with org-mode* documents using =org-indent-mode=. The indentation just doesn't work as expected. For that reason I prefer to just assign it a keybinding and call it when need it. So far I have not called it even once.

And finally, we could use the =adaptive-wrap= package to avoid that the next line, when artificially broken by =visual-fill-column=, be more on the left than its parent, in case the parent was indented.

#+begin_src emacs-lisp
  ;; (use-package adaptive-wrap
  ;;   :ensure t
  ;;   :after visual-fill-column
  ;;   :hook
  ;;   (visual-line-mode . adaptive-wrap-prefix-mode)
  ;;   :config
  ;;   (setq-default adaptive-wrap-extra-indent 0)
  ;;   )
#+end_src

** Edit the configuration file

Set =C-c e= to edit this file:

#+BEGIN_SRC emacs-lisp
  (defun config-visit ()
    (interactive)
    (find-file "~/config/dotFiles/emacs_init/dot_emacs.org"))
  (global-set-key (kbd "C-c e") 'config-visit)
#+END_SRC

Reload the configuration from this file when =C-c r= is pressed:

#+BEGIN_SRC emacs-lisp
  (defun config-reload ()
    "Reloads ~/.emacs.d/config.org at runtime"
    (interactive)
    (org-babel-load-file (expand-file-name "~/config/dotFiles/emacs_init/dot_emacs.org")))
  (global-set-key (kbd "C-c r") 'config-reload)
#+END_SRC

* Windows management



#+BEGIN_SRC emacs-lisp
  (use-package ace-window
    :ensure t
    :init
    (progn
      (global-set-key [remap other-window] 'ace-window)
      (custom-set-faces
       '(aw-leading-char-face
         ((t (:inherit ace-jump-face-foreground :height 2.0)))))
      ))

  ;; (global-set-key (kbd "M-o") 'ace-window)
#+END_SRC

Winner is a global minor mode built into Emacs that records the changes in the window configuration. It basically provides two functions:
1. =winner-undo=, by default bind to =C-c left=.
2. =winner-redo=, by default bind to =C-c right=.

Let's say we have a frame with one window (state 1), and we split it vertically (state 2) and then horizontally (state 3). If we call =winner-undo=, we will undo the last modification we did to the frame, which means that we will have two vertical windows (return to state 2). If we call once more =winner-undo=, we will return to the first state, with only one window in the frame. Then, we can return to state 3 by invoking =winner-redo= two times.

To enable =winner-mode= we need to customize the variable as follows:

#+begin_src emacs-lisp
  (winner-mode 1)
#+end_src

See [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Window-Convenience.html#index-winner_002dmode][official GNU/Emacs documentation]] or the [[https://www.emacswiki.org/emacs/WinnerMode][Emacs Wiki dedicated page]].

* Searching and helping to find things
** Vertico configuration
#+begin_src emacs-lisp
  (use-package vertico
    :ensure t
    :init
    (vertico-mode +1)

    ;; Different scroll margin
    ;; (setq vertico-scroll-margin 0)

    ;; Show more candidates
    ;; (setq vertico-count 20)

    ;; Grow and shrink the Vertico minibuffer
    ;; (setq vertico-resize t)

    ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
    ;; (setq vertico-cycle t)
    )
#+end_src
** Savehist configuration
#+begin_src emacs-lisp
  (use-package savehist
    :ensure t
    :init
    (savehist-mode))
#+end_src
** Orderless configuration
#+begin_src emacs-lisp
  (use-package orderless
    :ensure t
    :init
    ;; Configure a custom style dispatcher (see the Consult wiki)
    ;; (setq orderless-style-dispatchers '(+orderless-dispatch)
    ;;       orderless-component-separator #'orderless-escapable-split-on-space)
    (setq completion-styles '(orderless)
	  completion-category-defaults nil
	  completion-category-overrides '((file (styles partial-completion))))
    )
#+end_src
** Consult configuration
#+begin_src emacs-lisp
  (use-package consult
    :ensure t

    ;; Enable automatic preview at point in the *Completions* buffer. This is
    ;; relevant when you use the default completion UI.
    :hook (completion-list-mode . consult-preview-at-point-mode)

    ;; The :init configuration is always executed (Not lazy)
    :init

    ;; Optionally configure the register formatting. This improves the register
    ;; preview for `consult-register', `consult-register-load',
    ;; `consult-register-store' and the Emacs built-ins.
    (setq register-preview-delay 0.5
          register-preview-function #'consult-register-format)

    ;; Optionally tweak the register preview window.
    ;; This adds thin lines, sorting and hides the mode line of the window.
    (advice-add #'register-preview :override #'consult-register-window)

    ;; Use Consult to select xref locations with preview
    (setq xref-show-xrefs-function #'consult-xref
          xref-show-definitions-function #'consult-xref)
     )
#+end_src
** Marginalia configuration
#+begin_src emacs-lisp
  (use-package marginalia
    :ensure t
    ;; Either bind `marginalia-cycle` globally or only in the minibuffer
    :bind (("M-A" . marginalia-cycle)
	   :map minibuffer-local-map
	   ("M-A" . marginalia-cycle))

    ;; The :init configuration is always executed (Not lazy!)
    :init

    ;; Must be in the :init section of use-package such that the mode gets
    ;; enabled right away. Note that this forces loading the package.
    (marginalia-mode))
#+end_src

** Embark configuration
#+begin_src emacs-lisp
  (use-package embark
    :ensure t
    :bind
    (("C-}" . embark-act)         ;; pick some comfortable binding
     ("C-;" . embark-dwim)        ;; good alternative: M-.
     ("C-h B" . embark-bindings)  ;; alternative for `describe-bindings'
     ("M-o" . embark-export))
    :init

    ;; Optionally replace the key help with a completing-read interface
    (setq prefix-help-command #'embark-prefix-help-command)

    :config

    ;; Hide the mode line of the Embark live/completions buffers
    (add-to-list 'display-buffer-alist
                 '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
                   nil
                   (window-parameters (mode-line-format . none)))))

  ;; Consult users will also want the embark-consult package.
  (use-package embark-consult
    :ensure t
    :after (embark consult)
    :demand t ; only necessary if you have the hook below
    ;; if you want to have consult previews as you move around an
    ;; auto-updating embark collect buffer
    :hook
    (embark-collect-mode . consult-preview-at-point-mode))
#+end_src

* General packages
** Dired
The Dired documentation can be found by =C-h m= on the buffer, ot at [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][the GNU manual]].
   
List directories before files:

#+BEGIN_SRC emacs-lisp
  (defun mydired-sort ()
    "Sort dired listings with directories first."
    (save-excursion
      (let (buffer-read-only)
	(forward-line 2) ;; beyond dir. header 
	(sort-regexp-fields t "^.*$" "[ ]*." (point) (point-max)))
      (set-buffer-modified-p nil)))

  (defadvice dired-readin
      (after dired-after-updating-hook first () activate)
    "Sort dired listings with directories first before adding marks."
    (mydired-sort))
#+END_SRC

Show file sizes in KB, MB, GB instead of just bytes:

#+BEGIN_SRC emacs-lisp
  (setq-default dired-listing-switches "-alh")
#+END_SRC

Delete the previous buffer each time a new folder is entered. This way you do not end up with several buffers opened, one for each folder you visited.

#+begin_src emacs-lisp
(setq dired-kill-when-opening-new-dired-buffer t)
#+end_src


Ask for the creation of destination folders which do not exist.

#+begin_src emacs-lisp
(setq dired-create-destination-dirs "ask")
#+end_src

Hide dotfiles by default, and add =super + h= keybinding to toggle:

#+BEGIN_SRC emacs-lisp
  ;; (add-hook 'dired-load-hook #'(lambda () (require 'dired-x))) ; Load Dired X when Dired is loaded.
  ;; (setq dired-omit-mode t) ; Turn on Omit mode.

  ;; (require 'dired-x)
  ;; (setq-default dired-omit-files-p t) ; Buffer-local variable
  ;; (setq dired-omit-files (concat dired-omit-files "\\|^\\..+$"))

  ;; ;; keybinding toggle
  ;; (define-key dired-mode-map (kbd "s-h") 'dired-omit-mode)
#+END_SRC
** Elfeed
:PROPERTIES:
:ID:       4529071a-2ea8-4299-90b9-0593cc31ecda
:END:
   
Load elfeed

#+begin_src emacs-lisp
  ;; the database is strored in ~/.elfeed by default
  ;; after remove an rss, if you want to remove old entries from it, just delete the database with emacs shuted down 
  (use-package elfeed
    :ensure t
    :init
    (setq elfeed-db-directory "~/config/elfeed/elfeeddb")
    :bind
    (("C-x w" . elfeed))
    :config
    ;; Personalized authors list
    (add-hook 'elfeed-search-mode-hook 'elfeed-update)
    ;;(setq elfeed-search-title-max-width 100)
    (setq elfeed-search-filter "@2-week-ago +unread"))
#+end_src

Load elfeed-org to allow rss feeds to be set up with an org file: (It is important to note that each 1st
heading need to have the tag =elfeed= in order to be correctly parsed by the =elfeed-org= package. This
means that all the entries have the =elfeed= tag.)

   
#+begin_src emacs-lisp
  (use-package elfeed-org
    :ensure t
    :config
    (elfeed-org)
    (setq rmh-elfeed-org-files (list "~/config/dotFiles/elfeed.org"))
    )
#+end_src

Download video of the feed in the folder ~/Videos directly with the key binding =d=

#+begin_src emacs-lisp
  (defun ytg/yt-dl-it (url)
    "Downloads the URL in an async shell"
    (let ((default-directory "~/Videos"))
      (async-shell-command (format "yt-dlp %s" url))))

  (defun ytg/elfeed-youtube-dl (&optional use-generic-p)
    "Youtube-DL link"
    (interactive "P")
    (let ((entries (elfeed-search-selected)))
      (cl-loop for entry in entries
	       ;;do (elfeed-untag entry 'unread)
	       when (elfeed-entry-link entry)
	       do (ytg/yt-dl-it it))
      (mapc #'elfeed-search-update-entry entries)
      (unless (use-region-p) (forward-line))))

  (define-key elfeed-search-mode-map (kbd "d") 'ytg/elfeed-youtube-dl)
#+end_src

Start reproducing the video of the feed with the key =v=
   
#+begin_src emacs-lisp
  (defun ytg/elfeed-v-mpv (url)
    "Watch a video from URL in MPV" 
    (async-shell-command (format "mpv %s" url)))

  (defun ytg/elfeed-view-mpv (&optional use-generic-p)
    "Youtube-feed link"
    (interactive "P")
    (let ((buffer (current-buffer))
	  (entries (elfeed-search-selected)))
      (cl-loop for entry in entries
	       do (elfeed-untag entry 'unread)
	       when (elfeed-entry-link entry) 
	       do (ytg/elfeed-v-mpv it)) 
      (mapc #'elfeed-search-update-entry entries) 
      (unless (use-region-p) (forward-line)))) 

  (define-key elfeed-search-mode-map (kbd "v") 'ytg/elfeed-view-mpv)
#+end_src

Appearance settings:

#+BEGIN_SRC emacs-lisp
  ;; (setq-default elfeed-initial-tags nil)
  ;; (setq-default elfeed-search-date-format (quote ("%a, %R" 10 :left)))
  ;; (setq-default elfeed-curl-max-connections 100)
  ;; (setq-default elfeed-search-trailing-width 30)
#+END_SRC
** Org-capture in Elfeed configuration

When I am reading an article in [[id:4529071a-2ea8-4299-90b9-0593cc31ecda][Elfeed]], sometimes some idea popup and I want to capture it. Normally, I would have to manually copy the link, and then open the regular capture template I have and make the capture of the idea. What the following function does is to automate the copying part. The variable ~org-store-link-functions~ is set to ~ytg/org-elfeed-entry-store-link~, so in the =org-capture-template= dedicated to this purpose we can use =%a= to [[https://orgmode.org/manual/Template-expansion.html][retrieve the stored link]]. See the =org-capture-template= =Read later / take a note= on the section [[id:ebdfd897-7542-44e6-8413-632b41e7fb32][Org mode]] which makes use of this functions and hook by using =%a=, as previously explained.

This solution was taken from [[https://yiming.dev/blog/2016/01/28/add-org-store-link-entry-for-elfeed/][this post of Yiming Chen]].

#+begin_src emacs-lisp
(defun ytg/org-elfeed-entry-store-link ()
  (when elfeed-show-entry
    (let* ((link (elfeed-entry-link elfeed-show-entry))
           (title (elfeed-entry-title elfeed-show-entry)))
      (org-store-link-props
       :link link
       :description title)
      )))

(add-hook 'org-store-link-functions
          'ytg/org-elfeed-entry-store-link)
#+end_src

** Which-key

When typing in the M-x, it shows a list of possibilities

#+BEGIN_SRC emacs-lisp


  (use-package which-key
    :ensure t
    :config
    (which-key-mode))
#+END_SRC
** Try

#+begin_src emacs-lisp
  (use-package try
    :ensure t
    )
#+end_src
* Org-mode links integration with Thunderbird

Some years ago it was possible to use the [[https://github.com/mikehardy/thunderlink][Thunderlink]] plugin to obtain a "link" to a specific email, and when you clicked that link it would open Thunderbird with a focus on the required email. However, that project died. Fortunately, [[https://camiel.bouchier.be/en/about-me][Camiel Bouchier]] made the necessary re-writing of the code need to make it work with newer versions of Thunderbird's API, in what it's called [[https://github.com/CamielBouchier/cb_thunderlink][cb_thunderlink]]. For the time of writing ([2023-08-26 Sat]) it is still maintained, let's hope it keeps that way.

The (sort of) documentation for the plugin is on [[https://camiel.bouchier.be/en/cb_thunderlink][this post]] of Camiel's website. And to use it in conjunction with Emacs it is also needed an Elisp workaround to tell emacs how to respond when =org-open-at-point= is executed on one of =cb_thunderlink='s link.
1) The installation of the =cb_thunderlink= plugin is straightforward in the Thunderbird Plugin Store.
2) The workaround, on the other hand, I got from [[https://vxlabs.com/][vxlabs]]' website, where he explains how to [[https://vxlabs.com/2019/04/20/link-thunderbird-emails-from-emacs-orgmode/][Link directly to emails from Emacs Orgmode using Thunderbird and Thunderlink]]. As you may have noticed, the workaround was written for =thunderlink=, not for =cb_thunderlink=, so I have made some modifications to it. Also, there was a conditional to check if the system was Mac or not, I removed that part too as I do not need it. See the code below:

#+begin_src emacs-lisp
  (setq thunderbird-program "thunderbird")

  (defun org-message-thunderlink-open (slash-message-id)
    "Handler for org-link-set-parameters that converts a standard message:// link into
   a thunderlink and then invokes thunderbird."
    ;; remove any / at the start of slash-message-id to create real message-id
    (let ((message-id
           (replace-regexp-in-string (rx bos (* "/"))
                                     ""
                                     slash-message-id)))
      (kill-new (concat "cbthunderlink://" message-id))
      (start-process
       (concat "cbthunderlink: " message-id)
       nil
       thunderbird-program
       "-cbthunderlink"
       (concat "cbthunderlink://" message-id)
       )))
  ;; on message://aoeu link, this will call handler with //aoeu
  (org-link-set-parameters "message" :follow #'org-message-thunderlink-open)
#+end_src

A link generated with =cb_thunderlink= looks something like this:

#+begin_example
cbthunderlink://MjAyMy0wOC0yNVQxNToyOTowMC4wMDBaO05h
#+end_example

In the article [[https://vxlabs.com/2019/04/20/link-thunderbird-emails-from-emacs-orgmode/][Link directly to emails from Emacs Orgmode using Thunderbird and Thunderlink]] they suggest to write in your notes =message= instead of =cbthunderlink=, this way you can use something else in the future in case =cb_thunderlink= also dies as the linking system in your notes will not depend on it (at least completely).

In the configuration of the =cb_thunderlink= plugin you can manage the format to copy the email link. In my case I have made one called =emacsOrgLink=, which is set to ~[[message://$cblink$][$subject$]]~ to comply with Org-mode link format. Note that the name of the link will be the subject of the email.

The code above will associate the function ~org-message-thunderlink-open~ to the =message= key when =org-open-at-point= is executed on these links, and then it will replace =message= with =cbthunderlink= to pass the link to Thunderbird. Of course this part can be avoided by just letting the links in their original format (starting with =cbthunderlink=), and the function would be really simple. Once more, I chose =message= over =cbthunderlink= because =message= is built in Emacs. Nevertheless, I do not think if I stop using Thunderbird and go to Mu4e or Gnus the links would work (because of their =messageid= being different in Mu4e-Gnus VS =cb_thunderlink=). Anyway see [[https://vxlabs.com/2023/08/08/open-message/-links-with-mu4e-or-fastmail/][this recent post]] of vxlab which is similar to the one discussed above, but for Mu4e and fastmail. You can decide which format to use.

The last point to highlight is the use of ~(kill-new (concat "cbthunderlink://" message-id))~. Because of limitations of the Thunderbird API, which dropped support for the =thunderbird -thunderlink <email-link>= clickable feature, =cb_thunderlink= cannot directly open the emial is some systems (see documentation). In those systems where it cannot simulate the needed behavior and open the specific email directly, instead, it creates a button on the top-right corner (close to the "Display Thunderbird menu"), which once clicked will use the content of the clipboard to open the corresponding email, in case the content of the clipboard is a =cb_thunderlink= email link. This line of code copy the email link to the clipboard so we can access the desired email.

Summarizing, once everything is set up. You right-click on the body of the email in Thunderbird, go to the =cb_thunderlink= menu entry (usually on the bottom), and copy the formatted link you established (=emacsOrgLink= in my case). Next, past it in Emacs. Once you need to use it, just execute =org-open-at-point= (C-c C-o), and it will open Thunderbird, but in some cases not yet the specific email. If this functionality is missing, to open the specific email just click on the =cb_thunderlink= button on the top-right region. You should see now the email.

This solution is not es elegant as the use of Gnus and Notmuch, but certainly will require much less setup than those two, and time, which I don't have right now for that. If you have not the time, or would like to continue with the visual interface oriented approach that is Thunderbird in face to Gnus and Notmuch, this is the solution to have links in your notes redirecting to the related  email.

* Autocomplete
#+BEGIN_SRC emacs-lisp
  ;; (use-package auto-complete
  ;;   :ensure t
  ;;   :init
  ;;   (progn
  ;;     (ac-config-default)
  ;;     (global-auto-complete-mode t)
  ;;     ))
#+END_SRC

#+begin_src emacs-lisp
  (use-package company
    :ensure t
    :init
    ;;(setq global-company-mode t)
    :config
    (setq company-tooltip-align-annotations t)
    (setq company-tooltip-flip-when-above t)
    (setq company-idle-delay 0.2)
    (setq company-tooltip-align-annotations t)
    (setq company-minimum-prefix-length 3)
    (setq company-format-margin-function #'company-text-icons-margin)
    )

  (add-hook 'after-init-hook 'global-company-mode)
#+end_src

#+begin_src emacs-lisp
  (use-package company-auctex
    :ensure t
    )
#+end_src
* Projectile

#+begin_src emacs-lisp
  (use-package projectile
    :ensure t
    :init
    (projectile-mode +1)
    :bind (:map projectile-mode-map
                ("C-c p" . projectile-command-map)))
#+end_src

* Spelling
#+begin_src emacs-lisp
  (setq ispell-program-name "aspell")
  (require 'ispell)
#+end_src
* Python
#+BEGIN_SRC emacs-lisp
  ;; (use-package jedi  ;; It need virtualenv to be installed in the pc (pip install virtualenv)
  ;;   :ensure t
  ;;   :init
  ;;   (add-hook 'python-mode-hook 'jedi:setup)
  ;;   (add-hook 'python-mode-hook 'jedi:ac-setup)
  ;;   (add-hook 'python-mode-hook 'jedi:install-server)

  ;;   :config
  ;;   (progn
  ;;     (setq jedi:environment-root "jedi")  ; or any other name you like
  ;;     (setq jedi:environment-virtualenv
  ;;           (append python-environment-virtualenv
  ;;                   '("--python" "/usr/bin/python3")))
  ;;     (setq jedi:complete-on-dot t)
  ;;     (setq jedi:get-in-function-call-delay 1)
  ;;     ))
#+END_SRC

#+BEGIN_SRC emacs-lisp
  (defcustom python-shell-interpreter "python3"
    "Default Python interpreter for shell."
    :type 'string
    :group 'python)
#+END_SRC

#+BEGIN_SRC emacs-lisp
  ;; It is a package for documentation, completion, syntax check ...
  (use-package elpy
    :ensure t
    :config
    (elpy-enable)
    (setq python-indent-offset 4))
#+END_SRC

* Latex

#+BEGIN_SRC emacs-lisp
  (use-package tex
    :ensure auctex
    :ensure reftex
    :hook ((LaTeX-mode . flyspell-mode)
           (LaTeX-mode . visual-line-mode)
           (LaTeX-mode . LaTeX-math-mode)
           (LaTeX-mode . turn-on-reftex)
           )
    :config
    (setq TeX-parse-self t)
    (setq TeX-auto-save t)
    (setq-default TeX-master nil)
    (setq TeX-auto-local ".auto")
    ;;(setq-default TeX-parse-all-errors t)
    (setq-default TeX-display-help t)
    (setq reftex-label-alist '(AMSTeX)) ;; Para que ponga \eqref
    (setq reftex-plug-into-AUCTeX t)
    (setq bibtex-dialect 'biblatex)
    (setq reftex-cite-format 'biblatex)
    (setq reftex-default-bibliography '("/home/yaidel/config/latex_bib_databases/entireLibrary.bib"))
    (setq LaTeX-section-hook
          '(LaTeX-section-heading
            LaTeX-section-title
            LaTeX-section-toc
            LaTeX-section-section
            LaTeX-section-label))

    ;; (eval-after-load "tex" '(progn
    ;;                          (setq LaTeX-command (concat LaTeX-command " -shell-escape"))))
    ;; Don't forget to configure
    ;; Okular to use emacs in
    ;; "Configuration/Configure Okular/Editor"
    ;; = Editor = Emacsclient. (you should see
    ;; emacsclient -a emacs --no-wait +%l %(format "message" format-args))
    ;; in the field "Command".

    ;; Enable synctex correlation. From Okular just press
    ;; Shift + Left click to go to the good line.
    ;; From Evince just press Ctrl+Shift+Left click to go to the good line.
    (setq TeX-source-correlate-mode t
          TeX-source-correlate-start-server t)

    (eval-after-load "tex"
      '(setcar (cdr (assoc 'output-pdf TeX-view-program-selection)) "Evince"))
    )
#+END_SRC
* Spell for windows
# Info tomada de: https://lists.gnu.org/archive/html/help-gnu-emacs/2014-04/msg00030.html
#+BEGIN_SRC emacs-lisp
  ;; (if (eq system-type 'ms-dos)
  ;;     ((add-to-list 'exec-path "E:/config/hunspell/bin/")
  ;;      (setq ispell-program-name (locate-file "hunspell"
  ;; 					    exec-path exec-suffixes 'file-executable-p))

  ;;      (setq ispell-local-dictionary-alist '(

  ;; 					   (nil
  ;; 					    "[[:alpha:]]"
  ;; 					    "[^[:alpha:]]"
  ;; 					    "[']"
  ;; 					    t
  ;; 					    ("-d" "en_US" "-p" "E:\\config\\hunspell\\share\\hunspell\\en_US.aff")
  ;; 					    nil
  ;; 					    iso-8859-1)

  ;; 					   ("american"
  ;; 					    "[[:alpha:]]"
  ;; 					    "[^[:alpha:]]"
  ;; 					    "[']"
  ;; 					    t
  ;; 					    ("-d" "en_US" "-p" "E:\\config\\hunspell\\share\\hunspell\\en_US.aff")
  ;; 					    nil
  ;; 					    iso-8859-1)
  ;; 					   ))
  ;;      )
  ;;   (setq ispell-program-name "aspell")
  ;;   )

  ;; ;; activar ispell
  ;;(require 'ispell)
#+END_SRC
* Magit
#+BEGIN_SRC emacs-lisp
  (use-package magit
    :ensure t
  )
#+END_SRC

* ORG mode specifications

Some resources to which you can refer here are:
- [[https://orgmode.org/manual/index.html][The Org Manual]]
- [[https://blog.jethro.dev/posts/org_mode_workflow_preview/][Jethro's org-mode workflow]]
- [[http://cachestocaches.com/2016/9/my-workflow-org-agenda/][Caches to Caches]] (this blog is discontinued to the best of my knowledge)
- [[http://doc.norang.ca/org-mode.html][Bernt Hansen's guide]]

** Org mode
:PROPERTIES:
:ID:       ebdfd897-7542-44e6-8413-632b41e7fb32
:END:

Setting the name of the file where all the captured notes are going to.

#+begin_src emacs-lisp
  (setq organizer-file "20230105T175954--organizer__personal.org")
#+end_src


Set =C-c o= to edit the =organizer= file:

#+BEGIN_SRC emacs-lisp
  (defun organizer-visit ()
    (interactive)
    (find-file (concat "/media/Datos/notes/" organizer-file)))
  (global-set-key (kbd "C-c o") 'organizer-visit)
#+END_SRC


The =org-agenda-files= configuration has been written in the section [[*Adding _project files to the agenda][Adding _project files to the agenda]],
because it uses [[*Denote][Denote's]] tags in the file name to detect the project files and add them to the list.

#+begin_src emacs-lisp
  (use-package org
    :ensure t
    :hook
    (org-mode . flyspell-mode)
    (org-mode . visual-line-mode)
    (org-mode . org-indent-mode)
    :config

    ;; (setq org-adapt-indentation nil)  ;; set the identation method in ORG mode

    (setq org-clock-persist 'history) ;; Clocking projects time settings to save clocking history throughout sessions
    (org-clock-persistence-insinuate)
    (setq org-clock-idle-time 10)

    (setq org-clock-out-remove-zero-time-clocks t)  ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
    (setq calendar-week-start-day 1)

    ;;
    ;; Tasks and Todos
    (setq org-todo-keywords
          '((sequence "TODO(t)" "NEXT(n)" "WORKING(w)" "DELEGATED(g)" "|" "DONE(d)" "CANCELED(x)")
            (sequence "COMPUTE(c)" "COMPUTING(p)" "|" "FINISHED(f)" "UNFINISHED(u)")))
    (setq org-todo-keyword-faces
          (quote (("TODO"      :background "IndianRed1"      :foreground "black" :weight bold)
                  ("NEXT"      :background "sky blue"        :foreground "black" :weight bold)
                  ("WORKING"   :background "lemon chiffon"   :foreground "black" :weight bold)
                  ("COMPUTING" :background "lavender"        :foreground "black" :weight bold)
                  ("DONE"      :background "DarkOliveGreen2" :foreground "black" :weight bold)
                  ("CANCELED" :background "DarkOliveGreen2" :foreground "black" :weight bold)
                  ("DELEGATED" :background "aquamarine2"     :foreground "black" :weight bold))))
    (setq org-tag-alist
          '(("@project" . ?p) ("@someday" . ?s) ("@pyrene" . ?y) ("@curta" . ?c) ("@irene" . ?i)))

    ;;
    ;; TODO states trigers
    (setq org-todo-state-tags-triggers
          (quote ((done ("@pyrene") ("@curta") ("@irene") ("@project") ("@someday")))))

    ;;
    ;; Capture
    (setq org-directory "/media/Datos/notes/")
    (setq org-default-notes-file (concat org-directory organizer-file))
    (setq org-health-tracking-file (concat org-directory "20230815T112721--health-tracking__health.org"))
    (global-set-key (kbd "C-c c") 'org-capture)      ;; use C-c c to start capture mode

    ;; capture templates for: TODO tasks, Notes, appointments, meetings
    (setq org-templates-location-var (concat org-directory organizer-file))
    (setq org-capture-templates
          '(("t" "Todo" entry (file+headline org-templates-location-var "Inbox")
             "* TODO %? \nCaptured on %U")
            ("h" "Health Tracking" entry (file+headline org-health-tracking-file "Daily data")
             "* %t \n:PROPERTIES:\n:barras: %?\n:pararelas: \n:planchas: \n:abdominales: \n:dificultad: \n:ánimo: \n:tiempo: \n:sueño: \n:ayuno: \n:caminar: \n:END:")
            ("n" "Read later / take a note" entry (file+headline org-templates-location-var "Inbox")
             "* Note from %a\nCaptured on: %U\n\n*Highlighted region*: %i\n\n%?")
            ("c" "Coding" entry (file+headline org-templates-location-var "Inbox")
             "* TODO %? \nCaptured on %U\n*File*: [[file+emacs:%F]]\n*Highlighted region*:\n#+begin_src\n%i\n#+end_src\n\n")))

    ;; Refile
    ;; Targets include this file and any file contributing to the agenda - up to 9 levels deep
    ;; C-c C-w for refile
    (setq org-refile-targets (quote ((nil :maxlevel . 3)
                                     (org-agenda-files :maxlevel . 3))))
    ;;
    ;; Agenda customization
    ;;
    (global-set-key (kbd "C-c a") 'org-agenda)
    ;;
    ;; Format of the columns in the agenda view
    (setq org-columns-default-format-for-agenda "%65item(Task) %Effort(Effort){:} %clocksum_t(Today) %clocksum(Total)")
    ;; Format the habits tracker in the agenda buffer
    (setq org-habit-following-days 1)
    (setq org-habit-graph-column 80)


    (setq org-agenda-custom-commands
          '(("x" "My Agenda"  
             ((agenda "" ((org-agenda-overriding-header "Today's Schedule:")
                          (org-agenda-span 'day)
                          (org-agenda-ndays 1)
                          (org-agenda-start-on-weekday nil)
                          (org-agenda-start-day "+0d")
                          (org-agenda-sorting-strategy
                           (quote
                            (time-up deadline-down priority-down)))))
              (tags-todo "-@project/+WORKING"
                         ((org-agenda-overriding-header "Tasks in progress")
                          (org-agenda-sorting-strategy
                           (quote
                            (priority-down deadline-down effort-down)))))
              (tags-todo "-@project/+NEXT"
                         ((org-agenda-overriding-header "Next tasks")
                          (org-agenda-sorting-strategy
                           (quote
                            (priority-down deadline-down effort-down)))
                          (org-agenda-max-entries 5)))
              (tags-todo "-@project/+TODO"
                         ((org-agenda-overriding-header "TODOs")
                          (org-agenda-sorting-strategy
                           (quote
                            (priority-down deadline-down effort-down)))
                          (org-agenda-max-entries 5)))
              ;; (agenda ""
              ;;         ((org-agenda-overriding-header "The Week in a Glance:")
              ;;          (org-agenda-sorting-strategy
              ;;           (quote
              ;;            (time-up deadline-down priority-down)))))
              (tags "+@capture-@excludeFromAgenda"
                    ((org-agenda-overriding-header "Items to refile")
                     ;;(org-tags-match-list-sublevels nil)
                     (org-agenda-sorting-strategy
                      (quote
                       (priority-down time-down)))))
              (org-agenda-list-stuck-projects)
              (tags "CLOSED<=\"<-1m>\""
                    ((org-agenda-overriding-header "Items to archive (older than a month)")
                     (org-agenda-span
                      (quote month))))))
            ("c" "Computations"
             ((tags-todo "TODO=\"COMPUTING\"+@curta"
                        ((org-agenda-overriding-header "Computations Curta")
                         (org-agenda-sorting-strategy
                          (quote
                           (priority-down deadline-down effort-down)))))
              (tags-todo "TODO=\"COMPUTING\"+@pyrene"
                          ((org-agenda-overriding-header "Computations Pyrene")
                           (org-agenda-sorting-strategy
                            (quote
                             (priority-down deadline-down effort-down)))))
              (tags-todo "TODO=\"COMPUTING\"+@irene"
                          ((org-agenda-overriding-header "Computations TGCC")
                           (org-agenda-sorting-strategy
                            (quote
                             (priority-down deadline-down effort-down)))))
              ))
            ("p" "Projects"
             ((tags-todo "+@project-@someday/-DELEGATED-DONE-CANCELED"
                    ((org-agenda-overriding-header "Working on:")
                     (org-agenda-sorting-strategy
                      (quote
                       (priority-down deadline-down effort-down)))))
              (tags-todo "+@project+@someday/-DELEGATED-DONE-CANCELED"
                         ((org-agenda-overriding-header "Maybe/Someday Projects:")
                          (org-agenda-sorting-strategy
                           (quote
                            (priority-down deadline-down effort-down)))))
              (org-agenda-list-stuck-projects)
              ))
            ))

    (setq org-stuck-projects
          '("+@project/-DONE-CANCELED-DELEGATED"   ;; entries considered as projects
            ("NEXT" "WORKING")                      ;; if none of these are present in the subtree, the project is stuck
            ("@someday")                            ;; list of tags identifying non-stuck projects
            ""))                                    ;; arbitrary regular expression matching non-stuck projects

    ;; as the @project tag defines what is a project, I do not want all the sub-trees are marked also as projects
    ;; I want to manually set what are the projects 
    (setq org-tags-exclude-from-inheritance '("@project" "project" "blog" "@excludeFromAgenda"))

    )
#+end_src

Furthermore, to automatically set the values displayed in the agenda identifying the file from where the task is being pulled from to the "humanized" name of the file in the file-system, Boris Buliga proposed the following configuration in [[https://d12frosted.io/posts/2020-06-24-task-management-with-roam-vol2.html][this blog post]]. Nevertheless, after some time using it, I removed it from my configuration. A simpler solution is just to specify the =#+category:= value in the heading of the =org= file
being added to the agenda, and that value will be the one appearing in the agenda dispatcher identifying that specific file. This solution is the implemented in =org-mode= by default, and therefore the more straightforward.

It has to be taken into account that a field of 12 characters is designed to show the categories, so =#+category= values longer than 10 characters should not be used to maintain beauty and order in the agenda dispatcher.

See also https://orgmode.org/manual/Categories.html for more.

#+begin_src example
  (defun vulpea-buffer-prop-get (name)
    "Get a buffer property called NAME as a string."
    (org-with-point-at 1
      (when (re-search-forward (concat "^#\\+" name ": \\(.*\\)")
                               (point-max) t)
        (buffer-substring-no-properties
         (match-beginning 1)
         (match-end 1)))))

  (defun vulpea-agenda-category (&optional len)
    (let* ((file-name (when buffer-file-name
                        (file-name-sans-extension
                         (file-name-nondirectory buffer-file-name))))
           (title (vulpea-buffer-prop-get "title"))
           (category (org-get-category))
           (result
            (or (if (and
                     title
                     (string-equal category file-name))
                    title
                  category)
                "")))
      (if (numberp len)
          (s-truncate len (s-pad-right len " " result))
        result)))

  (setq org-agenda-prefix-format
        '((agenda . "%(vulpea-agenda-category 12)%?-12t%s ")
          (todo .   "%(vulpea-agenda-category 12) ")
          (tags .   "%(vulpea-agenda-category 12) ")
          (search . "%(vulpea-agenda-category 12) ")))
#+end_src

Add the habit module to org.

#+begin_src emacs-lisp
  ;;
  ;; Habits module enabled
  ;; (add-to-list 'org-modules 'habit)
  (require 'org-habit)
#+end_src

Remove tags from the right columns of the agenda dispatcher.

#+begin_src emacs-lisp
  (setq org-agenda-remove-tags t)
#+end_src

Do not start the Agenda on Mondays, but the day you are on

#+begin_src emacs-lisp
(setq org-agenda-start-on-weekday nil)
#+end_src

** Activate Babel languages (gnuplot, python, etc)

To execute certain languages inside an org buffer and to use the data contained in it (ex. tables), you need to enable the language. See the documentation [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.html][in the case of gnuplot]] and [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html][in the case of python]] for more information.

#+begin_src emacs-lisp
      ;; active Babel languages
      (org-babel-do-load-languages
       'org-babel-load-languages
       '((gnuplot . t)
         (python . t)))
#+end_src

** Org-bullets

#+BEGIN_SRC emacs-lisp
  (use-package org-bullets
    :ensure t
    :after (org)
    :hook
    (org-mode . (lambda () (org-bullets-mode 1)))
    :config
    (setq org-log-done 'time)
    (setq org-file-apps-gnu ;; esto es para que al exportar en org-mode se abra correctamente el PDF
	  (append '((t . "setsid -w xdg-open %s")) org-file-apps-gnu))
    :bind
    ("C-c x ." . 'org-time-stamp-inactive)
    )
#+END_SRC

** Visual tweaks

** Org Tempo

For Structure Templates [[https://orgmode.org/manual/Structure-Templates.html][(see Org webpage]])

#+begin_src emacs-lisp
  (require 'org-tempo)
  (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
  (add-to-list 'org-structure-template-alist '("py" . "src python"))
#+end_src

** Org Export Markdown

Enable Markdown export back-end (see [[https://orgmode.org/manual/Exporting.html][Org-export manual]])

#+begin_src emacs-lisp
(require 'ox-md)
#+end_src

** Org Export Latex

#+begin_src emacs-lisp
  (require 'ox-latex)

  ;; set the sequence for the compilation
  (setq org-latex-pdf-process
        '("pdflatex -interaction nonstopmode -output-directory %o %f"
          "bibtex %b"
          "pdflatex -interaction nonstopmode -output-directory %o %f"
          "pdflatex -interaction nonstopmode -output-directory %o %f"))

  ;; stop org adding hypersetup{author..} to latex export
  (setq org-latex-with-hyperref nil)
  ;; (setq org-latex-prefer-user-labels t)

  ;; deleted unwanted file extensions after latexMK
  (setq org-latex-logfiles-extensions
        (quote ("lof" "lot" "tex~" "aux" "idx" "log" "out" "toc" "nav" "snm" "vrb" "dvi" "fdb_latexmk" "blg" "brf" "fls" "entoc" "ps" "spl" "bbl" "xmpi" "run.xml" "bcf" "acn" "acr" "alg" "glg" "gls" "ist")))

  (unless (boundp 'org-latex-classes)
    (setq org-latex-classes nil))
#+end_src

* Org-cite and citations handling
To configure the citations within Org, we have its Org-cite functionality. More information about this
functionality can be found in the follwoing sources:
- [[https://orgmode.org/manual/Citation-handling.html#Citation-handling][Citation handling (The Org Manual)]]
- [[https://kristofferbalintona.me/posts/202206141852/][Citations in Org-mode (by Kristoffer Balintona)]]
- [[https://blog.tecosaur.com/tmio/2021-07-31-citations.html#fn.3][Introducing citations (by Tecosaur)]]

To use Org-cite, the first step is to load the processor you are interested in to export your
bibliography. See [[https://orgmode.org/manual/Citation-export-processors.html][available processors here]]. 

#+begin_src emacs-lisp
  (require 'oc-basic)
  (require 'oc-biblatex)
  (require 'oc-csl)
#+end_src

Then, either you specify in a per file basis the procesor to use and the address of the bib file, or you do it
globally here at the configuration file. The first option would be as follows:

#+begin_example
,#+bibliography: /home/yaidel/config/latex_bib_databases/entireLibrary.bib
,#+cite_export: biblatex
Text with cites goes here.
,#+print_bibliography:
#+end_example

Nevertheless, I have chosen the second option, globally specifying the processors for different types of
files, and also the entireLibrary.bib resource. Note that =#+print_bibliography:= has to be entered manually
where you whant the bibliography to appear.

#+begin_src emacs-lisp
  (setq org-cite-global-bibliography '("/home/yaidel/config/latex_bib_databases/entireLibrary.bib"))
  (setq org-cite-export-processors
        '((md . (csl "chicago-fullnote-bibliography.csl"))   ; Footnote reliant
          (latex biblatex)                                   ; LaTeX
          (odt . (csl "vancouver-superscript.csl"))  ; Footnote reliant
          (t basic)))
  (setq org-cite-csl-styles-dir "/home/yaidel/config/ZoteroData/styles")

  (use-package citeproc
    :ensure t)
#+end_src

For LaTeX it is possible to specify other options and customizations, and if it is true that there may be a
way to do so exclusively using Org-cite, I have come to find the use of =#+LATEX_HEADER:= to add LaTeX
options. I have created an Skeleton in [[*Org mode and note taking][Org mode and note taking]] section which is called
=skeleton-org-export-latex-options= to handle automatically the necessary options to export to as I want.
* Calendar and Diary

The following option displays by default the dates which are holidays in a different face in the calendar. This can be achieved also pressing =x= in the calendar buffer. To remove this behavior use the key =u= in the calendar buffer. For more information see section "28.6 Holidays" in the Emacs Manual.

#+begin_src emacs-lisp
(setq calendar-mark-holidays-flag t)
#+end_src

* Denote

*Denote Tips*
- When using =denote-open-or-create=, if you type-in the name of the note to find that it does not exists, and
  you want to create it, after hitting ENTER you'll be redirected to the echo area to enter the name of the
  note. *Hitting =M-p= will bring back the name you entered previously*

#+begin_src emacs-lisp
  (use-package denote
    :ensure t
    :demand t
    :config
    ;;
    ;; General key bindings
    (setq denote-directory (expand-file-name "/media/Datos/notes"))
    (setq denote-known-keywords '("emacs" "project"))
    (setq denote-infer-keywords t)
    (setq denote-sort-keywords t)
    ;;
    ;; Tweaking the frontmatter
    (setq denote-org-front-matter
          "#+title:      %s\n#+date:       %s\n#+filetags:   %s\n#+identifier: %s\n#+author:     yaidel\n#+startup:    showall\n\n")
    :bind
    ("C-c n f" . denote-open-or-create)
    ("C-c n n" . denote)
    ("C-c n l" . denote-link-or-create)
    ("C-c n B" . denote-find-link)
    ("C-c n b" . denote-backlinks)
    )
#+end_src

** Adding _project files to the agenda

First we set the =org-agenda-files= to point to the notes folder, so it shoud use the =org-agenda-file-regexp=
default value to load all the files inside it which end by =.org=. The next step is then to modify the
=org-agenda-file-regexp= variable to load all the files containig the keyword =_project=.

This means that all the project files will be added to the =org-agenda-file= variable, which is almost
perfect, as those files are the ones which should have TODOs.

Note that the =list= function is important in setting =org-agenda-files= with =setq=, as it need to be a list,
and not a string. Also, if instead of =setq= one uses =add-to-list=, it is ok to just write the string. 

#+begin_src emacs-lisp
  (setq org-agenda-file-regexp "\\`[^.].*_project.*\\.org\\'")
  (setq org-agenda-files (list "/media/Datos/notes/" (concat org-directory organizer-file)))
#+end_src

But the addition of the project files to the agenda will happen when Emacs loads, what if we added some other
projects during this section and what to have them in the agenda?

*The following functions need some more refinement*

The problem with the function adding the new file tagged as =_project= to the list =org-agenda-files= is that
it is an =after-save-hook=. This means that it will be executed each time you save a file. As consequence, if
you opened an existing file which is a project you have already being working on, make some modifications, and
save it, you will be saving a file which has the =_project= keyword. As consequence, it will be listed twice
in the =org-agenda-files= variable, and its entries will appear duplicate in the agenda dispatcher. A solution
to this problem would be to check if the file being added already exists in the =org-agenda-files= list, and
add it only if it is not. Unfortunately, at the moment I do not know how to do that en Elisp. The solution is
to comment the function and add any new file in the session to the =org-agenda-files= by using the
=org-agenda-file-to-front= (bind to =C-c [=). In a new session the new project will be added automatically due
to the above declaration of =org-agenda-file-regexp=.

Additionally, Protesilaos also provided a function which deletes the file from the =org-agenda-files= variable
when the tag =project= is removed. Nevertheless, it has a problem: when the _project keyword is removed (by
using =denote-keywords-remove=), then the file is no longer named as it is specified in the =org-agenda-files=
variable, because the =_project= part of the name was removed together with the keyword. For that reason this
function will never succeed in removing the file from the list.

Anyhow, the files will be deleted once emacs is closed and reopened, due to the definition of
=org-agenda-files= and =org-agenda-file-regexp= (see above).

#+begin_src emacs-lisp
  ;; (defvar my-denote-to-agenda-regexp "_project"
  ;;     "Denote file names that are added to the agenda.
  ;;       See `my-denote-add-to-agenda'.")
  ;;
  ;;   (defun my-denote-add-to-agenda ()
  ;;     "Add current file to the `org-agenda-files', if needed.
  ;;       The file's name must match the `my-denote-to-agenda-regexp'.
  ;;
  ;;       Add this to the `after-save-hook' or call it interactively."
  ;;     (interactive)
  ;;     (when-let* ((file (buffer-file-name))
  ;;                 ((denote-file-is-note-p file))
  ;;                 ((string-match-p my-denote-to-agenda-regexp (buffer-file-name))))
  ;;       (add-to-list 'org-agenda-files file)))
  ;;
  ;;   (add-hook 'after-save-hook #'my-denote-add-to-agenda)
#+end_src

#+begin_src emacs-lisp
  ;; (defun my-denote-remove-from-agenda ()
  ;;   "Remove current file from the `org-agenda-files'.
  ;;     See `my-denote-add-to-agenda' for how to add files to the Org
  ;;     agenda."
  ;;   (interactive)
  ;;   (when-let* ((file (buffer-file-name))
  ;;               ((string-match-p my-denote-to-agenda-regexp (buffer-file-name))))
  ;;     (setq org-agenda-files (delete file org-agenda-files))))
  ;; (add-hook 'after-save-hook #'my-denote-remove-from-agenda)
#+end_src

Furthermore, to those using Org-roam, https://d12frosted.io/ has a perfect solution to add files with TODOs to
the =org-agenda-files= variable. In fact, that solution is much better than adding all files with the
=_project= keyword in their name, but it is not possible to implement while using Denote. Because Denote do
not uses databases, the search for all the files containing =:project:= as keyword in the org heading is not
possible. 

** Journal entries

Define a function to handle the creation of the journal entry:

#+begin_src emacs-lisp
  (defun my-denote-journal ()
    "Create an entry tagged 'journal' with the date as its title.
  If a journal for the current day exists, visit it.  If multiple
  entries exist, prompt with completion for a choice between them.
  Else create a new file."
    (interactive)
    (let* ((today (format-time-string "%A %e %B %Y"))
           (string (denote-sluggify today))
           (files (denote-directory-files-matching-regexp string)))
      (cond
       ((> (length files) 1)
        (find-file (completing-read "Select file: " files nil :require-match)))
       (files
        (find-file (car files)))
       (t
        (denote
         today
         '("journal"))))))
#+end_src

And add a key binding for it

#+begin_src emacs-lisp
  (global-set-key (kbd "C-c n j") 'my-denote-journal)
#+end_src

Finally, define a function and a keybinding to handle the creation of weekly review journal entries:

#+begin_src emacs-lisp
  (defun my-denote-weekly-review ()
    "Create an entry tagged 'week' with the date as its title.
  If a week-note for the current week exists, visit it.  If multiple
  entries exist, prompt with completion for a choice between them.
  Else create a new file."
    (interactive)
    (let* ((today (format-time-string "Weekly review for week number %W of %Y"))
           (string (denote-sluggify today))
           (files (denote-directory-files-matching-regexp string)))
      (cond
       ((> (length files) 1)
        (find-file (completing-read "Select file: " files nil :require-match)))
       (files
        (find-file (car files)))
       (t
        (denote
         today
         '("journal"))))))
#+end_src

And add a key binding for it

#+begin_src emacs-lisp
  (global-set-key (kbd "C-c n w") 'my-denote-weekly-review)
#+end_src

* ERC

Initial configuration of the user and chats to connect to.

#+begin_src emacs-lisp
  (setq erc-server "irc.libera.chat"
	erc-port "6697"
	erc-nick "yaidel"
	erc-user-full-name "yaidel"
	erc-track-shorten-start 8
	erc-autojoin-channels-alist '(("irc.libera.chat" . "#emacs"))
	erc-kill-buffer-on-part t
	erc-auto-query 'bury)
#+end_src

Configuration of what to show or not on the cannels and the changes in status of them and thir participants

#+begin_src emacs-lisp
  (setq ;;erc-track-exclude '("#emacs")
   erc-track-exclude-types '("JOIN" "NICK" "QUIT" "MODE" "AWAY")
   erc-hide-list '("JOIN" "NICK" "QUIT" "MODE" "AWAY")
   erc-track-exclude-server-buffer t
   erc-interpret-mirc-color t)
#+end_src

This causes ERC to connect to the Libera.Chat network upon hitting C-c f
#+begin_src emacs-lisp
  (global-set-key "\C-cf" (lambda () (interactive)
			    (erc-tls :server "irc.libera.chat" :port "6697"
				     :nick "yaidel")))
#+end_src

Facilitating the automatic loggin to the IRC server by using auth-source library.

#+begin_src emacs-lisp
  (setq erc-prompt-for-password nil)
  (setq erc-prompt-for-nickserv-password nil)
  (setq auth-sources '(password-store))
#+end_src

** password-store

#+begin_src emacs-lisp
  (use-package password-store
    :ensure t)
#+end_src

* Markdown mode

#+begin_src emacs-lisp
  (use-package markdown-mode
    :ensure t
    :mode ("README\\.md\\'" . gfm-mode)
    :init (setq markdown-command "multimarkdown")
    :hook
    (markdown-mode . flyspell-mode)
    (markdown-mode . visual-line-mode)
    )
#+end_src

* Skeletons

Skeletons are a functionality available in Emacs Lisp which serves as shorthands, kind of what Yasnippets do,
but it already incorporated into Emacs and no other package is needed. The syntax they follow can be see at
[[https://www.gnu.org/software/emacs/manual/html_node/autotype/Skeleton-Language.html][the manual page]]. Some further examples and explainations can also be found at the Emacswiki [[https://www.emacswiki.org/emacs/SkeletonMode][SkeletonMode page]].

** Org mode and note taking

For more configuration of the LaTex export options, see:
- The [[https://orgmode.org/manual/LaTeX-Export.html][LaTeX Export]] section of the Org-mode manual.

#+begin_src emacs-lisp
  (define-skeleton skeleton-org-export-latex-options
    "Options inserted into an org file to export it to LaTex or PDF."
    nil
    "#+LATEX_CLASS_OPTIONS: [12pt]\n"
    "#+LATEX_HEADER: \\usepackage[style=numeric-comp, sorting=none, maxbibnames=3, minbibnames=3, maxcitenames=1, mincitenames=1, isbn=false, url=false, doi=false, eprint=false, related=false]{biblatex}\n"
    "#+LATEX_HEADER: \\renewbibmacro{in:}{}\n"
    "#+OPTIONS: \<:nil c:nil todo:nil H:5\n\n"

    _

    "\n\n* References\n"
    ":PROPERTIES:\n"
    ":UNNUMBERED: t\n"
    ":END:\n"
    "#+print_bibliography: :heading none"
  )
#+end_src

Project Meaningful Planning

#+begin_src emacs-lisp
  (define-skeleton skeleton-project-body
    "Insert the body of the Project Planning, acording to the Getting Things Done principles"
    nil
    "* NAME OF THE PROJECT"_ " :@project:\n" 
    "\n"
    "Think carefully, after the Purpose and Principles section completion, if the project is really worth our\n"
    "effort and time.\n"
    "\n"
    "- /Resources/: Me\n"
    "\n"
    "** Purpose and Principles of the project\n"
    "\n"
    "The first step when starting a project is to clearly define *why* are we going to spend *our time* in it. This\n"
    "way we can see why is it important, and why will its outcome be important to us. Also knowing the project's\n"
    "standards and quality requirements will help us. We do not need to put so much effort in something which has\n"
    "low standards, as a small tutorial for a friend, for example...some picture would suffice there.\n"
    "\n"
    "- /Why this project needs to be produced (its purpose)?/: \n"
    "- /What are the standards and quality requirements for the project (its principles)/: \n"
    "\n"
    "** Outcome visioning\n"
    "\n"
    "What will result from a successful outcome? What will it be like when the project is out in the world? It is\n"
    "easier to visualize something and head towards it, than going without direction. This will help to know what\n"
    "it might take to get there.\n"
    "\n"
    "- /What the end product will ideally look like/: \n"
    "- /How I will ideally feel afterwards/: \n"
    "- /How others will ideally respond/: \n"
    "- /What else will result from the completion of the project/: \n"
    "\n"
    "** Ideas dump\n"
    "\n"
    "Write *ever* idea that comes to your mind related to this project. It may be tasks to do, sub-projects to\n"
    "derive from it, relations with other projects, strategies to follow... *Everything*. Aim for *quantity over\n"
    "quality*. Resist organization, correction and analysis. Those are tasks to develop after all the ideas have\n"
    "been written down.\n"
    "\n"
    "- Ideas ...\n"
    "\n"
    "** To do list\n"
    "\n"
    "After the [[*Ideas sump][Ideas dump]] process, and in its organization process, some tasks will need to be done to achieve the\n"
    "final outcome of the project. This is the place to write them. Including the project in the\n"
    "=org-agenda-files=, and adding =TODO= and =NEXT= items, it is really easy to keep track of its progress\n"
    "together with all others at the same time, due to the =Org Agenda= exceptional capacities in doing so. If more\n"
    "information on this is needed, it can be found at [[file:/media/Datos/notes/20230105T120307--working-in-org-mode__config_emacs.org::*Agenda files][this tips note]] or at the specific section of the Emacs\n"
    "configuration file ([[*Adding _project files to the agenda][Adding _project files to the agenda]]).\n"
    "\n"
    )
#+end_src

The following Skeletons the column view I use to identify the time estimated and expended in the projects and
tasks. More information can be found at the [[https://orgmode.org/manual/Column-View.html][Column View]] section of the Org-mode manual, but the most basic
ones are given in the next table:

| Keybinding  | Function          | Description                                                  |
|-------------+-------------------+--------------------------------------------------------------|
| C-c C-x e   | org-set-effort    | Set the effort property of the current entry.                |
| C-c C-x C-c | org-columns       | Turn on column view on an Org mode file.                     |
| C-c C-c     | org-ctrl-c-ctrl-c | If column view is active, in agenda or org buffers, quit it. |

#+begin_src emacs-lisp
  (define-skeleton skeleton-column-project-times
    "Insert a global column definition to show that time estimated VS the real time expended in a project."
    nil
    "#+columns:    %65item(Task) %Effort(Effort){:} %clocksum_t(Today) %clocksum(Total)"
    )

#+end_src

** LaTeX

Article skeleton

#+begin_src emacs-lisp
  (define-skeleton skeleton-LaTeX-article
    "The skeleton of an article in LaTeX"
    nil
    "\\documentclass{article}\n"
    "\\usepackage{/home/yaidel/config/dotFiles/latex_styles/article_sty}\n"
    "\\addbibresource{/home/yaidel/config/latex_bib_databases/entireLibrary.bib}\n"
    "\n"
    "\\title{}\n"
    "\\author{Yaidel TOLEDO GONZALEZ}\n"
    "\\date{\\today}\n"
    "\n"
    "\\begin{document}\n"
    "\\maketitle\n"
    "\\tableofcontents\n"
    "\n"
    _
    "\n\n"
    "\\printbibliography\n"
    "\\end{document}\n"
    )
#+end_src

** Hugo and blogging

Heading for Markdown Hugo post using the Yugo theme

#+begin_src emacs-lisp
  (define-skeleton skeleton-md-Yugo-heading-hugo-post
    "Heading for a new post in Hugo using Markdown and the Yugo theme"
    nil
    "---\n"
    "title: \n" _
    "author:\n"
    "  post_name: yaidel\n"
    "  mdata_name: yaidel\n"
    "date: \"2023-01-01\"\n"
    "lastmod: \"2023-01-01\"\n"
    "categories: [""]\n"
    "tags: [""]\n"
    "draft: true\n"
    "description: \n"
    "---\n"
    )
#+end_src

#+begin_src emacs-lisp
  (define-skeleton skeleton-md-PaperMod-heading-hugo-post
    "Heading for a new post in Hugo using Markdown and the PaperMod theme"
    nil
    "---\n"
    "title: \"" _ "\"\n"
    "date: 2023-04-10\n"
    "# weight: 1 # pin the post to the begining no matter the date\n"
    "# aliases: [\"/alias-to-post\"]\n"
    "tags: [\"tag1\"]\n"
    "categories: [\"cat1\"]\n"
    "author: [\"yaidel\"]\n"
    "showToc: false\n"
    "TocOpen: false\n"
    "draft: true\n"
    "hidemeta: false\n"
    "math: false\n"
    "description: \"Desc Text.\"\n"
    "cover:\n"
    "    image: \"<figure-path>\"\n"
    "    alt: \"<alt text>\"\n"
    "    caption: \"<text>\"\n"
    "    relative: true # when using page bundles set this to true\n"
    "    hidden: false # only hide on current single page\n"
    "---\n"
    )
#+end_src


Figures polaroid like in a blog post

#+begin_src emacs-lisp
  (define-skeleton skeleton-Hugo-fig-polaroid
    "Hugo shortcode for the images showed as Polaroid"
    nil
    
    "{{< img class=\"polaroidImage\" width=\"50%\" src=\"image.png\" caption=\"Caption\" link=\"https://poview.org\" alt=\"Alternative text\" mouse=\"Mouse over\" >}}\n"
    )
#+end_src

* GNUPlot mode

#+begin_src emacs-lisp
  (use-package gnuplot-mode
    :ensure t)
#+end_src

#+begin_src emacs-lisp
  (use-package gnuplot
    :ensure t)
#+end_src

* Go-lang mode

#+begin_src emacs-lisp
  (use-package go-mode
    :ensure t)
#+end_src

* Packages I want to try and probably use
- PDFTools: https://github.com/vedang/pdf-tools
- Org-noter: https://github.com/weirdNox/org-noter
- Org-Download: https://github.com/abo-abo/org-download
- Org-Protocol: https://orgmode.org/worg/org-contrib/org-protocol.html
- Eglot: https://github.com/joaotavora/eglot
  - It's like an auto-completion and helper major mode.