Skip to content

Commit 3c2aae3

Browse files
author
Maximilian Cook
committed
Initial commit
0 parents  commit 3c2aae3

File tree

674 files changed

+196369
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

674 files changed

+196369
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# My Dotfiles
2+
3+
It's best to back up one's settings, especially if you often tweak your tools.
4+
5+
6+
## Installation
7+
8+
Each program has an `INSTALL.sh` in its folder. Run with `sudo` privileges.

emacs/Emacs.icns

6.32 MB
Binary file not shown.

emacs/INSTALL.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/zsh
2+
3+
mkdir -p $HOME/.emacs.d
4+
5+
ln -fs $DOTFILES/emacs/init.el $HOME/.emacs.d/
6+
ln -fs $DOTFILES/emacs/elisp $HOME/emacs
7+
8+
# Change the icon (because I need things to be pretty).
9+
sudo cp $DOTFILES/emacs/Emacs.icns /Applications/MacPorts/Emacs.app/Contents/Resources/Emacs.icns

emacs/elisp/elisp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/mc/code/dotfiles/emacs/elisp

emacs/elisp/typewriter-mode.el

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
;;; typewriter-mode.el --- Static cursor positioning while typing. -*- lexical-binding: t -*-
2+
3+
;;; Commentary:
4+
5+
;; I owe this hack to Chris Wellons at null program. Here's the original post:
6+
;; https://nullprogram.com/blog/2013/02/06/.
7+
8+
;; The actually structure of the mode is roughly based on `olivetti.el`, which
9+
;; you can find here: https://github.com/rnkn/olivetti.
10+
11+
12+
;;; Code:
13+
14+
;; INTERNAL VARIABLES ----------------------------------------------------------
15+
16+
(defvar-local typewriter/scroll-preserve-screen-position
17+
nil
18+
"Value of `scroll-preserve-screen-position` when `typewriter-mode` is enabled.")
19+
20+
(defvar-local typewriter/scroll-conservatively
21+
nil
22+
"Value of `scroll-conservatively` when `typewriter-mode` is enabled.")
23+
24+
(defvar-local typewriter/maximum-scroll-margin
25+
nil
26+
"Value of `maximum-scroll-margin` when `typewriter-mode` is enabled.")
27+
28+
(defvar-local typewriter/scroll-margin
29+
nil
30+
"Value of `scroll-margin` when `typewriter-mode` is enabled.")
31+
32+
33+
;; DEFINITION ------------------------------------------------------------------
34+
35+
(define-minor-mode typewriter-mode
36+
"Recover the good old days."
37+
:lighter " Typewriter"
38+
(if typewriter-mode
39+
(progn
40+
;; Bind original values.
41+
(unless (bound-and-true-p typewriter/scroll-preserve-screen-position)
42+
(setq typewriter/scroll-preserve-screen-position
43+
scroll-preserve-screen-position))
44+
(unless (bound-and-true-p typewriter/scroll-conservatively)
45+
(setq typewriter/scroll-conservatively scroll-conservatively))
46+
(unless (bound-and-true-p typewriter/maximum-scroll-margin)
47+
(setq typewriter/maximum-scroll-margin maximum-scroll-margin))
48+
(unless (bound-and-true-p typewriter/scroll-margin)
49+
(setq typewriter/scroll-margin scroll-margin))
50+
51+
;; Change original values to enable typewriter-mode.
52+
(setq scroll-preserve-screen-position t
53+
scroll-conservatively 0
54+
maximum-scroll-margin 0.5
55+
scroll-margin 99999))
56+
57+
;; Restore original values.
58+
(setq scroll-preserve-screen-position typewriter/scroll-preserve-screen-position
59+
scroll-conservatively typewriter/scroll-conservatively
60+
maximum-scroll-margin typewriter/maximum-scroll-margin
61+
scroll-margin typewriter/scroll-margin)
62+
63+
;; Remove local variables.
64+
(mapc #'kill-local-variable '(typewriter/scroll-preserve-screen-position
65+
typewriter/scroll-conservatively
66+
typewriter/maximum-scroll-margin
67+
typewriter/scroll-maring))))
68+
69+
(provide 'typewriter-mode)
70+
71+
;;; typewriter-mode.el ends here

0 commit comments

Comments
 (0)