emacs: Added some functions from @magnars, replaced standard goto-line with his version

This commit is contained in:
Vincent Ambo 2013-08-05 11:54:38 +02:00
parent 006043d82e
commit 46b80c00fd
4 changed files with 70 additions and 3 deletions

View file

@ -42,3 +42,5 @@
;; Add a fullscreen toggle ;; Add a fullscreen toggle
(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen)
;; Replace standard goto-line with goto-line-with-feedback
(global-set-key (kbd "M-g g") 'goto-line-with-feedback)

View file

@ -12,7 +12,7 @@
;; there) ;; there)
(unless (member "~/.emacs.d/themes" custom-theme-load-path) (unless (member "~/.emacs.d/themes" custom-theme-load-path)
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) (add-to-list 'custom-theme-load-path "~/.emacs.d/themes"))
;; Download file if it doesn't exist. ;; Download file if it doesn't exist.
(let ((file (let ((file
@ -22,7 +22,7 @@
(defun custom-download-script (url filename) (defun custom-download-script (url filename)
"Downloads an Elisp script, places it in ~/.emacs/other and then loads it" "Downloads an Elisp script, places it in ~/.emacs/other and then loads it"
;; Ensure the directory exists ;; Ensure the directory exists
(unless (file-exists-p "~/.emacs.d/other") (unless (file-exists-p "~/.emacs.d/other")
(make-directory "~/.emacs.d/other")) (make-directory "~/.emacs.d/other"))
@ -44,6 +44,58 @@
(shell-command (concat "git clone " url " " fullpath)))) (shell-command (concat "git clone " url " " fullpath))))
) )
;; These come from magnars, he's got some awesome things.
(defun goto-line-with-feedback ()
"Show line numbers temporarily, while prompting for the line number input"
(interactive)
(unwind-protect
(progn
(linum-mode 1)
(call-interactively 'goto-line))
(linum-mode -1)))
(defun rotate-windows ()
"Rotate your windows"
(interactive)
(cond ((not (> (count-windows)1))
(message "You can't rotate a single window!"))
(t
(setq i 1)
(setq numWindows (count-windows))
(while (< i numWindows)
(let* (
(w1 (elt (window-list) i))
(w2 (elt (window-list) (+ (% i numWindows) 1)))
(b1 (window-buffer w1))
(b2 (window-buffer w2))
(s1 (window-start w1))
(s2 (window-start w2))
)
(set-window-buffer w1 b2)
(set-window-buffer w2 b1)
(set-window-start w1 s2)
(set-window-start w2 s1)
(setq i (1+ i)))))))
(defun untabify-buffer ()
(interactive)
(untabify (point-min) (point-max)))
(defun indent-buffer ()
(interactive)
(indent-region (point-min) (point-max)))
(defun cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer.
Including indent-buffer, which should not be called automatically on save."
(interactive)
(untabify-buffer)
(delete-trailing-whitespace)
(indent-buffer))
;; These come from the emacs starter kit ;; These come from the emacs starter kit
(defun esk-pretty-lambdas () (defun esk-pretty-lambdas ()
(font-lock-add-keywords (font-lock-add-keywords
@ -75,4 +127,4 @@
(defun speak (m &optional voice) (defun speak (m &optional voice)
(shell-command (if 'voice (concat "say -v " voice " \"" m "\"") (shell-command (if 'voice (concat "say -v " voice " \"" m "\"")
(concat "say " m)))) (concat "say " m))))

View file

@ -111,6 +111,16 @@ comment as a filename."
;; Not the real deal without this ... ;; Not the real deal without this ...
(set-variable 'nyan-wavy-trail t) (set-variable 'nyan-wavy-trail t)
(setq linum-format (lambda (line)
(propertize
(format (concat " %"
(number-to-string
(length (number-to-string
(line-number-at-pos (point-max)))))
"d ")
line)
'face 'linum)))
;; Hiding JOIN, QUIT, PART ;; Hiding JOIN, QUIT, PART
(setq erc-hide-list '("JOIN" "PART" "QUIT")) (setq erc-hide-list '("JOIN" "PART" "QUIT"))

View file

@ -74,6 +74,9 @@
;; Actual servers and such are loaded from irc.el ;; Actual servers and such are loaded from irc.el
(load "~/.emacs.d/irc") (load "~/.emacs.d/irc")
;; Load magnars' string manipulation library
(require 's)
;; Seed RNG ;; Seed RNG
(random t) (random t)