add idea of distraction free view

This commit is contained in:
2022-12-29 14:32:07 +01:00
parent 99a0d6a185
commit a4e15965bb
4 changed files with 112 additions and 33 deletions

View File

@@ -2,11 +2,12 @@
# Table of Contents
1. [Installation](#installation)
2. [Usage](#usage)
3. [Packages](#packages)
4. [Information](#information)
5. [Errors](#errors)
6. [TODOs](#todos)
2. [External programs](#programs)
3. [Usage](#usage)
4. [Packages](#packages)
5. [Information](#information)
6. [Errors](#errors)
7. [TODOs](#todos)
This is an ongoing evolution of Emacs configuration files, inspired by
a bunch of online resources.
@@ -29,6 +30,13 @@ Installation path is `~/.config/emacs`. See details and other
installed linux packages as requirements inside `sripts/install.sh`.
<a id="programs"></a>
# External programs
- `ripgrep` (optional) used by `counsel-rg` (package `counsel`)
<a id="usage"></a>
# Usage
@@ -102,6 +110,13 @@ General key bindings and functions
</tr>
<tr>
<td class="org-left">all-the-icons-ivy-rich</td>
<td class="org-right">20221202.1336</td>
<td class="org-left">melpa</td>
</tr>
<tr>
<td class="org-left">amx</td>
<td class="org-right">20210305.118</td>
@@ -564,6 +579,13 @@ General key bindings and functions
</tr>
<tr>
<td class="org-left">olivetti</td>
<td class="org-right">20220330.635</td>
<td class="org-left">melpa</td>
</tr>
<tr>
<td class="org-left">ol-notmuch</td>
<td class="org-right">20220428.1337</td>
@@ -795,6 +817,13 @@ General key bindings and functions
</tr>
<tr>
<td class="org-left">posframe</td>
<td class="org-right">20221220.544</td>
<td class="org-left">melpa</td>
</tr>
<tr>
<td class="org-left">pos-tip</td>
<td class="org-right">20220715.102</td>
@@ -930,7 +959,7 @@ General key bindings and functions
<tr>
<td class="org-left">treemacs</td>
<td class="org-right">20221107.2105</td>
<td class="org-right">20221221.1301</td>
<td class="org-left">melpa</td>
</tr>

View File

@@ -21,6 +21,12 @@ sh -c "$(fetch -o - http://gitea.weseng.de/daniel/emacs/raw/master/scripts/insta
Installation path is =~/.config/emacs=. See details and other
installed linux packages as requirements inside =sripts/install.sh=.
* External programs
:PROPERTIES:
:CUSTOM_ID: programs
:END:
- =ripgrep= (optional) used by =counsel-rg= (package =counsel=)
* Usage
:PROPERTIES:
:CUSTOM_ID: usage
@@ -55,10 +61,11 @@ General key bindings and functions
- (=diff-buffer-with-file=) show a diff between buffer (current state) and file (saved state)
#+begin_src sh :exports results
dir=$HOME/repos/emacs-conf/lisp
dir=$(pwd)/lisp
verinfo() {
#echo -n $1 ''
# $dir: directory of packages
# $1: package name (basenaem and w/o extension)
if test -f $dir/$1.el; then
ver=$(grep -i package-version: $dir/$1.el | cut -d":" -f2 | xargs)
if test -z $ver; then
@@ -71,31 +78,31 @@ verinfo() {
fi
}
pkg_custom=$(
for i in $(echo awesome-tray dialog); do
map_pkg_ver() {
# $1: list of package names, either full path (can include a version) or just the package name
# $2: repo name
# 1st: get package name: strips list element to basename and removes version and extension
# 2nd: get package version (from the installed directory)
# 3rd: print info
for i in $1; do
pkg=$(sed 's/-[0-9].*//' <(basename $i))
ver=$(verinfo $pkg)
echo $pkg $ver custom
done)
pkg_elpagnu=$(
for i in $(ls -F ~/repos/my-elpa-gnu/archive/*.tar | grep -v @); do
pkg=$(sed 's/-[0-9].*//' <(basename $i))
ver=$(verinfo $pkg)
echo $pkg $ver elpa-gnu
done)
pkg_elpanongnu=$(
for i in $(ls -F ~/repos/my-elpa-nongnu/archive/*.tar | grep -v @); do
pkg=$(sed 's/-[0-9].*//' <(basename $i))
ver=$(verinfo $pkg)
echo $pkg $ver elpa-nongnu
done)
pkg_melpa=$(
for i in $(sort <(ls ~/repos/my-melpa/packages/*.tar | xargs -n1) <(ls ~/repos/my-melpa/packages/*.el | xargs -n1)); do
pkg=$(sed 's/-[0-9].*//' <(basename $i))
ver=$(verinfo $pkg)
echo $pkg $ver melpa
done)
echo -e "$pkg_custom\n$pkg_elpagnu\n$pkg_elpanongnu\n$pkg_melpa" | sort | column -t -N PACKAGE_____________________,VERSION______,REPO_______
echo $pkg $ver $2
done
}
pkg_custom_list=$(echo awesome-tray dialog)
pkg_elpagnu_list=$(ls -F ~/repos/my-elpa-gnu/archive/*.tar | grep -v @)
pkg_elpanongnu_list=$(ls -F ~/repos/my-elpa-nongnu/archive/*.tar | grep -v @)
pkg_melpa_list=$(sort <(ls ~/repos/my-melpa/packages/*.tar | xargs -n1) <(ls ~/repos/my-melpa/packages/*.el | xargs -n1))
pkg_custom=$(map_pkg_ver "$pkg_custom_list" custom)
pkg_elpagnu=$(map_pkg_ver "$pkg_elpagnu_list" elpa-gnu)
pkg_elpanongnu=$(map_pkg_ver "$pkg_elpanongnu_list" elpa-nongnu)
pkg_melpa=$(map_pkg_ver "$pkg_melpa_list" melpa)
echo -e "$pkg_custom\n$pkg_elpagnu\n$pkg_elpanongnu\n$pkg_melpa" | \
sort | \
column -t -N PACKAGE_____________________,VERSION______,REPO_______
#+end_src
#+RESULTS:
@@ -103,6 +110,7 @@ echo -e "$pkg_custom\n$pkg_elpagnu\n$pkg_elpanongnu\n$pkg_melpa" | sort | column
| ace-window | 20220911.358 | melpa |
| adaptive-wrap | 0.8 | elpa-gnu |
| all-the-icons | 20220929.2303 | melpa |
| all-the-icons-ivy-rich | 20221202.1336 | melpa |
| amx | 20210305.118 | melpa |
| anaconda-mode | 20220922.741 | melpa |
| async | 20221217.649 | melpa |
@@ -169,6 +177,7 @@ echo -e "$pkg_custom\n$pkg_elpagnu\n$pkg_elpanongnu\n$pkg_melpa" | sort | column
| multiple-cursors | 20221126.743 | melpa |
| notmuch | 20221115.1134 | melpa |
| ob-async | 20210428.2052 | melpa |
| olivetti | 20220330.635 | melpa |
| ol-notmuch | 20220428.1337 | melpa |
| org | 9.6 | elpa-gnu |
| org-appear | 20220617.2355 | melpa |
@@ -202,6 +211,7 @@ echo -e "$pkg_custom\n$pkg_elpagnu\n$pkg_elpanongnu\n$pkg_melpa" | sort | column
| polymode | 20220820.163 | melpa |
| popup | 20220927.161 | melpa |
| popwin | 20210215.1849 | melpa |
| posframe | 20221220.544 | melpa |
| pos-tip | 20220715.102 | melpa |
| powershell | 20220805.1712 | melpa |
| pythonic | 20220723.1741 | melpa |
@@ -221,7 +231,7 @@ echo -e "$pkg_custom\n$pkg_elpagnu\n$pkg_elpanongnu\n$pkg_melpa" | sort | column
| systemd | 20210209.2052 | melpa |
| tablist | 20200427.2205 | melpa |
| transient | 20221202.1727 | melpa |
| treemacs | 20221107.2105 | melpa |
| treemacs | 20221221.1301 | melpa |
| treemacs-magit | 20220917.1026 | melpa |
| use-package | 20221209.2013 | melpa |
| virtual-auto-fill | 20200906.2038 | melpa |

View File

@@ -7,6 +7,45 @@
(add-hook 'org-mode-hook 'my-org-link-color-hook)
(add-hook 'org-ctrl-c-ctrl-c-hook 'my-org-table-cell-color-attr)))
(use-package olivetti
:commands (olivetti-mode)
:bind (("<f8>" . my-distraction-free))
:config
(defun my-distraction-free ()
"Distraction-free writing environment."
(interactive)
(if (equal olivetti-mode nil)
(progn
(window-configuration-to-register 1)
(delete-other-windows)
(when (equal major-mode 'org-mode)
(when (and (featurep 'org-superstar)
(equal org-superstar-mode t))
;; remove leading stars
(setq my-last-org-hide-leading-stars org-hide-leading-stars)
(setq org-hide-leading-stars nil) ;; must be nil! hiding via `org-superstar-remove-leading-stars'
(setq my-last-org-superstar-remove-leading-stars org-superstar-remove-leading-stars)
(setq org-superstar-remove-leading-stars t)
(org-superstar-restart)
)
(setq my-last-org-num-mode org-num-mode)
(unless org-num-mode (org-num-mode))
)
(olivetti-mode t))
(progn
(jump-to-register 1)
;; reset to last state
(when (equal major-mode 'org-mode)
(when (and (featurep 'org-superstar)
(equal org-superstar-mode t))
(setq org-hide-leading-stars my-last-org-hide-leading-stars)
(setq org-superstar-remove-leading-stars my-last-org-superstar-remove-leading-stars)
(org-superstar-restart)
)
(unless my-last-org-num-mode (org-num-mode -1))
)
(olivetti-mode 0)))))
(use-package my-org-article
:after (org)
:config

View File

@@ -12,7 +12,8 @@
;; omit warnings like: /opt/emacs-conf/lisp/org/oc-basic.el: Warning: buffer-substring is an obsolete generalized variable.
(setq byte-compile-warnings nil)
(require 'use-package) ;; requires bind-key
(eval-when-compile
(require 'use-package)) ;; requires bind-key
(setq use-package-verbose t)
(setq use-package-compute-statistics t)
(use-package delight) ;; used for use-package :delight, see delight-delighted-modes