Reorganize sections

This commit is contained in:
contrapunctus 2022-01-14 16:41:12 +05:30
parent 4fff1af7ad
commit 6beef200ff
1 changed files with 414 additions and 406 deletions

820
init.org
View File

@ -186,7 +186,7 @@ NAME is the name of the process and its buffer."
("C-c" . volume-raise-10)
("C-r" . volume-lower-10)))
#+END_SRC
* emacs settings
* Emacs and Emacs-specific packages
:PROPERTIES:
:CUSTOM_ID: emacs-settings
:END:
@ -203,11 +203,42 @@ NAME is the name of the process and its buffer."
disabled-command-function nil
custom-file "~/.emacs.d/custom.el"
edebug-print-length nil
ispell-dictionary "en")
ispell-dictionary "en"
scroll-conservatively 10000
scroll-preserve-screen-position t
auto-window-vscroll nil)
(setq-default undo-limit (* 80 1000))
(load custom-file))
#+END_SRC
** package
#+BEGIN_SRC emacs-lisp
(use-package package
:bind
(:map package-menu-mode-map
("k" . package-autoremove)
("c" . previous-line)
("r" . next-line))
:config
(when (featurep 'boon)
(general-def package-menu-mode-map
"X" 'package-menu-execute)))
#+END_SRC
** feather
#+BEGIN_SRC emacs-lisp
(use-package feather
:diminish
:hook (package-menu-mode . feather-mode)
:bind ("<f5> p " . list-packages))
#+END_SRC
** esup, the Emacs StartUp Profiler
#+BEGIN_SRC emacs-lisp
(use-package esup
:config (setq esup-depth 0))
#+END_SRC
** gnutls
#+BEGIN_SRC emacs-lisp
(use-package gnutls
@ -216,6 +247,23 @@ NAME is the name of the process and its buffer."
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
#+END_SRC
** help-mode
#+BEGIN_SRC emacs-lisp
(use-package help-mode
:bind
(:map help-mode-map
("b" . help-go-back)
("f" . help-go-forward)))
#+END_SRC
** helpful
#+BEGIN_SRC emacs-lisp
(use-package helpful
:bind (("<f1> <f1>" . #'helpful-at-point)
("<f1> f" . #'helpful-callable)
("<f1> c" . #'helpful-command)
("<f1> k" . #'helpful-key)
("<f1> v" . #'helpful-variable)))
#+END_SRC
* user interface
:PROPERTIES:
:CUSTOM_ID: ui
@ -297,9 +345,7 @@ Must put this after loading the custom file, or I get prompted about the theme e
#+BEGIN_SRC emacs-lisp
;(load-theme 'distinguished t)
;(require 'github-theme)
;(require 'heroku-theme)
;;;; Good theme but uses different font sizes in org-mode, and (I think) some weird non-monospace font
@ -333,10 +379,149 @@ Must put this after loading the custom file, or I get prompted about the theme e
)
#+END_SRC
* esup, the Emacs StartUp Profiler
** powerline :disabled:
#+BEGIN_SRC emacs-lisp
(use-package esup
:config (setq esup-depth 0))
(use-package powerline)
#+END_SRC
**
**
#+BEGIN_SRC emacs-lisp
(autoload 'byte-recompile-file "bytecomp" "byte-recompile-file" t)
;; (2017-12-29T13:21:57+0530
;; TODO - watch Org and MD files and recompile it if they are newer
;; than their associated HTML files (e.g. I edited the source on a
;; phone and synced it back to the laptop)
;; see (info "(elisp) File Notifications")
;; and (describe-function 'file-newer-than-file-p)
;; )
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(defun cp/after-save ()
(let* ((file-path (buffer-file-name))
(file-path-shell (shell-quote-argument file-path)))
(cl-case major-mode
;; ;; This would be more useful if it was only displayed when
;; ;; tests failed. But even a constantly failing test result
;; ;; being shown each time you save can be annoying.
;; ('emacs-lisp-mode (let ((project-dir (locate-dominating-file file-path "Cask")))
;; (when project-dir
;; (cd project-dir)
;; (compile "cask exec buttercup -L . --traceback pretty"))))
;; ;; Handy as long as my only means of viewing Org data on mobile was the HTML export; not so much since I have Orgzly
;; ('org-mode
;; (pcase (file-name-nondirectory
;; (buffer-file-name
;; (current-buffer)))
;; ((or "chronometrist.org" "chronometrist-key-values.org" "init.org") t)
;; (_ (org-html-export-to-html))))
('LilyPond-mode
(my-compile-project "mkly" nil "./mkly dev"))
('latex-mode
(if (file-exists-p "Makefile")
(compile (car compile-history))
(compile (concat "xelatex " file-path-shell))))
;; ('markdown-mode (markdown-export))
('c-mode
(compile (concat "gcc -static -o "
(shell-quote-argument
(file-name-base))
" "
file-path-shell))))))
(add-hook 'after-save-hook 'cp/after-save)
#+END_SRC
** compile
#+BEGIN_SRC emacs-lisp
(use-package compile
:config
;; (add-hook 'compilation-start-hook
;; (lambda (proc)
;; (delete-other-windows)))
(setq compilation-always-kill t))
#+END_SRC
*** jump to Org LP from compilation output
:PROPERTIES:
:CUSTOM_ID: compile-org-lp-jump
:END:
#+BEGIN_SRC emacs-lisp
(defun my-org-lp-goto-error (oldfn &optional prefix &rest args)
"Make `compile-goto-error' lead to an Org literate program, if present.
This is meant to be used as `:around' advice for `compile-goto-error'.
OLDFN is `compile-goto-error'.
With PREFIX arg, just run `compile-goto-error' as though unadvised.
ARGS are ignored."
(interactive "P")
(if prefix
(funcall oldfn)
(let (buffer position column tangled-file-exists-p)
(save-window-excursion
(funcall oldfn)
(setq column (- (point) (point-at-bol)))
;; `compile-goto-error' might be called from the output of
;; `literate-elisp-byte-compile-file', which means
;; `org-babel-tangle-jump-to-org' would error
(when (ignore-errors (org-babel-tangle-jump-to-org))
(setq buffer (current-buffer)
position (point)
tangled-file-exists-p t)))
;; back to where we started - the `compilation-mode' buffer
(if tangled-file-exists-p
(let ((org-window (get-buffer-window buffer)))
;; if the Org buffer is visible, switch to its window
(if (window-live-p org-window)
(select-window org-window)
(switch-to-buffer buffer))
(goto-char (+ position column)))
(funcall oldfn)))))
(advice-add 'compile-goto-error :around #'my-org-lp-goto-error)
;; (advice-remove 'compile-goto-error #'my-org-lp-goto-error)
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(require 'cp-hindi)
;; (require 'cp-parens)
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(use-package keyfreq
:disabled
:init
(keyfreq-mode 1)
(keyfreq-autosave-mode 1))
;; ;; disabled on 2017-08-18T19:39:21+0530, no longer interested
;; (open-dribble-file (concat "~/.emacs.d/keylogs/"
;; (format-time-string "%Y%m%d-%H%M%S")
;; ".txt"))
;; 2017-10-14T15:22:56+0530 - I suspect devanagari-itrans tires the
;; left hand faster than the right - let's find out!
;; ;; 2020-08-05T16:28:07+0530 commented out, no longer interested
;; (add-hook
;; 'input-method-activate-hook
;; (lambda ()
;; (open-dribble-file
;; (concat
;; "~/.emacs.d/keylogs/"
;; (format-time-string "%Y%m%d-%H%M%S")
;; "-"
;; current-input-method
;; ".txt"))))
;; (add-hook
;; 'input-method-deactivate-hook
;; (lambda () (open-dribble-file nil)))
#+END_SRC
* Searching
@ -381,6 +566,20 @@ Must put this after loading the custom file, or I get prompted about the theme e
:commands (wgrep-change-to-wgrep-mode))
#+END_SRC
** Recenter screen on isearch matches
#+BEGIN_SRC emacs-lisp
(add-hook 'isearch-mode-hook 'recenter)
(add-hook 'isearch-update-post-hook 'recenter)
(defadvice isearch-repeat-forward
(after isearch-repeat-forward-recenter activate) (recenter))
(defadvice isearch-repeat-backward
(after isearch-repeat-backward-recenter activate) (recenter))
(ad-activate 'isearch-repeat-forward)
(ad-activate 'isearch-repeat-backward)
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(add-to-list 'load-path "~/.emacs.d/contrapunctus/")
@ -397,10 +596,8 @@ Must put this after loading the custom file, or I get prompted about the theme e
:END:
#+BEGIN_SRC emacs-lisp
;; fix Emacs' definition of a sentence
(setq sentence-end-double-space nil)
;; the utter basics
(general-define-key
"C-h" 'backward-delete-char
"C-w" 'backward-kill-word
@ -541,6 +738,12 @@ as links into an Org or Markdown document."
(markdown-display-inline-images)))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'text-mode
(define-key text-mode-map (kbd "M-p") 'org-drag-line-backward)
(define-key text-mode-map (kbd "M-n") 'org-drag-line-forward))
#+END_SRC
** undo-tree
:PROPERTIES:
:CUSTOM_ID: editing-undo-tree
@ -642,6 +845,77 @@ Doesn't work in my current main browser (Tor Browser), and thus barely used of l
'(("wikisource" . mediawiki-mode))))
#+END_SRC
** Unicode keys
#+BEGIN_SRC emacs-lisp
(general-auto-unbind-keys)
(general-def
:prefix "C-t"
;; currency
"r" [?₹] "- L" [?£] "L -" [?£] "e" [?€]
"." [?…]
"- m" [?—] "- n" [?] "m -" [?—] "n -" [?]
"t" [?™]
;; German
"\" a" [?ä] "a \"" [?ä] "\" A" [?Ä] "A \"" [?Ä]
"\" e" [?ë] "e \"" [?ë] "\" E" [?Ë] "E \"" [?Ë]
"\" o" [?ö] "o \"" [?ö] "\" O" [?Ö] "O \"" [?Ö]
"\" u" [?ü] "u \"" [?ü] "\" U" [?Ü] "U \"" [?Ü]
;; ;; " a/e/o/u are slow to type...
;; "a" [?ä] "A" [?Ä]
;; "e" [?ë] "E" [?Ë]
;; "o" [?ö] "O" [?Ö]
;; "u" [?ü] "U" [?Ü]
;; but "o" conflicts with "o o" for °, so...
"u a" [?ä] "u A" [?Ä]
"u e" [?ë] "u E" [?Ë]
"u o" [?ö] "u O" [?Ö]
"u u" [?ü] "u U" [?Ü]
"s s" [?ß]
;; French
", c" [?ç] "c ," [?ç] ", C" [?ç] "C ," [?Ç]
"' e" [?é] "e '" [?é] "' E" [?É] "E '" [?É]
"e `" [?è] "` e" [?è] "E `" [?È] "` E" [?È]
"e ^" [?ê] "^ e" [?ê] "E `" [?È] "` E" [?È]
"' a" [?á] "a '" [?á] "' A" [?Á] "A '" [?Á]
"a `" [?à] "` a" [?à] "A `" [?À] "` A" [?À]
"a ^" [?â] "^ a" [?â] "A ^" [?Â] "^ A" [?Â]
"~ n" [?ñ] "n ~" [?ñ] "~ N" [?Ñ] "N ~" [?Ñ]
"e e" [?ə]
"o e" [?œ] "O E" [?Œ]
"o o" [?°] "x" [?×]
"1 2" [?½] "1 3" [?⅓] "1 4" [?¼]
"2 3" [?⅔] "2 5" [?⅖]
"3 4" [?¾] "3 5" [?⅗]
"4 5" [?⅘]
"b" [?♭] "#" [?♯]
"< -" [?←] "- >" [?→]
"^ |" [?↑] "| ^" [?↑]
"v |" [?↓] "| v" [?↓]
", \\" [?λ] "l" [?λ]
"f" [?ƒ]
"q o" [?“] "q c" [?”])
(general-auto-unbind-keys t)
(setq default-input-method "devanagari-itrans")
#+END_SRC
Suggestion by lampilelo for extending =iso-transl-ctl-x-8-map= (https://dpaste.com/BAQUXSDVL.txt)
#+BEGIN_SRC emacs-lisp :tangle no
(eval-after-load 'iso-transl
'(let ((map (make-sparse-keymap)))
(define-key map (kbd "c") [?č])
(define-key map (kbd "C") [?Č])
(define-key iso-transl-ctl-x-8-map (kbd "v") map)))
#+END_SRC
* modal editing
** active boon config
#+BEGIN_SRC emacs-lisp
@ -2054,6 +2328,40 @@ PR ideas
:hook
(dired-mode . peep-dired))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defun contrapunctus-rename-this-file ()
(interactive)
(rename-file ;; message "will rename %s to %s"
(buffer-file-name (current-buffer))
(read-file-name "New name: " nil nil nil
(file-name-nondirectory
(buffer-file-name (current-buffer)))))
;; (rename-file (buffer-file-name (current-buffer)) new-name)
)
#+END_SRC
** backup configuration
#+BEGIN_SRC emacs-lisp
(setq backup-by-copying t
backup-directory-alist '(("." . "~/.emacs.d/saves/"))
kept-new-versions 50
kept-old-versions 50
version-control t
delete-old-versions t)
#+END_SRC
** async-backup (backup on save)
:PROPERTIES:
:CREATED: 2022-01-14T16:38:38+0530
:CUSTOM_ID: async-backup
:END:
#+BEGIN_SRC emacs-lisp
(use-package async-backup
:config (setq async-backup-location
"/media/data/anon/backups/emacs-async-backup/"))
#+END_SRC
** mail
#+BEGIN_SRC emacs-lisp
(use-package wl
@ -2169,6 +2477,82 @@ PR ideas
("C-c C-h" . comint-previous-prompt)))
#+END_SRC
** info
#+BEGIN_SRC emacs-lisp
(use-package info
:config
(info-initialize)
(cl-loop for dir in
'("~/.emacs.d/info/"
"~/.emacs.d/elisp-git/geiser/doc/"
"~/lilypond/usr/share/info/")
do (add-to-list #'Info-directory-list dir))
:bind
(:map Info-mode-map
("b" . Info-history-back)
("f" . Info-history-forward)))
#+END_SRC
** image-mode
#+BEGIN_SRC emacs-lisp
(use-package image-mode
:bind
(:map image-map
("c" . nil)
("r" . nil)
("o" . nil))
(:map image-mode-map
("c" . image-previous-file)
("r" . image-next-file)
("W" . image-transform-fit-to-width)
("H" . image-transform-fit-to-height)
("o" . nil)
("R" . contrapunctus-rename-this-file)))
#+END_SRC
** TODO magit [0%]
1. [ ] It'd be really cool to =(recenter 3)= when you /open/ a section, and =(recenter)= when you close a section
2. [ ] binding "c" to magit-section-backward and "j" to magit-commit means I can't nonchalantly hit "c c" to commit like before...it becomes "j c" :\
#+BEGIN_SRC emacs-lisp
(use-package magit
:bind (;; boon-like keys
:map magit-mode-map
("r" . magit-section-forward)
("c" . magit-section-backward)
("C" . magit-commit)
("R" . magit-rebase)
:map magit-diff-section-base-map
("C" . magit-commit)
("R" . magit-rebase)
:map magit-status-mode-map
;; ([mouse-3] . 'magit-section-toggle)
([down-mouse-3] . 'mouse-set-point)
([up-mouse-3] . 'magit-section-toggle)
("C" . magit-commit))
:commands magit-status
:hook
(magit-mode . visual-line-mode)
(magit-post-stage . (lambda () (recenter)))
:config
(cl-loop for symbol in '(magit-section-toggle
magit-section-forward
magit-section-backward)
do (advice-add symbol :after (lambda (&rest r) (recenter 3))))
;; (advice-add 'magit-unstage-item :after (lambda (&rest r) (next-line)))
)
#+END_SRC
** git-commit
:PROPERTIES:
:CREATED: 2022-01-14T16:36:44+0530
:END:
#+BEGIN_SRC emacs-lisp
(use-package git-commit
:bind
(:map git-commit-mode-map
("M-c" . git-commit-prev-message)
("M-r" . git-commit-next-message)))
#+END_SRC
* Completion
:PROPERTIES:
:CREATED: 2022-01-13T20:39:41+0530
@ -2828,23 +3212,6 @@ Don't try to check if there are files with a certain extension...it will lead to
("h" my-help-hydra/body "Help"))
#+END_SRC
* image-mode
#+BEGIN_SRC emacs-lisp
(use-package image-mode
:bind
(:map image-map
("c" . nil)
("r" . nil)
("o" . nil))
(:map image-mode-map
("c" . image-previous-file)
("r" . image-next-file)
("W" . image-transform-fit-to-width)
("H" . image-transform-fit-to-height)
("o" . nil)
("R" . contrapunctus-rename-this-file)))
#+END_SRC
* environment variables
#+BEGIN_SRC emacs-lisp
(setenv "PATH" (concat "~/bin:" (getenv "PATH")))
@ -2858,10 +3225,6 @@ Don't try to check if there are files with a certain extension...it will lead to
;; ;; (toggle-debug-on-quit)
#+END_SRC
#+BEGIN_SRC emacs-lisp
;; (add-to-list 'load-path "~/.emacs.d/elisp-git/yafolding.el/")
#+END_SRC
* general (keybindings)
#+BEGIN_SRC emacs-lisp
(use-package general
@ -3115,45 +3478,18 @@ Don't try to check if there are files with a certain extension...it will lead to
** outshine
#+BEGIN_SRC emacs-lisp
(use-package outshine
:commands (outshine-mode))
:commands (outshine-mode outshine-cycle)
:hook (texinfo-mode . outshine-mode))
#+END_SRC
* scrolling
#+BEGIN_SRC emacs-lisp
(setq scroll-conservatively 10000
scroll-preserve-screen-position t
auto-window-vscroll nil)
#+END_SRC
* Recenter screen on isearch matches
#+BEGIN_SRC emacs-lisp
(add-hook 'isearch-mode-hook 'recenter)
(add-hook 'isearch-update-post-hook 'recenter)
(defadvice isearch-repeat-forward
(after isearch-repeat-forward-recenter activate) (recenter))
(defadvice isearch-repeat-backward
(after isearch-repeat-backward-recenter activate) (recenter))
(ad-activate 'isearch-repeat-forward)
(ad-activate 'isearch-repeat-backward)
(setq )
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
;;;; While we're at it, let's add that to next-error as well
;;;; (this affects jumping to match from M-x grep , too)
#+END_SRC
**
While we're at it, let's add that to next-error as well (this affects
jumping to match from M-x grep , too)
#+BEGIN_SRC emacs-lisp
(add-hook 'next-error-hook 'recenter)
#+END_SRC
* date and time
@ -3172,11 +3508,10 @@ Don't try to check if there are files with a certain extension...it will lead to
(setq display-time-next-load-average t)
(add-to-list 'zoneinfo-style-world-list '("Europe/Berlin" "Berlin")))
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(defun cp/eval-sexp (arg)
"In emacs-lisp-mode, just run eval-defun.
In other modes - jump to first Lisp expression in current line
and eval it."
(interactive "P")
@ -3192,15 +3527,7 @@ and eval it."
(eval-last-sexp arg)))
(t nil))))
#+END_SRC
* helpful
#+BEGIN_SRC emacs-lisp
(use-package helpful
:bind (("<f1> <f1>" . #'helpful-at-point)
("<f1> f" . #'helpful-callable)
("<f1> c" . #'helpful-command)
("<f1> k" . #'helpful-key)
("<f1> v" . #'helpful-variable)))
#+END_SRC
* Buffer management
#+BEGIN_SRC emacs-lisp
(defun my-buffer-switch ()
@ -3218,21 +3545,6 @@ and eval it."
(:map ibuffer-mode-map
("X" . 'ibuffer-do-kill-on-deletion-marks))) ;; Boon hijacks the x key.
#+END_SRC
* info
#+BEGIN_SRC emacs-lisp
(use-package info
:config
(info-initialize)
(cl-loop for dir in
'("~/.emacs.d/info/"
"~/.emacs.d/elisp-git/geiser/doc/"
"~/lilypond/usr/share/info/")
do (add-to-list #'Info-directory-list dir))
:bind
(:map Info-mode-map
("b" . Info-history-back)
("f" . Info-history-forward)))
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
@ -3306,97 +3618,18 @@ and eval it."
;; (kbd "s-<mouse-9>") 'helm-mini
)
#+END_SRC
* help-mode
** midnight-mode (automatic buffer cleanup)
#+BEGIN_SRC emacs-lisp
(use-package help-mode
:bind
(:map help-mode-map
("b" . help-go-back)
("f" . help-go-forward)))
#+END_SRC
* Unicode keys
#+BEGIN_SRC emacs-lisp
(general-auto-unbind-keys)
(general-def
:prefix "C-t"
;; currency
"r" [?₹] "- L" [?£] "L -" [?£] "e" [?€]
"." [?…]
"- m" [?—] "- n" [?] "m -" [?—] "n -" [?]
"t" [?™]
;; German
"\" a" [?ä] "a \"" [?ä] "\" A" [?Ä] "A \"" [?Ä]
"\" e" [?ë] "e \"" [?ë] "\" E" [?Ë] "E \"" [?Ë]
"\" o" [?ö] "o \"" [?ö] "\" O" [?Ö] "O \"" [?Ö]
"\" u" [?ü] "u \"" [?ü] "\" U" [?Ü] "U \"" [?Ü]
;; ;; " a/e/o/u are slow to type...
;; "a" [?ä] "A" [?Ä]
;; "e" [?ë] "E" [?Ë]
;; "o" [?ö] "O" [?Ö]
;; "u" [?ü] "U" [?Ü]
;; but "o" conflicts with "o o" for °, so...
"u a" [?ä] "u A" [?Ä]
"u e" [?ë] "u E" [?Ë]
"u o" [?ö] "u O" [?Ö]
"u u" [?ü] "u U" [?Ü]
"s s" [?ß]
;; French
", c" [?ç] "c ," [?ç] ", C" [?ç] "C ," [?Ç]
"' e" [?é] "e '" [?é] "' E" [?É] "E '" [?É]
"e `" [?è] "` e" [?è] "E `" [?È] "` E" [?È]
"e ^" [?ê] "^ e" [?ê] "E `" [?È] "` E" [?È]
"' a" [?á] "a '" [?á] "' A" [?Á] "A '" [?Á]
"a `" [?à] "` a" [?à] "A `" [?À] "` A" [?À]
"a ^" [?â] "^ a" [?â] "A ^" [?Â] "^ A" [?Â]
"~ n" [?ñ] "n ~" [?ñ] "~ N" [?Ñ] "N ~" [?Ñ]
"e e" [?ə]
"o e" [?œ] "O E" [?Œ]
"o o" [?°] "x" [?×]
"1 2" [?½] "1 3" [?⅓] "1 4" [?¼]
"2 3" [?⅔] "2 5" [?⅖]
"3 4" [?¾] "3 5" [?⅗]
"4 5" [?⅘]
"b" [?♭] "#" [?♯]
"< -" [?←] "- >" [?→]
"^ |" [?↑] "| ^" [?↑]
"v |" [?↓] "| v" [?↓]
", \\" [?λ] "l" [?λ]
"f" [?ƒ]
"q o" [?“] "q c" [?”])
(general-auto-unbind-keys t)
(setq default-input-method "devanagari-itrans")
#+END_SRC
Suggestion by lampilelo for extending =iso-transl-ctl-x-8-map= (https://dpaste.com/BAQUXSDVL.txt)
#+BEGIN_SRC emacs-lisp :tangle no
(eval-after-load 'iso-transl
'(let ((map (make-sparse-keymap)))
(define-key map (kbd "c") [?č])
(define-key map (kbd "C") [?Č])
(define-key iso-transl-ctl-x-8-map (kbd "v") map)))
#+END_SRC
* backup configuration
#+BEGIN_SRC emacs-lisp
(setq backup-by-copying t
backup-directory-alist '(("." . "~/.emacs.d/saves/"))
kept-new-versions 50
kept-old-versions 50
version-control t
delete-old-versions t)
(use-package async-backup
:config (setq async-backup-location
"/media/data/anon/backups/emacs-async-backup/"))
(use-package midnight
:init
(midnight-mode)
:config
(setq clean-buffer-list-kill-regexps '("")
clean-buffer-list-delay-general 1
clean-buffer-list-delay-special (* 60 60 12))
(add-to-list 'clean-buffer-list-kill-never-buffer-names "Gajim")
:hook
(midnight . clean-buffer-list))
#+END_SRC
* browse-url
@ -3412,44 +3645,7 @@ SLIME opens CLHS links in Firefox, but I'd rather open them in Tor Browser; Tor
(setq browse-url-browser-function #'cp-copy-url))
#+END_SRC
* TODO magit [0%]
1. [ ] It'd be really cool to =(recenter 3)= when you /open/ a section, and =(recenter)= when you close a section
2. [ ] binding "c" to magit-section-backward and "j" to magit-commit means I can't nonchalantly hit "c c" to commit like before...it becomes "j c" :\
#+BEGIN_SRC emacs-lisp
(use-package magit
:bind (;; boon-like keys
:map magit-mode-map
("r" . magit-section-forward)
("c" . magit-section-backward)
("C" . magit-commit)
("R" . magit-rebase)
:map magit-diff-section-base-map
("C" . magit-commit)
("R" . magit-rebase)
:map magit-status-mode-map
;; ([mouse-3] . 'magit-section-toggle)
([down-mouse-3] . 'mouse-set-point)
([up-mouse-3] . 'magit-section-toggle)
("C" . magit-commit))
:commands magit-status
:hook
(magit-mode . visual-line-mode)
(magit-post-stage . (lambda () (recenter)))
:config
(cl-loop for symbol in '(magit-section-toggle
magit-section-forward
magit-section-backward)
do (advice-add symbol :after (lambda (&rest r) (recenter 3))))
(advice-add 'magit-unstage-item :after (next-line)))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package git-commit
:bind
(:map git-commit-mode-map
("M-c" . git-commit-prev-message)
("M-r" . git-commit-next-message)))
#+END_SRC
* markup
* Markup
** Org
#+BEGIN_SRC emacs-lisp
(use-package org
@ -3957,20 +4153,6 @@ Used by Eldev documentation.
(beginning-of-line)
(recenter)))
#+END_SRC
* midnight-mode
#+BEGIN_SRC emacs-lisp
(use-package midnight
:init
(midnight-mode)
:config
(setq clean-buffer-list-kill-regexps '("")
clean-buffer-list-delay-general 1
clean-buffer-list-delay-special (* 60 60 12))
(add-to-list 'clean-buffer-list-kill-never-buffer-names "Gajim")
:hook
(midnight . clean-buffer-list))
#+END_SRC
* yasnippet
:PROPERTIES:
:CREATED: 2022-01-05T20:16:31+0530
@ -4250,7 +4432,7 @@ Create advice for =lispy-pair= - if =lispy--in-string-or-comment-p= is true, sel
:commands imenus)
#+END_SRC
*** side-hustle
*** side-hustle :disabled:
#+BEGIN_SRC emacs-lisp
(use-package side-hustle
:disabled t
@ -4260,7 +4442,7 @@ Create advice for =lispy-pair= - if =lispy--in-string-or-comment-p= is true, sel
("c" . previous-line))))
#+END_SRC
*** orderless
*** orderless :disabled:
:PROPERTIES:
:CREATED: 2022-01-13T17:31:53+0530
:END:
@ -4778,180 +4960,6 @@ Potentially useful - https://www.draketo.de/software/emacs-javascript.html
:hook (js2-mode-hook . skewer-mode))
#+END_SRC
* package
#+BEGIN_SRC emacs-lisp
(use-package package
:bind
(:map package-menu-mode-map
("k" . package-autoremove)
("c" . previous-line)
("r" . next-line))
:config
(when (featurep 'boon)
(general-def package-menu-mode-map
"X" 'package-menu-execute)))
#+END_SRC
* feather
#+BEGIN_SRC emacs-lisp
(use-package feather
:diminish
:hook (package-menu-mode . feather-mode)
:bind ("<f5> p " . list-packages))
#+END_SRC
* mode line
** powerline :disabled:
#+BEGIN_SRC emacs-lisp
(use-package powerline)
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'text-mode
(define-key text-mode-map (kbd "M-p") 'org-drag-line-backward)
(define-key text-mode-map (kbd "M-n") 'org-drag-line-forward))
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(autoload 'byte-recompile-file "bytecomp" "byte-recompile-file" t)
;; (2017-12-29T13:21:57+0530
;; TODO - watch Org and MD files and recompile it if they are newer
;; than their associated HTML files (e.g. I edited the source on a
;; phone and synced it back to the laptop)
;; see (info "(elisp) File Notifications")
;; and (describe-function 'file-newer-than-file-p)
;; )
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(defun cp/after-save ()
(let* ((file-path (buffer-file-name))
(file-path-shell (shell-quote-argument file-path)))
(cl-case major-mode
;; ;; This would be more useful if it was only displayed when
;; ;; tests failed. But even a constantly failing test result
;; ;; being shown each time you save can be annoying.
;; ('emacs-lisp-mode (let ((project-dir (locate-dominating-file file-path "Cask")))
;; (when project-dir
;; (cd project-dir)
;; (compile "cask exec buttercup -L . --traceback pretty"))))
;; ;; Handy as long as my only means of viewing Org data on mobile was the HTML export; not so much since I have Orgzly
;; ('org-mode
;; (pcase (file-name-nondirectory
;; (buffer-file-name
;; (current-buffer)))
;; ((or "chronometrist.org" "chronometrist-key-values.org" "init.org") t)
;; (_ (org-html-export-to-html))))
('LilyPond-mode
(my-compile-project "mkly" nil "./mkly dev"))
('latex-mode
(if (file-exists-p "Makefile")
(compile (car compile-history))
(compile (concat "xelatex " file-path-shell))))
;; ('markdown-mode (markdown-export))
('c-mode
(compile (concat "gcc -static -o "
(shell-quote-argument
(file-name-base))
" "
file-path-shell))))))
(add-hook 'after-save-hook 'cp/after-save)
#+END_SRC
** compile
#+BEGIN_SRC emacs-lisp
(use-package compile
:config
;; (add-hook 'compilation-start-hook
;; (lambda (proc)
;; (delete-other-windows)))
(setq compilation-always-kill t))
#+END_SRC
*** jump to Org LP from compilation output
:PROPERTIES:
:CUSTOM_ID: compile-org-lp-jump
:END:
#+BEGIN_SRC emacs-lisp
(defun my-org-lp-goto-error (oldfn &optional prefix &rest args)
"Make `compile-goto-error' lead to an Org literate program, if present.
This is meant to be used as `:around' advice for `compile-goto-error'.
OLDFN is `compile-goto-error'.
With PREFIX arg, just run `compile-goto-error' as though unadvised.
ARGS are ignored."
(interactive "P")
(if prefix
(funcall oldfn)
(let (buffer position column tangled-file-exists-p)
(save-window-excursion
(funcall oldfn)
(setq column (- (point) (point-at-bol)))
;; `compile-goto-error' might be called from the output of
;; `literate-elisp-byte-compile-file', which means
;; `org-babel-tangle-jump-to-org' would error
(when (ignore-errors (org-babel-tangle-jump-to-org))
(setq buffer (current-buffer)
position (point)
tangled-file-exists-p t)))
;; back to where we started - the `compilation-mode' buffer
(if tangled-file-exists-p
(let ((org-window (get-buffer-window buffer)))
;; if the Org buffer is visible, switch to its window
(if (window-live-p org-window)
(select-window org-window)
(switch-to-buffer buffer))
(goto-char (+ position column)))
(funcall oldfn)))))
(advice-add 'compile-goto-error :around #'my-org-lp-goto-error)
;; (advice-remove 'compile-goto-error #'my-org-lp-goto-error)
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(require 'cp-hindi)
;; (require 'cp-parens)
#+END_SRC
**
#+BEGIN_SRC emacs-lisp
(use-package keyfreq
:disabled
:init
(keyfreq-mode 1)
(keyfreq-autosave-mode 1))
;; ;; disabled on 2017-08-18T19:39:21+0530, no longer interested
;; (open-dribble-file (concat "~/.emacs.d/keylogs/"
;; (format-time-string "%Y%m%d-%H%M%S")
;; ".txt"))
;; 2017-10-14T15:22:56+0530 - I suspect devanagari-itrans tires the
;; left hand faster than the right - let's find out!
;; ;; 2020-08-05T16:28:07+0530 commented out, no longer interested
;; (add-hook
;; 'input-method-activate-hook
;; (lambda ()
;; (open-dribble-file
;; (concat
;; "~/.emacs.d/keylogs/"
;; (format-time-string "%Y%m%d-%H%M%S")
;; "-"
;; current-input-method
;; ".txt"))))
;; (add-hook
;; 'input-method-deactivate-hook
;; (lambda () (open-dribble-file nil)))
#+END_SRC
* recentf
#+BEGIN_SRC emacs-lisp
(use-package recentf