Permalink
Browse files

Merge branch 'master' of https://github.com/senny/emacs-eclim

  • Loading branch information...
2 parents b67c331 + 2d3a607 commit dde042f021180b0ac03b90375114438681474897 @fred-o fred-o committed Dec 4, 2012
Showing with 19 additions and 19 deletions.
  1. +3 −6 eclim-java.el
  2. +16 −13 eclim.el
View
@@ -131,14 +131,11 @@ sources."
(defadvice delete-file (around eclim--delete-file activate)
"Advice the `delete-file' function to trigger a source update
in eclim when appropriate."
- (let ((buf (current-buffer))
- (pr nil)
+ (let ((pr nil)
(fn nil))
- (switch-to-buffer (find-buffer-visiting filename))
(ignore-errors
- (setq pr (eclim--project-name))
- (setq fn (eclim--project-current-file)))
- (switch-to-buffer buf)
+ (and (setq pr (eclim--project-name filename))
+ (setq fn (file-relative-name filename (eclim--project-dir filename)))))
ad-do-it
(when (and pr fn)
(ignore-errors (apply 'eclim--call-process (list "java_src_update" "-p" pr "-f" fn))))))
View
@@ -350,19 +350,22 @@ argument FILENAME is given, return that file's project root directory."
(defun eclim--project-name (&optional filename)
"Returns this file's project name. If the optional argument
FILENAME is given, return that file's project name instead."
- (or eclim--project-name
- (setq eclim--project-name
- (let ((project-list (eclim/project-list))
- (project-dir (eclim--project-dir (or filename buffer-file-name))))
- (when (and project-list project-dir)
- (assoc-default 'name
- (or
- (find project-dir project-list ;; case sensitive
- :key (lambda (e) (assoc-default 'path e))
- :test (lambda (s1 s2) (string= (file-truename s1) (file-truename s2))))
- (find project-dir project-list ;; case insensitive
- :key (lambda (e) (assoc-default 'path e))
- :test (lambda (s1 s2) (string= (downcase (file-truename s1)) (downcase (file-truename s2))))))))))))
+ (labels ((get-project-name (file)
+ (let ((project-list (eclim/project-list))
+ (project-dir (eclim--project-dir file)))
+ (when (and project-list project-dir)
+ (assoc-default 'name
+ (or
+ (find project-dir project-list ;; case sensitive
+ :key (lambda (e) (assoc-default 'path e))
+ :test (lambda (s1 s2) (string= (file-truename s1) (file-truename s2))))
+ (find project-dir project-list ;; case insensitive
+ :key (lambda (e) (assoc-default 'path e))
+ :test (lambda (s1 s2) (string= (downcase (file-truename s1)) (downcase (file-truename s2)))))))))))
+ (if filename
+ (get-project-name filename)
+ (or eclim--project-name
+ (setq eclim--project-name (get-project-name buffer-file-name))))))
(defun eclim--find-file (path-to-file)
(if (not (string-match-p "!" path-to-file))

0 comments on commit dde042f

Please sign in to comment.