Permalink
Browse files

updated projectile and zenburn

  • Loading branch information...
1 parent 47ccc36 commit df9315f6db5f1b40673147b299e9baa660c0a07c @bbatsov committed Oct 2, 2011
Showing with 90 additions and 29 deletions.
  1. +18 −13 themes/zenburn-theme.el
  2. +72 −16 vendor/projectile.el
View
@@ -51,7 +51,9 @@
;; colors with +x are lighter, colors with -x are darker
(zenburn-fg "#dcdccc")
(zenburn-fg-1 "#656555")
+ (zenburn-bg-2 "#1f1f1f")
(zenburn-bg-1 "#2b2b2b")
+ (zenburn-bg-05 "#383838")
(zenburn-bg "#3f3f3f")
(zenburn-bg+1 "#4f4f4f")
(zenburn-bg+2 "#5f5f5f")
@@ -80,11 +82,11 @@
(zenburn-blue-4 "#4c7073")
(zenburn-blue-5 "#366060")
(zenburn-magenta "#dc8cc3"))
- (custom-theme-set-faces
+ (custom-theme-set-faces
'zenburn
- '(link ((t (:foreground "#f0dfaf" :underline t))))
- '(link-visited ((t (:foreground "#8b008b" :underline t))))
'(button ((t (:underline t))))
+ `(link ((,class (:foreground ,zenburn-yellow :underline t :weight bold))))
+ `(link-visited ((,class (:foreground ,zenburn-yellow-2 :underline t :weight normal))))
;;; define some reusable zenburn faces that we can inherit from afterwards
`(zenburn-strong-1-face ((,class (:foreground ,zenburn-yellow :weight bold))))
@@ -96,9 +98,9 @@
`(default ((,class (:foreground ,zenburn-fg :background ,zenburn-bg))))
`(cursor ((,class (:foreground ,zenburn-fg))))
`(escape-glyph-face ((,class (:foreground ,zenburn-red))))
- `(fringe ((,class (:foreground ,zenburn-fg :background ,zenburn-bg))))
- `(header-line ((,class (:foreground ,zenburn-yellow :background ,zenburn-bg-1))))
- `(highlight ((,class (:background ,zenburn-bg+1))))
+ `(fringe ((,class (:foreground ,zenburn-fg :background ,zenburn-bg+1))))
+ `(header-line ((,class (:foreground ,zenburn-yellow :background ,zenburn-bg-2))))
+ `(highlight ((,class (:background ,zenburn-bg-1))))
;;; compilation
`(compilation-column-face ((,class (:foreground ,zenburn-yellow))))
@@ -132,7 +134,7 @@
`(mode-line-buffer-id ((,class (:foreground ,zenburn-yellow :weight bold))))
`(mode-line-inactive
((,class (:foreground ,zenburn-green-1 :background ,zenburn-bg-1))))
- `(region ((,class (:background ,zenburn-bg-1))))
+ `(region ((,class (:background ,zenburn-bg-05))))
`(secondary-selection ((,class (:background ,zenburn-bg+2))))
`(trailing-whitespace ((,class (:background ,zenburn-red))))
`(vertical-border ((,class (:foreground ,zenburn-fg))))
@@ -187,16 +189,16 @@
;; erc
`(erc-action-face ((,class (:inherit erc-default-face))))
`(erc-bold-face ((,class (:weight bold))))
- `(erc-current-nick-face ((,class (:foreground ,zenburn-yellow :weight bold))))
+ `(erc-current-nick-face ((,class (:foreground ,zenburn-blue :weight bold))))
`(erc-dangerous-host-face ((,class (:inherit font-lock-warning))))
`(erc-default-face ((,class (:foreground ,zenburn-fg))))
`(erc-direct-msg-face ((,class (:inherit erc-default))))
`(erc-error-face ((,class (:inherit font-lock-warning))))
`(erc-fool-face ((,class (:inherit erc-default))))
`(erc-highlight-face ((,class (:inherit hover-highlight))))
`(erc-input-face ((,class (:foreground ,zenburn-yellow))))
- `(erc-keyword-face ((,class (:foreground ,zenburn-yellow :weight bold))))
- `(erc-nick-default-face ((,class (:weigth bold))))
+ `(erc-keyword-face ((,class (:foreground ,zenburn-blue :weight bold))))
+ `(erc-nick-default-face ((,class (:foreground ,zenburn-yellow :weight bold))))
`(erc-my-nick-face ((,class (:foreground ,zenburn-red :weigth bold))))
`(erc-nick-msg-face ((,class (:inherit erc-default))))
`(erc-notice-face ((,class (:foreground ,zenburn-green))))
@@ -401,8 +403,11 @@
`(rpm-spec-var-face ((,class (:foreground ,zenburn-red))))
;; show-paren
- `(show-paren-mismatch ((,class (:foreground ,zenburn-red-3 :background ,zenburn-bg :weight bold))))
- `(show-paren-match ((,class (:foreground ,zenburn-blue-1 :background ,zenburn-bg :weight bold))))
+ `(show-paren-mismatch ((,class (:foreground ,zenburn-red-3 :weight bold))))
+ `(show-paren-match ((,class (:foreground ,zenburn-blue-1 :weight bold))))
+
+ ;; SLIME
+ `(slime-repl-inputed-output-face ((,class (:foreground ,zenburn-red))))
;; wanderlust
`(wl-highlight-folder-few-face ((,class (:foreground ,zenburn-red-2))))
@@ -435,7 +440,7 @@
(custom-theme-set-variables
'zenburn
- '(ansi-color-names-vector [zenburn-bg zenburn-red zenburn-green zenburn-yellow
+ '(ansi-color-names-vector [zenburn-bg zenburn-red zenburn-green zenburn-yellow
zenburn-blue zenburn-magenta zenburn-cyan zenburn-fg]))
(provide-theme 'zenburn)
View
@@ -31,19 +31,63 @@
;; Boston, MA 02110-1301, USA.
;;; Commentary:
+;;
+;; This library provides easy project management and navigation. The
+;; concept of a project is pretty basic - just a folder containing
+;; special file. Currently git, mercurial and bazaar repos are
+;; considered projects by default. If you want to mark a folder
+;; manually as a project just create an empty .projectile file in
+;; it. Some of projectile's features:
+;;
+;; * jump to a file in project
+;; * jump to a project buffer
+;; * multi-occur in project buffers
+;; * grep in project
+;; * regenerate project etags
+;;; Installation:
+;;
+;; (require 'projectile)
+;; (projectile-global-mode) ;; to enable in all buffers
+;;
+;; To enable projectile only in select modes:
+;;
+;; (add-hook 'ruby-mode-hook #'(lambda () (projectile-mode)))
+;;
+;;; Usage:
+;;
+;; Here's a list of the interactive Emacs Lisp functions, provided by projectile:
+;;
+;; * projectile-jump-to-project-file (C-c p j)
+;; * projectile-grep-in-project (C-c p f)
+;; * projectile-replace-in-project (C-c p r)
+;; * projectile-switch-to-buffer (C-c p b)
+;; * projectile-multi-occur (C-c p o)
+;; * projectile-regenerate-tags (C-c p t)
+;; * projectile-invalidate-project-cache (C-c p i)
+;;
+;;; Code:
-;; This library provides easy project management and navigation.
+;; requires
(require 'cl)
(require 'easymenu)
(require 'thingatpt)
-(defvar projectile-project-root-files '(".git" ".hg" ".bzr" ".projectile"))
+;; variables
+(defvar projectile-project-root-files '(".git" ".hg" ".bzr" ".projectile")
+ "A list of files considered to mark the root of a project")
-(defvar projectile-projects-cache (make-hash-table :test 'equal))
+(defvar projectile-ignored-file-extenstions '("class" "o" "so" "elc")
+ "A list of file extensions ignored by projectile.")
+
+(defvar projectile-projects-cache (make-hash-table :test 'equal)
+ "A hashmap used to cache project file names to speed up related operations")
(defun projectile-invalidate-project-cache ()
+ "Removes the current project's files from `projectile-projects-cache'"
(interactive)
- (remhash (projectile-get-project-root) projectile-projects-cache))
+ (let ((project-root (projectile-get-project-root)))
+ (remhash project-root projectile-projects-cache)
+ (message "Invalidated Projectile cache for %s" project-root)))
(defun projectile-get-project-root ()
(loop for file in projectile-project-root-files
@@ -63,15 +107,17 @@
(not (projectile-ignored-p current-file)))
(setq files-list (append files-list (projectile-get-project-files current-file))))
((and (string= (expand-file-name current-file) current-file)
- (not (file-directory-p current-file))) (setq files-list (cons current-file files-list)))))
- (puthash directory files-list projectile-projects-cache)
+ (not (file-directory-p current-file))
+ (not (projectile-ignored-extension-p current-file)))
+ (setq files-list (cons current-file files-list)))))
+ (when (string= directory (projectile-get-project-root))
+ (puthash directory files-list projectile-projects-cache))
files-list)))
(defun projectile-get-project-buffers ()
(let ((project-files (projectile-get-project-files (projectile-get-project-root)))
(buffer-files (mapcar 'buffer-file-name (buffer-list))))
- (mapcar 'get-file-buffer (intersection project-files buffer-files :test 'string=))
- ))
+ (mapcar 'get-file-buffer (intersection project-files buffer-files :test 'string=))))
(defun projectile-get-project-buffer-names ()
(mapcar 'buffer-name (projectile-get-project-buffers)))
@@ -111,6 +157,10 @@
do (return t)
finally (return nil)))
+(defun projectile-ignored-extension-p (file)
+ (let ((ext (file-name-extension file)))
+ (member ext projectile-ignored-file-extenstions)))
+
(defun projectile-jump-to-project-file ()
(interactive)
(let* ((project-files (projectile-hashify-files
@@ -153,18 +203,25 @@
(define-key map (kbd "C-c p o") 'projectile-multi-occur)
(define-key map (kbd "C-c p r") 'projectile-replace-in-project)
(define-key map (kbd "C-c p i") 'projectile-invalidate-project-cache)
+ (define-key map (kbd "C-c p t") 'projectile-regenerate-tags)
map)
- "Keymap for Projectile mode."
- )
+ "Keymap for Projectile mode.")
(easy-menu-define projectile-mode-menu projectile-mode-map
"Menu for Projectile mode"
'("Projectile"
("Navigating"
- ["Jump to file" projectile-jump-to-project-file])
-
- ("Search & Replace"
- ["Search in project" projectile-grep-in-project])))
+ ["Jump to file" projectile-jump-to-project-file]
+ ["Jump to buffer" projectile-switch-to-buffer])
+
+ ("Find & Replace"
+ ["Find in project" projectile-grep-in-project]
+ ["Replace in project" projectile-replace-in-project]
+ ["Multi-occur in project" projectile-multi-occur])
+
+ ("General"
+ ["Invalidate cache" projectile-invalidate-project-cache]
+ ["Regenerate etags" projectile-regenerate-tags])))
;; define minor mode
(define-globalized-minor-mode projectile-global-mode projectile-mode projectile-on)
@@ -174,8 +231,7 @@
(projectile-mode 1)))
(defun projectile-off ()
- (easy-menu-remove)
- )
+ (easy-menu-remove))
(define-minor-mode projectile-mode "Minor mode to assist project management and navigation."
:lighter " Projectile"

0 comments on commit df9315f

Please sign in to comment.