From 6a3c7880cb5834ae95eb62d988d737bb2edcdde3 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 3 Sep 2020 20:21:56 -0400 Subject: [PATCH] fixes for terminal --- init.el | 69 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/init.el b/init.el index 4680f06..0b9cd87 100644 --- a/init.el +++ b/init.el @@ -83,7 +83,8 @@ ;; now i just have one init file (unless (equal (user-uid) 0) ; don't make root owned files (byte-recompile-file (expand-file-name "init.el" init-dir) nil 0) - (byte-recompile-file "/p/c/mymu4e.el" nil 0) + (when (file-exists-p "/p/c/mymu4e.el") + (byte-recompile-file "/p/c/mymu4e.el" nil 0)) ) ;; load init in `after-init-hook' so all packages are loaded. However, disabled because @@ -257,19 +258,19 @@ Fourth argument TYPE is the custom option type." ;;;; alternate keyboards ;; todo, figure out an easy way to disable this when using external keyboard - (if (display-graphic-p) - (setq - enter-key (kbd "") - s-enter-key (kbd "") - c-m-enter-key (kbd "") - m-enter (kbd "") - c-enter (kbd "")) - (setq - enter-key (kbd "C-m") - s-enter-key (kbd "C-8") - c-m-enter-key (kbd "C-M-8") - m-enter (kbd "M-m") - c-enter (kbd "C-8"))) + ;; (if (display-graphic-p) + ;; (setq + ;; enter-key (kbd "") + ;; s-enter-key (kbd "") + ;; c-m-enter-key (kbd "") + ;; m-enter (kbd "") + ;; c-enter (kbd "")) + ;; (setq + ;; enter-key (kbd "C-m") + ;; s-enter-key (kbd "C-8") + ;; c-m-enter-key (kbd "C-M-8") + ;; m-enter (kbd "M-m") + ;; c-enter (kbd "C-8"))) (setq tp (string= (system-name) "tp")) (setq x200 (string= (system-name) "x2")) @@ -357,7 +358,8 @@ Fourth argument TYPE is the custom option type." (define-key ac-completing-map (kbd "") nil) (define-key ac-completing-map (kbd "") 'ac-expand) (define-key ac-completing-map "\t" 'ac-complete) - (define-key ac-completing-map (kbd "") 'ac-complete) + ;;(define-key ac-completing-map (kbd "") 'ac-complete) + (define-key ac-completing-map (kbd "TAB") 'ac-complete) @@ -402,7 +404,9 @@ Fourth argument TYPE is the custom option type." (add-hook 'shell-mode-hook (lambda () - (define-key shell-mode-map (kbd "") 'auto-complete))) + ;;(define-key shell-mode-map (kbd "") 'auto-complete) + (define-key shell-mode-map (kbd "TAB") 'auto-complete) + )) ;;; readline complete fix @@ -900,7 +904,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer." ;; mu4e-user-mail-address-list ;; and a function ;; inspired by mu4e info manual, search for mu4e-compose-pre-hook. - (load "/p/c/mymu4e.el") + (when (file-exists-p "/p/c/mymu4e.el") + (load "/p/c/mymu4e.el")) (defun my-decrypt () ;; use for decrypting in mu4e @@ -1171,7 +1176,8 @@ and Ian Kelling as the name" (add-hook 'haskell-interactive-mode-hook (lambda () (define-key haskell-interactive-mode-map "\r" nil) - (define-key haskell-interactive-mode-map (kbd "") 'haskell-interactive-mode-return))) + (define-key haskell-interactive-mode-map (kbd "RET") + 'haskell-interactive-mode-return))) (add-hook 'haskell-indentation-mode-hook (lambda () (define-key haskell-indentation-mode-map "\r" nil))) @@ -1349,7 +1355,8 @@ and Ian Kelling as the name" (setq css-indent-offset 2) - (load-file "/a/h/iank-mod.el") + (when (file-exists-p "/a/h/iank-mod.el") + (load-file "/a/h/iank-mod.el")) ;; from when i was running my own patches ;;(add-to-list 'load-path "/a/opt/ws-butler") @@ -2085,7 +2092,8 @@ Go to the next directory based on where the cursor is." (defun prog-mode-defaults () "Default coding hook, useful with any programming language." ;; so that I can do completion before the dialog pops up - (local-set-key (kbd "") 'auto-complete) + ;;(local-set-key (kbd "") 'auto-complete) + (local-set-key (kbd "TAB") 'auto-complete) ;; todo, this is causing error message on loading file, prolly not working ;;(flycheck-mode +1) (setq ac-sources (delq 'ac-source-dictionary ac-sources)) @@ -2211,10 +2219,10 @@ indent yanked text (with prefix arg don't indent)." ;; when opening a pair, and then inserting a newline, push the closing pair to another newline (sp-pair "{" nil :post-handlers '(:add ((lambda (id action context) - (gp/sp/pair-on-newline-and-indent id action context)) (kbd "")))) + (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET")))) (sp-pair "[" nil :post-handlers '(:add ((lambda (id action context) - (gp/sp/pair-on-newline-and-indent id action context)) (kbd "")))) + (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET")))) ;; in my version, this is not a pairing. @@ -2449,7 +2457,9 @@ indent yanked text (with prefix arg don't indent)." ;;;; single/special keys ;;;;; tab - isearch - (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace) + ;; todo: this doesnt work. needs , which doesnt work in terminal. fix that. + ;; (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace) + (define-key isearch-mode-map (kbd "M-f") 'isearch-query-replace) ;;;;; f12 - isearch-forward ;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs @@ -2729,7 +2739,7 @@ modes like org-mode which have their own yank function." (add-hook 'comint-mode-hook (lambda () (define-key comint-mode-map "\r" nil) - (define-key comint-mode-map (kbd "") 'comint-send-input))) + (define-key comint-mode-map (kbd "RET") 'comint-send-input))) (add-hook 'comint-mode-hook (lambda () @@ -3030,10 +3040,10 @@ modes like org-mode which have their own yank function." ;;;;; C-z - undo-only (global-set-key (kbd "C-z") 'undo-tree-undo) ;;;;; C-M-z - suspend-frame - (global-set-key (kbd "C-z") 'suspend-frame) - ;; previously, i meant to only use gui and ran this to - ;; be sure it never got ran - ;;(defun suspend-frame() (interactive)) + (global-set-key (kbd "C-M-z") 'suspend-frame) + ;; this is never good in a gui + (when (window-system) + (defun suspend-frame() (interactive))) ;;;;; C-x - kill-region @@ -3500,6 +3510,7 @@ modes like org-mode which have their own yank function." (interactive) (end-of-line) (newline-and-indent)) + ;; todo use alternate keybind make this work for terminal (global-set-key (kbd "") 'newline-anywhere) @@ -3508,7 +3519,7 @@ modes like org-mode which have their own yank function." (defun plain-newline () (interactive) (insert "\n")) - (global-set-key (kbd "") 'plain-newline) + (global-set-key (kbd "M-RET") 'plain-newline) ;;;;; C-space - org-edit-special -- 2.30.2