Browse files

Convert all tabs to spaces.

  • Loading branch information...
1 parent 7ebf682 commit d7fef0697a54fea23af53f2d8bc78a9d27adb50a @skeeto committed Dec 1, 2011
Showing with 68 additions and 68 deletions.
  1. +41 −41 java-docs.el
  2. +27 −27 java-mode-plus.el
82 java-docs.el
@@ -97,20 +97,20 @@
"Load pre-cached web indexes for URLS."
(dolist (url (remove-if 'java-docs-loadedp urls))
(let ((cache-file (concat java-docs-home "webcache/"
- (java-docs-hash-name url))))
+ (java-docs-hash-name url))))
(if (file-exists-p cache-file)
- (progn
- (java-docs-load-cache cache-file)
- (java-docs-sort))
- (error "No cache for %s" url)))))
+ (progn
+ (java-docs-load-cache cache-file)
+ (java-docs-sort))
+ (error "No cache for %s" url)))))
(defun java-docs-sort ()
"Sort the loaded indexes."
(setq java-docs-class-list
- (sort* java-docs-class-list '< :key 'length))
+ (sort* java-docs-class-list '< :key 'length))
(setq java-docs-short-class-list
- (sort* (mapcar 'java-docs-short-name java-docs-class-list)
- '< :key 'length)))
+ (sort* (mapcar 'java-docs-short-name java-docs-class-list)
+ '< :key 'length)))
(defun java-docs-loadedp (dir)
"Return t if DIR has already been loaded."
@@ -127,16 +127,16 @@
"Get the cache hashed name for DIR. This is basically an MD5
hash plus version info."
(concat (md5 dir) java-docs-cache-version
- (if java-docs-compress-cache ".gz" "")))
+ (if java-docs-compress-cache ".gz" "")))
(defun java-docs-add (dir)
"Add directory to directory list and either index or fetch the cache."
(add-to-list 'java-docs-loaded dir)
(let ((cache-file (concat java-docs-cache-dir "/" (java-docs-hash-name dir)))
- (hash (make-hash-table :test 'equal)))
+ (hash (make-hash-table :test 'equal)))
(if (and java-docs-enable-cache
- (file-exists-p cache-file))
- (java-docs-load-cache cache-file)
+ (file-exists-p cache-file))
+ (java-docs-load-cache cache-file)
(java-docs-index dir hash)
(java-docs-save-cache cache-file dir hash)
(java-docs-add-hash hash))))
@@ -159,14 +159,14 @@ hash plus version info."
(let ((hash (read (current-buffer))))
(java-docs-add-hash hash)
(setq java-docs-class-list
- (nconc java-docs-class-list (hash-table-keys hash))))
+ (nconc java-docs-class-list (hash-table-keys hash))))
(defun java-docs-save-cache (cache-file dir hash)
"Save a cache to the disk."
(when java-docs-enable-cache
(if (not (file-exists-p java-docs-cache-dir))
- (make-directory java-docs-cache-dir))
+ (make-directory java-docs-cache-dir))
(insert ";; " dir "\n\n")
(insert (prin1-to-string hash))
@@ -175,45 +175,45 @@ hash plus version info."
(defun java-docs-add-hash (hash)
"Combine HASH into the main index hash."
(maphash (lambda (key val)
- (puthash key val java-docs-index))
- hash))
+ (puthash key val java-docs-index))
+ hash))
(defun java-docs-update-list ()
"Update the completion list to match the index."
(setq java-docs-class-list nil)
(maphash (lambda (key val)
- (setq java-docs-class-list (cons key java-docs-class-list)))
- java-docs-index))
+ (setq java-docs-class-list (cons key java-docs-class-list)))
+ java-docs-index))
(defun java-docs-index (dir hash)
"Index the documentation in DIR into HASH."
(let* ((list (directory-files dir t "^[^.]"))
- (files (remove-if 'file-directory-p list))
- (dirs (remove-if-not 'file-directory-p list)))
+ (files (remove-if 'file-directory-p list))
+ (dirs (remove-if-not 'file-directory-p list)))
(dolist (file files)
(java-docs-add-file file hash))
(dolist (dir dirs)
(if (not (string-equal "class-use" (file-name-nondirectory dir)))
- (java-docs-index dir hash)))))
+ (java-docs-index dir hash)))))
(defun java-docs-add-file (fullfile hash)
"Add a file to the index if it looks like a class."
(let* ((file (file-name-nondirectory fullfile))
- (ext (file-name-extension fullfile))
- (class (file-name-sans-extension file))
- (rel (substring fullfile (length java-docs-current-root)))
- (fullclass (substitute ?. ?/ (file-name-sans-extension rel)))
- (case-fold-search nil))
+ (ext (file-name-extension fullfile))
+ (class (file-name-sans-extension file))
+ (rel (substring fullfile (length java-docs-current-root)))
+ (fullclass (substitute ?. ?/ (file-name-sans-extension rel)))
+ (case-fold-search nil))
(when (and (string-equal ext "html")
- (string-match "^[A-Z].+" class))
+ (string-match "^[A-Z].+" class))
(puthash fullclass fullfile hash)
(setq java-docs-class-list
- (cons fullclass java-docs-class-list)))))
+ (cons fullclass java-docs-class-list)))))
(defun java-docs-completing-read ()
"Query the user for a class name."
(unless (java-docs-core-indexed-p)
- (ignore-errors ; Provide *something* useful, if needed
+ (ignore-errors ; Provide *something* useful, if needed
(java-docs-web "")))
(funcall java-docs-completing-function "Class: " java-docs-class-list))
@@ -226,7 +226,7 @@ hash plus version info."
(interactive (list (java-docs-completing-read)))
(let ((file (gethash name java-docs-index)))
(if file
- (browse-url file))))
+ (browse-url file))))
(defun java-docs-core-indexed-p ()
"Return t if the JRE Javadoc has been indexed. The class
@@ -279,18 +279,18 @@ always be there."
(if (java-has-import)
- (progn
- (java-goto-first-import)
- (call-interactively 'insert-java-import)
- (sort-imports))
+ (progn
+ (java-goto-first-import)
+ (call-interactively 'insert-java-import)
+ (sort-imports))
- (goto-char (point-min))
- (if (java-in-package)
- (search-forward-regexp java-docs-package-regexp))
- (move-end-of-line nil)
- (forward-char)
- (insert "\n")
- (call-interactively 'insert-java-import)))))
+ (goto-char (point-min))
+ (if (java-in-package)
+ (search-forward-regexp java-docs-package-regexp))
+ (move-end-of-line nil)
+ (forward-char)
+ (insert "\n")
+ (call-interactively 'insert-java-import)))))
(defun sort-imports ()
"Sort the imports in the import section in proper order."
54 java-mode-plus.el
@@ -229,11 +229,11 @@ the given directory."
(dirs (remove-if-not 'file-directory-p list)))
(dolist (file files)
(if (open-java-project-file-p file)
- (find-file-noselect file)))
+ (find-file-noselect file)))
(dolist (dir dirs)
(when (open-java-project-dir-p dir)
- (find-file-noselect dir)
- (open-java-project dir)))))
+ (find-file-noselect dir)
+ (open-java-project dir)))))
;;; Helper functions to determine properties of the current source
@@ -242,11 +242,11 @@ the given directory."
file, based on the absolute filename. Package roots are matched
against `java-package-roots'."
(labels ((search-root (stack path)
- (if (or (null path) (member (car path) java-package-roots))
- (mapconcat 'identity stack ".")
- (search-root (cons (car path) stack) (cdr path)))))
+ (if (or (null path) (member (car path) java-package-roots))
+ (mapconcat 'identity stack ".")
+ (search-root (cons (car path) stack) (cdr path)))))
(search-root '() (cdr (reverse (split-string (file-name-directory
- buffer-file-name) "/"))))))
+ buffer-file-name) "/"))))))
(defun java-class-name ()
"Determine the class name from the filename."
@@ -259,26 +259,26 @@ against `java-package-roots'."
`(lexical-let ((target ,target))
(define-key java-mode-map ,key
(lambda (n)
- (interactive "p")
- (let* ((buffer-name (format "*compilation-%d*" n))
- (compilation-buffer-name-function (lambda (x) buffer-name)))
- (save-buffer)
- (compile (format "ant -emacs %s -find" target) t))))))
+ (interactive "p")
+ (let* ((buffer-name (format "*compilation-%d*" n))
+ (compilation-buffer-name-function (lambda (x) buffer-name)))
+ (save-buffer)
+ (compile (format "ant -emacs %s -find" target) t))))))
(defmacro ant-bind* (&rest keys/fns)
"Make several ant-bind bindings in a row."
,@(loop for (key fn) on keys/fns by 'cddr
- collecting `(ant-bind (kbd ,key) ,fn))))
+ collecting `(ant-bind (kbd ,key) ,fn))))
(ant-bind* "C-c C-j c" 'compile ; default Ant target
- "C-c C-j j" 'jar
- "C-c C-j C" 'clean
- "C-c C-j r" 'run
- "C-c C-j t" 'test
- "C-c C-j y" 'check
- "C-c C-j f" 'format
- "C-c C-j x" 'hotswap)
+ "C-c C-j j" 'jar
+ "C-c C-j C" 'clean
+ "C-c C-j r" 'run
+ "C-c C-j t" 'test
+ "C-c C-j y" 'check
+ "C-c C-j f" 'format
+ "C-c C-j x" 'hotswap)
;; Add the very handy binding from java-docs
(define-key java-mode-map (kbd "C-c C-j i") 'add-java-import)
@@ -287,13 +287,13 @@ against `java-package-roots'."
"Create (old) short bindings for java-mode."
(ant-bind* "C-x c" 'compile
- "C-x j" 'jar
- "C-x C" 'clean
- "C-x r" 'run
- "C-x t" 'test
- "C-x y" 'check
- "C-x f" 'format
- "C-x x" 'hotswap)
+ "C-x j" 'jar
+ "C-x C" 'clean
+ "C-x r" 'run
+ "C-x t" 'test
+ "C-x y" 'check
+ "C-x f" 'format
+ "C-x x" 'hotswap)
(define-key java-mode-map (kbd "C-x I") 'add-java-import))
;; This is here for the sake of the "run" Ant target above, so you can

0 comments on commit d7fef06

Please sign in to comment.