Archived
1
0
Fork 0

add persp-mod-projectile-bridge and help-projectile

This commit is contained in:
KemoNine 2022-04-25 17:04:42 -04:00
parent fc748c724f
commit 92a77c2f97
12 changed files with 2916 additions and 0 deletions

View file

@ -0,0 +1,79 @@
;;; helm-projectile-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "helm-projectile" "helm-projectile.el" (0 0
;;;;;; 0 0))
;;; Generated autoloads from helm-projectile.el
(defvar helm-projectile-fuzzy-match t "\
Enable fuzzy matching for Helm Projectile commands.
This needs to be set before loading helm-projectile.el.")
(custom-autoload 'helm-projectile-fuzzy-match "helm-projectile" t)
(autoload 'helm-projectile-find-file-dwim "helm-projectile" "\
Find file at point based on context." t nil)
(autoload 'helm-projectile-find-other-file "helm-projectile" "\
Switch between files with the same name but different extensions using Helm.
With FLEX-MATCHING, match any file that contains the base name of current file.
Other file extensions can be customized with the variable `projectile-other-file-alist'.
\(fn &optional FLEX-MATCHING)" t nil)
(autoload 'helm-projectile-on "helm-projectile" "\
Turn on `helm-projectile' key bindings." t nil)
(autoload 'helm-projectile-off "helm-projectile" "\
Turn off `helm-projectile' key bindings." t nil)
(autoload 'helm-projectile-grep "helm-projectile" "\
Helm version of `projectile-grep'.
DIR is the project root, if not set then current directory is used
\(fn &optional DIR)" t nil)
(autoload 'helm-projectile-ack "helm-projectile" "\
Helm version of projectile-ack.
\(fn &optional DIR)" t nil)
(autoload 'helm-projectile-ag "helm-projectile" "\
Helm version of `projectile-ag'.
\(fn &optional OPTIONS)" t nil)
(autoload 'helm-projectile-rg "helm-projectile" "\
Projectile version of `helm-rg'." t nil)
(autoload 'helm-projectile-toggle "helm-projectile" "\
Toggle Helm version of Projectile commands.
\(fn TOGGLE)" nil nil)
(autoload 'helm-projectile "helm-projectile" "\
Use projectile with Helm instead of ido.
With a prefix ARG invalidates the cache first.
If invoked outside of a project, displays a list of known projects to jump.
\(fn &optional ARG)" t nil)
(eval-after-load 'projectile '(progn (define-key projectile-command-map (kbd "h") #'helm-projectile)))
(register-definition-prefixes "helm-projectile" '("helm-"))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; helm-projectile-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; Generated package description from helm-projectile.el -*- no-byte-compile: t -*-
(define-package "helm-projectile" "20201217.908" "Helm integration for Projectile" '((helm "1.9.9") (projectile "2.2.0") (cl-lib "0.3")) :commit "58123f14c392021714fc5d23b9f95c7f95ce07f1" :authors '(("Bozhidar Batsov")) :maintainer '("Bozhidar Batsov") :keywords '("project" "convenience") :url "https://github.com/bbatsov/helm-projectile")

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
;;; persp-mode-projectile-bridge-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "persp-mode-projectile-bridge" "persp-mode-projectile-bridge.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from persp-mode-projectile-bridge.el
(defvar persp-mode-projectile-bridge-mode nil "\
Non-nil if Persp-Mode-Projectile-Bridge mode is enabled.
See the `persp-mode-projectile-bridge-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 `persp-mode-projectile-bridge-mode'.")
(custom-autoload 'persp-mode-projectile-bridge-mode "persp-mode-projectile-bridge" nil)
(autoload 'persp-mode-projectile-bridge-mode "persp-mode-projectile-bridge" "\
`persp-mode' and `projectile-mode' integration.
Creates perspectives for projectile projects.
This is a minor mode. If called interactively, toggle the
`Persp-Mode-Projectile-Bridge mode' mode. If the prefix argument
is positive, enable the mode, and if it is zero or negative,
disable the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `(default-value \\='persp-mode-projectile-bridge-mode)'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
\(fn &optional ARG)" t nil)
(register-definition-prefixes "persp-mode-projectile-bridge" '("persp-mode-projectile-bridge-"))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; persp-mode-projectile-bridge-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; Generated package description from persp-mode-projectile-bridge.el -*- no-byte-compile: t -*-
(define-package "persp-mode-projectile-bridge" "20170315.1120" "persp-mode + projectile integration." '((persp-mode "2.9") (projectile "0.13.0") (cl-lib "0.5")) :commit "f6453cd7b8b4352c06e771706f2c5b7e2cdff1ce" :authors '(("Constantin Kulikov (Bad_ptr)" . "zxnotdead@gmail.com")) :maintainer '("Constantin Kulikov (Bad_ptr)" . "zxnotdead@gmail.com") :keywords '("persp-mode" "projectile") :url "https://github.com/Bad-ptr/persp-mode-projectile-bridge.el")

View file

@ -0,0 +1,211 @@
;;; persp-mode-projectile-bridge.el --- persp-mode + projectile integration. -*- lexical-binding: t -*-
;; Copyright (C) 2017 Constantin Kulikov
;;
;; Author: Constantin Kulikov (Bad_ptr) <zxnotdead@gmail.com>
;; Version: 0.1
;; Package-Version: 20170315.1120
;; Package-Commit: f6453cd7b8b4352c06e771706f2c5b7e2cdff1ce
;; Package-Requires: ((persp-mode "2.9") (projectile "0.13.0") (cl-lib "0.5"))
;; Date: 2017/03/04 10:10:41
;; License: GPL either version 3 or any later version
;; Keywords: persp-mode, projectile
;; URL: https://github.com/Bad-ptr/persp-mode-projectile-bridge.el
;;; License:
;; This file is not part of GNU Emacs.
;; 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.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; Creates a perspective for each projectile project.
;;; Usage:
;; Installation:
;; M-x package-install-file RET persp-mode-projectile-bridge.el RET
;; Example configuration:
;; (with-eval-after-load "persp-mode-projectile-bridge-autoloads"
;; (add-hook 'persp-mode-projectile-bridge-mode-hook
;; #'(lambda ()
;; (if persp-mode-projectile-bridge-mode
;; (persp-mode-projectile-bridge-find-perspectives-for-all-buffers)
;; (persp-mode-projectile-bridge-kill-perspectives))))
;; (add-hook 'after-init-hook
;; #'(lambda ()
;; (persp-mode-projectile-bridge-mode 1))
;; t))
;;; Code:
(require 'persp-mode)
(require 'projectile)
(require 'cl-lib)
(defvar persp-mode-projectile-bridge-mode nil)
(defgroup persp-mode-projectile-bridge nil
"persp-mode projectile integration."
:group 'persp-mode
:group 'projectile
:prefix "persp-mode-projectile-bridge-"
:link
'(url-link
:tag "Github" "https://github.com/Bad-ptr/persp-mode-projectile-bridge.el"))
(defcustom persp-mode-projectile-bridge-persp-name-prefix "[p] "
"Prefix to use for projectile perspective names."
:group 'persp-mode-projectile-bridge
:type 'string
:set #'(lambda (sym val)
(if persp-mode-projectile-bridge-mode
(let ((old-prefix (symbol-value sym)))
(custom-set-default sym val)
(let (old-name)
(mapc #'(lambda (p)
(when (and
p (persp-parameter
'persp-mode-projectile-bridge p))
(setq old-name
(substring (persp-name p)
(string-width old-prefix)))
(persp-rename (concat val old-name) p)))
(persp-persps))))
(custom-set-default sym val))))
(defun persp-mode-projectile-bridge-add-new-persp (name)
(let ((persp (persp-get-by-name name *persp-hash* :nil)))
(if (eq :nil persp)
(prog1
(setq persp (persp-add-new name))
(when persp
(set-persp-parameter 'persp-mode-projectile-bridge t persp)
(set-persp-parameter 'dont-save-to-file t persp)
(persp-add-buffer (projectile-project-buffers)
persp nil nil)))
persp)))
(defun persp-mode-projectile-bridge-find-perspective-for-buffer (b)
(when (buffer-live-p b)
(with-current-buffer b
(when (and persp-mode-projectile-bridge-mode
(buffer-file-name b) (projectile-project-p))
(let ((persp (persp-mode-projectile-bridge-add-new-persp
(concat persp-mode-projectile-bridge-persp-name-prefix
(projectile-project-name)))))
(when persp
(persp-add-buffer b persp nil nil)
persp))))))
(defvar persp-mode-projectile-bridge-before-switch-selected-window-buffer nil)
(defun persp-mode-projectile-bridge-hook-before-switch (&rest _args)
(let ((win (if (minibuffer-window-active-p (selected-window))
(minibuffer-selected-window)
(selected-window))))
(when (window-live-p win)
(setq persp-mode-projectile-bridge-before-switch-selected-window-buffer
(window-buffer win)))))
(defun persp-mode-projectile-bridge-hook-switch (&rest _args)
(let ((persp
(persp-mode-projectile-bridge-find-perspective-for-buffer
(current-buffer))))
(when persp
(when (buffer-live-p
persp-mode-projectile-bridge-before-switch-selected-window-buffer)
(let ((win (selected-window)))
(unless (eq (window-buffer win)
persp-mode-projectile-bridge-before-switch-selected-window-buffer)
(set-window-buffer
win persp-mode-projectile-bridge-before-switch-selected-window-buffer)
(setq persp-mode-projectile-bridge-before-switch-selected-window-buffer nil))))
(persp-frame-switch (persp-name persp)))))
(defun persp-mode-projectile-bridge-hook-find-file (&rest _args)
(let ((persp
(persp-mode-projectile-bridge-find-perspective-for-buffer
(current-buffer))))
(when persp
(persp-add-buffer (current-buffer) persp nil nil))))
(defun persp-mode-projectile-bridge-find-perspectives-for-all-buffers ()
(when (and persp-mode-projectile-bridge-mode)
(mapc #'persp-mode-projectile-bridge-find-perspective-for-buffer
(buffer-list))))
(defun persp-mode-projectile-bridge-kill-perspectives ()
(when (and persp-mode projectile-mode)
(mapc #'persp-kill
(mapcar #'persp-name
(cl-delete-if-not
(apply-partially
#'persp-parameter
'persp-mode-projectile-bridge)
(persp-persps))))))
;;;###autoload
(define-minor-mode persp-mode-projectile-bridge-mode
"`persp-mode' and `projectile-mode' integration.
Creates perspectives for projectile projects."
:require 'persp-mode-projectile-bridge
:group 'persp-mode-projectile-bridge
:init-value nil
:global t
(if persp-mode-projectile-bridge-mode
(if (and persp-mode projectile-mode)
(progn
(add-hook 'find-file-hook
#'persp-mode-projectile-bridge-hook-find-file)
(add-hook 'projectile-mode-hook
#'(lambda ()
(unless projectile-mode
(persp-mode-projectile-bridge-mode -1))))
(add-hook 'persp-mode-hook
#'(lambda ()
(unless persp-mode
(persp-mode-projectile-bridge-mode -1))))
(add-hook 'projectile-before-switch-project-hook
#'persp-mode-projectile-bridge-hook-before-switch)
(add-hook 'projectile-after-switch-project-hook
#'persp-mode-projectile-bridge-hook-switch)
(add-hook 'projectile-find-file-hook
#'persp-mode-projectile-bridge-hook-switch))
(message "You can not enable persp-mode-projectile-bridge-mode \
unless persp-mode and projectile-mode are active.")
(setq persp-mode-projectile-bridge-mode nil))
(remove-hook 'find-file-hook
#'persp-mode-projectile-bridge-hook-find-file)
(remove-hook 'projectile-before-switch-project-hook
#'persp-mode-projectile-bridge-hook-before-switch)
(remove-hook 'projectile-after-switch-project-hook
#'persp-mode-projectile-bridge-hook-switch)
(remove-hook 'projectile-find-file-hook
#'persp-mode-projectile-bridge-hook-switch)))
(provide 'persp-mode-projectile-bridge)
;;; persp-mode-projectile-bridge.el ends here

View file

@ -0,0 +1,79 @@
;;; helm-projectile-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "helm-projectile" "helm-projectile.el" (0 0
;;;;;; 0 0))
;;; Generated autoloads from helm-projectile.el
(defvar helm-projectile-fuzzy-match t "\
Enable fuzzy matching for Helm Projectile commands.
This needs to be set before loading helm-projectile.el.")
(custom-autoload 'helm-projectile-fuzzy-match "helm-projectile" t)
(autoload 'helm-projectile-find-file-dwim "helm-projectile" "\
Find file at point based on context." t nil)
(autoload 'helm-projectile-find-other-file "helm-projectile" "\
Switch between files with the same name but different extensions using Helm.
With FLEX-MATCHING, match any file that contains the base name of current file.
Other file extensions can be customized with the variable `projectile-other-file-alist'.
\(fn &optional FLEX-MATCHING)" t nil)
(autoload 'helm-projectile-on "helm-projectile" "\
Turn on `helm-projectile' key bindings." t nil)
(autoload 'helm-projectile-off "helm-projectile" "\
Turn off `helm-projectile' key bindings." t nil)
(autoload 'helm-projectile-grep "helm-projectile" "\
Helm version of `projectile-grep'.
DIR is the project root, if not set then current directory is used
\(fn &optional DIR)" t nil)
(autoload 'helm-projectile-ack "helm-projectile" "\
Helm version of projectile-ack.
\(fn &optional DIR)" t nil)
(autoload 'helm-projectile-ag "helm-projectile" "\
Helm version of `projectile-ag'.
\(fn &optional OPTIONS)" t nil)
(autoload 'helm-projectile-rg "helm-projectile" "\
Projectile version of `helm-rg'." t nil)
(autoload 'helm-projectile-toggle "helm-projectile" "\
Toggle Helm version of Projectile commands.
\(fn TOGGLE)" nil nil)
(autoload 'helm-projectile "helm-projectile" "\
Use projectile with Helm instead of ido.
With a prefix ARG invalidates the cache first.
If invoked outside of a project, displays a list of known projects to jump.
\(fn &optional ARG)" t nil)
(eval-after-load 'projectile '(progn (define-key projectile-command-map (kbd "h") #'helm-projectile)))
(register-definition-prefixes "helm-projectile" '("helm-"))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; helm-projectile-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; Generated package description from helm-projectile.el -*- no-byte-compile: t -*-
(define-package "helm-projectile" "20201217.908" "Helm integration for Projectile" '((helm "1.9.9") (projectile "2.2.0") (cl-lib "0.3")) :commit "58123f14c392021714fc5d23b9f95c7f95ce07f1" :authors '(("Bozhidar Batsov")) :maintainer '("Bozhidar Batsov") :keywords '("project" "convenience") :url "https://github.com/bbatsov/helm-projectile")

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
;;; persp-mode-projectile-bridge-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "persp-mode-projectile-bridge" "persp-mode-projectile-bridge.el"
;;;;;; (0 0 0 0))
;;; Generated autoloads from persp-mode-projectile-bridge.el
(defvar persp-mode-projectile-bridge-mode nil "\
Non-nil if Persp-Mode-Projectile-Bridge mode is enabled.
See the `persp-mode-projectile-bridge-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 `persp-mode-projectile-bridge-mode'.")
(custom-autoload 'persp-mode-projectile-bridge-mode "persp-mode-projectile-bridge" nil)
(autoload 'persp-mode-projectile-bridge-mode "persp-mode-projectile-bridge" "\
`persp-mode' and `projectile-mode' integration.
Creates perspectives for projectile projects.
This is a minor mode. If called interactively, toggle the
`Persp-Mode-Projectile-Bridge mode' mode. If the prefix argument
is positive, enable the mode, and if it is zero or negative,
disable the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `(default-value \\='persp-mode-projectile-bridge-mode)'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
\(fn &optional ARG)" t nil)
(register-definition-prefixes "persp-mode-projectile-bridge" '("persp-mode-projectile-bridge-"))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; persp-mode-projectile-bridge-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; Generated package description from persp-mode-projectile-bridge.el -*- no-byte-compile: t -*-
(define-package "persp-mode-projectile-bridge" "20170315.1120" "persp-mode + projectile integration." '((persp-mode "2.9") (projectile "0.13.0") (cl-lib "0.5")) :commit "f6453cd7b8b4352c06e771706f2c5b7e2cdff1ce" :authors '(("Constantin Kulikov (Bad_ptr)" . "zxnotdead@gmail.com")) :maintainer '("Constantin Kulikov (Bad_ptr)" . "zxnotdead@gmail.com") :keywords '("persp-mode" "projectile") :url "https://github.com/Bad-ptr/persp-mode-projectile-bridge.el")

View file

@ -0,0 +1,211 @@
;;; persp-mode-projectile-bridge.el --- persp-mode + projectile integration. -*- lexical-binding: t -*-
;; Copyright (C) 2017 Constantin Kulikov
;;
;; Author: Constantin Kulikov (Bad_ptr) <zxnotdead@gmail.com>
;; Version: 0.1
;; Package-Version: 20170315.1120
;; Package-Commit: f6453cd7b8b4352c06e771706f2c5b7e2cdff1ce
;; Package-Requires: ((persp-mode "2.9") (projectile "0.13.0") (cl-lib "0.5"))
;; Date: 2017/03/04 10:10:41
;; License: GPL either version 3 or any later version
;; Keywords: persp-mode, projectile
;; URL: https://github.com/Bad-ptr/persp-mode-projectile-bridge.el
;;; License:
;; This file is not part of GNU Emacs.
;; 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.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; Creates a perspective for each projectile project.
;;; Usage:
;; Installation:
;; M-x package-install-file RET persp-mode-projectile-bridge.el RET
;; Example configuration:
;; (with-eval-after-load "persp-mode-projectile-bridge-autoloads"
;; (add-hook 'persp-mode-projectile-bridge-mode-hook
;; #'(lambda ()
;; (if persp-mode-projectile-bridge-mode
;; (persp-mode-projectile-bridge-find-perspectives-for-all-buffers)
;; (persp-mode-projectile-bridge-kill-perspectives))))
;; (add-hook 'after-init-hook
;; #'(lambda ()
;; (persp-mode-projectile-bridge-mode 1))
;; t))
;;; Code:
(require 'persp-mode)
(require 'projectile)
(require 'cl-lib)
(defvar persp-mode-projectile-bridge-mode nil)
(defgroup persp-mode-projectile-bridge nil
"persp-mode projectile integration."
:group 'persp-mode
:group 'projectile
:prefix "persp-mode-projectile-bridge-"
:link
'(url-link
:tag "Github" "https://github.com/Bad-ptr/persp-mode-projectile-bridge.el"))
(defcustom persp-mode-projectile-bridge-persp-name-prefix "[p] "
"Prefix to use for projectile perspective names."
:group 'persp-mode-projectile-bridge
:type 'string
:set #'(lambda (sym val)
(if persp-mode-projectile-bridge-mode
(let ((old-prefix (symbol-value sym)))
(custom-set-default sym val)
(let (old-name)
(mapc #'(lambda (p)
(when (and
p (persp-parameter
'persp-mode-projectile-bridge p))
(setq old-name
(substring (persp-name p)
(string-width old-prefix)))
(persp-rename (concat val old-name) p)))
(persp-persps))))
(custom-set-default sym val))))
(defun persp-mode-projectile-bridge-add-new-persp (name)
(let ((persp (persp-get-by-name name *persp-hash* :nil)))
(if (eq :nil persp)
(prog1
(setq persp (persp-add-new name))
(when persp
(set-persp-parameter 'persp-mode-projectile-bridge t persp)
(set-persp-parameter 'dont-save-to-file t persp)
(persp-add-buffer (projectile-project-buffers)
persp nil nil)))
persp)))
(defun persp-mode-projectile-bridge-find-perspective-for-buffer (b)
(when (buffer-live-p b)
(with-current-buffer b
(when (and persp-mode-projectile-bridge-mode
(buffer-file-name b) (projectile-project-p))
(let ((persp (persp-mode-projectile-bridge-add-new-persp
(concat persp-mode-projectile-bridge-persp-name-prefix
(projectile-project-name)))))
(when persp
(persp-add-buffer b persp nil nil)
persp))))))
(defvar persp-mode-projectile-bridge-before-switch-selected-window-buffer nil)
(defun persp-mode-projectile-bridge-hook-before-switch (&rest _args)
(let ((win (if (minibuffer-window-active-p (selected-window))
(minibuffer-selected-window)
(selected-window))))
(when (window-live-p win)
(setq persp-mode-projectile-bridge-before-switch-selected-window-buffer
(window-buffer win)))))
(defun persp-mode-projectile-bridge-hook-switch (&rest _args)
(let ((persp
(persp-mode-projectile-bridge-find-perspective-for-buffer
(current-buffer))))
(when persp
(when (buffer-live-p
persp-mode-projectile-bridge-before-switch-selected-window-buffer)
(let ((win (selected-window)))
(unless (eq (window-buffer win)
persp-mode-projectile-bridge-before-switch-selected-window-buffer)
(set-window-buffer
win persp-mode-projectile-bridge-before-switch-selected-window-buffer)
(setq persp-mode-projectile-bridge-before-switch-selected-window-buffer nil))))
(persp-frame-switch (persp-name persp)))))
(defun persp-mode-projectile-bridge-hook-find-file (&rest _args)
(let ((persp
(persp-mode-projectile-bridge-find-perspective-for-buffer
(current-buffer))))
(when persp
(persp-add-buffer (current-buffer) persp nil nil))))
(defun persp-mode-projectile-bridge-find-perspectives-for-all-buffers ()
(when (and persp-mode-projectile-bridge-mode)
(mapc #'persp-mode-projectile-bridge-find-perspective-for-buffer
(buffer-list))))
(defun persp-mode-projectile-bridge-kill-perspectives ()
(when (and persp-mode projectile-mode)
(mapc #'persp-kill
(mapcar #'persp-name
(cl-delete-if-not
(apply-partially
#'persp-parameter
'persp-mode-projectile-bridge)
(persp-persps))))))
;;;###autoload
(define-minor-mode persp-mode-projectile-bridge-mode
"`persp-mode' and `projectile-mode' integration.
Creates perspectives for projectile projects."
:require 'persp-mode-projectile-bridge
:group 'persp-mode-projectile-bridge
:init-value nil
:global t
(if persp-mode-projectile-bridge-mode
(if (and persp-mode projectile-mode)
(progn
(add-hook 'find-file-hook
#'persp-mode-projectile-bridge-hook-find-file)
(add-hook 'projectile-mode-hook
#'(lambda ()
(unless projectile-mode
(persp-mode-projectile-bridge-mode -1))))
(add-hook 'persp-mode-hook
#'(lambda ()
(unless persp-mode
(persp-mode-projectile-bridge-mode -1))))
(add-hook 'projectile-before-switch-project-hook
#'persp-mode-projectile-bridge-hook-before-switch)
(add-hook 'projectile-after-switch-project-hook
#'persp-mode-projectile-bridge-hook-switch)
(add-hook 'projectile-find-file-hook
#'persp-mode-projectile-bridge-hook-switch))
(message "You can not enable persp-mode-projectile-bridge-mode \
unless persp-mode and projectile-mode are active.")
(setq persp-mode-projectile-bridge-mode nil))
(remove-hook 'find-file-hook
#'persp-mode-projectile-bridge-hook-find-file)
(remove-hook 'projectile-before-switch-project-hook
#'persp-mode-projectile-bridge-hook-before-switch)
(remove-hook 'projectile-after-switch-project-hook
#'persp-mode-projectile-bridge-hook-switch)
(remove-hook 'projectile-find-file-hook
#'persp-mode-projectile-bridge-hook-switch)))
(provide 'persp-mode-projectile-bridge)
;;; persp-mode-projectile-bridge.el ends here