Permalink
Browse files

misc cleanup and refactoring

  • Loading branch information...
1 parent b1cb536 commit 43b578b4d0495358c3ac7ef495eae1d78de74ba3 @tavisrudd committed Aug 19, 2010
@@ -1,3 +1,6 @@
+(require 'paren)
+(require 'cc-vars)
+
(fset 'yes-or-no-p 'y-or-n-p) ; less typing
;; encoding
@@ -48,10 +51,6 @@
(set-default major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
-(defun dss/set-undo-boundary ()
- (interactive)
- (undo-boundary))
-
;; mouse and selection settings
(add-hook 'after-init-hook (lambda ()
(xterm-mouse-mode 1)))
@@ -1,6 +1,10 @@
(require 'filladapt)
(setq-default filladapt-mode t)
+(defun dss/set-undo-boundary ()
+ (interactive)
+ (undo-boundary))
+
(defun dss/cap-sentence ()
(interactive)
(save-excursion
@@ -50,6 +54,7 @@
;; http://www.bloomington.in.us/~brutt/marker-visit.el
;;; http://emacs-fu.blogspot.com/2009/05/tracking-changes.html
+(require 'hilit-chg)
(setq highlight-changes-visibility-initial-state nil)
(global-highlight-changes-mode t)
;; (global-set-key (kbd "<f6>") 'highlight-changes-visible-mode) ;; changes
@@ -1,3 +1,11 @@
+(require 'moz)
+(require 'json)
+(require 'thingatpt)
+(require 'browse-url)
+
+(eval-when-compile
+ (require 'cl))
+
(defun dss/open-url ()
"Open a new buffer containing the contents of URL.
http://github.com/technomancy/emacs-starter-kit/blob/master/starter-kit-defuns.el"
@@ -16,8 +24,6 @@ http://github.com/technomancy/emacs-starter-kit/blob/master/starter-kit-defuns.e
; extensions.mozrepl.autoStart;true
; extensions.mozrepl.initUrl;file://localhost/home/tavis/tr_toolchain/mozrepl/custom.js
-(require 'moz)
-(require 'json)
(add-hook 'js2-mode-hook (lambda () (moz-minor-mode 1)))
; * C-c C-s: open a MozRepl interaction buffer and switch to it
; * C-c C-l: save the current buffer and load it in MozRepl
@@ -50,6 +56,7 @@ http://github.com/technomancy/emacs-starter-kit/blob/master/starter-kit-defuns.e
(defun dss/moz-restart-repl ()
(interactive)
+ (delete-process inferior-moz-buffer)
(kill-buffer inferior-moz-buffer)
(inferior-moz-process))
@@ -119,12 +126,14 @@ http://github.com/technomancy/emacs-starter-kit/blob/master/starter-kit-defuns.e
(dss/moz-eval-expression
(format "gBrowser.selectedTab = gBrowser.addTab('%s')\n" url)))
+(defvar dss-browse-url-hook nil
+ "Hook run on after each call of browser-url.")
+
(defun dss/browse-url-firefox-new-tab (url &optional new-window)
"Open URL in a new tab in Mozilla."
(interactive (browse-url-interactive-arg "URL: "))
(dss/moz-new-tab-url url)
- (if (not (eq moz-repl-host "tavismac"))
- (dss/x-display-focus-firefox)))
+ (run-hooks 'dss-browse-url-hook))
(setq browse-url-browser-function 'dss/browse-url-firefox-new-tab)
(defun dss/moz-duplicate-tab ()
@@ -1,6 +1,4 @@
-(when (fboundp 'winner-mode)
- (winner-mode 1))
-
+(require 'ibuffer)
(require 'window-numbering)
(window-numbering-mode 1)
;; (setq window-numbering-assign-func
@@ -10,6 +8,10 @@
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
+(when (fboundp 'winner-mode)
+ (winner-mode 1))
+
+
; http://dfan.org/blog/2009/02/19/emacs-dedicated-windows/
(defun dss/toggle-current-window-dedication ()
(interactive)
@@ -21,36 +23,6 @@
(buffer-name))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(require 'ibuffer)
-(setq ibuffer-saved-filter-groups
- (quote (("default"
- ("Org" ;; all org-related buffers
- (mode . org-mode))
- ("DSS"
- (filename . "code/active/dss.hg/"))
- ("Dentalle"
- (filename . "code/active/dentalle.hg/"))
- ("Programming" ;; prog stuff not already in above groups
- (or
- (mode . c-mode)
- (mode . perl-mode)
- (mode . python-mode)
- (mode . cython-mode)
- (mode . emacs-lisp-mode)
- ;; etc
- ))
- ("emacs" (or
- (name . "^\\*scratch\\*$")
- (name . "^\\*Messages\\*$")))
- ;("ERC" (mode . erc-mode))
- ))))
-; this didn't work when I first tried it
-(add-hook 'ibuffer-mode-hook
- (lambda ()
- (linum-mode 1)
- (ibuffer-switch-to-saved-filter-groups "default")))
-
-
(defun dss/kill-clean-buffer ()
(interactive)
(let ((buf (current-buffer)))
@@ -1,4 +1,5 @@
(require 'browse-kill-ring)
+(require 'dss-elisp-funcs) ; dss/file-to-string
(setq x-select-enable-clipboard t)
@@ -22,23 +23,6 @@
(unless (string= (car kill-ring) xsel-output)
xsel-output)))
-(defun dss/file-to-string (file)
- "There must be a built-in that does this..."
- (when (file-readable-p file)
- (with-temp-buffer
- (insert-file-contents file)
- (buffer-string))))
-
-(defun dss/x-display-use-b3 ()
- (interactive)
- (shell-command "use_b3_display")
- (dss/x-display-sync))
-
-(defun dss/x-display-use-local ()
- (interactive)
- (shell-command "use_local_display")
- (dss/x-display-sync))
-
(defun dss/x-display-sync ()
(interactive)
(setenv "DISPLAY"
@@ -57,7 +41,6 @@
(setq interprogram-cut-function nil)
(setq interprogram-paste-function nil))
-
;; also see http://stackoverflow.com/questions/994563/integrate-readlines-kill-ring-and-the-x11-clipboard
;; http://bbs.archlinux.org/viewtopic.php?id=80226
;; and run the following
@@ -1,3 +1,5 @@
+(require 'dss-basic-editing)
+(require 'k2-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun dss/display-syntax (syntax-type)
(eq syntax-type (syntax-ppss-context (syntax-ppss))))
@@ -248,6 +250,7 @@ Comes from http://github.com/technomancy/emacs-starter-kit/blob/master/starter-k
;; (goto-char position) (goto-char (overlay-start position))))))
+(require 'column-marker)
(defvar dss/major-column-face 'dss/major-column-face
"major column grid marker")
(defface dss/major-column-face '((t (:background "#484848")))
@@ -290,7 +293,7 @@ Comes from http://github.com/technomancy/emacs-starter-kit/blob/master/starter-k
(defun dss/local-line-jump (n)
(interactive "nLine: ")
;(message (format "%d" (+ n (* (/ (line-number-at-pos) 100) 100))))
- (goto-line (+ n (* (/ (line-number-at-pos) 100) 100))))
+ (dss/goto-line (+ n (* (/ (line-number-at-pos) 100) 100))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'dss-codenav-helpers)
View
@@ -3,6 +3,15 @@
;; note, this will look horrible in anything other than a 256 color
;; black or transparent black terminal window.
+(defun dss/flash-modeline ()
+ (interactive)
+ (let ((orig-background (face-background 'modeline)))
+ (set-face-background 'modeline "red")
+ (run-with-timer 3 nil
+ 'set-face-background
+ 'modeline
+ orig-background)))
+
(defun dss/color-theme-dark-tty ()
(interactive)
(require 'color-theme)
View
@@ -1,3 +1,5 @@
+(require 'comint)
+(require 'dss-paths)
(eval-when-compile (require 'cl))
(setq-default abbrev-mode t)
@@ -208,6 +210,7 @@ advice like this:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; partially working support for using auto complete in ipython buffers
+(require 'ipython)
(defun dss-ipython-completion-candidate (&optional use-ido)
"This is a hacked version of ipython-complete from ipython.el,
which can be used with either autocomplete-mode or ido.
View
@@ -1,4 +1,4 @@
-(setq dss/ecb-loaded nil)
+(defvar dss/ecb-loaded nil)
(defun dss/load-ecb ()
(interactive)
(load "/usr/share/emacs/site-lisp/cedet/common/cedet")
View
@@ -4,6 +4,6 @@
(if (file-exists-p "/usr/share/emacs/etc/ess")
(condition-case nil
(require 'ess-site)
- (message ("Error while loading ess"))))
+ (message "Error while loading ess")))
(provide 'dss-ess)
View
@@ -1,11 +1,12 @@
+(require 'dss-paths)
+(require 'cc-vars)
+(require 'dss-codenav-helpers)
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Yegge's js2-mode with better indentation support
-(require 'dss-codenav-helpers)
-
(add-to-list 'load-path (concat dss-vendor-dir "js2-mode"))
-
-(autoload 'js2-mode "js2-mode" nil t)
+(require 'js2-mode)
(defun dss/js2-indent-function ()
"This is just a copy of http://mihai.bazon.net/projects/editing-javascript-with-emacs-js2-mode"
View
@@ -1,15 +1,22 @@
+(require 'auto-complete)
+(require 'ido)
+(require 'comint)
+(require 'org)
+(require 'fm)
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; additional custom keymaps, populated below
-(setq f2-map (make-sparse-keymap))
-(setq f4-map (make-sparse-keymap))
-(setq f6-map (make-sparse-keymap))
-(setq f7-map (make-sparse-keymap))
+(defvar f2-map (make-sparse-keymap))
+(defvar f4-map (make-sparse-keymap))
+(defvar f6-map (make-sparse-keymap))
+(defvar f7-map (make-sparse-keymap))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; global map
-(global-set-key (kbd "M-X") 'smex-update-and-run)
-(global-set-key (kbd "M-x") 'smex)
-(global-set-key (kbd "M-s") 'ido-goto-symbol)
+(define-key global-map (kbd "M-X") 'smex-update-and-run)
+(define-key global-map (kbd "M-x") 'smex)
+(define-key global-map (kbd "M-s") 'ido-goto-symbol)
+(define-key global-map (kbd "M-]") 'dss/goto-match-paren)
(defun dss/hippie-expand ()
(interactive)
@@ -62,6 +69,9 @@
(define-key global-map "\e[C" (kbd "<right>"))
(define-key global-map "\e[D" (kbd "<left>"))
+(define-key paredit-mode-map (kbd "C-<right>") 'forward-word)
+(define-key paredit-mode-map (kbd "C-<left>") 'backward-word)
+
(define-key ac-completing-map "\e[A" 'ac-previous)
(define-key ac-completing-map "\e[B" 'ac-next)
@@ -80,6 +90,7 @@
(define-key global-map [mouse-5] 'up-slightly)
+
;http://www.emacsblog.org/2007/02/27/quick-tip-add-occur-to-isearch/
(define-key isearch-mode-map (kbd "C-o")
(lambda ()
View
@@ -1,12 +1,13 @@
+(require 'dss-paths)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; nxml
-(setq dss-nxml-html5-dir (concat dss-vendor-dir "nxml-html5-el/"))
+(defvar dss-nxml-html5-dir (concat dss-vendor-dir "nxml-html5-el/"))
(add-to-list 'load-path dss-nxml-html5-dir)
-(eval-after-load "rng-loc"
- '(add-to-list 'rng-schema-locating-files (concat dss-nxml-html5-dir "schemas.xml")))
-(require 'whattf-dt)
-
+;; (eval-after-load "rng-loc"
+;; (progn
+;; (add-to-list 'rng-schema-locating-files (concat dss-nxml-html5-dir "schemas.xml"))
+;; (require 'whattf-dt)))
(add-to-list 'auto-mode-alist '("\\.html$" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.xml$" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.xsd$" . nxml-mode))
@@ -17,11 +18,12 @@
(add-to-list 'auto-mode-alist '("\\.svg$" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.rss$" . nxml-mode))
+(require 'nxml-mode)
(add-hook 'nxml-mode-hook
(lambda ()
(outline-minor-mode)
-;; (xslt-process-mode t)
- (setq xslt-process-default-processor (quote (Xalan)))
+ ;; (xslt-process-mode t)
+ ;; (setq xslt-process-default-processor (quote (Xalan)))
(setq nxml-child-indent 2)
(setq nxml-auto-insert-xml-declaration-flag t)
(setq nxml-slash-auto-complete-flag t)
Oops, something went wrong.

0 comments on commit 43b578b

Please sign in to comment.