Compare commits

...

13 Commits

Author SHA1 Message Date
Lucien Cartier-Tilet 8173bfcb20
[yadm] update private files 2021-03-26 13:52:55 +01:00
Lucien Cartier-Tilet 81ecf5ce0a
[Awesome, Bin] formatting 2021-03-26 13:52:08 +01:00
Lucien Cartier-Tilet dcf42a9340
[Bin] `emacs' is now designed as a fallback for `emacsclient' 2021-03-26 13:51:22 +01:00
Lucien Cartier-Tilet 5088871487
[Emacs] Remove unused column 2021-03-26 13:51:02 +01:00
Lucien Cartier-Tilet 126f265281
[Emacs] Remove indent-guide-mode
It slows Emacs too much and isn’t all that useful actually
2021-03-26 13:50:25 +01:00
Lucien Cartier-Tilet 8995aeb881
[Emacs] Formatting 2021-03-26 13:50:10 +01:00
Lucien Cartier-Tilet 841f6b7f85
[Emacs] Give mu4e the ability to export mails to PDF again! 2021-03-26 13:49:22 +01:00
Lucien Cartier-Tilet 4f7927a5f7
[Emacs] New keybindings for image-mode, change eshell keybinding
The eshell keybinding changes from SPC o a ' to SPC o '

It is now possible to open an image from image-mode in GIMP directly
as well as rotate it.
2021-03-26 13:47:53 +01:00
Lucien Cartier-Tilet ffacd7d71a
[Emacs] Ignore some recent files 2021-03-26 13:47:19 +01:00
Lucien Cartier-Tilet d4aaecab9b
[Emacs] Better org-mode visuals
Now inline source blocks should be fontified

We should also have better LaTeX handling as well as markers
2021-03-26 13:46:17 +01:00
Lucien Cartier-Tilet 43b8263702
[Emacs] Add two new custom functions 2021-03-26 13:45:47 +01:00
Lucien Cartier-Tilet 3909031ae2
[Emacs] Add Scala layer, revert relative lines settings 2021-03-26 13:45:11 +01:00
Lucien Cartier-Tilet 774f69589a
[Emacs] org-appear now on MELPA 2021-03-26 13:41:11 +01:00
6 changed files with 388 additions and 56 deletions

Binary file not shown.

View File

@ -118,7 +118,7 @@ This function is called at the very end of Spacemacs initialization."
'(objed-cursor-color "#ff6c6b")
'(org-export-headline-levels 4)
'(package-selected-packages
'(ob-latex-as-png nord-theme eshell-syntax-highlighting diredfl caddyfile-mode ob-swift wttrin wrap-region pinentry org-tree-slide org-sidebar org-ql peg ov org-super-agenda ts dired-du caddyfile-mode loop xkcd vmd-mode visual-fill-column typit mmt sudoku restclient-helm pony-mode pacmacs ox-reveal outorg ob-restclient ob-http meson-mode ibuffer-projectile lv helm-w3m w3m graphviz-dot-mode flycheck-gometalinter transient ess-smart-equals ess-R-data-view ctable ess julia-mode eshell-git-prompt emoji-cheat-sheet-plus edit-indirect dockerfile-mode docker docker-tramp company-restclient restclient know-your-http-well company-quickhelp company-emoji company-emacs-eclim eclim atomic-chrome websocket 2048-game ox-gfm slime-company slime common-lisp-snippets erlang insert-shebang fish-mode company-shell faceup racket-mode treepy graphql yapfify yaml-mode xterm-color web-beautify twittering-mode toml-mode tagedit stickyfunc-enhance smeargle slim-mode shell-pop selectric-mode scss-mode sass-mode ranger rainbow-identifiers pytest pyenv-mode py-isort pug-mode plantuml-mode phpunit phpcbf php-auto-yasnippets pdf-tools tablist ox-pandoc orgit org-present org-pomodoro alert log4e gntp ob-elixir multi-term markdown-toc magit-gitflow magit-gh-pulls livid-mode live-py-mode json-snatcher js2-refactor js-doc htmlize hlint-refactor hindent helm-pydoc helm-hoogle helm-gitignore helm-css-scss haskell-snippets haml-mode gnuplot glsl-mode gitignore-mode github-search github-clone github-browse-file gitconfig-mode gitattributes-mode git-messenger gist gh marshal logito pcache ht gh-md flyspell-correct-helm flyspell-correct flycheck-rust pos-tip flycheck-mix flycheck-credo eshell-z eshell-prompt-extras esh-help drupal-mode disaster cython-mode dash-functional tern company-ghci company-ghc ghc color-identifiers-mode cmm-mode clang-format cargo auto-dictionary alchemist modern-cpp-font-lock yasnippet-snippets x86-lookup web-mode srefactor racer pyvenv pip-requirements pandoc-mode org-projectile org-category-capture org-mime org-download nasm-mode json-reformat intero imenu-list hy-mode git-timemachine git-link geiser flycheck-pos-tip flycheck-haskell evil-magit emmet-mode cmake-mode anaconda-mode rust-mode elixir-mode flycheck haskell-mode multiple-cursors skewer-mode simple-httpd markdown-mode magit magit-popup git-commit ghub with-editor pythonic emms gmail-message-mode ham-mode html-to-markdown flymd edit-server image-dired+ go-guru go-eldoc company-go go-mode unfill mwim company-web web-completion-data company-tern company-cabal company-c-headers company-auctex company-anaconda elcord xresources-theme sql-indent rainbow-mode php-extras php-mode mmm-mode json-mode js2-mode csv-mode coffee-mode auctex helm-company helm-c-yasnippet fuzzy company-statistics company auto-yasnippet yasnippet ac-ispell auto-complete ws-butler winum which-key volatile-highlights vi-tilde-fringe uuidgen use-package toc-org spaceline powerline restart-emacs request rainbow-delimiters popwin persp-mode pcre2el paradox spinner org-plus-contrib org-bullets open-junk-file neotree move-text macrostep lorem-ipsum linum-relative link-hint indent-guide hydra hungry-delete hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation helm-themes helm-swoop helm-projectile helm-mode-manager helm-make projectile pkg-info epl helm-flx helm-descbinds helm-ag google-translate golden-ratio flx-ido flx fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-ediff evil-args evil-anzu anzu evil goto-chg undo-tree eval-sexp-fu highlight elisp-slime-nav dumb-jump f dash s diminish define-word column-enforce-mode clean-aindent-mode bind-map bind-key auto-highlight-symbol auto-compile packed aggressive-indent adaptive-wrap ace-window ace-link ace-jump-helm-line helm avy helm-core popup async))
'(org-appear yasnippet-snippets yapfify yaml-mode xkcd x86-lookup wttrin xterm-color ws-butler wrap-region winum which-key web-mode web-beautify volatile-highlights vmd-mode visual-fill-column vi-tilde-fringe uuidgen use-package unfill undo-tree twittering-mode toml-mode toc-org tide typescript-mode tagedit systemd stickyfunc-enhance srefactor spaceline smeargle slim-mode sicp shell-pop selectric-mode scss-mode sass-mode restclient-helm restart-emacs rainbow-mode rainbow-identifiers rainbow-delimiters racer pyvenv pytest pyenv-mode py-isort pug-mode pony-mode plantuml-mode pip-requirements pinentry persp-mode pcre2el paradox spinner ox-ssh ox-reveal ox-gfm outorg orgit org-tree-slide org-sidebar org-ql peg ov org-super-agenda ts org-ref pdf-tools key-chord ivy org-projectile org-category-capture org-present org-pomodoro org-mime org-download org-bullets open-junk-file ob-restclient ob-latex-as-png ob-http nginx-mode neotree nasm-mode mwim multi-term mu4e-maildirs-extension mu4e-alert ht alert log4e gntp move-text mmm-mode markdown-toc magit-gitflow magit-popup magit macrostep lua-mode lorem-ipsum livid-mode skewer-mode live-py-mode linum-relative link-hint js2-refactor multiple-cursors js2-mode js-doc insert-shebang info-colors indent-guide imenu-list ibuffer-projectile hydra lv hy-mode dash-functional hungry-delete htmlize hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation helm-themes helm-swoop helm-pydoc helm-projectile projectile helm-mode-manager helm-make helm-gitignore request helm-flx helm-descbinds helm-css-scss helm-company helm-c-yasnippet helm-bibtex bibtex-completion parsebib helm-ag haml-mode graphviz-dot-mode google-translate golden-ratio gnuplot gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-commit with-editor gh-md geiser fuzzy flyspell-correct-helm flyspell-correct flycheck-rust flycheck-pos-tip flycheck pkg-info epl flx-ido flx fish-mode fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist highlight evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-ediff evil-args evil-anzu anzu evil goto-chg eval-sexp-fu eshell-z eshell-syntax-highlighting eshell-prompt-extras esh-help emmet-mode elisp-slime-nav elfeed-web simple-httpd elfeed-org elfeed-goodies ace-jump-mode noflet powerline popwin elfeed elcord edit-indirect dumb-jump dockerfile-mode docker transient tablist json-mode docker-tramp json-snatcher json-reformat disaster diredfl dired-git-info diminish define-word cython-mode csv-mode company-web web-completion-data company-statistics company-shell company-restclient restclient know-your-http-well company-quickhelp pos-tip company-emacs-eclim eclim company-c-headers company-auctex company-anaconda company column-enforce-mode color-identifiers-mode coffee-mode cmake-mode clean-aindent-mode clang-format cargo markdown-mode rust-mode caddyfile-mode loop bind-map bind-key biblio biblio-core auto-yasnippet yasnippet auto-highlight-symbol auto-dictionary auto-compile packed auctex anaconda-mode pythonic f dash s aggressive-indent adaptive-wrap ace-window ace-link ace-jump-helm-line helm avy helm-core async ac-ispell auto-complete popup nord-theme))
'(pdf-view-midnight-colors '("#655370" . "#fbf8ef"))
'(safe-local-variable-values
'((org-confirm-babel-evaluate)

View File

@ -1313,9 +1313,9 @@ to which tag by default.
| class | firefox | 3 |
| class | Nemo | 4 |
| class | Gimp* | 5 |
| class | Steam | 9 |
| class | discord | 0 |
| class | mattermost | 0 |
| class | Steam | 9 |
#+NAME: rules-default-tags-generate
#+BEGIN_SRC emacs-lisp :tangle no :exports none :cache yes :var tags=rules-default-tags-table

View File

@ -468,7 +468,7 @@ sequencially.
:HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/.local/bin/dired
:END:
#+BEGIN_SRC bash
emacsclient -c -e "(dired \"$@\")"
emacsclient -c -a emacs -e "(dired \"$@\")"
#+END_SRC
** Emacsmail
@ -479,7 +479,7 @@ sequencially.
This short script is used in my =~/.local/share/applications/mu4e.desktop= file
in order to send to Emacs any ~mailto:~ requests made in my system.
#+BEGIN_SRC bash
emacsclient -c --eval "(browse-url-mail \"$@\")"
emacsclient -c -n -a emacs -e "(browse-url-mail \"$@\")"
#+END_SRC
* Media

View File

@ -163,8 +163,8 @@ Typically, the variable will be set like so:
helm
multiple-cursors
org
(shell :variables shell-default-height
30 shell-default-position 'bottom)
(shell :variables shell-default-height 30
shell-default-position 'bottom)
treemacs))
#+END_SRC
@ -259,6 +259,7 @@ the cursor is on one.
org-enable-hugo-support t
org-enable-reveal-js-support t
org-enable-sticky-header t
org-enable-appear-support t
spaceline-org-clock-p t
org-projectile-file "TODOs.org"
org-download-image-dir "~/Pictures/org/"
@ -496,10 +497,10 @@ programming language, so here it is.
lua-lsp-emmy-enable-file-watchers t)
#+END_SRC
Unfortunately, I have to write Java code for one of my university courses, so
here is the layer:
Unfortunately, I have to write Java and Scala code for one of my university
courses, so here are the layers:
#+BEGIN_SRC emacs-lisp
java
java scala
#+END_SRC
*** Readers
@ -1053,7 +1054,10 @@ control:
When used in a plist, ~visual~ takes precendence over ~relative~.
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-line-numbers '(:relative nil
:enabled-for-modes prog-mode))
:visual nil
:disabled-for-modes org-mode pdf-view-mode
dired-mode doc-view-mode
text-mode))
#+END_SRC
Select a scope to highlight delimiter. Possible values are:
@ -1376,12 +1380,6 @@ Emacs config file:
(load "~/.config/emacs/private/private_emacs")
#+END_SRC
Ill also load a package I cloned locally as it is not (yet?) available in the
MELPA: [[https://github.com/awth13/org-appear][org-appear]].
#+BEGIN_SRC emacs-lisp
(require 'org-appear "~/fromGIT/emacs-packages/org-appear/org-appear.el")
#+END_SRC
Then, I want a couple of requires:
#+BEGIN_SRC emacs-lisp
(require 'org-id)
@ -1506,6 +1504,26 @@ the ~$HOME~ (~/home/<username>/~) directory to a simple =~=.
(t (error "Invalid argument %s, neither stringp nor listp" $path))))
#+END_SRC
*** ~phundrak/all?~
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-all-0655600c
:END:
This function is inspired by dashs ~-all?~ function: it will test all the
elements of the list ~seq~ against the predicate ~fn~ which should return either
~t~ or ~nil~. If all of them return something else than ~nil~, then it is a
success, otherwise it is a failure. Note that empty lists will always return
~t~.
#+BEGIN_SRC emacs-lisp
(defun phundrak/all? (fn seq)
"Check if all members of `SEQ' satisfy predicate `FN'. Note that
it will return t if `SEQ' is nil."
(declare (pure t) (side-effect-free t))
(if seq
(and (funcall fn (car seq))
(phundrak/all? fn (cdr seq)))
t))
#+END_SRC
*** ~phundrak/add-all-to-list~
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-add-all-to-list-a8b2680d
@ -1685,6 +1703,24 @@ the root of the git repository, else it will return ~nil~.
(phundrak/git-repo-root (f-parent $path)))))
#+END_SRC
*** ~phundrak/none?~
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-none-463dee26
:END:
In the same vein as ~phundrak/all?~, ~phundrak/none?~ checks if all elements of
~seq~ do not satify the predicate ~fn~. Again, if the list is empty, it will
return ~t~.
#+BEGIN_SRC emacs-lisp
(defun phundrak/none? (fn seq)
"Check if all members of `SEQ' do not satisfy predicate `FN'.
Note that it will return t if `SEQ' is nil."
(declare (pure t) (side-effect-free t))
(if seq
(and (not (funcall fn (car seq)))
(phundrak/none? fn (cdr seq)))
t))
#+END_SRC
*** ~phundrak/prompt-toggle-abbreviation~
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Custom-functions-macros-and-variables-phundrak-prompt-toggle-abbreviation-753ca549
@ -2380,10 +2416,13 @@ such as with this document.
<<org-confirm-babel>>
;; Beautiful org
<<beautiful-org-hooks>>
<<beautiful-org-faces>>
<<beautiful-org-options>>
<<beautiful-org-fontify-blocks>>
<<beautiful-org-fontify-inline>>
<<beautiful-org-images>>
<<beautiful-org-hide-macro-markers>>
<<beautiful-org-latex-inline>>
<<beautiful-org-latex-inline-transparent>>
<<beautiful-org-macro-ellipsis-markers>>
<<beautiful-org-hide-dots>>
;; Capture
<<org-capture-target-files>>
@ -2593,46 +2632,219 @@ of:
In order to make org-mode even sexier, lets enable ~variable-pitch-mode~ for
org-mode so we can get some proportional font. Ill also remove ~auto-fill-mode~
which seems to stick to Orgmode like hell and I dont know why. A hook to
org-appears minor mode will also be added.
which seems to stick to Orgmode like hell and I dont know why.
#+NAME: beautiful-org-hooks
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook 'visual-line-mode)
(remove-hook 'org-mode-hook 'auto-fill-mode)
(add-hook 'org-mode-hook 'variable-pitch-mode)
(auto-fill-mode -1)
(add-hook 'org-mode-hook 'org-appear-mode)
#+END_SRC
You can then see the modified faces for org-mode [[#User-Configuration-Visual-configuration-Better-faces-Org-mode-07754177][here]].
Some other tweaks will make Org-mode more beautiful. This includes a new folding
icon, some indentation that is not added whitespace.
By default, I would like my org-mode buffers to be indented and tables to be
aligned.
#+NAME: beautiful-org-options
#+BEGIN_SRC emacs-lisp
(setq org-startup-indented t
org-startup-align-all-tables t
org-pretty-entities t
org-fontify-whole-heading-line t
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-display-inline-images t
org-redisplay-inline-images t
org-startup-with-inline-images "inlineimages"
org-ellipsis "  ")
org-startup-align-all-tables t)
#+END_SRC
Lets limit the width of images inlined in org buffers to 550px. It roughly
corresponds to the width of a paragraph on which ~org-fill-paragraph~ is called.
***** Fontifying parts of org-mode
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Emacs-builtins-Org-mode-Beautify-Org-mode-Fontifying-parts-of-org-mode-f690ee40
:END:
Some blocks of org-mode should have their own face, such as the whole heading
line, the done headline, the quote and the verse blocks,… actually, lets enable
that for all of them.
#+name: beautiful-org-fontify-blocks
#+BEGIN_SRC emacs-lisp
(setq org-pretty-entities t
org-fontify-whole-heading-line t
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t)
#+END_SRC
***** Fontifying inline src blocks
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Emacs-builtins-Org-mode-Beautify-Org-mode-Fontifying-inline-src-blocks-bf879724
:END:
When it comes to source blocks in org-mode, Emacs handle them really well with
some beautiful syntax highlight thanks to the the languages major mode and
their font-locks. But inline src blocks are the forgotten child and get next to
no love, which is really sad ; I want it to feel loved, to stand out from the
crowd and to give me what its brother gives me already!
Enters [[https://tecosaur.github.io/emacs-config/config.html#fontifying-inline-src][Tecosaurs config]]! With ~org-src-font-lock-fontify-block~, anythings
possible! And ~{{{results(...)}}}~ can also have the ~org-block~ face applied to
match and make org-mode even more beautiful! Lets do it:
#+name: beautiful-org-fontify-inline
#+BEGIN_SRC emacs-lisp
(defvar org-prettify-inline-results t
"Whether to use (ab)use prettify-symbols-mode on
{{{results(...)}}}.")
(defun org-fontify-inline-src-blocks (limit)
"Try to apply `org-fontify-inline-src-blocks-1'."
(condition-case nil
(org-fontify-inline-src-blocks-1 limit)
(error (message "Org mode fontification error in %S at %d"
(current-buffer)
(line-number-at-pos)))))
(defun org-fontify-inline-src-blocks-1 (limit)
"Fontify inline src_LANG blocks, from `point' up to `LIMIT'."
(let ((case-fold-search t))
(when
; stolen from `org-element-inline-src-block-parser'
(re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t)
(let ((beg (match-beginning 0))
pt
(lang-beg (match-beginning 1))
(lang-end (match-end 1)))
(remove-text-properties beg lang-end '(face nil))
(font-lock-append-text-property lang-beg lang-end 'face 'org-meta-line)
(font-lock-append-text-property beg lang-beg 'face 'shadow)
(font-lock-append-text-property beg lang-end 'face 'org-block)
(setq pt (goto-char lang-end))
(when (org-element--parse-paired-brackets ?\[)
(remove-text-properties pt (point) '(face nil))
(font-lock-append-text-property pt
(point)
'face
'org-block)
(setq pt (point)))
(when (org-element--parse-paired-brackets ?\{)
(remove-text-properties pt (point) '(face nil))
(font-lock-append-text-property pt
(1+ pt)
'face
'(org-block shadow))
(unless (= (1+ pt) (1- (point)))
(if org-src-fontify-natively
(org-src-font-lock-fontify-block
(buffer-substring-no-properties lang-beg
lang-end)
(1+ pt)
(1- (point)))
(font-lock-append-text-property (1+ pt)
(1- (point))
'face
'org-block)))
(font-lock-append-text-property (1- (point))
(point)
'face
'(org-block shadow))
(setq pt (point)))
(when (and org-prettify-inline-results
(re-search-forward "\\= {{{results(" limit t))
(font-lock-append-text-property pt
(1+ pt)
'face
'org-block)
(goto-char pt))))
(when (and org-prettify-inline-results
(re-search-forward "{{{results(\\(.+?\\))}}}"
limit t))
(remove-list-of-text-properties (match-beginning 0)
(point)
'(composition prettify-symbols-start prettify-symbols-end))
(font-lock-append-text-property (match-beginning 0)
(match-end 0)
'face
'org-block)
(let ((start (match-beginning 0))
(end (match-beginning 1)))
(with-silent-modifications (compose-region start end "⟨")
(add-text-properties start
end
`(prettify-symbols-start ,start prettify-symbols-end
,end))))
(let ((start (match-end 1))
(end (point)))
(with-silent-modifications (compose-region start end "⟩")
(add-text-properties start
end
`(prettify-symbols-start ,start prettify-symbols-end
,end)))))))
(defun org-fontify-inline-src-blocks-enable ()
"Add inline src fontification to font-lock in Org.
Must be run as part of `org-font-lock-set-keywords-hook'."
(setq org-font-lock-extra-keywords
(append org-font-lock-extra-keywords '((org-fontify-inline-src-blocks)))))
(add-hook 'org-font-lock-set-keywords-hook #'org-fontify-inline-src-blocks-enable)
#+END_SRC
***** Images in org-mode
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Emacs-builtins-Org-mode-Beautify-Org-mode-Images-in-org-mode-8cf9bb6c
:END:
By default, images should be displayed inline, but not with a too large width. I
found that 550px fits well, since that is roughly the average width of the text
when ~org-fill-paragraph~ is called. Lets also tell org-mode to display images
as inline images and redisplay them when needed.
#+NAME: beautiful-org-images
#+BEGIN_SRC emacs-lisp
(setq org-image-actual-width 550)
(setq org-image-actual-width 550
org-redisplay-inline-images t
org-display-inline-images t
org-startup-with-inline-images "inlineimages")
#+END_SRC
Visually, I prefer to hide the markers of macros, so lets do that:
#+NAME: beautiful-org-hide-macro-markers
***** Prettier LaTeX inline rendering
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Emacs-builtins-Org-mode-Beautify-Org-mode-Prettier-LaTeX-inline-rendering-66605d3c
:END:
[[https://tecosaur.github.io/emacs-config/config.html#prettier-rendering][Tecosaur strikes again]]! Lets admit it, inline LaTeX code looks cool, properly
formatted LaTeX inline fragments look rad! Lets fix their appearance:
#+name: beautiful-org-latex-inline
#+BEGIN_SRC emacs-lisp
(setq org-hide-macro-markers t)
(setq org-format-latex-header "\\documentclass{article}
\\usepackage[usenames]{color}
\\usepackage[T1]{fontenc}
\\usepackage{booktabs}
\\pagestyle{empty} % do not remove
% The settings below are copied from fullpage.sty
\\setlength{\\textwidth}{\\paperwidth}
\\addtolength{\\textwidth}{-3cm}
\\setlength{\\oddsidemargin}{1.5cm}
\\addtolength{\\oddsidemargin}{-2.54cm}
\\setlength{\\evensidemargin}{\\oddsidemargin}
\\setlength{\\textheight}{\\paperheight}
\\addtolength{\\textheight}{-\\headheight}
\\addtolength{\\textheight}{-\\headsep}
\\addtolength{\\textheight}{-\\footskip}
\\addtolength{\\textheight}{-3cm}
\\setlength{\\topmargin}{1.5cm}
\\addtolength{\\topmargin}{-2.54cm}
% my custom stuff
\\usepackage[nofont,plaindd]{bmc-maths}
\\usepackage{arev}
")
#+END_SRC
And I much prefer when LaTeX fragments are transparent, so lets make them.
#+name: beautiful-org-latex-inline-transparent
#+BEGIN_SRC emacs-lisp
(setq org-format-latex-options
(plist-put org-format-latex-options :background "Transparent"))
#+END_SRC
***** Symbols
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Emacs-builtins-Org-mode-Beautify-Org-mode-Symbols-042d7374
:END:
I visually prefer to have a nicer folding icon in Emacs and the markers of macros hidden.
#+NAME: beautiful-org-macro-ellipsis-markers
#+BEGIN_SRC emacs-lisp
(setq org-hide-macro-markers t
org-ellipsis " ")
#+END_SRC
I also have an issue where small dots precede my org headers. Lets fix that:
@ -2807,7 +3019,7 @@ Will be exported as if it were the buffer
**** Capture
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Org-mode-Org_capture-f58979cf
:header-args:org: :mkdirp yes
:header-args:org: :mkdirp yes :padline no
:END:
Org-capture is an amazing feature of Org-mode which allows me to quickly save
links, resources, reminders, and notes in neatly organized org files. Here they
@ -3368,7 +3580,6 @@ Chinese and Korean) support.
("" "amssymb" t)
("" "capt-of" nil)
("" "minted" nil)
("" "xeCJK" nil)
("" "hyperref" nil)))
#+END_SRC
@ -3407,6 +3618,65 @@ HTML. Lets disable that since I never use it.
(setq org-html-validation-link nil)
#+END_SRC
However, something I very often use are metadata information in my HTML files. I
just want to automate that. Fortunately, [[https://tecosaur.github.io/emacs-config/config.html#extra-header-content,code--3][Tecosaur comes to the rescue]]! First,
here is our function that will generate all the meta tags in our HTML:
#+BEGIN_SRC emacs-lisp
(defun org-html-meta-tags-fancy (info)
"Use the INFO plist to construct the meta tags, as described in
`org-html-meta-tags'."
(message "%s" info)
(let ((title (org-html-plain-text
(org-element-interpret-data (plist-get info :title)) info))
(author (and (plist-get info :with-author)
(let ((auth (plist-get info :author)))
;; Return raw Org syntax.
(and auth (org-html-plain-text
(org-element-interpret-data auth) info))))))
(list
(when (org-string-nw-p author)
(list "name" "author" author))
(when (org-string-nw-p (plist-get info :description))
(list "name" "description"
(plist-get info :description)))
'("name" "generator" "org mode (Emacs)")
'("name" "theme-color" "#3b4252")
'("property" "og:type" "article")
(list "property" "og:title" title)
(let ((subtitle (org-export-data (plist-get info :subtitle) info)))
(when (org-string-nw-p subtitle)
(list "property" "og:description" subtitle)))
(let ((meta-image (org-export-data (plist-get info :metaimage) info)))
(when (org-string-nw-p meta-image)
(list "property" "og:image" meta-image)))
(let ((meta-image-type (org-export-data (plist-get info :metaimagetype) info)))
(when (org-string-nw-p meta-image-type)
(list "property" "og:image:type" meta-image-type)))
(let ((meta-image-width (org-export-data (plist-get info :metaimagewidth) info)))
(when (org-string-nw-p meta-image-width)
(list "property" "og:image:width" meta-image-width)))
(let ((meta-image-height (org-export-data (plist-get info :metaimageheight) info)))
(when (org-string-nw-p meta-image-height)
(list "property" "og:image:height" meta-image-height)))
(let ((meta-image-alt (org-export-data (plist-get info :metaimagealt) info)))
(when (org-string-nw-p meta-image-alt)
(list "property" "og:image:alt" meta-image-alt)))
(when (org-string-nw-p author)
(list "property" "og:article:author:first_name" (car (s-split-up-to " " author 2))))
(when (and (org-string-nw-p author) (s-contains-p " " author))
(list "property" "og:article:author:last_name" (cadr (s-split-up-to " " author 2))))
(list "property" "og:article:published_time" (format-time-string "%FT%T%z")))))
#+END_SRC
This will use some special keywords in our org buffer and insert their content in
Now lets bind it to when we export our org buffer to HTML:
#+BEGIN_SRC emacs-lisp
(unless (functionp #'org-html-meta-tags-default)
(defalias 'org-html-meta-tags-default #'ignore))
(setq org-html-meta-tags #'org-html-meta-tags-fancy)
#+END_SRC
**** LaTeX formats
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Org-mode-Custom_LaTeX_formats-8e8dca1c
@ -3632,6 +3902,36 @@ include in exported files.
user-mail-address "lucien@phundrak.com")
#+END_SRC
*** Recentf
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Emacs-builtins-Recentf-b00d8ddd
:END:
~recentf-mode~ allows Emacs to list all recent files it read. It is also used by
Spacemacs to display a list of recent files so they can be quickly opened by the
user. Unfortunately, a lot of these files are just noise I dont care about, but
fortunately we can ignore files with the variable ~recentf-exclude~. So, I will
ignore these paths:
#+name: recentf-ignored-paths
| =~/.mail/= |
| =~/.emacs.d/= |
| =~/.elfeed/index= |
| =/tmp/= |
#+name: recentf-ignored-paths-gen
#+header: :var paths=recentf-ignored-paths
#+BEGIN_SRC emacs-lisp :tangle no :exports none
(mapconcat (lambda (path)
(format "(add-to-list 'recentf-exclude\n (expand-file-name \"%s\"))"
(replace-regexp-in-string "=" "" (car path))))
paths
"\n")
#+END_SRC
#+BEGIN_SRC emacs-lisp :noweb yes
(with-eval-after-load 'recentf
<<recentf-ignored-paths-gen()>>)
#+END_SRC
** Editing and modes
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Editing_and_modes-7dbaf258
@ -3802,12 +4102,12 @@ As this is a new category, lets declare its prefix:
Now, lets also declare the keybindings in this category. ~oac~ will invoke
Emacs calculator, while ~oac~ invokes the calendar, ~oae~ invokes the Eww web
browser, ~oaw~ invokes ~woman~ (actually ~helm-man-woman~), and ~oaW~ invokes
the weather forecast. Lastly, the apostrophe in ~oa'~ will invoke Eshell
the weather forecast. Lastly, the apostrophe in ~o'~ will invoke Eshell
directly, without any popup window as with ~,'~ while ~oan~ will open a new
eshell buffer if another one already exists.
#+BEGIN_SRC emacs-lisp
(spacemacs/set-leader-keys
"oa'" 'eshell
"o'" 'eshell
"oac" 'calc
"oaC" 'calendar
"oae" 'eww
@ -3816,6 +4116,23 @@ eshell buffer if another one already exists.
"oaW" 'wttrin)
#+END_SRC
**** Image mode
:PROPERTIES:
:CUSTOM_ID: User-Configuration-Keybindings-Applications-Image-mode-e5df694e
:END:
Viewing images in Emacs is nice, but I want to be able to do more than just view
them, such as opening them in GIMP. Ill also declare a couple of keybindings
that make sense to me.
#+BEGIN_SRC emacs-lisp
(spacemacs/declare-prefix-for-mode 'image-mode "G" "Open in GIMP")
(spacemacs/declare-prefix-for-mode 'image-mode "o" "Open in external viewer")
(spacemacs/declare-prefix-for-mode 'image-mode "r" "Rotate clockwise")
(spacemacs/set-leader-keys-for-major-mode 'image-mode
"G" (lambda () (interactive) (start-process "" nil "gimp" (buffer-name)))
"o" (lambda () (interactive) (start-process "" nil "xdg-open" (buffer-name)))
"r" 'image-rotate)
#+END_SRC
**** Org tree slide
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Keybindings-Applications-Org_tree_slide-29545c5e
@ -4177,6 +4494,22 @@ signature to emails to the hook called when creating a new email.
(add-hook 'mu4e-compose-mode-hook 'mml-secure-message-sign-pgpmime)
#+END_SRC
mu4e used to be able to export emails to PDFs, but unfortunately this
possibility was discontinued. But we can (sort of) bring it back!
#+BEGIN_SRC emacs-lisp
(defun mu4e-action-open-as-pdf (msg)
"Export and open as PDF a mu4e `MSG'"
(let* ((date (mu4e-message-field msg :date))
(infile (mu4e~write-body-to-html msg))
(outfile (format-time-string "/tmp/%Y-%m-%d%H%M%S.pdf" date)))
(with-temp-buffer
(shell-command
(format "wkhtmltopdf %s %s" infile outfile) t))
(find-file outfile)))
(add-to-list 'mu4e-view-actions '("PDF view" . mu4e-action-open-as-pdf) t)
#+END_SRC
Lastly, some emails are better displayed in a browser than in Emacs. My Emacs
build has the webkit browser enabled, so Ill add an option to open with it
emails.
@ -4476,8 +4809,8 @@ Emacs throws me an error about the python interpreter, lets silence it:
I need to point to racer where the source code of Rust is located so I can get
some documentation. This is installed with the ~rust-src~ component you can get
through ~rustup~. To install it, simply run
#+BEGIN_SRC shell :tangle no :exports code
$ rustup component add rust-src
#+BEGIN_SRC sh :tangle no :exports code
rustup component add rust-src
#+END_SRC
Now, the source code for Rust should be included in your installation. I
@ -4491,8 +4824,8 @@ search for documentation in the stable sources:
Rusts default ~cargo check~ command is already very good, however I also enjoy
getting some more hints while developping, and ~clippy~ does a very good job at
it. To get clippy, I need to run the following to install it:
#+BEGIN_SRC shell
$ rustup compontent add clippy
#+BEGIN_SRC sh :tangle no :exports code
rustup compontent add clippy
#+END_SRC
And this will get it installed with all of my Rust toolchain, and it will be
@ -4504,12 +4837,11 @@ updated with it. Now, lets indicate LSP that I want to use that instead of
Finally, I wish to enable ~electric-pair-mode~ and ~indent-guide-mode~ for Rust
files, so lets enable that through the use of a hook:
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp :tangle no
(add-hook 'rust-mode-hook
'(lambda ()
(local-set-key (kbd "TAB") #'company-indent-or-complete-common)
(electric-pair-mode 1)
(indent-guide-mode 1)))
(electric-pair-mode 1)))
#+END_SRC
*** Scheme
@ -4692,6 +5024,7 @@ The user can also add some tags if they wish to.
*** Org blocks
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Snippets-org-mode_snippets-Org_blocks-e4dfc448
:HEADER-ARGS:snippet: :padline no :mkdirp yes
:END:
Now, Lets write some snippets for org blocks. The first one is for a comment
block, then two snippets for an unnamed and a named Elisp source block, and two
@ -4950,12 +5283,12 @@ Ill get into more detail below this code block.
Apparently, diff and Magit faces do not follow the nord themes color scheme, so
lets redefine their background and sometimes their foreground.
#+tblname: diff-faces
| / | | |
| Name | background | foreground |
|----------------------+------------------+------------|
| ediff-current-diff-A | ,phundrak/nord11 | |
| ediff-current-diff-C | ,phundrak/nord13 | |
| ediff-current-diff-C | ,phundrak/nord14 | |
| / | |
| Name | background |
|----------------------+------------------|
| ediff-current-diff-A | ,phundrak/nord11 |
| ediff-current-diff-C | ,phundrak/nord13 |
| ediff-current-diff-C | ,phundrak/nord14 |
**** Mu4e
:PROPERTIES:

View File

@ -170,7 +170,6 @@ highlighting. Lets set the manpager to bat then:
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
#+END_SRC
** Development
:PROPERTIES:
:CUSTOM_ID: Global_variables-Development-76b3ff13