diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2021-03-17 12:48:00 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2021-03-17 12:48:00 +0100 |
| commit | 5d5060a5da9eee99cdd50bc477e70d3c1d0ef38f (patch) | |
| tree | ddba2c25292dac572003acf1a74af5a779a72a9f /.emacs | |
| parent | 60e7992b11b6f41229af105035d1a04da716d732 (diff) | |
| download | dotfiles-5d5060a5da9eee99cdd50bc477e70d3c1d0ef38f.tar.xz | |
Commit a collection of tweaks to Emacs config
Diffstat (limited to '.emacs')
| -rw-r--r-- | .emacs | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -96,6 +96,22 @@ (set-variable 'tab-width new-width) (message "changed from %s to %s" old-width new-width))) +(defun my/center-window (text-width) + (interactive + (list (cond + ;; Explicit length. + ((integerp current-prefix-arg) + current-prefix-arg) + ;; C-u. + ((and (listp current-prefix-arg) current-prefix-arg) + nil) + ;; Default. + (80)))) + (let ((margin-width (when text-width + (/ (- (window-width) text-width) 2)))) + ;; Only set left margin, so that long lines are not truncated. + (set-window-margins nil margin-width))) + (defun my/kill (stuff) (kill-new stuff) (message stuff)) @@ -149,7 +165,8 @@ (my/define-prefix-command my/display-map "Keymap for display-related commands." - '(("t" toggle-truncate-lines) + '(("c" my/center-window) + ("t" toggle-truncate-lines) ("v" visual-line-mode))) (my/define-prefix-command my/editing-map @@ -177,7 +194,8 @@ (my/define-prefix-command my/manual-map "Keymap for reading manuals." '(("i" info-display-manual) - ("m" man))) + ("m" man) + ("s" shortdoc-display-group))) (my/define-prefix-command my/project-map "Keymap for project-related commands." @@ -274,6 +292,8 @@ ;; in stone, and I would miss out on future updates by Magit. (add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell) +(setq magit-process-finish-apply-ansi-colors t) + (defun my/revision-at-point () (cond ((derived-mode-p 'magit-mode) @@ -490,4 +510,15 @@ (setq-default paragraph-start (concat "[ ]*- \\|" paragraph-start)) +(defun my/screenshot (output) + (interactive + (list + (let ((default (format-time-string "/tmp/Emacs-Screenshot-%F-%T.pdf"))) + (read-file-name (format-prompt "Output?" default) nil default)))) + (let ((data (x-export-frames)) + (buf (find-file output))) + (insert data) + (save-buffer) + (kill-buffer buf))) + ;; TODO: decruftify mode-line (e.g. remove superflous parens) |
