#+STARTUP: overview indent
* Emacs configuration
+
** Elisp Header
#+begin_src emacs-lisp
;;; Commentary: Tangled version of esy.org
;;; Code:
#+end_src
+
** Set a higher GC threshold during initializion
+
#+begin_src emacs-lisp
(let ((normal-gc-cons-threshold (* 20 1024 1024))
(init-gc-cons-threshold (* 128 1024 1024)))
(add-hook 'emacs-startup-hook
(lambda () (setq gc-cons-threshold normal-gc-cons-threshold))))
#+end_src
+
** Package archives
#+begin_src emacs-lisp
(require 'package)
- (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
-
- (setq package-selected-packages
- '(academic-phrases ace-jump-mode ace-link affe alert all-the-icons
- all-the-icons-completion anzu auctex-latexmk beacon benchmark-init
- browse-at-remote browse-kill-ring cape corfu command-log-mode
- dabbrev define-word diff-hl diminish disable-mouse dockerfile-mode
- dtache elfeed emacsql-sqlite3 embark-consult erlang exec-path-from-shell
- expand-region flymake-swi-prolog fullframe ggtags git-blamed git-timemachine
- gitconfig-mode gitignore-mode gnu-elpa-keyring-update gnuplot gnuplot-mode
- go-mode graphviz-dot-mode helpful highlight-escape-sequences htmlize ialign
- keyfreq keycast iedit lin list-unicode-display lorem-ipsum magit-todos
- marginalia move-dup no-littering ns-auto-titlebar ob-prolog orderless
- org-superstar pdf-tools rainbow-delimiters rg smtpmail-multi tramp typit
- vterm vundo which-key whitespace-cleanup-mode hide-mode-line))
+ (add-to-list 'package-archives
+ '("melpa" . "http://melpa.org/packages/"))
+
+ (setq package-selected-packages '(academic-phrases ace-jump-mode
+ ace-link affe alert all-the-icons all-the-icons-completion anzu
+ auctex-latexmk beacon benchmark-init browse-at-remote
+ browse-kill-ring cape corfu command-log-mode dabbrev define-word
+ diff-hl diminish disable-mouse dockerfile-mode dtache elfeed
+ emacsql-sqlite3 embark-consult erlang exec-path-from-shell
+ expand-region flymake-swi-prolog fullframe ggtags git-blamed
+ git-timemachine gitconfig-mode gitignore-mode
+ gnu-elpa-keyring-update gnuplot gnuplot-mode go-mode
+ graphviz-dot-mode helpful highlight-escape-sequences htmlize
+ ialign keyfreq keycast iedit lin list-unicode-display
+ lorem-ipsum magit-todos marginalia move-dup no-littering
+ ns-auto-titlebar ob-prolog orderless org-superstar pdf-tools
+ rainbow-delimiters rg smtpmail-multi tramp typit vterm vundo
+ which-key whitespace-cleanup-mode hide-mode-line))
(package-initialize)
#+end_src
-#+RESULTS:
-
** Suppressing native compilation warnings
#+begin_src emacs-lisp
#+end_src
** History
+
#+begin_src emacs-lisp
(defun esy/setup-history ()
"Setup `recentf-mode', `savehist-mode' and more history-related settings."
** Display settings
*** Must have display settings
+
#+begin_src emacs-lisp
(setq use-file-dialog nil
use-dialog-box nil
(add-hook 'after-init-hook #'esy/setup-display)
#+end_src
+
** Org-mode settings :org:
*** Literate config bootstrap
#+begin_src emacs-lisp
(require 'f)
-
+
(defconst esy/website-source-root "~/checkouts/eshelyaron.com"
"Local path of my website sources")
- (defconst esy/website-target-html "/ssh:root@direct.eshelyaron.com:/var/www/html"
+ (defconst esy/website-source-org (expand-file-name "org"
+ esy/website-source-root)
+ "Local path of my website Org files")
+
+ (defconst esy/website-target-root "/ssh:root@direct.eshelyaron.com:/var/www"
"Remote path of my website pages")
+ (defconst esy/website-target-html (concat esy/website-target-root "/html")
+ "Remote path of my website pages")
+
+ (defconst esy/website-html-header
+ "<link rel=\"stylesheet\" href=\"/style.css\" type=\"text/css\"/>"
+ "HTML Header of my website pages")
+
(defconst esy/publish-project-index-template
`( :base-extension "org"
- :base-directory ,(expand-file-name "org" esy/website-source-root)
+ :base-directory ,esy/website-source-org
:exclude ".*"
:include ("index.org")
:publishing-function org-html-publish-to-html
:html-head "<link rel=\"stylesheet\" href=\"/style.css\" type=\"text/css\"/>"
- :html-postamble ,(f-read-text "~/checkouts/eshelyaron.com/org/html_postamble.html"))
+ :html-postamble ,(f-read-text
+ "~/checkouts/eshelyaron.com/org/html_postamble.html"))
+ "Template for the index page of my website")
+
+ (defconst esy/publish-project-config-template
+ `( :base-extension "org"
+ :base-directory ,esy/website-source-org
+ :exclude ".*"
+ :include ("esy.org")
+ :publishing-function org-html-publish-to-html
+ :html-head ,esy/website-html-header
+ :html-postamble ,(f-read-text
+ "~/checkouts/eshelyaron.com/org/html_postamble.html"))
"Template for the index page of my website")
(defconst esy/publish-project-static-template
- `( :base-directory ,(expand-file-name "org" esy/website-source-root)
+ `( :base-directory ,esy/website-source-org
:base-extension "ico\\|css\\|jpg\\|gif\\|png\\|txt\\|pdf"
:recursive t
:publishing-function org-publish-attachment)
:publishing-directory ,esy/website-target-html
.
,esy/publish-project-static-template)
- ("eshelyaron.com" :components ("index" "static"))
+ ("config"
+ :publishing-directory ,esy/website-target-html
+ .
+ ,esy/publish-project-config-template)
+ ("eshelyaron.com" :components ("index"
+ "static"
+ "config"))
("index.local"
- :publishing-directory ,(expand-file-name "html" esy/website-source-root)
+ :publishing-directory ,(expand-file-name "html"
+ esy/website-source-root)
.
,esy/publish-project-index-template)
+ ("config.local"
+ :publishing-directory ,(expand-file-name "html"
+ esy/website-source-root)
+ .
+ ,esy/publish-project-config-template)
("static.local"
- :publishing-directory ,(expand-file-name "html" esy/website-source-root)
+ :publishing-directory ,(expand-file-name "html"
+ esy/website-source-root)
.
,esy/publish-project-static-template)
- ("eshelyaron.local" :components ("index.local" "static.local" "config.local")))))
+ ("eshelyaron.local" :components ("index.local"
+ "static.local"
+ "config.local")))))
(add-hook 'after-init-hook #'esy/setup-publish)
#+end_src
#+end_src
** Display weekly agenda on startup
+
#+begin_src emacs-lisp :tangle no
(defun esy/display-weekly-agenda ()
"Display the weekly agenda."
*** Completions
#+begin_src emacs-lisp
- (defun esy/setup-completions ()
- "Setup completions related-package."
- (require 'corfu)
- (require 'dabbrev)
- (require 'cape)
- (require 'marginalia)
- (require 'orderless)
- (require 'all-the-icons)
- (require 'all-the-icons-completion)
- (require 'hide-mode-line)
- (setq corfu-cycle t
- corfu-auto t
- read-extended-command-predicate #'command-completion-default-include-p
- completions-format 'one-column
- completion-auto-select t
- completion-styles '(basic orderless)
- completion-show-help nil
- completion-wrap-movement t)
- (corfu-global-mode)
- (marginalia-mode)
- (add-to-list 'completion-at-point-functions #'cape-file)
- (add-to-list 'completion-at-point-functions #'cape-dabbrev)
- (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
- (add-hook 'completion-list-mode-hook #'hide-mode-line-mode))
-
- (add-hook 'after-init-hook #'esy/setup-completions)
+ (defun esy/setup-completions ()
+ "Setup completions related-package."
+ (require 'corfu)
+ (require 'dabbrev)
+ (require 'cape)
+ (require 'marginalia)
+ (require 'orderless)
+ (require 'all-the-icons)
+ (require 'all-the-icons-completion)
+ (require 'hide-mode-line)
+ (setq corfu-cycle t
+ corfu-auto t
+ read-extended-command-predicate #'command-completion-default-include-p
+ completions-format 'one-column
+ completion-auto-select nil
+ completion-styles '(basic orderless)
+ completion-show-help nil
+ completions-header-format nil
+ completion-auto-help 'visual
+ completions-max-height 16
+ completion-wrap-movement t)
+ (define-key minibuffer-local-completion-map [remap previous-line] #'minibuffer-previous-completion)
+ (define-key minibuffer-local-completion-map [remap next-line] #'minibuffer-next-completion)
+ (corfu-global-mode)
+ (marginalia-mode)
+ (add-to-list 'completion-at-point-functions #'cape-file)
+ (add-to-list 'completion-at-point-functions #'cape-dabbrev)
+ (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
+ (add-hook 'completion-list-mode-hook #'hide-mode-line-mode))
+
+ (add-hook 'after-init-hook #'esy/setup-completions)
#+end_src
#+end_src
** Setup PATH from shell environment
+
#+begin_src emacs-lisp
(require 'exec-path-from-shell)
(add-hook 'after-init-hook #'exec-path-from-shell-initialize)
#+end_src
** Programming
+
*** General =prog-mode= settings
+
#+begin_src emacs-lisp
(defun esy/setup-programming ()
"Setup `prog-mode' and more programming-related settings."
(add-hook 'prog-mode-hook #'esy/setup-programming)
#+end_src
+
*** Prolog specific settings
+
#+begin_src emacs-lisp
(add-to-list 'auto-mode-alist '("\\.pl\\'" . prolog-mode))
(add-to-list 'auto-mode-alist '("\\.plt\\'" . prolog-mode))
#+end_src
** LaTeX and PDF settings
+
#+begin_src emacs-lisp
(defun esy/pdf-tools-install ()
"Install PDF-Tools on demand."
(add-hook 'after-init-hook #'esy/setup-misc)
#+end_src
+
** Elisp Footer
#+begin_src emacs-lisp