From: Mark Wooding Date: Mon, 16 Mar 2009 15:53:46 +0000 (+0000) Subject: Merge commit 'crybaby/master'; commit 'ponder/master' X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/2d18398ae92f3da8ef49fe8e376ff5cdab53608a?hp=1db6f8da9c563c98cfdf54e3d28d3d228cde0cb8 Merge commit 'crybaby/master'; commit 'ponder/master' * commit 'crybaby/master': bash_profile: Extend the collection of INFOPATH directories. * commit 'ponder/master': zile: Yet another editor configuration. emacs: Give org-iswitchb a key binding, and include diary stuff in agenda. emacs, dot-emacs.el: Extend and semi-automate evil-keymap hacking. dot-emacs.el: Insert missing blank line before section header. --- diff --git a/bash_profile b/bash_profile index 017ff4c..57475a8 100644 --- a/bash_profile +++ b/bash_profile @@ -94,7 +94,7 @@ emacs_startup_args="--no-site-file --mdw-fast-startup -nw" for ed in \ "emacs22 $emacs_startup_args" \ "emacs21 $emacs_startup_args" \ - mg \ + zile mg \ "emacs -nw" \ vi pico nano ae; do name=`echo $ed | sed 's/ .*$//'` diff --git a/dot-emacs.el b/dot-emacs.el index 14d06a6..5b9408f 100644 --- a/dot-emacs.el +++ b/dot-emacs.el @@ -188,6 +188,43 @@ (defun mdw-todo (&optional when) (nth 2 when)))))))) (eq w d))) +;; --- Fighting with Org-mode's evil key maps --- + +(defvar mdw-evil-keymap-keys + '(([S-up] . [?\C-c up]) + ([S-down] . [?\C-c down]) + ([S-left] . [?\C-c left]) + ([S-right] . [?\C-c right]) + (([M-up] [?\e up]) . [C-up]) + (([M-down] [?\e down]) . [C-down]) + (([M-left] [?\e left]) . [C-left]) + (([M-right] [?\e right]) . [C-right])) + "Defines evil keybindings to clobber in `mdw-clobber-evil-keymap'. +The value is an alist mapping evil keys (as a list, or singleton) +to good keys (in the same form).") + +(defun mdw-clobber-evil-keymap (keymap) + "Replace evil key bindings in the KEYMAP. +Evil key bindings are defined in `mdw-evil-keymap-keys'." + (dolist (entry mdw-evil-keymap-keys) + (let ((binding nil) + (keys (if (listp (car entry)) + (car entry) + (list (car entry)))) + (replacements (if (listp (cdr entry)) + (cdr entry) + (list (cdr entry))))) + (catch 'found + (dolist (key keys) + (setq binding (lookup-key keymap key)) + (when binding + (throw 'found nil)))) + (when binding + (dolist (key keys) + (define-key keymap key nil)) + (dolist (key replacements) + (define-key keymap key binding)))))) + ;;;----- Mail and news hacking ---------------------------------------------- (define-derived-mode mdwmail-mode mail-mode "[mdw] mail" @@ -395,6 +432,7 @@ (defadvice find-file (after mdw-autorevert activate) (mdw-check-autorevert)) (defadvice write-file (after mdw-autorevert activate) (mdw-check-autorevert)) + ;;;----- Dired hacking ------------------------------------------------------ (defadvice dired-maybe-insert-subdir diff --git a/emacs b/emacs index dcb561d..4337d39 100644 --- a/emacs +++ b/emacs @@ -121,7 +121,18 @@ (setq sendmail-program "~/bin/sendmail-hack") (setq mail-user-agent 'message-user-agent) -(setq message-signature-separator "^-- \\(\\|\\[mdw\\]\\)$") +(setq message-signature-separator "^-- \\(\\|\\[mdw\\]\\)$" + message-yank-prefix "> " + message-yank-cited-prefix "> " + message-indent-citation-function '(message-indent-citation + mdw-trim-spaces-after-citing)) + +(defun mdw-trim-spaces-after-citing () + (save-excursion + (save-restriction + (narrow-to-region (point) (mark t)) + (while (re-search-forward "^> +$" nil t) + (replace-match ">"))))) (and (fboundp 'turn-on-gnus-dired-mode) (not mdw-fast-startup) @@ -290,6 +301,10 @@ (setq appt-display-interval 3) (setq appt-message-warning-time 10) +;; --- Org-mode agenda --- + +(setq org-agenda-include-diary t) + ;; --- Cosmetic stuff --- (setq display-time-24hr-format t) @@ -376,6 +391,7 @@ (global-set-key [?\C-x ?w ?l] 'windmove-right) (global-set-key [?\C-x ?g ?l] 'org-store-link) (global-set-key [?\C-x ?g ?a] 'org-agenda) +(global-set-key [?\C-x ?g ?b] 'org-iswitchb) (global-set-key [?\C-x ?t ?i] 'timeclock-in) (global-set-key [?\C-x ?t ?c] 'timeclock-change) (global-set-key [?\C-x ?t ?o] 'timeclock-out) @@ -403,20 +419,10 @@ (and (not mdw-fast-startup) (fboundp 'hippie-expand) (global-set-key [?\M-/] 'hippie-expand)) -(defun mdw-clobber-org-mode-map () - (dolist (key '([S-up] [S-down] [S-left] [S-right] - [?\e left] [?\e right] - [M-left] [M-right])) - (define-key org-mode-map key nil)) - (define-key org-mode-map [?\C-c left] 'org-shiftleft) - (define-key org-mode-map [?\C-c right] 'org-shiftright) - (define-key org-mode-map [?\C-c up] 'org-shiftup) - (define-key org-mode-map [?\C-c down] 'org-shiftdown) - (define-key org-mode-map [C-left] 'org-metaleft) - (define-key org-mode-map [C-right] 'org-metaright) - (define-key org-mode-map [C-up] 'org-metaup) - (define-key org-mode-map [C-down] 'org-metadown)) -(add-hook 'org-mode-hook 'mdw-clobber-org-mode-map) +(add-hook 'org-mode-hook + #'(lambda () (mdw-clobber-evil-keymap org-mode-map))) +(add-hook 'org-agenda-mode-hook + #'(lambda () (mdw-clobber-evil-keymap org-agenda-mode-map))) ;; --- Recognising types of files --- diff --git a/screenrc b/screenrc index 2c4ada0..134dd9b 100644 --- a/screenrc +++ b/screenrc @@ -5,3 +5,4 @@ deflogin off defencoding utf8 setenv LC_CTYPE en_GB.utf8 setenv LESSCHARSET utf-8 +altscreen on diff --git a/setup b/setup index 79a6f34..da1d071 100755 --- a/setup +++ b/setup @@ -130,7 +130,7 @@ fi dotfiles=" bash_profile bash_logout bashrc inputrc bash_completion emacs emacs-calc vm gnus.el - vimrc mg + vimrc mg zile mailrc signature cgrc tigrc gdbinit diff --git a/zile b/zile new file mode 100644 index 0000000..97c90d9 --- /dev/null +++ b/zile @@ -0,0 +1,13 @@ +;;; -*-emacs-lisp-*- +;;; +;;; Configuration file for ZILE. + +;; Indentation. +(setq indent-tabs-mode t) +(setq standard-indent 2) + +;; Key bindings. +(global-set-key "\M-\LEFT" 'backward-word) +(global-set-key "\M-\RIGHT" 'forward-word) +(global-set-key "\F4" 'call-last-kbd-macro) +(global-set-key "\C-x/" 'auto-fill-mode)