diff --git a/counsel-projectile.el b/counsel-projectile.el index e52d6d0..5c7ce32 100644 --- a/counsel-projectile.el +++ b/counsel-projectile.el @@ -13,15 +13,15 @@ ;;; License: -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3, or (at +;; your option) any later version. ;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the @@ -31,10 +31,11 @@ ;;; Commentary: ;; ;; Projectile has native support for using ivy as its completion -;; system. Counsel-projectile provides further ivy integration into +;; system. Counsel-projectile provides further ivy integration into ;; projectile by taking advantage of ivy's mechanism to select from a -;; list of actions and/or apply an action without leaving the comlpetion -;; session. It is inspired by helm-projectile. See the README for more details. +;; list of actions and/or apply an action without leaving the +;; comlpetion session. It is inspired by helm-projectile. See the +;; README for more details. ;; ;;; Code: @@ -44,13 +45,15 @@ ;;; counsel-projectile-map (defun counsel-projectile-drop-to-switch-project () - "For use in minibuffer maps. Quit and call `counsel-projectile-switch-project'." + "For use in minibuffer maps. Quit and call +`counsel-projectile-switch-project'." (interactive) (ivy-quit-and-run (counsel-projectile-switch-project))) (defvar counsel-projectile-drop-to-switch-project-binding "M-SPC" - "Key binding for `counsel-projectile-drop-to-switch-project' in `counsel-projectile-map'.") + "Key binding for `counsel-projectile-drop-to-switch-project' in + `counsel-projectile-map'.") (defvar counsel-projectile-map (let ((map (make-sparse-keymap))) @@ -65,7 +68,9 @@ (defun counsel-projectile--file-list (&optional no-buffer) "Return a list of files for the current project. -Like `projectile-current-project-files', but fontifies non-visited file names with the `ivy-virtual' face. With optional argument NO-BUFFER, only list non-visited files." +Like `projectile-current-project-files', but fontifies +non-visited file names with the `ivy-virtual' face. With optional +argument NO-BUFFER, only list non-visited files." (let ((root (projectile-project-root))) (cl-loop for name in (projectile-current-project-files) @@ -85,15 +90,16 @@ Like `projectile-current-project-files', but fontifies non-visited file names wi (run-hooks 'projectile-find-file-hook)) (defun counsel-projectile--find-file-other-window-action (file) - "Find FILE in another window and run `projectile-find-file-hook'." + "Find FILE in another window and run +`projectile-find-file-hook'." (counsel-projectile--find-file-action file t)) ;;;###autoload (defun counsel-projectile-find-file (&optional arg) "Jump to a project's file using completion. -Replacement for `projectile-find-file'. -With a prefix ARG invalidates the cache first." +Replacement for `projectile-find-file'. With a prefix ARG +invalidates the cache first." (interactive "P") (projectile-maybe-invalidate-cache arg) (ivy-read (projectile-prepend-project-name "Find file: ") @@ -126,7 +132,8 @@ With a prefix ARG invalidates the cache first." (run-hooks 'projectile-find-dir-hook)) (defun counsel-projectile--find-dir-other-window-action (dir) - "Visit DIR with dired in another window and run `projectile-find-dir-hook'." + "Visit DIR with dired in another window and run +`projectile-find-dir-hook'." (counsel-projectile--find-dir-action dir t)) ;;;###autoload @@ -153,13 +160,15 @@ With a prefix ARG invalidates the cache first." (defun counsel-projectile--buffer-list () "Get a list of project buffer names. -Like `projectile-project-buffer-names', but propertize buffer names as in `ivy--buffer-list'." +Like `projectile-project-buffer-names', but propertize buffer +names as in `ivy--buffer-list'." (ivy--buffer-list "" nil (lambda (x) (member (car x) (projectile-project-buffer-names))))) (defun counsel-projectile--switch-buffer-action (buffer &optional other-window) "Switch to BUFFER. + BUFFER may be a string or nil." (cond ((zerop (length buffer)) @@ -171,6 +180,7 @@ BUFFER may be a string or nil." (defun counsel-projectile--switch-buffer-other-window-action (buffer) "Switch to BUFFER in other window. + BUFFER may be a string or nil." (counsel-projectile--switch-buffer-action buffer t)) @@ -229,8 +239,11 @@ BUFFER may be a string or nil." ;;;###autoload (defun counsel-projectile-switch-project (&optional arg) "Switch to a project we have visited before. -Invokes the command referenced by `projectile-switch-project-action' on switch. -With a prefix ARG invokes `projectile-commander' instead of `projectile-switch-project-action.'" + +Invokes the command referenced by +`projectile-switch-project-action' on switch. With a prefix ARG +invokes `projectile-commander' instead of +`projectile-switch-project-action.'" (interactive "P") (ivy-read (projectile-prepend-project-name "Switch to project: ") projectile-known-projects @@ -299,6 +312,7 @@ With a prefix ARG invokes `projectile-commander' instead of `projectile-switch-p (defun counsel-projectile--transformer (str) "Fontifies modified, file-visiting buffers. + Relies on `ivy-switch-buffer-transformer'." (if (eq (get-text-property 0 'type str) 'buffer) (ivy-switch-buffer-transformer str) @@ -306,7 +320,9 @@ Relies on `ivy-switch-buffer-transformer'." (defun counsel-projectile--matcher (regexp candidates) "Return REGEXP-matching CANDIDATES. -Relies on `ivy--switch-buffer-matcher` and `counsel--find-file-matcher'." + +Relies on `ivy--switch-buffer-matcher` and +`counsel--find-file-matcher'." (let ((buffers (cl-remove-if-not (lambda (name) (eq (get-text-property 0 'type name) 'buffer)) candidates))