branch: elpa/javelin
commit d858c3912864fe44fd8a907d64d9a038c6c807e4
Author: Otávio Schwanck dos Santos <[email protected]>
Commit: Otávio Schwanck dos Santos <[email protected]>

    harpoon separate by branch option
---
 README.org |  6 ++++++
 harpoon.el | 13 +++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index a608a839b32..5d1e7c8dd0f 100644
--- a/README.org
+++ b/README.org
@@ -57,6 +57,12 @@ Example of how to set the shortcuts:
 (map! :leader "9" 'harpoon-go-to-9)
 #+end_src
 
+* Customizing
+You can customize by setting this variable:
+
+| Variable                   | Description                | Default |
+| harpoon-separate-by-branch | If nil, ignores the branch | t       |
+
 * My other works:
 ** Rails i18n:
 https://github.com/otavioschwanck/rails-i18n.el
diff --git a/harpoon.el b/harpoon.el
index 38568a2c0c0..793abc1a51a 100644
--- a/harpoon.el
+++ b/harpoon.el
@@ -40,6 +40,10 @@
   "Where the cache will be saved."
   :type 'string)
 
+(defcustom harpoon-separate-by-branch t
+  "Harpoon separated by branch."
+  :type 'string)
+
 (defvar harpoon-cache '()
   "Cache for harpoon.")
 
@@ -57,9 +61,11 @@
 
 (defun harpoon--cache-key ()
   "Key to save current file on cache."
-  (concat (harpoon--sanitize (projectile-project-name))
-          "#"
-          (harpoon--sanitize (magit-get-current-branch))))
+  (if harpoon-separate-by-branch
+      (concat (harpoon--sanitize (projectile-project-name))
+              "#"
+              (harpoon--sanitize (magit-get-current-branch)))
+    (harpoon--sanitize (projectile-project-name))))
 
 (defun harpoon--create-directory ()
   "Create harpoon cache dir if dont exists."
@@ -67,7 +73,6 @@
     (shell-command (concat "mkdir " harpoon-cache-file))))
 
 
-
 (defun harpoon--file-name ()
   "File name for harpoon on current project."
   (concat harpoon-cache-file (harpoon--cache-key)))

Reply via email to