From b792a4957c372600484d6471d16475f7a7dea1d7 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 20 Aug 2014 23:51:07 +0200 Subject: Update config --- .emacs.d/init.el | 57 ++++++++++++++++++++++++++++++++++++----- .emacs.d/init.org | 39 +++++++++++++++++++++++++--- .emacs.d/site-lisp/gnus-init.el | 2 ++ .emacs.d/site-lisp/my-smt.el | 14 ++++++++-- .emacs.d/site-lisp/org-init.el | 25 ++++++++++++------ 5 files changed, 117 insertions(+), 20 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 061be7f..29dbbc9 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -318,6 +318,13 @@ MODE1 is enabled and vice-versa." (when (fboundp 'prettify-symbols-mode) (prettify-symbols-mode arg))) +(defun oni:maybe-switch-to-normal-state () + "Switch the current buffer to normal state. + +Only do this when the mode is not in emacs state by default." + (unless (memql major-mode (oni:modes-starting-in 'emacs)) + (evil-normal-state))) + (defun oni:mini-fix-timestamp-string (date-string) "A minimal version of Xah Lee's `fix-timestamp-string'. Turn DATE-STRING into something else that can be worked with in @@ -354,6 +361,10 @@ extracts the parts I want to know about." (format "[%s - %s]" band title)) song))) +(defun oni:modes-starting-in (state) + "Get a list of the modes whose default state is STATE." + (symbol-value (evil-state-property state :modes))) + (defun oni:move-beginning-of-dwim () "Move to beginning of line either after indentation or before." (interactive) @@ -400,6 +411,18 @@ PLIST contains all the pertinent information." (c-set-offset 'arglist-close '0) (setq-local fci-rule-column 80)) +(defun oni:print-keymap (keymap) + "Recursively print KEYMAP with keys as characters." + (mapcar (lambda (itm) + (if (consp itm) + (if (integerp (car itm)) + (cons (format "%c" (car itm)) + (if (listp (cdr itm)) + (oni:print-keymap (cddr itm)) + (cdr itm))) + itm) + itm)) keymap)) + (defun oni:prog-mode-func () "Function for `prog-mode-hook'." (setq-local comment-auto-fill-only-comments t)) @@ -624,7 +647,7 @@ For `python-mode' I prefer `python-imenu-create-flat-index'." (ignore frame) (unless setp ;; (load-theme 'yoshi t) - (load-theme 'monokai t) + (load-theme 'yoshi t) ;; (smt/enable) ;; (require 'my-smt) ;; (smt/set-theme 'my-smt) @@ -997,6 +1020,12 @@ from myaethon2.core.decorators import ( (add-to-list 'eshell-output-filter-functions #'eshell-truncate-buffer)) (stante-after evil + (evil-define-operator oni:evil-sort-operator (beg end) + "Sort text." + :move-point nil + :type line + (sort-lines nil beg end)) + (mapc (lambda (mode) (evil-set-initial-state mode 'emacs)) '(jabber-roster-mode grep-mode avandu-overview-mode avandu-article-mode gnus-summary-mode @@ -1004,9 +1033,12 @@ from myaethon2.core.decorators import ( magit-status-mode magit-key-mode sql-interactive-mode Info-mode jabber-chat-mode diff-mode prodigy-mode - calculator-mode messages-buffer-mode)) - (setq evilnc-hotkey-comment-operator ",") - (require 'evil-nerd-commenter)) + calculator-mode messages-buffer-mode + help-mode)) + (evil-set-initial-state 'git-commit-mode 'normal) + (require 'evil-nerd-commenter) + (define-key evil-normal-state-map ",s" 'oni:evil-sort-operator) + (add-hook 'before-save-hook #'oni:maybe-switch-to-normal-state)) (stante-after eww (setq eww-download-path ; Don't go to ~/Downloads @@ -1048,7 +1080,9 @@ from myaethon2.core.decorators import ( (mapc (lambda (c) (delq c flycheck-checkers)) '(python-pylint python-pyflakes)) (setf flycheck-highlighting-mode 'columns) - (require 'flycheck-commit-check)) + (require 'flycheck-commit-check) + (setq flycheck-display-errors-function + #'flycheck-pos-tip-error-messages)) (stante-after geiser-repl (setq geiser-repl-history-filename "~/.emacs.d/geiser-history")) @@ -1061,6 +1095,8 @@ from myaethon2.core.decorators import ( (stante-after grep (add-to-list 'grep-find-ignored-directories "migrations") (add-to-list 'grep-find-ignored-directories "vendor") + (add-to-list 'grep-find-ignored-directories "tmp") + (add-to-list 'grep-find-ignored-directories "log") (add-to-list 'grep-find-ignored-files "TAGS")) (stante-after help-at-pt @@ -1075,7 +1111,9 @@ from myaethon2.core.decorators import ( (setq ido-auto-merge-work-directories-length -1) (setq ido-default-buffer-method 'pop-to-buffer) (setq ido-max-window-height 1) - (setq ido-save-directory-list-file nil)) + (setq ido-save-directory-list-file nil) + (setq ido-enable-flex-matching t) + (setq ido-use-faces nil)) (stante-after imenu (setq imenu-auto-rescan t)) @@ -1401,6 +1439,10 @@ from myaethon2.core.decorators import ( (global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "\"") 'oni:self-insert-dwim) (global-set-key [remap move-beginning-of-line] #'oni:move-beginning-of-dwim) +(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) +(global-set-key (kbd "M-+") 'mc/mark-next-like-this) +(global-set-key (kbd "M--") 'mc/mark-previous-like-this) +(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) ;;;; Misc modes @@ -1425,7 +1467,8 @@ from myaethon2.core.decorators import ( (popwin-mode) (evil-mode) - (require 'colemak-evil)) + (require 'colemak-evil) + (global-evil-surround-mode)) (when (equal system-name "drd") (load "eap-autoloads")) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index d71f2eb..1031ae2 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -113,14 +113,13 @@ (blink-cursor-mode -1) #+END_SRC -** Column and line numbers +** Line numbers As I'm currently using svg-mode-line-themes[fn:2] for my ~mode-line~ I don't need to show these. Also I didn't really use them much, I don't often need to know what line I'm on. #+BEGIN_SRC emacs-lisp - (column-number-mode -1) (line-number-mode -1) #+END_SRC @@ -293,6 +292,20 @@ (setq scroll-preserve-screen-position t) #+END_SRC +** Don't show a mode line for completions + + One of the things I dislike about Emacs is its rigidity concerning + windows and other UI elements. One very simple way to make it + /feel/ less so is to show less of it where possible. A mode line for + completion buffers creates more separation than necessary, and I + can't recall a single time where I've used the completion's mode + line for anything. + + #+BEGIN_SRC emacs-lisp + (add-hook 'completion-list-mode-hook + (lambda () (setq mode-line-format nil))) + #+END_SRC + * Add org-mode appointments to the diary Diary offers reminders, which can be useful when scheduling @@ -582,7 +595,8 @@ '("~/.emacs.d/site-lisp" "~/.emacs.d/vendor-lisp/mozrepl" "~/.emacs.d/vendor-lisp/eap" "/usr/share/emacs/site-lisp" - "/usr/lib/node_modules/tern/emacs/"))) + "/usr/lib/node_modules/tern/emacs/" + "~/.emacs.d/vendor-lisp/habitrpg.el"))) #+END_SRC * Some unconditional settings @@ -859,10 +873,29 @@ highly annoying. #+BEGIN_SRC emacs-lisp + (defvar scss-compile-at-save) + (with-eval-after-load 'scss-mode (setq scss-compile-at-save nil)) #+END_SRC +* Change listings in dired + + The number of bytes a file is doesn't usually tell me much when it's + something like ~292837~. I prefer seeing just how many Kb or Mb a + certain file is. I also don't need to see the ~.~ and ~..~ directories + when I insert directories into the current dired buffer, as there is + a great chance that the current and parent directory are already + shown in the buffer. + + #+BEGIN_SRC emacs-lisp + (defvar dired-subdir-switches) + + (with-eval-after-load 'dired + (setq dired-listing-switches "-alh" + dired-subdir-switches "-Alh")) + #+END_SRC + * Load custom file I don't really use the Emacs customization interface much, but I diff --git a/.emacs.d/site-lisp/gnus-init.el b/.emacs.d/site-lisp/gnus-init.el index 5e6919e..60093c4 100644 --- a/.emacs.d/site-lisp/gnus-init.el +++ b/.emacs.d/site-lisp/gnus-init.el @@ -78,3 +78,5 @@ (ispell-change-dictionary "nl")) (t (ispell-change-dictionary "en"))))) (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) + +(setq message-kill-buffer-on-exit t) diff --git a/.emacs.d/site-lisp/my-smt.el b/.emacs.d/site-lisp/my-smt.el index 1010ddb..32009a2 100644 --- a/.emacs.d/site-lisp/my-smt.el +++ b/.emacs.d/site-lisp/my-smt.el @@ -83,19 +83,29 @@ WIDGET is ignored." ispell-local-dictionary flyspell-default-dictionary))))) +(smt/defwidget my-smt-position + :text (lambda (widget) + (ignore widget) + (format-mode-line "%l/%c:%p"))) + (smt/defrow my-smt-right :prototype 'default-right :widgets '(my-smt-jabber-activity major-mode my-smt-current-dictionary my-smt-flycheck-errors - version-control minor-modes)) + version-control minor-modes) + :margin 16) (smt/defrow my-smt-left :prototype 'default-left :widgets '(buffer-info my-smt-buffer-identification my-smt-po-counters which-function)) +(smt/defrow my-smt-position + :prototype 'default-position + :widgets '(my-smt-position)) + (defun my-smt-major-mode-style (widget) (ignore widget) '(:fill "#ccc" :font-family "Fantasque Sans" :filter nil @@ -107,7 +117,7 @@ WIDGET is ignored." (smt/make-widget :prototype 'major-mode :style 'my-smt-major-mode-style))) - :rows '(my-smt-left default-position my-smt-right)) + :rows '(my-smt-left my-smt-position my-smt-right)) (provide 'my-smt) ;;; my-smt.el ends here diff --git a/.emacs.d/site-lisp/org-init.el b/.emacs.d/site-lisp/org-init.el index 5a4d804..6a5c908 100644 --- a/.emacs.d/site-lisp/org-init.el +++ b/.emacs.d/site-lisp/org-init.el @@ -40,6 +40,9 @@ (with-eval-after-load 'org-crypt (org-crypt-use-before-save-magic)) +(eval-and-compile + (add-to-list 'load-path "~/.emacs.d/vendor-lisp/habitrpg.el")) + (defun tagify (str) "Remove dots, replace - with _ in STR." (replace-regexp-in-string @@ -77,12 +80,14 @@ (defun org-init-skip-tags () "Skip the \"ex\" and \"unconfirmed\" tags." - (let ((tags (org-entry-get (point) "TAGS"))) - (when (and tags (string-match-p - (rx (and ":" (or "ex" "unconfirmed") ":")) tags)) + (let ((tags (org-get-tags-at (point)))) + (when (or (member "ex" tags) + (member "unconfirmed" tags)) (save-excursion - (org-forward-element) - (point))))) + (or + (ignore-errors (org-forward-element) + (point)) + (point-max)))))) (defun org-init-get-tag-name () "Get the name for a new tag for the currently loaded desktop." @@ -94,8 +99,6 @@ "")) ""))) -(setq org-agenda-files '("~/documents/org/tasks")) - (setq org-agenda-cmp-user-defined (lambda (a b) 1)) (setq org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t% s") @@ -112,7 +115,7 @@ (setq org-directory (expand-file-name "~/documents/org")) (setq org-default-notes-file (concat org-directory "/org")) (setq org-capture-templates - `(("t" "Task" entry (file "~/documents/org/tasks") + `(("t" "Task" entry (file+headline "~/documents/org/tasks" "Task Queue") "* TODO %? %(org-init-get-tag-name)" :empty-lines-before 1) ("T" "Linked task" entry (file "~/documents/org/tasks") @@ -179,5 +182,11 @@ (org-agenda-to-appt) (ad-activate 'org-agenda-redo) +(require 'habitrpg) +(add-hook 'org-after-todo-state-change-hook 'habitrpg-add 'append) + +(setq org-mobile-directory "~/ownCloud/MobileOrg" + org-mobile-inbox-for-pull "~/documents/org/inbox.org") + (provide 'org-init) ;;; org-init.el ends here -- cgit v1.2.3-54-g00ecf