From 3303f1ac3aacc9cb16ddad909824b1b03ca9baaa Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 6 Oct 2016 10:56:17 +0200 Subject: [PATCH] Update packages --- elpa/erlang-20160831.740/erlang-pkg.el | 4 - .../erlang-autoloads.el | 10 +- .../erlang-eunit.el | 0 .../erlang-flymake.el | 0 elpa/erlang-20161005.305/erlang-pkg.el | 4 + .../erlang-skels-old.el | 0 .../erlang-skels.el | 0 .../erlang-start.el | 0 .../erlang-test.el | 0 .../erlang.el | 2 - .../erlang_appwiz.el | 0 .../js2-imenu-extras.el | 0 .../js2-mode-autoloads.el | 10 +- .../js2-mode-pkg.el | 2 +- .../js2-mode.el | 10 +- .../js2-old-indent.el | 0 .../projectile-autoloads.el | 36 +-- .../projectile-pkg.el | 2 +- .../projectile.el | 253 +++++++++++++----- 19 files changed, 222 insertions(+), 111 deletions(-) delete mode 100644 elpa/erlang-20160831.740/erlang-pkg.el rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang-autoloads.el (94%) rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang-eunit.el (100%) rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang-flymake.el (100%) create mode 100644 elpa/erlang-20161005.305/erlang-pkg.el rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang-skels-old.el (100%) rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang-skels.el (100%) rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang-start.el (100%) rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang-test.el (100%) rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang.el (99%) rename elpa/{erlang-20160831.740 => erlang-20161005.305}/erlang_appwiz.el (100%) rename elpa/{js2-mode-20160926.1243 => js2-mode-20161005.1411}/js2-imenu-extras.el (100%) rename elpa/{js2-mode-20160926.1243 => js2-mode-20161005.1411}/js2-mode-autoloads.el (91%) rename elpa/{js2-mode-20160926.1243 => js2-mode-20161005.1411}/js2-mode-pkg.el (74%) rename elpa/{js2-mode-20160926.1243 => js2-mode-20161005.1411}/js2-mode.el (99%) rename elpa/{js2-mode-20160926.1243 => js2-mode-20161005.1411}/js2-old-indent.el (100%) rename elpa/{projectile-20161004.1340 => projectile-20161005.2209}/projectile-autoloads.el (94%) rename elpa/{projectile-20161004.1340 => projectile-20161005.2209}/projectile-pkg.el (71%) rename elpa/{projectile-20161004.1340 => projectile-20161005.2209}/projectile.el (94%) diff --git a/elpa/erlang-20160831.740/erlang-pkg.el b/elpa/erlang-20160831.740/erlang-pkg.el deleted file mode 100644 index 6f710dd..0000000 --- a/elpa/erlang-20160831.740/erlang-pkg.el +++ /dev/null @@ -1,4 +0,0 @@ -(define-package "erlang" "20160831.740" "Erlang major mode" 'nil) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/erlang-20160831.740/erlang-autoloads.el b/elpa/erlang-20161005.305/erlang-autoloads.el similarity index 94% rename from elpa/erlang-20160831.740/erlang-autoloads.el rename to elpa/erlang-20161005.305/erlang-autoloads.el index e55240f..ccaaa79 100644 --- a/elpa/erlang-20160831.740/erlang-autoloads.el +++ b/elpa/erlang-20161005.305/erlang-autoloads.el @@ -1,9 +1,9 @@ ;;; erlang-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil "erlang" "erlang.el" (22490 24938 259400 312000)) +;;;### (autoloads nil "erlang" "erlang.el" (22518 4433 253987 51000)) ;;; Generated autoloads from erlang.el (autoload 'erlang-mode "erlang" "\ @@ -118,8 +118,8 @@ editing control characters: ;;;*** -;;;### (autoloads nil "erlang-start" "erlang-start.el" (22490 24938 -;;;;;; 243400 358000)) +;;;### (autoloads nil "erlang-start" "erlang-start.el" (22518 4433 +;;;;;; 225986 910000)) ;;; Generated autoloads from erlang-start.el (let ((a '("\\.erl\\'" . erlang-mode)) (b '("\\.hrl\\'" . erlang-mode))) (or (assoc (car a) auto-mode-alist) (setq auto-mode-alist (cons a auto-mode-alist))) (or (assoc (car b) auto-mode-alist) (setq auto-mode-alist (cons b auto-mode-alist)))) @@ -132,7 +132,7 @@ editing control characters: ;;;### (autoloads nil nil ("erlang-eunit.el" "erlang-flymake.el" ;;;;;; "erlang-pkg.el" "erlang-skels-old.el" "erlang-skels.el" "erlang-test.el" -;;;;;; "erlang_appwiz.el") (22490 24938 297767 827000)) +;;;;;; "erlang_appwiz.el") (22518 4433 269987 132000)) ;;;*** diff --git a/elpa/erlang-20160831.740/erlang-eunit.el b/elpa/erlang-20161005.305/erlang-eunit.el similarity index 100% rename from elpa/erlang-20160831.740/erlang-eunit.el rename to elpa/erlang-20161005.305/erlang-eunit.el diff --git a/elpa/erlang-20160831.740/erlang-flymake.el b/elpa/erlang-20161005.305/erlang-flymake.el similarity index 100% rename from elpa/erlang-20160831.740/erlang-flymake.el rename to elpa/erlang-20161005.305/erlang-flymake.el diff --git a/elpa/erlang-20161005.305/erlang-pkg.el b/elpa/erlang-20161005.305/erlang-pkg.el new file mode 100644 index 0000000..b1ea51f --- /dev/null +++ b/elpa/erlang-20161005.305/erlang-pkg.el @@ -0,0 +1,4 @@ +(define-package "erlang" "20161005.305" "Erlang major mode" 'nil) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/erlang-20160831.740/erlang-skels-old.el b/elpa/erlang-20161005.305/erlang-skels-old.el similarity index 100% rename from elpa/erlang-20160831.740/erlang-skels-old.el rename to elpa/erlang-20161005.305/erlang-skels-old.el diff --git a/elpa/erlang-20160831.740/erlang-skels.el b/elpa/erlang-20161005.305/erlang-skels.el similarity index 100% rename from elpa/erlang-20160831.740/erlang-skels.el rename to elpa/erlang-20161005.305/erlang-skels.el diff --git a/elpa/erlang-20160831.740/erlang-start.el b/elpa/erlang-20161005.305/erlang-start.el similarity index 100% rename from elpa/erlang-20160831.740/erlang-start.el rename to elpa/erlang-20161005.305/erlang-start.el diff --git a/elpa/erlang-20160831.740/erlang-test.el b/elpa/erlang-20161005.305/erlang-test.el similarity index 100% rename from elpa/erlang-20160831.740/erlang-test.el rename to elpa/erlang-20161005.305/erlang-test.el diff --git a/elpa/erlang-20160831.740/erlang.el b/elpa/erlang-20161005.305/erlang.el similarity index 99% rename from elpa/erlang-20160831.740/erlang.el rename to elpa/erlang-20161005.305/erlang.el index 73c6b8d..788de75 100644 --- a/elpa/erlang-20160831.740/erlang.el +++ b/elpa/erlang-20161005.305/erlang.el @@ -1512,8 +1512,6 @@ Other commands: (setq paragraph-separate paragraph-start) (make-local-variable 'paragraph-ignore-fill-prefix) (setq paragraph-ignore-fill-prefix t) - (make-local-variable 'require-final-newline) - (setq require-final-newline t) (make-local-variable 'defun-prompt-regexp) (setq defun-prompt-regexp erlang-defun-prompt-regexp) (make-local-variable 'comment-start) diff --git a/elpa/erlang-20160831.740/erlang_appwiz.el b/elpa/erlang-20161005.305/erlang_appwiz.el similarity index 100% rename from elpa/erlang-20160831.740/erlang_appwiz.el rename to elpa/erlang-20161005.305/erlang_appwiz.el diff --git a/elpa/js2-mode-20160926.1243/js2-imenu-extras.el b/elpa/js2-mode-20161005.1411/js2-imenu-extras.el similarity index 100% rename from elpa/js2-mode-20160926.1243/js2-imenu-extras.el rename to elpa/js2-mode-20161005.1411/js2-imenu-extras.el diff --git a/elpa/js2-mode-20160926.1243/js2-mode-autoloads.el b/elpa/js2-mode-20161005.1411/js2-mode-autoloads.el similarity index 91% rename from elpa/js2-mode-20160926.1243/js2-mode-autoloads.el rename to elpa/js2-mode-20161005.1411/js2-mode-autoloads.el index c2b356a..dc757ff 100644 --- a/elpa/js2-mode-20160926.1243/js2-mode-autoloads.el +++ b/elpa/js2-mode-20161005.1411/js2-mode-autoloads.el @@ -3,8 +3,8 @@ ;;; Code: (add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil "js2-imenu-extras" "js2-imenu-extras.el" (22508 -;;;;;; 49890 901948 818000)) +;;;### (autoloads nil "js2-imenu-extras" "js2-imenu-extras.el" (22518 +;;;;;; 4413 133886 14000)) ;;; Generated autoloads from js2-imenu-extras.el (autoload 'js2-imenu-extras-setup "js2-imenu-extras" "\ @@ -19,8 +19,8 @@ Toggle Imenu support for frameworks and structural patterns. ;;;*** -;;;### (autoloads nil "js2-mode" "js2-mode.el" (22508 49890 917948 -;;;;;; 854000)) +;;;### (autoloads nil "js2-mode" "js2-mode.el" (22518 4413 157886 +;;;;;; 136000)) ;;; Generated autoloads from js2-mode.el (autoload 'js2-highlight-unused-variables-mode "js2-mode" "\ @@ -56,7 +56,7 @@ variables (`sgml-basic-offset' et al) locally, like so: ;;;*** ;;;### (autoloads nil nil ("js2-mode-pkg.el" "js2-old-indent.el") -;;;;;; (22508 49890 913948 845000)) +;;;;;; (22518 4413 149886 96000)) ;;;*** diff --git a/elpa/js2-mode-20160926.1243/js2-mode-pkg.el b/elpa/js2-mode-20161005.1411/js2-mode-pkg.el similarity index 74% rename from elpa/js2-mode-20160926.1243/js2-mode-pkg.el rename to elpa/js2-mode-20161005.1411/js2-mode-pkg.el index 49a9ade..bd666dc 100644 --- a/elpa/js2-mode-20160926.1243/js2-mode-pkg.el +++ b/elpa/js2-mode-20161005.1411/js2-mode-pkg.el @@ -1,4 +1,4 @@ -(define-package "js2-mode" "20160926.1243" "Improved JavaScript editing mode" +(define-package "js2-mode" "20161005.1411" "Improved JavaScript editing mode" '((emacs "24.1") (cl-lib "0.5")) :url "https://github.com/mooz/js2-mode/" :keywords diff --git a/elpa/js2-mode-20160926.1243/js2-mode.el b/elpa/js2-mode-20161005.1411/js2-mode.el similarity index 99% rename from elpa/js2-mode-20160926.1243/js2-mode.el rename to elpa/js2-mode-20161005.1411/js2-mode.el index e6d1c00..fb3482c 100644 --- a/elpa/js2-mode-20160926.1243/js2-mode.el +++ b/elpa/js2-mode-20161005.1411/js2-mode.el @@ -6395,14 +6395,14 @@ its relevant fields and puts it into `js2-ti-tokens'." js2-TEMPLATE_HEAD js2-NO_SUBS_TEMPLATE)))) -(defun js2-read-regexp (start-tt) +(defun js2-read-regexp (start-tt start-pos) "Called by parser when it gets / or /= in literal context." (let (c err in-class ; inside a '[' .. ']' character-class flags (continue t) (token (js2-new-token 0))) - (js2-record-text-property (1- js2-ts-cursor) js2-ts-cursor + (js2-record-text-property start-pos (1+ start-pos) 'syntax-table (string-to-syntax "\"/")) (setq js2-ts-string-buffer nil) (if (eq start-tt js2-ASSIGN_DIV) @@ -10425,9 +10425,9 @@ array-literals, array comprehensions and regular expressions." (js2-parse-template-literal)) ((or (= tt js2-DIV) (= tt js2-ASSIGN_DIV)) ;; Got / or /= which in this context means a regexp literal - (let ((px-pos (js2-current-token-beg)) - (flags (js2-read-regexp tt)) - (end (js2-current-token-end))) + (let* ((px-pos (js2-current-token-beg)) + (flags (js2-read-regexp tt px-pos)) + (end (js2-current-token-end))) (prog1 (make-js2-regexp-node :pos px-pos :len (- end px-pos) diff --git a/elpa/js2-mode-20160926.1243/js2-old-indent.el b/elpa/js2-mode-20161005.1411/js2-old-indent.el similarity index 100% rename from elpa/js2-mode-20160926.1243/js2-old-indent.el rename to elpa/js2-mode-20161005.1411/js2-old-indent.el diff --git a/elpa/projectile-20161004.1340/projectile-autoloads.el b/elpa/projectile-20161005.2209/projectile-autoloads.el similarity index 94% rename from elpa/projectile-20161004.1340/projectile-autoloads.el rename to elpa/projectile-20161005.2209/projectile-autoloads.el index 8e2961c..b9a938b 100644 --- a/elpa/projectile-20161004.1340/projectile-autoloads.el +++ b/elpa/projectile-20161005.2209/projectile-autoloads.el @@ -3,8 +3,8 @@ ;;; Code: (add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil "projectile" "projectile.el" (22516 57894 833479 -;;;;;; 951000)) +;;;### (autoloads nil "projectile" "projectile.el" (22518 4419 65915 +;;;;;; 788000)) ;;; Generated autoloads from projectile.el (autoload 'projectile-version "projectile" "\ @@ -408,6 +408,16 @@ entirely.") (custom-autoload 'projectile-mode-line "projectile" t) +(defvar projectile-mode nil "\ +Non-nil if Projectile mode is enabled. +See the `projectile-mode' command +for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `projectile-mode'.") + +(custom-autoload 'projectile-mode "projectile" nil) + (autoload 'projectile-mode "projectile" "\ Minor mode to assist project management and navigation. @@ -423,27 +433,7 @@ Otherwise behave as if called interactively. \(fn &optional ARG)" t nil) -(defvar projectile-global-mode nil "\ -Non-nil if Projectile-Global mode is enabled. -See the `projectile-global-mode' command -for a description of this minor mode. -Setting this variable directly does not take effect; -either customize it (see the info node `Easy Customization') -or call the function `projectile-global-mode'.") - -(custom-autoload 'projectile-global-mode "projectile" nil) - -(autoload 'projectile-global-mode "projectile" "\ -Toggle Projectile mode in all buffers. -With prefix ARG, enable Projectile-Global mode if ARG is positive; -otherwise, disable it. If called from Lisp, enable the mode if -ARG is omitted or nil. - -Projectile mode is enabled in all buffers where -`projectile-mode' would do it. -See `projectile-mode' for more information on Projectile mode. - -\(fn &optional ARG)" t nil) +(define-obsolete-function-alias 'projectile-global-mode 'projectile-mode) ;;;*** diff --git a/elpa/projectile-20161004.1340/projectile-pkg.el b/elpa/projectile-20161005.2209/projectile-pkg.el similarity index 71% rename from elpa/projectile-20161004.1340/projectile-pkg.el rename to elpa/projectile-20161005.2209/projectile-pkg.el index fb55411..e809e09 100644 --- a/elpa/projectile-20161004.1340/projectile-pkg.el +++ b/elpa/projectile-20161005.2209/projectile-pkg.el @@ -1,2 +1,2 @@ ;;; -*- no-byte-compile: t -*- -(define-package "projectile" "20161004.1340" "Manage and navigate projects in Emacs easily" '((pkg-info "0.4")) :url "https://github.com/bbatsov/projectile" :keywords '("project" "convenience")) +(define-package "projectile" "20161005.2209" "Manage and navigate projects in Emacs easily" '((pkg-info "0.4")) :url "https://github.com/bbatsov/projectile" :keywords '("project" "convenience")) diff --git a/elpa/projectile-20161004.1340/projectile.el b/elpa/projectile-20161005.2209/projectile.el similarity index 94% rename from elpa/projectile-20161004.1340/projectile.el rename to elpa/projectile-20161005.2209/projectile.el index 2ae2b63..4b9d194 100644 --- a/elpa/projectile-20161004.1340/projectile.el +++ b/elpa/projectile-20161005.2209/projectile.el @@ -4,7 +4,7 @@ ;; Author: Bozhidar Batsov ;; URL: https://github.com/bbatsov/projectile -;; Package-Version: 20161004.1340 +;; Package-Version: 20161005.2209 ;; Keywords: project, convenience ;; Version: 0.15.0-cvs ;; Package-Requires: ((pkg-info "0.4")) @@ -318,6 +318,7 @@ The topmost match has precedence." ".git" ; Git VCS root dir ".hg" ; Mercurial VCS root dir ".fslckout" ; Fossil VCS root dir + "_FOSSIL_" ; Fossil VCS root DB on Windows ".bzr" ; Bazaar VCS root dir "_darcs" ; Darcs VCS root dir ) @@ -357,7 +358,7 @@ containing a root file." "A list of files globally unignored by projectile." :group 'projectile :type '(repeat string) - :package-version '(projectile "0.14.0")) + :package-version '(projectile . "0.14.0")) (defcustom projectile-globally-ignored-file-suffixes nil @@ -372,6 +373,7 @@ containing a root file." ".git" ".hg" ".fslckout" + "_FOSSIL_" ".bzr" "_darcs" ".tox" @@ -386,7 +388,7 @@ containing a root file." "A list of directories globally unignored by projectile." :group 'projectile :type '(repeat string) - :package-version '(projectile "0.14.0")) + :package-version '(projectile . "0.14.0")) (defcustom projectile-globally-ignored-modes '("erc-mode" @@ -564,6 +566,15 @@ projects." function) :package-version '(projectile . "0.13.0")) +(defcustom projectile-track-known-projects-automatically t + "Controls whether Projectile will automatically register known projects. + +When set to nil you'll have always add projects explicitly with +`projectile-add-known-project'." + :group 'projectile + :type 'boolean + :package-version '(projectile . "0.15.0")) + ;;; Version information @@ -733,9 +744,9 @@ The cache is created both in memory and on the hard drive." (not (projectile-ignored-project-p project-root))) (projectile-cache-current-file)))) -(defun projectile-cache-projects-find-file-hook () +(defun projectile-track-known-projects-find-file-hook () "Function for caching projects with `find-file-hook'." - (when (projectile-project-p) + (when (and projectile-track-known-projects-automatically (projectile-project-p)) (let ((known-projects (and (sequencep projectile-known-projects) (copy-sequence projectile-known-projects)))) (projectile-add-known-project (projectile-project-root)) @@ -944,14 +955,18 @@ Files are returned as relative paths to the project root." "Command used by projectile to get the ignored files in a git project." :group 'projectile :type 'string - :package-version '(projectile "0.14.0")) + :package-version '(projectile . "0.14.0")) (defcustom projectile-hg-command "hg locate -f -0 -I ." "Command used by projectile to get the files in a hg project." :group 'projectile :type 'string) -(defcustom projectile-fossil-command "fossil ls | tr '\\n' '\\0'" +(defcustom projectile-fossil-command (concat "fossil ls | " + (when (string-equal system-type + "windows-nt") + "dos2unix | ") + "tr '\\n' '\\0'") "Command used by projectile to get the files in a fossil project." :group 'projectile :type 'string) @@ -976,6 +991,15 @@ Files are returned as relative paths to the project root." :group 'projectile :type 'string) +(defcustom projectile-vcs-dirty-state '("edited" "unregistered" "needs-update" "needs-merge" "unlocked-changes" "conflict") + "List of states checked by `projectile-browse-dirty-projects'. +Possible checked states are: +\"edited\", \"unregistered\", \"needs-update\", \"needs-merge\", unlocked-changes\" and \"conflict\", +as defined in `vc.el'." + :group 'projectile + :type '(repeat (string)) + :package-version '(projectile . "0.15.0")) + (defun projectile-get-ext-command () "Determine which external command to invoke based on the project's VCS." (let ((vcs (projectile-project-vcs))) @@ -1076,6 +1100,74 @@ they are excluded from the results of this function." (when cmd (projectile-files-via-ext-command cmd)))) +(defun projectile-call-process-to-string (program &rest args) + "Invoke the executable PROGRAM with ARGS and return the output as a string." + (with-temp-buffer + (apply 'call-process program nil (current-buffer) nil args) + (buffer-string))) + +(defun projectile-shell-command-to-string (command) + "Try to run COMMAND without actually using a shell and return the output. + +The function `eshell-search-path' will be used to search the PATH +environment variable for an appropriate executable using the text +occuring before the first space. If no executable is found, +fallback to `shell-command-to-string'." + (cl-destructuring-bind + (the-command . args) (split-string command " ") + (let ((binary-path (eshell-search-path the-command))) + (if binary-path + (apply 'projectile-call-process-to-string binary-path args) + (shell-command-to-string command))))) + +(defun projectile-check-vcs-status (&optional PROJECT-PATH) + "Check the status of the current project. +If PROJECT-PATH is a project, check this one instead." + (let* ((PROJECT-PATH (or PROJECT-PATH (projectile-project-root))) + (project-status nil)) + (save-excursion + (vc-dir PROJECT-PATH) + ;; wait until vc-dir is done + (while (vc-dir-busy) (sleep-for 0 100)) + ;; check for status + (save-excursion + (save-match-data + (dolist (check projectile-vcs-dirty-state) + (goto-char (point-min)) + (when (search-forward check nil t) + (setq project-status (cons check project-status)))))) + (kill-buffer) + project-status))) + +(defun projectile-check-vcs-status-of-known-projects () + "Return the list of dirty projects. +The list is composed of sublists~: (project-path, project-status). +Raise an error if their is no dirty project." + (let ((projects projectile-known-projects) + (status ()) + (tmp-status nil)) + (dolist (project projects) + (condition-case nil + (setq tmp-status (projectile-check-vcs-status project)) + (error nil)) + (when tmp-status + (setq status (cons (list project tmp-status) status)))) + (when (= (length status) 0) + (message "No dirty projects have been found")) + status)) + +(defun projectile-browse-dirty-projects () + "Browse dirty version controlled projects." + (interactive) + (let ((status nil) + (mod-proj nil)) + (message "Checking for modifications in known projects...") + (setq status (projectile-check-vcs-status-of-known-projects)) + (while (not (= (length status) 0)) + (setq mod-proj (cons (car (pop status)) mod-proj))) + (projectile-vc + (projectile-completing-read "Select project: " mod-proj)))) + (defun projectile-files-via-ext-command (command) "Get a list of relative file names in the project root by executing COMMAND." (split-string (shell-command-to-string command) "\0" t)) @@ -1490,36 +1582,44 @@ Never use on many files since it's going to recalculate the project-root for every file." (expand-file-name name (projectile-project-root))) -(defun projectile-completing-read (prompt choices &optional initial-input) +(cl-defun projectile-completing-read (prompt choices &key initial-input action) "Present a project tailored PROMPT with CHOICES." - (let ((prompt (projectile-prepend-project-name prompt))) - (cond - ((eq projectile-completion-system 'ido) - (ido-completing-read prompt choices nil nil initial-input)) - ((eq projectile-completion-system 'default) - (completing-read prompt choices nil nil initial-input)) - ((eq projectile-completion-system 'helm) - (if (fboundp 'helm-comp-read) - (helm-comp-read prompt choices - :initial-input initial-input - :candidates-in-buffer t - :must-match 'confirm) - (user-error "Please install helm from \ + (let ((prompt (projectile-prepend-project-name prompt)) + res) + (setq res + (cond + ((eq projectile-completion-system 'ido) + (ido-completing-read prompt choices nil nil initial-input)) + ((eq projectile-completion-system 'default) + (completing-read prompt choices nil nil initial-input)) + ((eq projectile-completion-system 'helm) + (if (fboundp 'helm) + (helm :sources + `((name . ,prompt) + (candidates . ,choices) + (action . ,(prog1 action + (setq action nil))))) + (user-error "Please install helm from \ https://github.com/emacs-helm/helm"))) - ((eq projectile-completion-system 'grizzl) - (if (and (fboundp 'grizzl-completing-read) - (fboundp 'grizzl-make-index)) - (grizzl-completing-read prompt (grizzl-make-index choices)) - (user-error "Please install grizzl from \ + ((eq projectile-completion-system 'grizzl) + (if (and (fboundp 'grizzl-completing-read) + (fboundp 'grizzl-make-index)) + (grizzl-completing-read prompt (grizzl-make-index choices)) + (user-error "Please install grizzl from \ https://github.com/d11wtq/grizzl"))) - ((eq projectile-completion-system 'ivy) - (if (fboundp 'ivy-read) - (ivy-read prompt choices - :initial-input initial-input - :caller 'projectile-completing-read) - (user-error "Please install ivy from \ + ((eq projectile-completion-system 'ivy) + (if (fboundp 'ivy-read) + (ivy-read prompt choices + :initial-input initial-input + :action (prog1 action + (setq action nil)) + :caller 'projectile-completing-read) + (user-error "Please install ivy from \ https://github.com/abo-abo/swiper"))) - (t (funcall projectile-completion-system prompt choices))))) + (t (funcall projectile-completion-system prompt choices)))) + (if action + (funcall action res) + res))) (defun projectile-current-project-files () "Return a list of files for the current project." @@ -1560,7 +1660,7 @@ https://github.com/abo-abo/swiper"))) ;;; Interactive commands (defcustom projectile-other-file-alist - '(;; handle C/C++ extensions + '( ;; handle C/C++ extensions ("cpp" . ("h" "hpp" "ipp")) ("ipp" . ("h" "hpp" "cpp")) ("hpp" . ("h" "ipp" "cpp" "cc")) @@ -1583,7 +1683,10 @@ https://github.com/abo-abo/swiper"))) ("lock" . ("")) ("gpg" . ("")) ) - "Alist of extensions for switching to file with the same name, using other extensions based on the extension of current file.") + "Alist of extensions for switching to file with the same name, + using other extensions based on the extension of current + file." + :type 'alist) ;;;###autoload (defun projectile-find-other-file (&optional flex-matching) @@ -1798,10 +1901,12 @@ is presented. With a prefix ARG invalidates the cache first." (interactive "P") (projectile-maybe-invalidate-cache arg) - (let ((file (projectile-completing-read "Find file: " - (projectile-current-project-files)))) - (find-file (expand-file-name file (projectile-project-root))) - (run-hooks 'projectile-find-file-hook))) + (projectile-completing-read + "Find file: " + (projectile-current-project-files) + :action `(lambda (file) + (find-file (expand-file-name file ,(projectile-project-root))) + (run-hooks 'projectile-find-file-hook)))) ;;;###autoload (defun projectile-find-file-other-window (&optional arg) @@ -2603,7 +2708,10 @@ For hg projects `monky-status' is used if available." "Show a list of recently visited files in a project." (interactive) (if (boundp 'recentf-list) - (find-file (projectile-expand-root (projectile-completing-read "Recently visited files: " (projectile-recentf-files)))) + (find-file (projectile-expand-root + (projectile-completing-read + "Recently visited files: " + (projectile-recentf-files)))) (message "recentf is not enabled"))) (defun projectile-recentf-files () @@ -2770,6 +2878,10 @@ with a prefix ARG." (test-cmd (projectile-maybe-read-command arg default-cmd "Test command: ")) (default-directory project-root)) (puthash project-root test-cmd projectile-test-cmd-map) + (save-some-buffers (not compilation-ask-about-save) + (lambda () + (projectile-project-buffer-p (current-buffer) + project-root))) (projectile-run-compilation test-cmd))) ;;;###autoload @@ -2822,9 +2934,10 @@ With a prefix ARG invokes `projectile-commander' instead of (interactive "P") (let (projects) (if (setq projects (projectile-relevant-known-projects)) - (projectile-switch-project-by-name - (projectile-completing-read "Switch to project: " projects) - arg) + (projectile-completing-read + "Switch to project: " projects + :action (lambda (project) + (projectile-switch-project-by-name project arg))) (error "There are no known projects")))) ;;;###autoload @@ -2937,15 +3050,17 @@ See `projectile-cleanup-known-projects'." ;;;###autoload (defun projectile-remove-known-project (&optional project) "Remove PROJECT from the list of known projects." - (interactive (list (projectile-completing-read "Remove from known projects: " - projectile-known-projects))) - (setq projectile-known-projects - (cl-remove-if - (lambda (proj) (string= project proj)) - projectile-known-projects)) - (projectile-merge-known-projects) - (when projectile-verbose - (message "Project %s removed from the list of known projects." project))) + (interactive (list (projectile-completing-read + "Remove from known projects: " projectile-known-projects + :action 'projectile-remove-known-project))) + (unless (called-interactively-p 'any) + (setq projectile-known-projects + (cl-remove-if + (lambda (proj) (string= project proj)) + projectile-known-projects)) + (projectile-merge-known-projects) + (when projectile-verbose + (message "Project %s removed from the list of known projects." project)))) ;;;###autoload (defun projectile-remove-current-project-from-known-projects () @@ -3120,6 +3235,10 @@ is chosen." "Open project root in vc-dir or magit." (projectile-vc)) + (def-projectile-commander-method ?V + "Browse dirty projects" + (projectile-browse-dirty-projects)) + (def-projectile-commander-method ?r "Replace a string in the project." (projectile-replace)) @@ -3231,6 +3350,7 @@ is chosen." (define-key map (kbd "T") #'projectile-find-test-file) (define-key map (kbd "u") #'projectile-run-project) (define-key map (kbd "v") #'projectile-vc) + (define-key map (kbd "V") #'projectile-browse-dirty-projects) (define-key map (kbd "x e") #'projectile-run-eshell) (define-key map (kbd "x t") #'projectile-run-term) (define-key map (kbd "x s") #'projectile-run-shell) @@ -3268,6 +3388,7 @@ is chosen." ["Search in project (ag)" projectile-ag] ["Replace in project" projectile-replace] ["Multi-occur in project" projectile-multi-occur] + ["Browse dirty projects" projectile-browse-dirty-projects] "--" ["Run shell" projectile-run-shell] ["Run eshell" projectile-run-eshell] @@ -3305,7 +3426,14 @@ entirely." :group 'projectile :type 'sexp :risky t - :package-version '(projectile "0.12.0")) + :package-version '(projectile . "0.12.0")) + +(defun projectile-find-file-hook-function () + "Called by `find-file-hook' when `projectile-mode' is on." + (unless (file-remote-p default-directory) + (projectile-cache-files-find-file-hook) + (projectile-track-known-projects-find-file-hook) + (projectile-visit-project-tags-table))) ;;;###autoload (define-minor-mode projectile-mode @@ -3324,6 +3452,7 @@ Otherwise behave as if called interactively. :keymap projectile-mode-map :group 'projectile :require 'projectile + :global t (cond (projectile-mode ;; initialize the projects cache if needed @@ -3331,25 +3460,19 @@ Otherwise behave as if called interactively. (setq projectile-projects-cache (or (projectile-unserialize projectile-cache-file) (make-hash-table :test 'equal)))) - (add-hook 'find-file-hook #'projectile-cache-files-find-file-hook t t) - (add-hook 'find-file-hook #'projectile-cache-projects-find-file-hook t t) - (add-hook 'projectile-find-dir-hook #'projectile-cache-projects-find-file-hook) - (add-hook 'find-file-hook #'projectile-visit-project-tags-table t t) - (add-hook 'dired-before-readin-hook #'projectile-cache-projects-find-file-hook t t) + (add-hook 'find-file-hook 'projectile-find-file-hook-function) + (add-hook 'projectile-find-dir-hook #'projectile-track-known-projects-find-file-hook t) + (add-hook 'dired-before-readin-hook #'projectile-track-known-projects-find-file-hook t t) (ad-activate 'compilation-find-file) (ad-activate 'delete-file)) (t - (remove-hook 'find-file-hook #'projectile-cache-files-find-file-hook t) - (remove-hook 'find-file-hook #'projectile-cache-projects-find-file-hook t) - (remove-hook 'find-file-hook #'projectile-visit-project-tags-table t) - (remove-hook 'dired-before-readin-hook #'projectile-cache-projects-find-file-hook t) + (remove-hook 'find-file-hook #'projectile-find-file-hook-function) + (remove-hook 'dired-before-readin-hook #'projectile-track-known-projects-find-file-hook t) (ad-deactivate 'compilation-find-file) (ad-deactivate 'delete-file)))) ;;;###autoload -(define-globalized-minor-mode projectile-global-mode - projectile-mode - projectile-mode) +(define-obsolete-function-alias 'projectile-global-mode 'projectile-mode) (provide 'projectile)