Mercurial > dotfiles
view .elisp/settings/50.localfuncs.el @ 171:2f865a7f84e6
textmate: do not trust cached project root of $HOME
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Wed, 16 Dec 2009 22:18:43 -0600 |
parents | 36a4e4b0f9c3 |
children | cd4e645d1207 |
line wrap: on
line source
(defun af-generic-diff-repo () (interactive) (let ((root (textmate-project-root))) (cd root) (hg-view-output ((format "project diff for %s" root)) (call-process (textmate-project-root-type root) nil t nil "diff") (diff-mode) (setq diff (not (= (point-min) (point-max)))) (font-lock-fontify-buffer) (cd root)))) (global-set-key [(control c)(t)(=)] 'af-generic-diff-repo) (global-set-key [(control c)(d)] 'af-generic-diff-repo) (defun pyflakes-this-buffer () (interactive) (compilation-start (concat "cd " (file-name-directory buffer-file-name) "; pyflakes " (file-name-nondirectory buffer-file-name)) nil (lambda (mode) "*pyflakes*"))) (defun fullscreen () (interactive) (set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen) nil 'fullboth))) (defun hg-rm-this-file () (interactive) (shell-command-to-string (concat "hg rm " (shell-quote-argument buffer-file-name)))) ;; Lifted from http://code.google.com/p/ergoemacs/ (defun select-text-in-quote () "Select text between the nearest left and right delimiters. Delimiters are paired characters: ()[]<>«»“”‘’「」, including \"\"." (interactive) (let (b1 b2) (skip-chars-backward "^<>(“{[「«\"‘") (setq b1 (point)) (skip-chars-forward "^<>)”}]」»\"’") (setq b2 (point)) (set-mark b1) ) ) ;; Most of this was extracted from show-paren-function in paren.el from an emacs 23 nightly ;; Also, it seems like this really ought to be builtin, but I can't find it. (defun bounce-to-other-paren () (interactive) (let ((oldpos (point)) (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1) ((eq (syntax-class (syntax-after (point))) 4) 1))) pos mismatch face) ;; ;; Find the other end of the sexp. (when dir (save-excursion (save-restriction ;; Determine the range within which to look for a match. (when blink-matching-paren-distance (narrow-to-region (max (point-min) (- (point) blink-matching-paren-distance)) (min (point-max) (+ (point) blink-matching-paren-distance)))) ;; Scan across one sexp within that range. ;; Errors or nil mean there is a mismatch. (condition-case () (setq pos (scan-sexps (point) dir)) (error (setq pos t mismatch t))) ;; Move back the other way and verify we get back to the ;; starting point. If not, these two parens don't really match. ;; Maybe the one at point is escaped and doesn't really count. (when (integerp pos) (unless (condition-case () (eq (point) (scan-sexps pos (- dir))) (error nil)) (setq pos nil))) ))) ;; Highlight the other end of the sexp, or unhighlight if none. (if (and pos (integerp pos)) (goto-char pos) (message "No matching other paren found.") )))