flip to single emacs profile for /just/ org-mode todo, habits
This commit is contained in:
parent
d13087164e
commit
1b85376046
|
@ -1,14 +0,0 @@
|
|||
(
|
||||
("default" . ((user-emacs-directory . "/data/data/com.termux/files/home/.emacs.d.profiles/code")
|
||||
(server-name . "code")))
|
||||
("code" . ((user-emacs-directory . "/data/data/com.termux/files/home/.emacs.d.profiles/code")
|
||||
(server-name . "code")))
|
||||
("org" . ((user-emacs-directory . "/data/data/com.termux/files/home/.emacs.d.profiles/org")
|
||||
(server-name . "org")))
|
||||
("beancount" . ((user-emacs-directory . "/data/data/com.termux/files/home/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
("ledger" . ((user-emacs-directory . "/data/data/com.termux/files/home/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
("accounting" . ((user-emacs-directory . "/data/data/com.termux/files/home/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
)
|
|
@ -1,14 +0,0 @@
|
|||
(
|
||||
("default" . ((user-emacs-directory . "C:/Users/mcros/Nextcloud/.emacs.d.profiles/code" )
|
||||
(server-name . "code")))
|
||||
("code" . ((user-emacs-directory . "C:/Users/mcros/Nextcloud/.emacs.d.profiles/code")
|
||||
(server-name . "code")))
|
||||
("org" . ((user-emacs-directory . "C:/Users/mcros/Nextcloud/.emacs.d.profiles/org")
|
||||
(server-name . "org")))
|
||||
("beancount" . ((user-emacs-directory . "C:/Users/mcros/Nextcloud/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
("ledger" . ((user-emacs-directory . "C:/Users/mcros/Nextcloud/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
("accounting" . ((user-emacs-directory . "C:/Users/mcros/Nextcloud/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting"))
|
||||
)
|
|
@ -1,13 +0,0 @@
|
|||
(("default" . ((user-emacs-directory . "~/.emacs.d.profiles/code")
|
||||
(server-name . "code")))
|
||||
("code" . ((user-emacs-directory . "~/.emacs.d.profiles/code")
|
||||
(server-name . "code")))
|
||||
("org" . ((user-emacs-directory . "~/.emacs.d.profiles/org")
|
||||
(server-name . "org")))
|
||||
("beancount" . ((user-emacs-directory . "~/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
("ledger" . ((user-emacs-directory . "~/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
("accounting" . ((user-emacs-directory . "~/.emacs.d.profiles/accounting")
|
||||
(server-name . "accounting")))
|
||||
)
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,4 @@
|
|||
*.elc
|
||||
orig/
|
||||
org/deft
|
||||
**ido.last**
|
||||
**projectile-bookmarks**
|
||||
**/auto-save-list
|
||||
|
|
9
README.md
Normal file
9
README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
## Important
|
||||
|
||||
I no longer use `org-mode` as a personal knowledge base / 2nd brain. I also no longer use it for any code editing.
|
||||
|
||||
The main branch of the repo is now my config for *just* todo tracking, habit tracking, pomodoro timer and some basic time tracking.
|
||||
|
||||
## The 'Real Config'
|
||||
|
||||
If you are interested in a more complex config that shows how I leveraged emacs with multiple profiles and more, see the `pre-kb-removal` branch.
|
28
_setup.sh
28
_setup.sh
|
@ -1,28 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# kemo setup
|
||||
if [[ ! -d ~/.emacs.d.profiles ]]; then
|
||||
git clone https://git.kemonine.info/kemonine/emacs.git ~/.emacs.d.profiles
|
||||
fi
|
||||
|
||||
# multi profile
|
||||
if [[ ! -d ~/.emacs.d ]]; then
|
||||
git clone https://github.com/plexus/chemacs2.git ~/.emacs.d
|
||||
fi
|
||||
|
||||
# profiles
|
||||
rm ~/.emacs-profiles.el
|
||||
if grep -q "Android" <<< `uname -a`; then
|
||||
ln -s ~/.emacs.d.profiles/.emacs-profiles-mobile.el ~/.emacs-profiles.el
|
||||
else
|
||||
ln -s ~/.emacs.d.profiles/.emacs-profiles.el ~/.emacs-profiles.el
|
||||
fi
|
||||
|
||||
# dont forget to pre-compile elisp / install plugins
|
||||
cat ~/.emacs-profiles.el
|
||||
echo "run emacs with each profile in '~/.emacs-profiles.el'"
|
||||
echo "install multimarkdown (windows bin release + add to emacs path like sqlite3)"
|
||||
echo "pacman -S mingw-w64-x86_64-{emacs,emacs-pdf-tools-server,imagemagick} in msys2"
|
||||
echo "pacman -S mingw-w64-x86_64-texlive-full in msys2"
|
||||
echo "pacman -S mingw-w64-x86_64-aspell mingw-w64-x86_64-hunspell mingw-w64-x86_64-hunspell-en in msys2"
|
||||
echo "pip install 'python-lsp-server[all]' python-lsp-black pyls-memestra pylsp-rope"
|
|
@ -1,682 +0,0 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; windows performance tweaks, add to top of init.el as well
|
||||
(when (eq system-type 'windows-nt)
|
||||
; https://lists.gnu.org/archive/html/bug-gnu-emacs/2012-10/msg00274.html
|
||||
; https://gioorgi.com/2013/solving-emacs-freeze-andor-slowdown-on-windows7/
|
||||
(setq w32-get-true-file-attributes nil)
|
||||
|
||||
; https://www.reddit.com/r/emacs/comments/c9ef5i/comment/esx5ndr/
|
||||
(setq inhibit-compacting-font-caches t)
|
||||
|
||||
; https://www.reddit.com/r/emacs/comments/c9ef5i/comment/esx5snw/
|
||||
(when (boundp 'w32-pipe-read-delay)
|
||||
(setq w32-pipe-read-delay 0))
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Packages related
|
||||
(require 'package)
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; this goes in chemacs2 init -- DO NOT UNCOMMENT
|
||||
(package-initialize) ; this goes in chemacs2 init -- DO NOT UNCOMMENT
|
||||
(add-to-list 'package-selected-packages
|
||||
'(which-key all-the-icons revert-buffer-all centaur-tabs scratch persistent-scratch persp-mode rainbow-mode rainbow-delimiters markdown-mode focus zoom popwin dired-single diredfl doominhibitinhibit-modeline helpful helm helm-org dired-rainbow dired-rainbow-listing dired-single dash s origami modus-themes use-package)
|
||||
)
|
||||
(add-to-list 'package-selected-packages
|
||||
'(xclip)
|
||||
)
|
||||
(require 'use-package)
|
||||
|
||||
; helper functions
|
||||
(require 'subr-x)
|
||||
(setq kmn/is-termux
|
||||
(string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))
|
||||
|
||||
|
||||
; ensure elisp plugins are compiled
|
||||
(require 'dash)
|
||||
(require 'f)
|
||||
|
||||
(defun was-compiled-p (path)
|
||||
"Does the directory at PATH contain any .elc files?"
|
||||
(--any-p (f-ext? it "elc") (f-files path)))
|
||||
|
||||
(defun ensure-packages-compiled ()
|
||||
"If any packages installed with package.el aren't compiled yet, compile them."
|
||||
(--each (f-directories package-user-dir)
|
||||
(unless (was-compiled-p it)
|
||||
(byte-recompile-directory it 0))))
|
||||
|
||||
(ensure-packages-compiled)
|
||||
|
||||
(unless (was-compiled-p "~/.emacs.d.profiles/common")
|
||||
(byte-recompile-directory "~/.emacs.d.profiles/common" 0))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; eshell
|
||||
(setq eshell-prompt-function (lambda () (concat (car (last (split-string (eshell/pwd) "/"))) " $ ")))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; dont wrap lines
|
||||
(set-default 'truncate-lines t)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; highlight current line global -- Do NOT use
|
||||
;(global-hl-line-mode +1) ; this overrides std hl-line-mode buffer config
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; hl-line-mode based on major mode hook (on by default, off for listed major modes)
|
||||
; to get major mode: (message "%s" major-mode)
|
||||
; to get minor modes: (describe-mode)
|
||||
(add-hook 'minibuffer-setup-hook #'(lambda () (hl-line-mode 0)))
|
||||
(add-hook 'after-change-major-mode-hook
|
||||
#'(lambda () (hl-line-mode (if (member major-mode '(org-agenda-mode)) 0 1))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; fix opening urls inside termux
|
||||
(when kmn/is-termux
|
||||
(setq browse-url-browser-function 'browse-url-generic
|
||||
browse-url-generic-program "/data/data/com.termux/files/usr/bin/termux-open"))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; backups
|
||||
(defconst kmn/backup-dir
|
||||
(expand-file-name "backups/" user-emacs-directory))
|
||||
(unless (file-exists-p kmn/backup-dir)
|
||||
(make-directory kmn/backup-dir))
|
||||
(setq backup-directory-alist `((".*" . ,kmn/backup-dir)))
|
||||
(setq auto-save-list-file-prefix kmn/backup-dir)
|
||||
(setq auto-save-file-name-transforms
|
||||
`(("\\(?:[^/]*/\\)*\\(.*\\)" ,(concat kmn/backup-dir "\\1") t)))
|
||||
(setq backup-by-copying t) ; safest form of backup file creation
|
||||
; Config backups so we have *more*, not less
|
||||
(setq delete-old-versions t
|
||||
kept-new-versions 1
|
||||
kept-old-versions 3
|
||||
version-control t
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; add all-the-icons so status icons (normally handled by a font patched w/ nerd font)
|
||||
(when (not kmn/is-termux)
|
||||
(require 'all-the-icons)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; which-key
|
||||
(require 'which-key)
|
||||
;; Allow C-h to trigger which-key before it is done automatically
|
||||
;(setq which-key-show-early-on-C-h t)
|
||||
;; make sure which-key doesn't show normally but refreshes quickly after it is
|
||||
;; triggered.
|
||||
;(setq which-key-idle-delay 10000)
|
||||
;(setq which-key-idle-secondary-delay 0.05)
|
||||
(which-key-mode)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; dired adjustments
|
||||
(with-eval-after-load 'dired
|
||||
(require 'dired-x)
|
||||
;; Set dired-x global variables here. For example:
|
||||
;; (setq dired-x-hands-off-my-keys nil)
|
||||
)
|
||||
(require 'dired-single)
|
||||
(setq dired-single-use-magic-buffer t)
|
||||
(setq dired-single-magic-buffer-name "dired - main")
|
||||
|
||||
; open dirs in same dired window + open files in main window
|
||||
; facilitates static file browser sidebar
|
||||
(defun my/dired-open()
|
||||
(interactive)
|
||||
(setq file (dired-get-file-for-visit))
|
||||
(if (equal (file-directory-p file) t)
|
||||
(progn
|
||||
(dired-single-buffer)
|
||||
)
|
||||
(progn
|
||||
(dired-find-file-other-window)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun my/dired-init ()
|
||||
"Bunch of stuff to run for dired, either immediately or when it's
|
||||
loaded."
|
||||
;; <add other stuff here>
|
||||
(define-key dired-mode-map [remap dired-find-file]
|
||||
'my/dired-open)
|
||||
(define-key dired-mode-map [remap dired-mouse-find-file-other-window]
|
||||
'my/dired-open)
|
||||
(define-key dired-mode-map [remap dired-up-directory]
|
||||
'dired-single-up-directory))
|
||||
|
||||
;; if dired's already loaded, then the keymap will be bound
|
||||
(if (boundp 'dired-mode-map)
|
||||
;; we're good to go; just add our bindings
|
||||
(my/dired-init)
|
||||
;; it's not loaded yet, so add our bindings to the load-hook
|
||||
(add-hook 'dired-load-hook 'my/dired-init))
|
||||
|
||||
; icons / colors / line tunes
|
||||
(add-hook 'dired-mode-hook
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(all-the-icons-dired-mode 1)
|
||||
(hl-line-mode 1)))
|
||||
(use-package diredfl
|
||||
:commands diredfl-global-mode
|
||||
:init
|
||||
(diredfl-global-mode))
|
||||
|
||||
; hide dired details by default, use `(` to toggle
|
||||
(add-hook 'dired-mode-hook 'dired-hide-details-mode)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; coding general (in case its ever on)
|
||||
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; markdown config (used by kmn all over everything)
|
||||
(use-package markdown-mode
|
||||
:ensure t
|
||||
:commands (markdown-mode gfm-mode)
|
||||
:mode (("README\\.md\\'" . gfm-mode)
|
||||
("\\.md\\'" . markdown-mode)
|
||||
("\\.markdown\\'" . markdown-mode))
|
||||
:init (setq markdown-command "multimarkdown"))
|
||||
|
||||
(use-package markdown-preview-mode
|
||||
:ensure t
|
||||
:if (boundp 'mdcommand)
|
||||
:init
|
||||
;(setq markdown-preview-auto-open nil)
|
||||
:custom
|
||||
(markdown-preview-ws-port 9697)
|
||||
(markdown-preview-http-port 9696)
|
||||
(markdown-preview-host "127.0.0.1")
|
||||
(markdown-preview-http-host "127.0.0.1"))
|
||||
(setq markdown-preview-stylesheets (list "https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css"))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; origami config
|
||||
(use-package origami
|
||||
:demand
|
||||
|
||||
:config
|
||||
(define-prefix-command 'origami-mode-map)
|
||||
(define-key ctl-x-map (kbd "z") 'origami-mode-map)
|
||||
(global-origami-mode)
|
||||
|
||||
:bind
|
||||
(:map origami-mode-map
|
||||
("o" . origami-open-node)
|
||||
("O" . origami-open-node-recursively)
|
||||
("c" . origami-close-node)
|
||||
("C" . origami-close-node-recursively)
|
||||
("a" . origami-toggle-node)
|
||||
("t" . origami-recursively-toggle-node)
|
||||
("R" . origami-open-all-nodes)
|
||||
("M" . origami-close-all-nodes)
|
||||
("v" . origami-show-only-node)
|
||||
("k" . origami-previous-fold)
|
||||
("j" . origami-forward-fold)
|
||||
("x" . origami-reset)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Setup global keys
|
||||
(cua-mode 1)
|
||||
(windmove-default-keybindings 'meta)
|
||||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||||
(global-set-key (kbd "M-g") 'keyboard-quit)
|
||||
(global-set-key (kbd "M-m") 'menu-bar-open)
|
||||
(global-set-key (kbd "C-x C-z") nil)
|
||||
|
||||
(global-set-key (kbd "C-g") 'goto-line)
|
||||
(global-set-key (kbd "C-c u") 'toggle-truncate-lines)
|
||||
(global-set-key (kbd "C-o") 'helm-find-files)
|
||||
(global-set-key (kbd "C-k") 'kmn/dired-default-directory-on-left)
|
||||
(global-set-key (kbd "C-a") 'mark-whole-buffer)
|
||||
(global-set-key (kbd "C-S-a") 'kmn/smart-beginning-of-line)
|
||||
(global-set-key (kbd "M-a") 'kmn/smart-beginning-of-line)
|
||||
(global-set-key (kbd "C-S-e") 'kmn/smart-end-of-line)
|
||||
(global-set-key (kbd "M-e") 'kmn/smart-end-of-line)
|
||||
(global-set-key (kbd "C-c v") 'previous-buffer)
|
||||
(global-set-key (kbd "C-c w")
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(whitespace-mode)
|
||||
(whitespace-newline-mode)
|
||||
)
|
||||
)
|
||||
|
||||
; tmux keybind compatibility
|
||||
(setq windmove-wrap-around t) ; tmux does wraparound for window movements, enable for emacs
|
||||
(define-key global-map (kbd "C-b") (make-sparse-keymap))
|
||||
; prevent ardux typos w/ window sizing
|
||||
(global-set-key (kbd "C-<up>") nil)
|
||||
(global-set-key (kbd "C-<down>") nil)
|
||||
(global-set-key (kbd "C-<right>") nil)
|
||||
(global-set-key (kbd "C-<left>") nil)
|
||||
; main tmux key binds
|
||||
; *remember* C-b b in tmux sends a single C-b to the underlying tty
|
||||
(global-set-key (kbd "C-b c") (lambda () (interactive)
|
||||
(let ((frame (make-frame))
|
||||
; yes, this is silly
|
||||
; need a name for the buffer and emacs always re-uses buffers based on name
|
||||
; to keep w/ tmux, use an arbitrary, 'unique' name of the new buffer
|
||||
(buffer (get-buffer-create (format-time-string "%Y-%m-%d %H:%M:%S" (current-time)))))
|
||||
(select-frame-set-input-focus frame)
|
||||
(display-buffer buffer)
|
||||
(switch-to-buffer buffer)
|
||||
(delete-other-windows)
|
||||
)))
|
||||
(global-set-key (kbd "C-b &") 'delete-frame)
|
||||
(global-set-key (kbd "C-b \"") 'split-window-below)
|
||||
(global-set-key (kbd "C-b %") 'split-window-right)
|
||||
(global-set-key (kbd "C-b x") 'delete-window)
|
||||
(global-set-key (kbd "C-b <up>") 'windmove-up)
|
||||
(global-set-key (kbd "C-b <down>") 'windmove-down)
|
||||
(global-set-key (kbd "C-b <left>") 'windmove-left)
|
||||
(global-set-key (kbd "C-b <right>") 'windmove-right)
|
||||
(global-set-key (kbd "C-b !") 'make-frame)
|
||||
(global-set-key (kbd "C-b C-<up>") 'enlarge-window)
|
||||
(global-set-key (kbd "C-b C-<down>") 'shrink-window)
|
||||
(global-set-key (kbd "C-b C-<right>") 'enlarge-window-horizontally)
|
||||
(global-set-key (kbd "C-b C-<left>") 'shrink-window-horizontally)
|
||||
(global-set-key (kbd "C-b :") 'helm-M-x)
|
||||
(global-set-key (kbd "C-b SPC") 'zoom-mode) ; use 'balance-windows function if not using zoom.el or golden-ratio
|
||||
|
||||
;; Lookup the current symbol at point. C-c C-d is a common keybinding
|
||||
;; for this in lisp modes.
|
||||
(global-set-key (kbd "M-h") 'describe-bindings)
|
||||
(global-set-key (kbd "C-c C-d") #'helpful-at-point)
|
||||
|
||||
(bind-key* "M-%" 'query-replace-region-or-from-top)
|
||||
(global-set-key (kbd "C-h") 'query-replace-region-or-from-top)
|
||||
|
||||
; more vscode/gui styled find/replace
|
||||
(global-set-key (kbd "C-s") 'isearch-forward)
|
||||
(global-set-key (kbd "C-f") 'isearch-forward)
|
||||
|
||||
; C-h find/replace
|
||||
(global-set-key (kbd "C-h") 'query-replace)
|
||||
(global-set-key (kbd "C-H") 'query-replace-regexp)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Set some global config
|
||||
(setq inhibit-splash-screen t) ; why do you need to tell me things i know by default
|
||||
(setq inhibit-startup-screen t)
|
||||
(setq inhibit-startup-echo-area-message t)
|
||||
(setq-default tab-width 4) ; sanity!
|
||||
(electric-indent-mode 0) ; return should NOT fuck with the indentation of the previous line
|
||||
|
||||
;; make typing delete/overwrites selected text
|
||||
(delete-selection-mode 1)
|
||||
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
(setq pixel-scroll-precision-mode t)
|
||||
|
||||
;; UTF-8 as default encoding
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-language-environment "UTF-8")
|
||||
(set-default-coding-systems 'utf-8-unix)
|
||||
|
||||
; dont pop-up tooltips, show in echo area instead
|
||||
(setq tooltip-mode nil)
|
||||
(setq tooltip-use-echo-area t)
|
||||
|
||||
; auto revert when files/dired changes
|
||||
(setq global-auto-revert-non-file-buffers t)
|
||||
(global-auto-revert-mode 1)
|
||||
|
||||
; Clipboard integration
|
||||
(use-package xclip :config (xclip-mode 1))
|
||||
|
||||
;; use y or n instead of yes or no
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
; org mode syntax highlight code blocks
|
||||
(setq org-src-fontify-natively t)
|
||||
|
||||
; org mode - multiple agenda buffers
|
||||
(setq org-agenda-sticky t)
|
||||
|
||||
; org show file name in refile, also allows refiling to the file as a top level headline
|
||||
(setq org-refile-use-outline-path 'file)
|
||||
(setq org-outline-path-complete-in-steps nil)
|
||||
(setq org-refile-allow-creating-parent-nodes 'confirm)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; set font for emoji -- DOES NOT WORK ON MOBILE
|
||||
(when (eq system-type 'windows-nt)
|
||||
(set-fontset-font
|
||||
t
|
||||
'(#x1f300 . #x1fad0)
|
||||
(cond
|
||||
((member "Noto Color Emoji" (font-family-list)) "Noto Color Emoji")
|
||||
((member "Noto Emoji" (font-family-list)) "Noto Emoji")
|
||||
((member "Segoe UI Emoji" (font-family-list)) "Segoe UI Emoji")
|
||||
((member "Symbola" (font-family-list)) "Symbola")
|
||||
((member "Apple Color Emoji" (font-family-list)) "Apple Color Emoji"))
|
||||
;; Apple Color Emoji should be before Symbola, but Richard Stallman skum disabled it.
|
||||
;; GNU Emacs Removes Color Emoji Support on the Mac
|
||||
;; http://ergoemacs.org/misc/emacs_macos_emoji.html
|
||||
;;
|
||||
)
|
||||
|
||||
(custom-theme-set-faces
|
||||
'user
|
||||
'(default ((t ( :family "MonoLisa Variable" :height 100))))
|
||||
'(variable-pitch ((t (:family "Atkinson Hyperlegible" :height 120))))
|
||||
'(fixed-pitch ((t ( :family "MonoLisa Variable" :height 120))))
|
||||
)
|
||||
|
||||
; (custom-theme-set-faces
|
||||
; 'user
|
||||
; '(org-agenda ((t (:inherit fixed-pitch))))
|
||||
; '(org-block ((t (:inherit fixed-pitch))))
|
||||
; '(org-code ((t (:inherit (shadow fixed-pitch)))))
|
||||
; '(org-document-info ((t (:inherit fixed-pitch))))
|
||||
; '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
|
||||
; '(org-indent ((t (:inherit (org-hide fixed-pitch)))))
|
||||
; '(org-link ((t (:inherit (shadow fixed-pitch)))))
|
||||
; '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))
|
||||
; '(org-property-value ((t (:inherit fixed-pitch))) t)
|
||||
; '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
|
||||
; '(org-table ((t (:inherit fixed-pitch))))
|
||||
; '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8))))
|
||||
; '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))
|
||||
;)
|
||||
|
||||
;(add-hook 'org-mode-hook 'variable-pitch-mode)
|
||||
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; line numbers
|
||||
; find major mode : M-x eval-expression [enter] major-mode
|
||||
(require 'display-line-numbers)
|
||||
(defcustom display-line-numbers-exempt-modes '(org-mode org-agenda-mode)
|
||||
"Major modes on which to disable the linum mode, exempts them from global requirement"
|
||||
:group 'display-line-numbers
|
||||
:type 'list
|
||||
:version "green")
|
||||
(defun display-line-numbers--turn-on ()
|
||||
"turn on line numbers but excempting certain majore modes defined in `display-line-numbers-exempt-modes'"
|
||||
(if (and
|
||||
(not (member major-mode display-line-numbers-exempt-modes))
|
||||
(not (minibufferp)))
|
||||
(display-line-numbers-mode)))
|
||||
(global-display-line-numbers-mode)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; whitespace
|
||||
(progn
|
||||
;; Make whitespace-mode with very basic background coloring for whitespaces.
|
||||
;; http://xahlee.info/emacs/emacs/whitespace-mode.html
|
||||
(setq whitespace-style (quote (face spaces tabs newline space-mark tab-mark newline-mark )))
|
||||
|
||||
;; Make whitespace-mode and whitespace-newline-mode use “¶” for end of line char and “▷” for tab.
|
||||
(setq whitespace-display-mappings
|
||||
;; all numbers are unicode codepoint in decimal. e.g. (insert-char 182 1)
|
||||
'(
|
||||
(space-mark 32 [183] [46]) ; SPACE 32 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
|
||||
(newline-mark 10 [8629 10]) ; LINE FEED,
|
||||
(tab-mark 9 [8594 9] [92 9]) ; tab
|
||||
)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; modus-themes setup and enable
|
||||
(require-theme 'modus-themes)
|
||||
(setq modus-themes-region '(no-extend)
|
||||
modus-themes-fringes 'subtle
|
||||
modus-themes-scale-headings t
|
||||
)
|
||||
(load-theme 'modus-vivendi :no-confirm)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; focus on text (turn on as desired/needed ; off by default
|
||||
(require 'focus)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; helm
|
||||
(setq completion-styles '(flex))
|
||||
|
||||
(require 'helm-color)
|
||||
(require 'helm-bookmark)
|
||||
|
||||
(helm-autoresize-mode 1)
|
||||
|
||||
(setq helm-display-header-line nil
|
||||
helm-autoresize-max-height 30
|
||||
helm-autoresize-min-height 30)
|
||||
|
||||
(setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window
|
||||
helm-ff-file-name-history-use-recentf t
|
||||
helm-echo-input-in-header-line t)
|
||||
|
||||
(global-set-key (kbd "C-x C-d") 'helm-browse-project)
|
||||
(global-set-key (kbd "C-x b") 'list-buffers)
|
||||
(global-set-key (kbd "C-x f") 'focus-mode)
|
||||
(global-set-key (kbd "C-x c") 'focus-read-only-mode)
|
||||
(define-key global-map [remap find-file] 'helm-find-files)
|
||||
(define-key global-map [remap occur] 'helm-occur)
|
||||
(define-key global-map [remap list-buffers] 'helm-buffers-list)
|
||||
(define-key global-map [remap dabbrev-expand] 'helm-dabbrev)
|
||||
(define-key global-map [remap execute-extended-command] 'helm-M-x)
|
||||
(define-key global-map [remap apropos-command] 'helm-apropos)
|
||||
(define-key global-map [remap bookmark-jump] 'helm-filtered-bookmarks)
|
||||
(unless (boundp 'completion-in-region-function)
|
||||
(define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)
|
||||
(define-key emacs-lisp-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point))
|
||||
(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$CONF_FILE") (delete-file "$CONF_FILE"))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; activate helm after its fully configured
|
||||
;(helm-mode 1)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; diminish config
|
||||
; https://melpa.org/#/manage-minor-mode
|
||||
; M-x: manage-minor-mode
|
||||
;
|
||||
; M-x: describe-mode
|
||||
;(require 'diminish)
|
||||
;(diminish 'rainbow-mode) ; Hide lighter from mode-line
|
||||
;(diminish 'org-habit) ; im well aware i have org-habit enabled globally. thanks
|
||||
;(diminish 'helm-mode)
|
||||
;(diminish 'eldoc-mode)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; doom-modeline
|
||||
(require 'doom-modeline)
|
||||
(setq all-the-icons-color-icons nil)
|
||||
(setq find-file-visit-truename t)
|
||||
(doom-modeline-mode 1)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; flyspell
|
||||
(require 'flyspell)
|
||||
(setenv "LANG" "en_US")
|
||||
(setq ispell-program-name "hunspell")
|
||||
(setq ispell-dictionary "en_US")
|
||||
(use-package flyspell :demand t
|
||||
:config
|
||||
(use-package
|
||||
flyspell-correct-helm)
|
||||
|
||||
(defun flyspell-most-modes()
|
||||
(add-hook 'text-mode-hook (lambda () (flyspell-mode 1) ))
|
||||
(add-hook 'prog-mode-hook (lambda () (flyspell-mode 1) ))
|
||||
(dolist (hook '(change-log-mode-hook log-edit-mode-hook org-agenda))
|
||||
(add-hook hook (lambda ()
|
||||
(flyspell-mode -1)))))
|
||||
(flyspell-most-modes)
|
||||
)
|
||||
|
||||
(defun flyspell-on-for-buffer-type ()
|
||||
"Enable Flyspell appropriately for the major mode of the current buffer. Uses `flyspell-prog-mode' for modes derived from `prog-mode', so only strings and comments get checked. All other buffers get `flyspell-mode' to check all text. If flyspell is already enabled, does nothing."
|
||||
(interactive)
|
||||
(if (not (symbol-value flyspell-mode)) ; if not already on
|
||||
(progn
|
||||
(if (derived-mode-p 'prog-mode)
|
||||
(progn
|
||||
(message "Flyspell on (code)")
|
||||
(flyspell-prog-mode))
|
||||
;; else
|
||||
(progn
|
||||
(message "Flyspell on (text)")
|
||||
(flyspell-mode 1)))
|
||||
)))
|
||||
(defun flyspell-toggle ()
|
||||
"Turn Flyspell on if it is off, or off if it is on. When turning on, it uses `flyspell-on-for-buffer-type' so code-vs-text is handled appropriately."
|
||||
(interactive)
|
||||
(if (symbol-value flyspell-mode)
|
||||
(progn ; flyspell is on, t it off
|
||||
(message "Flyspell off")
|
||||
(flyspell-mode -1))
|
||||
; else - flyspell is off, turn it on
|
||||
(flyspell-on-for-buffer-type)))
|
||||
|
||||
; flyspell keyboard shortcuts
|
||||
(global-set-key (kbd "C-x y") 'flyspell-toggle)
|
||||
(global-set-key (kbd "C-x w") 'flyspell-correct-wrapper)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; zoom (replaces golden-ratio)
|
||||
(require 'zoom)
|
||||
|
||||
; sizing
|
||||
;(setq zoom-size '(0.618 . 0.618))
|
||||
(defun kmn-zoom-size-callback ()
|
||||
(cond
|
||||
((equal major-mode 'dired-mode) '(0.20 . 0.20))
|
||||
((equal major-mode 'eww-mode) '(0.75 . 0.75))
|
||||
((equal major-mode 'eshell-mode) '(0.75 . 0.75))
|
||||
((string-equal (window-dedicated-p) "side") '(0.15 . 0.15))
|
||||
(t '(0.618 . 0.618))
|
||||
))
|
||||
|
||||
; tuning
|
||||
(custom-set-variables
|
||||
'(zoom-size 'kmn-zoom-size-callback)
|
||||
'(temp-buffer-resize-mode t)
|
||||
; '(zoom-ignored-major-modes '(dired-mode))
|
||||
; '(zoom-ignore-predicates '((lambda ()
|
||||
; (if (string-equal (window-dedicated-p) "side") 'Y' nil)
|
||||
; )))
|
||||
)
|
||||
|
||||
(global-set-key (kbd "C-x +") 'zoom)
|
||||
(zoom-mode t)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; popup windows
|
||||
(use-package popwin
|
||||
:bind ( :map popwin:keymap
|
||||
("h" . popwin:close-popup-window)
|
||||
("r" . kmn/workspace-frame-scratch)
|
||||
("R" . kmn/popwin-scratch)
|
||||
("q" . kmn/popwin-quick-ref))
|
||||
:config
|
||||
(global-set-key (kbd "C-w") popwin:keymap)
|
||||
(push "_quick_reference.org" popwin:special-display-config))
|
||||
|
||||
(popwin-mode 1)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; tabs-bar
|
||||
;(tab-bar-mode t)
|
||||
;(burly-tabs-mode 1)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; tab line via centaur tabs
|
||||
(require 'centaur-tabs)
|
||||
(setq centaur-tabs-set-bar 'under)
|
||||
(setq centaur-tabs-set-close-button nil)
|
||||
(setq centaur-tabs-set-modified-marker t)
|
||||
(setq centaur-tabs-set-icons t)
|
||||
(setq centaur-tabs-plain-icons t)
|
||||
(setq centaur-tabs-cycle-scope 'tabs)
|
||||
(setq centaur-tabs-show-new-tab-button nil)
|
||||
(add-hook 'dired-mode-hook 'centaur-tabs-local-mode)
|
||||
(add-hook 'org-agenda-mode 'centaur-tabs-local-mode)
|
||||
(global-set-key (kbd "C-c t i") 'centaur-tabs-backward)
|
||||
(global-set-key (kbd "C-c t <left>") 'centaur-tabs-backward)
|
||||
(global-set-key (kbd "C-c t e") 'centaur-tabs-forward)
|
||||
(global-set-key (kbd "C-c t <right>") 'centaur-tabs-forward)
|
||||
(global-set-key (kbd "C-c t y") 'centaur-tabs-local-mode)
|
||||
(global-set-key (kbd "C-c t <down>") 'centaur-tabs-local-mode)
|
||||
(global-set-key (kbd "C-c t <up>") 'centaur-tabs-local-mode)
|
||||
|
||||
(defun centaur-tabs-buffer-groups ()
|
||||
"`centaur-tabs-buffer-groups' control buffers' group rules.
|
||||
|
||||
Group centaur-tabs with mode if buffer is derived from `eshell-mode' `emacs-lisp-mode' `dired-mode' `org-mode' `magit-mode'.
|
||||
All buffer name start with * will group to \"Emacs\".
|
||||
Other buffer group by `centaur-tabs-get-group-name' with project name."
|
||||
(list
|
||||
(cond
|
||||
((string-equal "*" (substring (buffer-name) 0 1))
|
||||
(memq major-mode '(magit-process-mode
|
||||
magit-status-mode
|
||||
magit-diff-mode
|
||||
magit-log-mode
|
||||
magit-file-mode
|
||||
magit-blob-mode
|
||||
magit-blame-mode
|
||||
))
|
||||
"Misc")
|
||||
((derived-mode-p 'dired-mode)
|
||||
"Dired")
|
||||
((memq major-mode '(helpful-mode
|
||||
help-mode))
|
||||
"Help")
|
||||
(t
|
||||
(centaur-tabs-get-group-name (current-buffer))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; persp-mode
|
||||
(setq persp-auto-resume-time -1.0)
|
||||
(with-eval-after-load "persp-mode-autoloads"
|
||||
(setq wg-morph-on nil) ;; switch off animation
|
||||
(setq persp-autokill-buffer-on-remove 'kill-weak)
|
||||
(add-hook 'window-setup-hook #'(lambda () (persp-mode 1))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; scratch buffer
|
||||
; set mode options -- borrowed from : https://emacsredux.com/blog/2014/07/25/configure-the-scratch-buffers-mode/
|
||||
; fundamental-mode / text-mode / org-mode
|
||||
(setq initial-major-mode 'text-mode)
|
||||
(setq initial-scratch-message "original scratch buffer")
|
||||
|
||||
; persistent-scratch (melpa)
|
||||
(persistent-scratch-autosave-mode 0)
|
||||
(global-set-key (kbd "C-c r S") 'persistent-scratch-save)
|
||||
(global-set-key (kbd "C-c r r") 'persistent-scratch-restore)
|
||||
(global-set-key (kbd "C-c r w") 'persistent-scratch-save-to-file)
|
||||
(global-set-key (kbd "C-c r l") 'persistent-scratch-restore-from-file)
|
||||
|
||||
; scratch buffers frame - use 'scratch and prompts to manage as needed
|
||||
(defun kmn/workspace-frame-scratch()
|
||||
(interactive)
|
||||
(let ((frame (make-frame)))
|
||||
(select-frame-set-input-focus frame)
|
||||
(delete-other-windows)
|
||||
(scratch 'text-mode)
|
||||
)
|
||||
)
|
||||
|
||||
; scratch buffers frame, prompt for initial mode - use 'scratch and prompts to manage as needed
|
||||
(defun kmn/workspace-frame-scratch-prompt()
|
||||
(interactive)
|
||||
(let ((frame (make-frame)))
|
||||
(select-frame-set-input-focus frame)
|
||||
(delete-other-windows)
|
||||
(scratch (let ((current-prefix-arg t)) (scratch--buffer-querymode)))
|
||||
)
|
||||
)
|
||||
|
||||
; scratch.el (multi-scratch / melpa)
|
||||
(global-set-key (kbd "C-c r s") #'kmn/workspace-frame-scratch)
|
||||
(global-set-key (kbd "C-c r p") #'kmn/workspace-frame-scratch-prompt)
|
||||
|
|
@ -1,316 +0,0 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; generic functions
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open org agenda in top side window
|
||||
; BUGGED AND UNUSED, agenda does NOT work properly in side windows
|
||||
(defun kmn/org-agenda-on-top ()
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . t)
|
||||
(no-delete-other-windows . t))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
(interactive)
|
||||
(display-buffer-in-side-window
|
||||
(get-buffer "*Org Agenda*") `((side . top) (slot . 0)
|
||||
(window-width . fit-window-to-buffer)
|
||||
(preserve-size . (t . nil)) , parameters))
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open dired with default directory in left side window
|
||||
(defun kmn/dired-directory-on-left (&optional dir_path no-win no-del-o-win slot-num)
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . ,(or no-win (setq no-win t)))
|
||||
(no-delete-other-windows . ,(or no-del-o-win (setq no-del-o-win t))))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
"Display `default-directory' in side window on left, hiding details."
|
||||
(interactive)
|
||||
(let ((buffer (dired-noselect (or dir_path (setq dir_path default-directory)))))
|
||||
(with-current-buffer buffer (dired-hide-details-mode t))
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . left) (slot . ,(or slot-num (setq slot-num -1)))
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open eshell in left side window
|
||||
(defun kmn/eshell-on-left (&optional shell-directory no-win no-del-o-win slot-num)
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . ,(or no-win (setq no-win t)))
|
||||
(no-delete-other-windows . ,(or no-del-o-win (setq no-del-o-win t))))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
(setq default-directory (or shell-directory (setq shell-directory default-directory)))
|
||||
|
||||
(interactive)
|
||||
(let ((buffer (eshell)))
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . left) (slot . ,(or slot-num (setq slot-num -1)))
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open eww in right side window
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open eww in right side window
|
||||
(defun kmn/eww-on-right (url &optional no-win no-del-o-win slot-num)
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . ,(or no-win (setq no-win t)))
|
||||
(no-delete-other-windows . ,(or no-del-o-win (setq no-del-o-win t))))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
(interactive)
|
||||
(eww url)
|
||||
(let ((buffer (current-buffer)))
|
||||
(previous-buffer)
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . right) (slot . ,(or slot-num (setq slot-num -1)))
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open text-mode scratch in right side window
|
||||
(defun kmn/scratch-text-on-right ()
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . t)
|
||||
(no-delete-other-windows . t))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
"Display `default-directory' in side window on right, hiding details."
|
||||
(interactive)
|
||||
(let ((buffer (scratch 'text-mode)))
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . right) (slot . -1)
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open text-mode scratch in left side window
|
||||
(defun kmn/scratch-text-on-left ()
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . t)
|
||||
(no-delete-other-windows . t))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
"Display `default-directory' in side window on left, hiding details."
|
||||
(interactive)
|
||||
(let ((buffer (scratch 'text-mode)))
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . left) (slot . -1)
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open text-mode scratch in right side window
|
||||
(defun kmn/scratch-prompt-on-right ()
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . t)
|
||||
(no-delete-other-windows . t))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
"Display `default-directory' in side window on left, hiding details."
|
||||
(interactive)
|
||||
(let ((buffer (scratch (let ((current-prefix-arg t)) (scratch--buffer-querymode)))))
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . right) (slot . -1)
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; open text-mode scratch in left side window
|
||||
(defun kmn/scratch-prompt-on-left ()
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-other-window . t)
|
||||
(no-delete-other-windows . t))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
"Display `default-directory' in side window on left, hiding details."
|
||||
(interactive)
|
||||
(let ((buffer (scratch (let ((current-prefix-arg t)) (scratch--buffer-querymode)))))
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . left) (slot . -1)
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; text-mode scratch buffer as a pop up window
|
||||
(defun kmn/popwin-scratch ()
|
||||
(interactive)
|
||||
(popwin:popup-buffer (scratch 'text-mode)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; quick reference notes as a pop up window
|
||||
(defun kmn/popwin-quick-ref ()
|
||||
(interactive)
|
||||
(when (eq system-type 'windows-nt)
|
||||
(popwin:find-file "~/org/_quick_reference.org"))
|
||||
(when kmn/is-termux
|
||||
(popwin:find-file "~/storage/shared/org/_quick_reference.org")))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; modern home/end via C-a and C-e
|
||||
(defun kmn/smart-beginning-of-line ()
|
||||
"Move point to `beginning-of-line'. If repeat command it cycle
|
||||
position between `back-to-indentation' and `beginning-of-line'."
|
||||
(interactive "^")
|
||||
(if (eq last-command 'smart-beginning-of-line)
|
||||
(if (= (line-beginning-position) (point))
|
||||
(back-to-indentation)
|
||||
(beginning-of-line))
|
||||
(back-to-indentation)))
|
||||
|
||||
(defun kmn/smart-end-of-line ()
|
||||
"Move point to `end-of-line'. If repeat command it cycle
|
||||
position between last non-whitespace and `end-of-line'."
|
||||
(interactive "^")
|
||||
(if (and (eq last-command 'kmn/smart-end-of-line)
|
||||
(= (line-end-position) (point)))
|
||||
(skip-syntax-backward " " (line-beginning-position))
|
||||
(end-of-line)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; function to kill all non special, non active buffers
|
||||
(defun kmn/kill-other-buffers ()
|
||||
"Kill all buffers but the current one. Don't mess with special buffers. Kill dired buffers"
|
||||
(interactive)
|
||||
; dired buffer cleanup
|
||||
(mapc
|
||||
(lambda (buffer)
|
||||
(when (eq 'dired-mode (buffer-local-value 'major-mode buffer))
|
||||
(kill-buffer buffer)))
|
||||
(buffer-list))
|
||||
; non special buffer cleanup
|
||||
(dolist (buffer (buffer-list))
|
||||
(unless (or (eql buffer (current-buffer)) (not (buffer-file-name buffer)))
|
||||
(kill-buffer buffer))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; find/replace all (interactive)
|
||||
(defun kmn/query-replace-region-or-from-top ()
|
||||
"If marked, query-replace for the region, else for the whole buffer (start from the top)"
|
||||
(interactive)
|
||||
(progn
|
||||
(let ((orig-point (point)))
|
||||
(if (use-region-p)
|
||||
(call-interactively 'query-replace)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(call-interactively 'query-replace)))
|
||||
(message "Back to old point.")
|
||||
(goto-char orig-point))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; dock current buffer in given side panel
|
||||
(defun kmn/dock-current-buffer-on-side (selected_side)
|
||||
(defvar parameters
|
||||
'(window-parameters . ((no-delete-other-windows . t))))
|
||||
|
||||
(setq fit-window-to-buffer-horizontally t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
"Display `default-directory' in side window on left, hiding details."
|
||||
(interactive)
|
||||
(let ((buffer (current-buffer)))
|
||||
(display-buffer-in-side-window
|
||||
buffer `((side . ,selected_side) (slot . -1)
|
||||
(window-width . fit-window-to-buffer)
|
||||
, parameters)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; dock current buffer on right
|
||||
(defun kmn/dock-current-buffer-on-right ()
|
||||
(interactive)
|
||||
(kmn/dock-current-buffer-on-side 'right)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; dock current buffer on right
|
||||
(defun kmn/dock-current-buffer-on-left ()
|
||||
(interactive)
|
||||
(kmn/dock-current-buffer-on-side 'left)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; dock current buffer on right
|
||||
(defun kmn/dock-current-buffer-on-top ()
|
||||
(interactive)
|
||||
(kmn/dock-current-buffer-on-side 'top)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; dock current buffer on right
|
||||
(defun kmn/dock-current-buffer-on-bottom ()
|
||||
(interactive)
|
||||
(kmn/dock-current-buffer-on-side 'bottom)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; perform days math on a date string
|
||||
(defun kmn/date-string-days-math (date-string days-to-subtract)
|
||||
(format-time-string "%Y-%m-%d"
|
||||
(encode-time
|
||||
(decoded-time-add (parse-time-string date-string) (make-decoded-time :day days-to-subtract))
|
||||
)
|
||||
))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; subtract 7 days from a date string
|
||||
(defun kmn/date-string-minus-seven-days (date-string)
|
||||
(kmn/date-string-days-math date-string -7)
|
||||
)
|
||||
|
||||
; subtract 3 days from a date string
|
||||
(defun kmn/date-string-minus-three-days (date-string)
|
||||
(kmn/date-string-days-math date-string -3)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; create new frame if not inside termux
|
||||
(defun kmn/possibly-create-frame ()
|
||||
(interactive)
|
||||
(when (not kmn/is-termux)
|
||||
(let ((frame (make-frame)))
|
||||
(select-frame-set-input-focus frame)))
|
||||
)
|
|
@ -1,162 +0,0 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; various workspaces used day to day
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; load most recent auto save
|
||||
(defun kmn/workspace-load-auto ()
|
||||
(interactive)
|
||||
(persp-load-state-from-file "persp-auto-save")
|
||||
(persistent-scratch-restore)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; save the current workspace to `latest` filename
|
||||
(defun kmn/workspace-save-latest ()
|
||||
(interactive)
|
||||
(persp-save-state-to-file "latest")
|
||||
(persistent-scratch-save-to-file
|
||||
(expand-file-name ".persistent-scratch-latest" user-emacs-directory))
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; load `latest` file name to current workspace
|
||||
(defun kmn/workspace-load-latest ()
|
||||
(interactive)
|
||||
(persp-load-state-from-file "latest")
|
||||
(persistent-scratch-restore-from-file
|
||||
(expand-file-name ".persistent-scratch-latest" user-emacs-directory))
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Reusable hugo dev workspace
|
||||
(defun kmn/workspace-hugo-generic (src-sub-dir)
|
||||
(interactive)
|
||||
(kmn/possibly-create-frame)
|
||||
(delete-other-windows)
|
||||
(centaur-tabs-mode t)
|
||||
(setq src-sub-dir (concat "~/src/" src-sub-dir))
|
||||
(kmn/dired-directory-on-left src-sub-dir nil nil -1)
|
||||
(kmn/eshell-on-left src-sub-dir nil nil 0)
|
||||
(kmn/eww-on-right "http://localhost:1313")
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Hugo blog workspace
|
||||
(defun kmn/workspace-hugo-blog ()
|
||||
(interactive)
|
||||
(kmn/workspace-hugo-generic "blog.kemonine.info")
|
||||
(find-file "~/org/blog/_blog.org")
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Hugo accessible.tips workspace
|
||||
(defun kmn/workspace-hugo-accessible-tips ()
|
||||
(interactive)
|
||||
(kmn/workspace-hugo-generic "accessible.tips")
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Hugo culinary.kemonine.info workspace
|
||||
(defun kmn/workspace-hugo-culinary ()
|
||||
(interactive)
|
||||
(kmn/workspace-hugo-generic "culinary")
|
||||
(find-file "~/org/culinary/_culinary.org")
|
||||
(find-file "~/org/culinary/_recipes.org")
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; org-mode workspace
|
||||
(defun kmn/workspace-org ()
|
||||
(interactive)
|
||||
(kmn/possibly-create-frame)
|
||||
; start with fresh frame
|
||||
(delete-other-windows)
|
||||
(kmn/kill-other-buffers)
|
||||
(ignore-errors (kill-buffer "*scratch*"))
|
||||
; Open main files used as 'gateway' to everything else
|
||||
(find-file "~/org/_habits.org")
|
||||
(find-file "~/org/_todo.org")
|
||||
(find-file "~/org/_slipbox.org")
|
||||
(find-file "~/org/_index.org")
|
||||
; top window for habits/scheduled
|
||||
(org-agenda nil "h")
|
||||
(goto-char 0)
|
||||
; main todo/slipbox
|
||||
(split-window-below)
|
||||
(next-multiframe-window)
|
||||
(org-agenda nil "t")
|
||||
(goto-char 0)
|
||||
(next-multiframe-window)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; org-mode workspace for termux devices (mobile / android)
|
||||
(defun kmn/workspace-org-single-window ()
|
||||
(interactive)
|
||||
; start with fresh frame
|
||||
(delete-other-windows)
|
||||
(kmn/kill-other-buffers)
|
||||
(ignore-errors (kill-buffer "*scratch*"))
|
||||
; Open main files used as 'gateway' to everything else
|
||||
(find-file "~/org/_habits.org")
|
||||
(find-file "~/org/_todo.org")
|
||||
(find-file "~/org/_slipbox.org")
|
||||
(find-file "~/org/_index.org")
|
||||
; Personal startup screen - orgmode agenda with all TODO
|
||||
(org-agenda nil "r")
|
||||
; start at the top of the agenda
|
||||
(goto-char 0)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; org-mode workspace for general kb work that doesnt use the agenda
|
||||
(defun kmn/workspace-org-index ()
|
||||
(interactive)
|
||||
(kmn/possibly-create-frame)
|
||||
; start with fresh frame
|
||||
(delete-other-windows)
|
||||
; setup scratch on right
|
||||
(kmn/scratch-text-on-right)
|
||||
(goto-char 0)
|
||||
; Open main files used as 'gateway' to everything else
|
||||
(find-file "~/org/_index.org")
|
||||
(goto-char 0)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; org-mode workspace for culinary work that doesnt use the agenda
|
||||
(defun kmn/workspace-org-culinary ()
|
||||
(interactive)
|
||||
(kmn/possibly-create-frame)
|
||||
; start with fresh frame
|
||||
(delete-other-windows)
|
||||
; setup scratch on right
|
||||
(kmn/scratch-text-on-left)
|
||||
(goto-char 0)
|
||||
; Open main files used as 'gateway' to everything else
|
||||
(find-file "~/org/culinary/_culinary.org")
|
||||
(goto-char 0)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; empty code workspace
|
||||
(defun kmn/workspace-code-empty (&optional dir_path)
|
||||
(interactive)
|
||||
(kmn/possibly-create-frame)
|
||||
(delete-other-windows)
|
||||
(kmn/kill-other-buffers)
|
||||
(ignore-errors (kill-buffer "*scratch*"))
|
||||
(scratch 'text-mode)
|
||||
; show dired at `~` in left side window
|
||||
(kmn/dired-directory-on-left dir_path)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; hugo development
|
||||
(defun kmn/workspace-code-generic()
|
||||
(interactive)
|
||||
(kmn/workspace-code-empty "~/src")
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; _global.el for scratch workspace definitions
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue