Move slime-helper and move-beginning-of-dwim functions
This commit is contained in:
parent
cbfaf91265
commit
d68673f992
2 changed files with 34 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue