From 5f7059b571f859ae57e1f7ef9606a79fe36d6ad0 Mon Sep 17 00:00:00 2001 From: kmt Date: Sat, 14 Sep 2013 22:25:15 -0400 Subject: [PATCH 1/6] Added some C-h handling from http://stackoverflow.com/questions/13897125/emacs-translating-c-h-to-del-m-h-to-m-del --- personal/kmt-c-h.el | 152 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 personal/kmt-c-h.el diff --git a/personal/kmt-c-h.el b/personal/kmt-c-h.el new file mode 100644 index 0000000000..3d59dcfe0b --- /dev/null +++ b/personal/kmt-c-h.el @@ -0,0 +1,152 @@ +;;; first off, we do some fancy stuff to make C-h work "properly," but still +;;; have good access to the help functions! +;;; +;;; Using C-h for "help" might seem OK to some folks, but since it's also the +;;; ASCII standard value for the "backspace" character, one typically used ever +;;; since the days of the typewriter to move the cursor backwards one position +;;; and in computing normally to erase any character backed over, a vast amount +;;; of stupidity is needed in emacs to continue to (ab)use as the "help" +;;; character. Instead it is still quite intuitive, and often much easier in +;;; zillions of environments, to use M-? for help. +;;; +;;; So, we can set C-h and C-? and friends to sensible bindings... +;; +;; Remember to call override-local-key-settings in the appropriate hooks to fix +;; up modes which violate global user preferences.... +;; +(global-set-key "\C-h" 'delete-backward-char) +(global-set-key "\C-?" 'delete-char) +(global-set-key "\e\C-h" 'backward-kill-word) +(global-set-key "\e\C-?" 'kill-word) + +;;; and then we diddle with help to make it work again.... +;; +;; Oddly, the help interface in emacs is extremely scatter-brained, with +;; several slightly different ways of doing the same thing. This is probably +;; due to the fact that several different programmers have implemented various +;; bits and pieces of the help systems. See help.el and help-macro.el, but try +;; not to tear your hair out when you find out help-event-list in 19.34 is +;; essentially bogus, since it is simply an extension to a "standard" list. +;; +;; Remember to call override-local-key-settings in the appropriate hooks to fix +;; up modes which violate global user preferences.... +;; +(global-set-key [f1] 'help-command) ; first do this for 19.28. +(global-set-key "\e?" 'help-command) ; this is the first step to set up help +(global-set-key "\e?F" 'view-emacs-FAQ) ; in 19.34 it needs more help... +;; should help-char be just ? instead? +(setq help-char ?\M-?) ; this should "fix" the rest. + +;; one more handy help-related binding... +;; +(define-key help-map "?" 'describe-key-briefly) ; also C-x? for Jove compat + +;;; Now for function key mappings... +;;; +;;; I USUALLY EXPECT THE BACKSPACE KEY TO WORK LIKE AN ASCII BACKSPACE! +;; +;; For some entirely un-fathomable reason the default function bindings make +;; the 'backspace' and 'delete' keys synonymous! +;; +;; NOTE: this *should* work by simply reading termio for current erase char. +;; +;; As of emacs-21.2 a note was added to the NEWS file which says "** On +;; terminals whose erase-char is ^H (Backspace), Emacs now uses +;; normal-erase-is-backspace-mode." Unfortunately this does EXACTLY the WRONG +;; thing, and in a totally bizzare, disruptive, subversive, and stupid +;; backwards way. With every major release it's gotten worse and worse and +;; worse; more convoluted, and ugly. +;; +;; So, we must do something to kill that horrible stupid broken poor +;; useless excuse for a feature, normal-erase-is-backspace-mode.... +;; +;; seems 23.1 changes function-key-map radically.... +;; +;; Unfortunately 23.1 also still has function-key-map so we can't make that +;; (function-key-map) an alias for the new local-function-key-map that we need +;; to use in 23.1 to modify key translations. Sigh. +;; +;; Instead make a new alias that can be used transparently as the desired map. +;; +(eval-and-compile + (if (functionp 'defvaralias) ; since 22.1 + (if (boundp 'local-function-key-map) + (defvaralias 'my-function-key-map 'local-function-key-map + "Special variable alias to allow transparent override of +`local-function-key-map' for 23.1 vs 22.3(?).") + (defvaralias 'my-function-key-map 'function-key-map + "Special variable alias to allow transparent override +of `function-key-map' for 22.3(?) vs. older,")) + ;; XXX is this right? it works (maybe?) + (defvar my-function-key-map function-key-map))) +;; +;; First undo (local-)funtion-key-map weirdness. +;; +;; luckily on Mac OS-X X11, at least with the mini-wireless keyboard and on the +;; large USB keyboard, the big "delete" key on the main block is actually +;; sending by default, else one would have to first change the X11 +;; keyboard map! +;; +(define-key my-function-key-map [delete] [?\C-?]) +(define-key my-function-key-map [S-delete] [?\C-h]) +(define-key my-function-key-map [M-delete] [?\C-\M-?]) +(define-key my-function-key-map [kp-delete] [?\C-?]) +(define-key my-function-key-map [backspace] [?\C-h]) +(define-key my-function-key-map [S-backspace] [?\C-?]) +;;(define-key my-function-key-map [C-backspace] [?\C-h]) ; sometimes *is* DEL.... +(define-key my-function-key-map [M-backspace] [?\e?\C-h]) +(define-key my-function-key-map [M-S-backspace] [?\e?\C-?]) +(define-key my-function-key-map [kp-backspace] [?\C-h]) +;; +;; Next, zap the keyboard translate table, set up by +;; normal-erase-is-backspace-mode (in simple.el), which can do nothing +;; but confuse! +;; +(setq keyboard-translate-table nil) +;; +;; Finally, kill, Kill, KILL! the input-decode-map added in 23.x, and set +;; up by normal-erase-is-backspace-mode (in simple.el) which can do +;; nothing but confuse! +;; +;; This is TRULY _E_V_I_L_!!!! HORRID!!! MASSIVELY STUPID!!!! +;; +;; input-decode-map is poorly documented, and causes things above and +;; below to fail with the most confusing errors! +;; +;; (This probably only needs to be blown away on window systems, and +;; perhaps only for X, but doing it here now is apparently early enough +;; to allow for terminal mode specific settings to be re-applied to it +;; and so it seems safe to just blow away the asinine stupid attempt to +;; transpose backspace and delete. RMS is a pedantic idiot on this!) +;; +(if (boundp 'input-decode-map) + (setq input-decode-map (make-sparse-keymap))) + +;; finally here's a little function to help fix up modes which don't honour default +;; bindings in sensible ways. Use this in any init hooks for modes which cause problems +;; +(defun override-local-key-settings () + "User defined function. Intended to be called within various hooks to +override the value of buffer-local key map settings which may have been +overridden without consideration by the major mode." + (local-set-key "\C-?" 'delete-char) ; many modes + (local-set-key "\C-h" 'delete-backward-char) ; sh-mode + ;; the rest are *not* overridden by cc-mode, but are by c-mode + (local-set-key "\e\C-h" 'backward-kill-word) ; text-mode + (local-set-key "\e?" 'help-command) ; nroff-mode + (local-set-key "\eh" 'mark-c-function) + (local-set-key "\e\C-?" 'kill-word) + (local-set-key "\e\C-e" 'compile) + ;; try this on for size... + (local-set-key "\C-x\e\C-e" 'recompile) + ) + +(add-hook 'isearch-mode-hook + (function + (lambda () + "Private isearch-mode fix for C-h." + (define-key isearch-mode-map "\C-h" 'isearch-delete-char)))) + + +;;; OK, that's the end of the stuff to fix GNU Emacs' C-h brain damage. Phew! +(provide 'kmt-c-h) From a83d3a577d2facdb2bc7ab1df757943f9b6350ed Mon Sep 17 00:00:00 2001 From: kmt Date: Sat, 14 Sep 2013 22:25:41 -0400 Subject: [PATCH 2/6] Added server-start --- personal/kmt-server.el | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 personal/kmt-server.el diff --git a/personal/kmt-server.el b/personal/kmt-server.el new file mode 100644 index 0000000000..b5b4e6b418 --- /dev/null +++ b/personal/kmt-server.el @@ -0,0 +1,3 @@ +(require 'server) +(or (server-running-p) + (server-start)) From 3afc4ec630bf2c9755c515dfc36a63396419b216 Mon Sep 17 00:00:00 2001 From: kmt Date: Thu, 19 Sep 2013 22:09:42 -0400 Subject: [PATCH 3/6] Added kmt-init.el to personal --- personal/kmt-init.el | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 personal/kmt-init.el diff --git a/personal/kmt-init.el b/personal/kmt-init.el new file mode 100644 index 0000000000..411ccd18c4 --- /dev/null +++ b/personal/kmt-init.el @@ -0,0 +1,39 @@ +;;;; UTF-8 support +(set-keyboard-coding-system 'mule-utf-8) +(set-terminal-coding-system 'mule-utf-8) +(prefer-coding-system 'utf-8) + + +;;;; Shell-mode +(add-hook 'shell-mode-hook 'compilation-shell-minor-mode) +(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m) + + +;;;; Compilation +(setq compilation-scroll-output t) + + +;;;;; Projectile +(defun kmt/projectile-shell () + "Open a shell in the current project's root." + (interactive) + (projectile-dired) + (shell (concat (concat "*"(projectile-project-name) "-shell*")))) +(defun kmt/projectile-switch-project-shell () + "Switch to a project and open a shell in it's root." + (interactive) + (let* ((project-to-switch + (projectile-completing-read "Shell in project: " + projectile-known-projects)) + (default-directory project-to-switch)) + (kmt/projectile-shell) + (let ((project-switched project-to-switch)) + (run-hooks 'projectile-switch-project-hook)))) +(add-hook 'projectile-mode-hook + (lambda () + (define-key projectile-mode-map (kbd "C-c p M-m") 'kmt/projectile-shell) + (define-key projectile-mode-map (kbd "C-c p M-s") 'kmt/projectile-switch-project-shell))) + + +(provide 'kmt-init) +;;; kmt-init.el ends here From 0a1988fcd170c00f29042ac7a3c35ac23ce6c977 Mon Sep 17 00:00:00 2001 From: kmt Date: Wed, 2 Apr 2014 21:33:01 -0400 Subject: [PATCH 4/6] Added kmt-local --- personal/kmt-local.el | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 personal/kmt-local.el diff --git a/personal/kmt-local.el b/personal/kmt-local.el new file mode 100644 index 0000000000..3cad570de4 --- /dev/null +++ b/personal/kmt-local.el @@ -0,0 +1,5 @@ +;; load the local settings +(setq kmt-local-dir "~/.emacs-local.d/") +(when (file-exists-p kmt-local-dir) + (message "Loading personal configuration files in %s..." kmt-local-dir) + (mapc 'load (directory-files kmt-local-dir 't "^[^#].*el$"))) From cf2d76957f395cd3c3bb74f91159dab2a656117b Mon Sep 17 00:00:00 2001 From: kmt Date: Wed, 2 Apr 2014 21:33:37 -0400 Subject: [PATCH 5/6] Added kmt-org --- personal/kmt-org.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 personal/kmt-org.el diff --git a/personal/kmt-org.el b/personal/kmt-org.el new file mode 100644 index 0000000000..d5773dfb53 --- /dev/null +++ b/personal/kmt-org.el @@ -0,0 +1,22 @@ +;;;; Org-Mode +(add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) +(setq org-agenda-files '("~/org")) + +(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) + +(setq org-agenda-custom-commands + '( + ("n" "Agenda and all TODO's" + ((agenda "" (alltodo))) + ) + ("R" "Report completed tasks from previous week" + ((agenda "" ((org-agenda-entry-types '(:timestamp :sexp :scheduled)) + (org-agenda-show-log t))))) + ;; ("W" "Completed and/or deferred tasks from previous week" + ;; ((agenda "" ((org-agenda-span 5) + ;; (org-agenda-start-day "lastweek") + ;; (org-agenda-entry-types '(:timestamp :sexp :scheduled)) + ;; (org-agenda-show-log t))))) + ;; other commands + ) +) From 96927cf05a738bd631aee50c407bd312f85db387 Mon Sep 17 00:00:00 2001 From: kmt Date: Wed, 2 Apr 2014 21:34:17 -0400 Subject: [PATCH 6/6] +(setq projectile-enable-idle-timer t) --- personal/kmt-init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/personal/kmt-init.el b/personal/kmt-init.el index 411ccd18c4..cc2e945c0f 100644 --- a/personal/kmt-init.el +++ b/personal/kmt-init.el @@ -33,7 +33,7 @@ (lambda () (define-key projectile-mode-map (kbd "C-c p M-m") 'kmt/projectile-shell) (define-key projectile-mode-map (kbd "C-c p M-s") 'kmt/projectile-switch-project-shell))) - +(setq projectile-enable-idle-timer t) (provide 'kmt-init) ;;; kmt-init.el ends here