From 2984869ad7146c0a30f76b7e50dc8b696b0fdeb9 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 7 Sep 2020 10:56:11 -0400 Subject: [PATCH] cleanup and terminal fixes --- init.el | 82 ++++++++++++++---------------------------------- misc-disabled.el | 31 ++++++++++++++++++ 2 files changed, 54 insertions(+), 59 deletions(-) diff --git a/init.el b/init.el index 61e347e..150669d 100644 --- a/init.el +++ b/init.el @@ -14,7 +14,7 @@ ;; along with this program. If not, see . ;; do m-x benchmark-init to see some benchmark stats -;;(add-to-list 'load-path "~/.emacs.d/src/benchmark-init-el/") +;;(add-to-list 'load-path (concat user-emacs-directory "src/benchmark-init-el/") ;;(require 'benchmark-init-loaddefs) ;;(benchmark-init/activate) @@ -60,18 +60,13 @@ ;; these need to be done before the hook in order to satisfy the byte compiler or batch mode -;; this is the builtin org mode -;;(add-to-list 'load-path "~/.emacs.d/emacs/site-lisp/org") - -(add-to-list 'load-path "~/.emacs.d/src/readline-complete") +(add-to-list 'load-path (concat user-emacs-directory "src/readline-complete")) ;; disabled since not used. -;;(add-to-list 'load-path "~/.emacs.d/src/bbdb-csv-import") -;;(add-to-list 'load-path "~/.emacs.d/src/ghci-completion") -;;(add-to-list 'load-path "~/.emacs.d/src/mediawiki-el") -;;(add-to-list 'load-path "~/.emacs.d/src/spray") +;;(add-to-list 'load-path (concat user-emacs-directory "src/bbdb-csv-import")) +;;(add-to-list 'load-path (concat user-emacs-directory "src/spray")) -(add-to-list 'load-path "~/.emacs.d/src/visible-mark") +(add-to-list 'load-path (concat user-emacs-directory "src/visible-mark")) @@ -231,7 +226,7 @@ ;; keep our init.el clean, by moving customization elisp to it's own file -(setq custom-file "~/.emacs.d/custom.el") +(setq custom-file (concat user-emacs-directory "custom.el")) ;; empty atm ;;(load custom-file 'noerror) @@ -640,7 +635,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." (setq save-place-version-control 'nospecial save-place-limit 4000 - save-place-file "~/.emacs.d/places") + save-place-file (concat user-emacs-directory "places")) (save-place-mode 1)) @@ -652,7 +647,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; save every minute savehist-autosave-interval 60 ;; keep the home clean - savehist-file "~/.emacs.d/.savehist") + savehist-file (concat user-emacs-directory ".savehist")) (savehist-mode 1)) ;;; dired @@ -1056,7 +1051,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer." shift-select-mode nil truncate-partial-width-windows nil uniquify-buffer-name-style 'forward - oddmuse-directory "~/.emacs.d/oddmuse" + oddmuse-directory (concat user-emacs-directory "oddmuse") echo-keystrokes 0.1 mark-ring-max 160 sort-fold-case t ; case insensitive line sorting @@ -1080,18 +1075,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer." imenu-auto-rescan t indicate-empty-lines t) ; mark end of buffer -(require 'smooth-scroll) -;; long gnus summary buffers lags too much with this, -;; but I like it enough to leave it enabled by default -;; and crank up the step size to be faster -;; and it doesn't have a way to enable it only for certain modes etc. -;; todo sometime, make it work for certain modes only -(smooth-scroll-mode t) -;; its too slow with the default of 2 -(setq smooth-scroll/vscroll-step-size 6) -;; sublimity doesn't work as good going fast by default -;; smooth-scrolling.el, does not do smooth scrolling. its about cursor location - (blink-cursor-mode '(-4)) (menu-bar-mode -1) @@ -1655,7 +1638,7 @@ indent yanked text (with prefix arg don't indent)." ;; worth the benefit of only having one concept in my mind. (dolist (r `( - (?i (file . ,"~/.emacs.d/init.el")) + (?i (file . ,(concat user-emacs-directory "init.el"))) (?o (file . ,"/a/work.org")) (?t (file . ,"/a/t.org")) (?s (file . ,"/usr/share/doc/exim4-base/spec.txt.gz")) @@ -1677,7 +1660,7 @@ indent yanked text (with prefix arg don't indent)." (use-package undo-tree :config ;; more resilient undo-tree-history if we have its location set up front. - (setq undo-tree-history-directory-alist '(("." . "~/.undo-tree-history")) + (setq undo-tree-history-directory-alist '(("." . (concat user-emacs-directory ".undo-tree-history"))) undo-outer-limit 100000000 ; per undo command undo-limit 500000000 ; undo history limit undo-strong-limit 600000000 ; undo history limit plus some extra @@ -2170,6 +2153,8 @@ modes like org-mode which have their own yank function." (define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp))) ;;;;; M-r ?? unused + + ;;;;; C-a copy buffer (defun copy-all () @@ -2233,34 +2218,10 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "M-d") 'run) -;;;;; C-M-d - swap buffer across windows -;; from http://www.emacswiki.org/emacs/TransposeWindows +;;;;; C-M-d - split-window-horizontally + +(global-set-key (kbd "C-M-c") 'split-window-horizontally) -(setq swapping-buffer nil) -(setq swapping-window nil) -(defun swap-buffers-in-windows () - "Swap buffers between two windows" - (interactive) - (if (and swapping-window - swapping-buffer) - (let ((this-buffer (current-buffer)) - (this-window (selected-window))) - (if (and (window-live-p swapping-window) - (buffer-live-p swapping-buffer)) - (progn (switch-to-buffer swapping-buffer) - (select-window swapping-window) - (switch-to-buffer this-buffer) - (select-window this-window) - (message "Swapped buffers.")) - (message "Old buffer/window killed. Aborting.")) - (setq swapping-buffer nil) - (setq swapping-window nil)) - (progn - (setq swapping-buffer (current-buffer)) - (setq swapping-window (selected-window)) - (message "Buffer and window marked for swapping.")))) - -(global-set-key (kbd "C-M-d") 'swap-buffers-in-windows) ;;;;; C-f - kill-whole-line @@ -2318,7 +2279,7 @@ modes like org-mode which have their own yank function." ;; todo; check out smex-show-unbound-commands shows frequently used commands that have no key bindings. ;; this must be before smex-initialize (setq - smex-save-file "~/.emacs.d/.smex-items") + smex-save-file (concat user-emacs-directory ".smex-items")) ;; this uses smex (global-set-key (kbd "M-x") 'counsel-M-x) @@ -2357,7 +2318,7 @@ modes like org-mode which have their own yank function." ;;;;; C-M-c - copy-to-register -(global-set-key (kbd "C-M-c") 'copy-to-register) +(global-set-key (kbd "C-M-d") 'copy-to-register) ;;;;; C-v - yank @@ -2483,8 +2444,7 @@ modes like org-mode which have their own yank function." (progn (basic-save-buffer) (delete-frame)) (save-buffers-kill-terminal t)))) -;;;;; C-* - split-window-horizontally -(global-set-key (kbd "C-*") 'split-window-horizontally) +;;;;; C-* - --- terminal ;;;;; C-M-* - calc-dispatch (global-set-key (kbd "C-M-*") 'calc-dispatch) @@ -2665,8 +2625,12 @@ modes like org-mode which have their own yank function." (defun vim-style-join-line () (interactive) (join-line '(4))) +;; terminal +(global-set-key (kbd "C-_") 'vim-style-join-line) +;; gui (global-set-key (kbd "C-/") 'vim-style-join-line) (define-key undo-tree-map (kbd "C-/") nil) +(define-key undo-tree-map (kbd "C-_") nil) ;;;;; C-M-/ - copy-buffer-file-name diff --git a/misc-disabled.el b/misc-disabled.el index ac5fea8..0a7c5b3 100644 --- a/misc-disabled.el +++ b/misc-disabled.el @@ -458,3 +458,34 @@ (setq mode-line (concat mode-line flymake-mode-line-status)) (setq flymake-mode-line mode-line) (force-mode-line-update))) + + + + +;; this seems like it could be useful, but I havent been using it, so disabled +;; from http://www.emacswiki.org/emacs/TransposeWindows +(setq swapping-buffer nil) +(setq swapping-window nil) +(defun swap-buffers-in-windows () + "Swap buffers between two windows" + (interactive) + (if (and swapping-window + swapping-buffer) + (let ((this-buffer (current-buffer)) + (this-window (selected-window))) + (if (and (window-live-p swapping-window) + (buffer-live-p swapping-buffer)) + (progn (switch-to-buffer swapping-buffer) + (select-window swapping-window) + (switch-to-buffer this-buffer) + (select-window this-window) + (message "Swapped buffers.")) + (message "Old buffer/window killed. Aborting.")) + (setq swapping-buffer nil) + (setq swapping-window nil)) + (progn + (setq swapping-buffer (current-buffer)) + (setq swapping-window (selected-window)) + (message "Buffer and window marked for swapping.")))) + +(global-set-key (kbd "C-M-d") 'swap-buffers-in-windows) -- 2.30.2