From d68673f99260909f8a49e6bc95fa688fcca5bf84 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 23 May 2013 02:44:38 +0200 Subject: Move slime-helper and move-beginning-of-dwim functions --- emacs/init.org | 36 ++++++++++++++++++++++++++++++++++-- emacs/site-lisp/oni.el | 8 -------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index 6605dcd..ad3a5ad 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -1355,6 +1355,40 @@ (add-hook 'python-mode-hook 'oni:local-set-smartparens-hook) #+END_SRC +* Load slime-helper to work with slime :slime: + + The slime helper is necessary to work with slime. It gets installed + by quicklisp. + + #+BEGIN_SRC emacs-lisp + (load (expand-file-name "~/.local/share/quicklisp/slime-helper.el")) + #+END_SRC + +* Smarter move-beginning-of-line :navigation: + + This snippet has been in my Emacs setup for a while, but seeing + [[http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/][bbatsov]] talk about it prompted me to take over one of his tweaks: I + used =beginning-of-line= whereas he uses =move-beginning-of-line=. I've + also grabbed the example of the remap key binding from him. + + This function moves to the first non-whitespace character on the + line, or if you're already there it jumps to the first (whitespace + or otherwise) character on the line. Subsequent calls toggle + between the two locations. + + #+BEGIN_SRC emacs-lisp + (defun oni:move-beginning-of-dwim () + "Move to beginning of line either after indentation or before." + (interactive) + (let ((start (point))) + (back-to-indentation) + (if (= start (point)) + (move-beginning-of-line 1)))) + + (global-set-key [remap move-beginning-of-line] + 'oni:move-beginning-of-dwim) + #+END_SRC + * All the rest This still needs to be sorted out and documented, haven't had time @@ -1438,7 +1472,6 @@ (global-set-key (kbd "C-M-d") 'kill-word) (global-set-key (kbd "C-M-w") 'backward-kill-word) (global-set-key (kbd "C-S-k") 'kill-whole-line) - (global-set-key (kbd "C-a") 'oni:move-beginning-of-dwim) (global-set-key (kbd "C-c a") 'org-agenda) (global-set-key (kbd "C-c c") 'org-capture) (global-set-key (kbd "C-c i p") 'identica-update-status-interactive) @@ -1595,5 +1628,4 @@ ;;; Finally, load any `customize' settings and slime. (load custom-file) - (load (expand-file-name "~/quicklisp/slime-helper.el")) #+END_SRC diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index b90bd4a..11378be 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -253,14 +253,6 @@ extracts the parts I want to know about." (title (substring song (match-beginning 5) (match-end 5)))) (format "[%s - %s]" band title))) -(defun oni:move-beginning-of-dwim () - "Move to beginning of line either after indentation or before." - (interactive) - (let ((start (point))) - (back-to-indentation) - (if (= start (point)) - (beginning-of-line)))) - (defun oni:move-end-of-dwim () "Move to end of line, either before any comments or after." (interactive) -- cgit v1.2.3-54-g00ecf