[Emacs Lisp] Personal ~/.emacs.d/ configuration folder.
Org mode is now its own top-level section <3
smart-documents.org
@@ -556,237 +556,8 @@
556
556
(require 'bind-key)
557
557
#+END_SRC
558
558
559
Removed:
** ~org-mode~
559
Added:
** ~evil-mode~
560
560
561
Removed:
Phew, I can finally introduce Org mode! I am so *excited*.
562
Removed:
563
Removed:
Org mode replaces aword processor, a presentation creator, and a spreadsheet
564
Removed:
editor. IMHO, the spreadsheet ability captures more than 80% use cases wherein
565
Removed:
one wishes to include a table in a text document destined for physical
566
Removed:
publication. (It is clear that Excel spreadsheets are /not/ destined for
567
Removed:
physical publication---simply attempt to print an Excel spreadsheet with the
568
Removed:
default settings.) In my opinion, Org mode matches all /useful/ features of
569
Removed:
the Microsoft Office suite 1-to-1.
570
Removed:
571
Removed:
What follows are customizations designed to make Org mode behave more like
572
Removed:
Microsoft Word. The end goal is, once again, to draw as many new users to Emacs
573
Removed:
as possible!
574
Removed:
575
Removed:
Check out how much information Org mode keeps concerning the most recent
576
Removed:
header:
577
Removed:
578
Removed:
#+NAME: org-meta-info
579
Removed:
#+BEGIN_SRC emacs-lisp :tangle no :results pp :exports both :cache yes
580
Removed:
(save-excursion
581
Removed:
(org-previous-visible-heading 1)
582
Removed:
(org-element-at-point))
583
Removed:
#+END_SRC
584
Removed:
585
Removed:
#+RESULTS[cf28d310a45fa4e4dcd49882889cd36a2ae3820d]: org-meta-info
586
Removed:
: (headline
587
Removed:
: (:raw-value "~org-mode~" :begin 15920 :end 23157
588
Removed:
: :pre-blank 1 :contents-begin 15935 :contents-end 23156
589
Removed:
: :level 2 :priority nil :tags nil
590
Removed:
: :todo-keyword nil :todo-type nil
591
Removed:
: :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 15920 :title "~org-mode~"))
592
Removed:
593
Removed:
*** Basic customization
594
Removed:
595
Removed:
Org base directory is in user home on GNU/Linux, or in =AppData= in MS Windows.
596
Removed:
597
Removed:
#+NAME: org-directory
598
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
599
Removed:
(setq org-directory (concat user-emacs-directory "~/org"))
600
Removed:
#+END_SRC
601
Removed:
602
Removed:
First, we hide markup symbols for *bold*, /italic/, _underlined_ and
603
Removed:
+strikethrough+ text, and ensure our document appears indented upon
604
Removed:
loading:[fn::It /appears/ indented, but the underlying plaintext file does not
605
Removed:
contain tab characters!]
606
Removed:
607
Removed:
For the time being, I will in fact display emphasis markers, because hiding
608
Removed:
them corrupts tables.
609
Removed:
610
Removed:
#+NAME: org-format
611
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
612
Removed:
(setq org-hide-emphasis-markers nil
613
Removed:
org-startup-indented t
614
Removed:
org-src-preserve-indentation nil
615
Removed:
org-edit-src-content-indentation 0)
616
Removed:
#+END_SRC
617
Removed:
618
Removed:
We enable the dynamic numbering of headlines in an Org buffer.
619
Removed:
620
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
621
Removed:
(add-hook 'org-mode-hook 'org-num-mode)
622
Removed:
#+END_SRC
623
Removed:
624
Removed:
*** Languages executable in smart documents
625
Removed:
626
Removed:
The following languages can be written inside =SRC= blocks, in view of being
627
Removed:
executed by the Org Babel backend.
628
Removed:
629
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
630
Removed:
(setq org-babel-load-languages
631
Removed:
'((shell . t)
632
Removed:
(python . t)
633
Removed:
(plantuml . t)
634
Removed:
(emacs-lisp . t)
635
Removed:
(awk . t)
636
Removed:
(ledger . t)
637
Removed:
(gnuplot . t)
638
Removed:
(latex . t)))
639
Removed:
640
Removed:
(org-babel-do-load-languages
641
Removed:
'org-babel-load-languages '((C . t) (shell . t) (gnuplot . t)))
642
Removed:
#+END_SRC
643
Removed:
644
Removed:
*** Prevent or warn on invisible edits
645
Removed:
646
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
647
Removed:
(setq org-catch-invisible-edits t)
648
Removed:
#+END_SRC
649
Removed:
650
Removed:
*** Agenda
651
Removed:
652
Removed:
The agenda displays a chronological list of headings across all agenda files
653
Removed:
for which the heading or body contain a matching =org-time-stamp=.[fn::An
654
Removed:
=org-time-stamp= can be inserted with ~C-c .~ (period)]
655
Removed:
656
Removed:
We open the agenda in a separate window.
657
Removed:
658
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
659
Removed:
(setq org-agenda-window-setup 'other-frame)
660
Removed:
#+END_SRC
661
Removed:
662
Removed:
*** Timestamps
663
Removed:
664
Removed:
More literary timestamps are exported to LaTeX using the following custom
665
Removed:
format:
666
Removed:
667
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
668
Removed:
(setq org-time-stamp-custom-formats
669
Removed:
'("%d %b. %Y (%a)" . "%d %b. %Y (%a), at %H:%M"))
670
Removed:
#+END_SRC
671
Removed:
672
Removed:
*** LaTeX export
673
Removed:
674
Removed:
We'll be compiling our documents with LuaTeX. This will afford us some
675
Removed:
future-proofing, since it was designated as the successor to pdfTeX by the
676
Removed:
latter's creators.
677
Removed:
678
Removed:
First, we define the command executed when an Org file is exported to
679
Removed:
LaTeX. We'll use =latexmk=, the Perl script which automagically runs binaries
680
Removed:
related to LaTeX in the correct order and the right amount of times.
681
Removed:
682
Removed:
Options and why we need them:
683
Removed:
- ~-shell-excape~ :: required by minted to color source blocks
684
Removed:
- ~-pdflatex=lualatex~ :: we use lualatex to generate our PDF
685
Removed:
- ~-interaction=nonstopmode~ :: go as far as possible without prompting user
686
Removed:
for input
687
Removed:
688
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
689
Removed:
(setq org-latex-pdf-process
690
Removed:
'("latexmk -pdf -f \
691
Removed:
-pdflatex=lualatex -shell-escape \
692
Removed:
-interaction=nonstopmode -outdir=%o %f"))
693
Removed:
#+END_SRC
694
Removed:
695
Removed:
**** Exporting timestamps
696
Removed:
697
Removed:
We customize the format for org time stamps to make them appear monospaced in
698
Removed:
our exported LaTeX documents. This makes them visually distinguishable from
699
Removed:
body text.
700
Removed:
701
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
702
Removed:
(setq org-latex-active-timestamp-format
703
Removed:
"\\texttt{%s}")
704
Removed:
(setq org-latex-inactive-timestamp-format
705
Removed:
"\\texttt{%s}")
706
Removed:
#+END_SRC
707
Removed:
708
Removed:
**** LaTeX packages
709
Removed:
710
Removed:
The following packages are loaded for every time we export to LaTeX.
711
Removed:
712
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
713
Removed:
(setq org-latex-packages-alist
714
Removed:
'(("AUTO" "polyglossia" t
715
Removed:
("xelatex" "lualatex"))
716
Removed:
("AUTO" "babel" t
717
Removed:
("pdflatex"))
718
Removed:
("" "booktabs" t
719
Removed:
("pdflatex"))
720
Removed:
("table,svgnames" "xcolor" t
721
Removed:
("pdflatex"))))
722
Removed:
#+END_SRC
723
Removed:
724
Removed:
**** Colored source blocks in PDF export
725
Removed:
726
Removed:
Little bonus for GNU/Linux users: syntax highlighting for source code blocks in
727
Removed:
LaTeX exports.
728
Removed:
729
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
730
Removed:
(when (string-equal system-type "gnu/linux")
731
Removed:
(add-to-list 'org-latex-packages-alist '("AUTO" "minted" t
732
Removed:
("pdflatex" "lualatex")))
733
Removed:
(setq org-latex-listings 'minted)
734
Removed:
(setq org-latex-minted-options '(("style" "friendly")
735
Removed:
("breaklines" "true")
736
Removed:
("breakanywhere" "true"))))
737
Removed:
#+END_SRC
738
Removed:
739
Removed:
**** Cleaning directory after PDF compilation
740
Removed:
741
Removed:
Now, we set the files to be deleted when a LaTeX \rightarrow PDF compilation
742
Removed:
occurs. We only care about two files, in the end: the Org mode file for
743
Removed:
edition, and the PDF for distribution.
744
Removed:
745
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
746
Removed:
(setq org-latex-logfiles-extensions
747
Removed:
'("aux" "bcf" "blg" "fdb_latexmk"
748
Removed:
"fls" "figlist" "idx" "log" "nav"
749
Removed:
"out" "ptc" "run.xml" "snm" "toc" "vrb" "xdv"
750
Removed:
"tex" "lot" "lof"))
751
Removed:
#+END_SRC
752
Removed:
753
Removed:
**** Chronological diary entries
754
Removed:
755
Removed:
By default, Org agenda inserts diary entries as the first under the selected
756
Removed:
date. It is preferable to insert entries in the order that they were recorded,
757
Removed:
i.e. chronologically.
758
Removed:
759
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
760
Removed:
(setq org-agenda-insert-diary-strategy 'date-tree-last)
761
Removed:
#+END_SRC
762
Removed:
763
Removed:
What follows is an additional document class structures that can be exported in
764
Removed:
LaTeX.
765
Removed:
766
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
767
Removed:
;; (add-to-list 'org-latex-classes
768
Removed:
;; '("book-blendoit"
769
Removed:
;; "\\documentclass[12pt]{book}"
770
Removed:
;; ("\\chapter{%s}" . "\\chapter*{%s}")
771
Removed:
;; ("\\section{%s}" . "\\section*{%s}")
772
Removed:
;; ("\\subsection*{%s}" . "\\subsection*{%s}")
773
Removed:
;; ("\\subsubsection*{%s}" . "\\subsubsection*{%s}")))
774
Removed:
#+END_SRC
775
Removed:
776
Removed:
**** Table of contents
777
Removed:
778
Removed:
By default, body text can immediately follow the table of contents. It is
779
Removed:
however cleaner to separate table of contents with the rest of the work.
780
Removed:
781
Removed:
#+BEGIN_SRC emacs-lisp :tangle yes
782
Removed:
(setq org-latex-toc-command "\\tableofcontents\\clearpage")
783
Removed:
#+END_SRC
784
Removed:
785
Removed:
The following makes =TODO= items appear red and =CLOSED= items appear green in
786
Removed:
Org's LaTeX exports. Very stylish, much flair!
787
Removed:
788
Removed:
** TODO ~evil-mode~
789
Removed:
790
561
Forgive me, for I have sinned.
791
562
792
563
This is the 2^{nd} most significant customization after ~org-mode~. Enabling
@@ -1054,6 +825,249 @@
1054
825
(when (string-equal system-type "gnu/linux")
1055
826
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))))
1056
827
#+END_SRC
828
Added:
829
Added:
* ~org-mode~
830
Added:
831
Added:
Phew, I can finally introduce Org mode! I am so *excited*.
832
Added:
833
Added:
Org mode replaces aword processor, a presentation creator, and a spreadsheet
834
Added:
editor. IMHO, the spreadsheet ability captures more than 80% use cases wherein
835
Added:
one wishes to include a table in a text document destined for physical
836
Added:
publication. (It is clear that Excel spreadsheets are /not/ destined for
837
Added:
physical publication---simply attempt to print an Excel spreadsheet with the
838
Added:
default settings.) In my opinion, Org mode matches all /useful/ features of
839
Added:
the Microsoft Office suite 1-to-1.
840
Added:
841
Added:
What follows are customizations designed to make Org mode behave more like
842
Added:
Microsoft Word. The end goal is, once again, to draw as many new users to Emacs
843
Added:
as possible!
844
Added:
845
Added:
Check out how much information Org mode keeps concerning the most recent
846
Added:
header:
847
Added:
848
Added:
#+NAME: org-meta-info
849
Added:
#+BEGIN_SRC emacs-lisp :tangle no :results pp :exports both :cache yes
850
Added:
(save-excursion
851
Added:
(org-previous-visible-heading 1)
852
Added:
(org-element-at-point))
853
Added:
#+END_SRC
854
Added:
855
Added:
#+RESULTS[cf28d310a45fa4e4dcd49882889cd36a2ae3820d]: org-meta-info
856
Added:
: (headline
857
Added:
: (:raw-value "~org-mode~" :begin 15920 :end 23157
858
Added:
: :pre-blank 1 :contents-begin 15935 :contents-end 23156
859
Added:
: :level 2 :priority nil :tags nil
860
Added:
: :todo-keyword nil :todo-type nil
861
Added:
: :post-blank 1 :footnote-section-p nil
862
Added:
: :archivedp nil :commentedp nil
863
Added:
: :post-affiliated 15920 :title "~org-mode~"))
864
Added:
865
Added:
** Basic customization
866
Added:
867
Added:
Org base directory is in user home on GNU/Linux, or in =AppData= in MS Windows.
868
Added:
869
Added:
#+NAME: org-directory
870
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
871
Added:
(setq org-directory (concat user-emacs-directory "~/org"))
872
Added:
#+END_SRC
873
Added:
874
Added:
First, we hide markup symbols for *bold*, /italic/, _underlined_ and
875
Added:
+strikethrough+ text, and ensure our document appears indented upon
876
Added:
loading:[fn::It /appears/ indented, but the underlying plaintext file does not
877
Added:
contain tab characters!]
878
Added:
879
Added:
For the time being, I will in fact display emphasis markers, because hiding
880
Added:
them corrupts tables.
881
Added:
882
Added:
#+NAME: org-format
883
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
884
Added:
(setq org-hide-emphasis-markers nil
885
Added:
org-startup-indented t
886
Added:
org-src-preserve-indentation nil
887
Added:
org-edit-src-content-indentation 0)
888
Added:
#+END_SRC
889
Added:
890
Added:
We enable the dynamic numbering of headlines in an Org buffer.
891
Added:
892
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
893
Added:
(add-hook 'org-mode-hook 'org-num-mode)
894
Added:
#+END_SRC
895
Added:
896
Added:
By default, we hide Org document properties such as =#+TITLE=, =#+AUTHOR=, and
897
Added:
=#+DATE=, because those keywords are defined when the document template is
898
Added:
populated. We can nevertheless always access those properties and edit them
899
Added:
manually, with a simple keyboard shortcut (cf. Section [[Open Org mode document
900
Added:
properties]]).
901
Added:
902
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
903
Added:
(defun sd-document-properties ()
904
Added:
"Open separate buffer enabling the editing of Org mode properties.")
905
Added:
#+END_SRC
906
Added:
907
Added:
908
Added:
** TODO Languages executable in smart documents
909
Added:
910
Added:
The following languages can be written inside =SRC= blocks, in view of being
911
Added:
executed by the Org Babel backend.
912
Added:
913
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
914
Added:
(setq org-babel-load-languages
915
Added:
'((shell . t)
916
Added:
(python . t)
917
Added:
(plantuml . t)
918
Added:
(emacs-lisp . t)
919
Added:
(awk . t)
920
Added:
(ledger . t)
921
Added:
(gnuplot . t)
922
Added:
(latex . t)))
923
Added:
924
Added:
(org-babel-do-load-languages
925
Added:
'org-babel-load-languages '((C . t) (shell . t) (gnuplot . t)))
926
Added:
#+END_SRC
927
Added:
928
Added:
** Prevent or warn on invisible edits
929
Added:
930
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
931
Added:
(setq org-catch-invisible-edits t)
932
Added:
#+END_SRC
933
Added:
934
Added:
** Agenda
935
Added:
936
Added:
The agenda displays a chronological list of headings across all agenda files
937
Added:
for which the heading or body contain a matching =org-time-stamp=.[fn::An
938
Added:
=org-time-stamp= can be inserted with ~C-c .~ (period)]
939
Added:
940
Added:
We open the agenda in a separate window.
941
Added:
942
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
943
Added:
(setq org-agenda-window-setup 'other-frame)
944
Added:
#+END_SRC
945
Added:
946
Added:
** Timestamps
947
Added:
948
Added:
More literary timestamps are exported to LaTeX using the following custom
949
Added:
format:
950
Added:
951
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
952
Added:
(setq org-time-stamp-custom-formats
953
Added:
'("%d %b. %Y (%a)" . "%d %b. %Y (%a), at %H:%M"))
954
Added:
#+END_SRC
955
Added:
956
Added:
** LaTeX export
957
Added:
958
Added:
We'll be compiling our documents with LuaTeX. This will afford us some
959
Added:
future-proofing, since it was designated as the successor to pdfTeX by the
960
Added:
latter's creators.
961
Added:
962
Added:
First, we define the command executed when an Org file is exported to
963
Added:
LaTeX. We'll use =latexmk=, the Perl script which automagically runs binaries
964
Added:
related to LaTeX in the correct order and the right amount of times.
965
Added:
966
Added:
Options and why we need them:
967
Added:
- ~-shell-excape~ :: required by minted to color source blocks
968
Added:
- ~-pdflatex=lualatex~ :: we use lualatex to generate our PDF
969
Added:
- ~-interaction=nonstopmode~ :: go as far as possible without prompting user
970
Added:
for input
971
Added:
972
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
973
Added:
(setq org-latex-pdf-process
974
Added:
'("latexmk -pdf -f \
975
Added:
-pdflatex=lualatex -shell-escape \
976
Added:
-interaction=nonstopmode -outdir=%o %f"))
977
Added:
#+END_SRC
978
Added:
979
Added:
*** Exporting timestamps
980
Added:
981
Added:
We customize the format for org time stamps to make them appear monospaced in
982
Added:
our exported LaTeX documents. This makes them visually distinguishable from
983
Added:
body text.
984
Added:
985
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
986
Added:
(setq org-latex-active-timestamp-format
987
Added:
"\\texttt{%s}")
988
Added:
(setq org-latex-inactive-timestamp-format
989
Added:
"\\texttt{%s}")
990
Added:
#+END_SRC
991
Added:
992
Added:
*** LaTeX packages
993
Added:
994
Added:
The following packages are loaded for every time we export to LaTeX.
995
Added:
996
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
997
Added:
(setq org-latex-packages-alist
998
Added:
'(("AUTO" "polyglossia" t
999
Added:
("xelatex" "lualatex"))
1000
Added:
("AUTO" "babel" t
1001
Added:
("pdflatex"))
1002
Added:
("" "booktabs" t
1003
Added:
("pdflatex"))
1004
Added:
("table,svgnames" "xcolor" t
1005
Added:
("pdflatex"))))
1006
Added:
#+END_SRC
1007
Added:
1008
Added:
*** Colored source blocks in PDF export
1009
Added:
1010
Added:
Little bonus for GNU/Linux users: syntax highlighting for source code blocks in
1011
Added:
LaTeX exports.
1012
Added:
1013
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
1014
Added:
(when (string-equal system-type "gnu/linux")
1015
Added:
(add-to-list 'org-latex-packages-alist '("AUTO" "minted" t
1016
Added:
("pdflatex" "lualatex")))
1017
Added:
(setq org-latex-listings 'minted)
1018
Added:
(setq org-latex-minted-options '(("style" "friendly")
1019
Added:
("breaklines" "true")
1020
Added:
("breakanywhere" "true"))))
1021
Added:
#+END_SRC
1022
Added:
1023
Added:
*** Cleaning directory after PDF compilation
1024
Added:
1025
Added:
Now, we set the files to be deleted when a LaTeX \rightarrow PDF compilation
1026
Added:
occurs. We only care about two files, in the end: the Org mode file for
1027
Added:
edition, and the PDF for distribution.
1028
Added:
1029
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
1030
Added:
(setq org-latex-logfiles-extensions
1031
Added:
'("aux" "bcf" "blg" "fdb_latexmk"
1032
Added:
"fls" "figlist" "idx" "log" "nav"
1033
Added:
"out" "ptc" "run.xml" "snm" "toc" "vrb" "xdv"
1034
Added:
"tex" "lot" "lof"))
1035
Added:
#+END_SRC
1036
Added:
1037
Added:
*** Chronological diary entries
1038
Added:
1039
Added:
By default, Org agenda inserts diary entries as the first under the selected
1040
Added:
date. It is preferable to insert entries in the order that they were recorded,
1041
Added:
i.e. chronologically.
1042
Added:
1043
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
1044
Added:
(setq org-agenda-insert-diary-strategy 'date-tree-last)
1045
Added:
#+END_SRC
1046
Added:
1047
Added:
What follows is an additional document class structures that can be exported in
1048
Added:
LaTeX.
1049
Added:
1050
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
1051
Added:
;; (add-to-list 'org-latex-classes
1052
Added:
;; '("book-blendoit"
1053
Added:
;; "\\documentclass[12pt]{book}"
1054
Added:
;; ("\\chapter{%s}" . "\\chapter*{%s}")
1055
Added:
;; ("\\section{%s}" . "\\section*{%s}")
1056
Added:
;; ("\\subsection*{%s}" . "\\subsection*{%s}")
1057
Added:
;; ("\\subsubsection*{%s}" . "\\subsubsection*{%s}")))
1058
Added:
#+END_SRC
1059
Added:
1060
Added:
*** Table of contents
1061
Added:
1062
Added:
By default, body text can immediately follow the table of contents. It is
1063
Added:
however cleaner to separate table of contents with the rest of the work.
1064
Added:
1065
Added:
#+BEGIN_SRC emacs-lisp :tangle yes
1066
Added:
(setq org-latex-toc-command "\\tableofcontents\\clearpage")
1067
Added:
#+END_SRC
1068
Added:
1069
Added:
The following makes =TODO= items appear red and =CLOSED= items appear green in
1070
Added:
Org's LaTeX exports. Very stylish, much flair!
1057
1071
1058
1072
* One-click workflows
1059
1073