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

    fix the way the files are loaded
---
 harpoon.el | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/harpoon.el b/harpoon.el
index 79dbbd75c24..98a4b33a2ed 100644
--- a/harpoon.el
+++ b/harpoon.el
@@ -100,8 +100,8 @@
 (defun harpoon--get-project-name ()
   "Get the harpoon project name."
   (condition-case nil (cond
-   ((eq harpoon-project-package 'projectile) (when (fboundp 
'projectile-project-name) (projectile-project-name)))
-   ((eq harpoon-project-package 'project) 
(harpoon--get-project-name-for-project)))
+                       ((eq harpoon-project-package 'projectile) (when 
(fboundp 'projectile-project-name) (projectile-project-name)))
+                       ((eq harpoon-project-package 'project) 
(harpoon--get-project-name-for-project)))
     (error nil)))
 
 (defun harpoon-project-name-function ()
@@ -124,10 +124,10 @@
 (defun harpoon--cache-key ()
   "Key to save current file on cache."
   (if (harpoon--has-project) (if harpoon-separate-by-branch
-      (concat (harpoon--sanitize (harpoon-project-name-function))
-              "#"
-              (harpoon--sanitize (harpoon--get-branch-name)))
-    (harpoon--sanitize (harpoon-project-name-function)))
+                                 (concat (harpoon--sanitize 
(harpoon-project-name-function))
+                                         "#"
+                                         (harpoon--sanitize 
(harpoon--get-branch-name)))
+                               (harpoon--sanitize 
(harpoon-project-name-function)))
     (harpoon--sanitize (harpoon-project-name-function))))
 
 (defun harpoon--create-directory ()
@@ -135,8 +135,6 @@
   (unless (f-directory? harpoon-cache-file)
     (make-directory harpoon-cache-file)))
 
-
-;;;###autoload
 (defun harpoon--file-name ()
   "File name for harpoon on current project."
   (concat harpoon-cache-file (harpoon--cache-key)))
@@ -153,11 +151,16 @@
 (defun harpoon-go-to (line-number)
   "Go to specific file on harpoon (by line order). LINE-NUMBER: Line to go."
   (require 'project)
+
   (let* ((file-name (s-replace-regexp "\n" ""
-                                      (shell-command-to-string
-                                       (format "head -n %s < %s | tail -n 1"
-                                               line-number
-                                               (if (eq major-mode 
'harpoon-mode) (file-truename (buffer-file-name)) (harpoon--file-name))))))
+                                      (with-temp-buffer
+                                        (insert-file-contents-literally
+                                         (if (eq major-mode 'harpoon-mode)
+                                             (file-truename (buffer-file-name))
+                                           (harpoon--file-name)))
+                                        (goto-char (point-min))
+                                        (forward-line (- line-number 1))
+                                        (buffer-substring-no-properties 
(line-beginning-position) (line-end-position)))))
          (full-file-name (if (and (fboundp 'project-root) 
(harpoon--has-project)) (concat (or harpoon--project-path 
(harpoon-project-root-function)) file-name) file-name)))
     (if (file-exists-p full-file-name)
         (find-file full-file-name)
@@ -301,7 +304,7 @@
   (require 'hydra)
   (let ((candidates (harpoon--hydra-candidates "harpoon-go-to-")))
     (eval `(defhydra harpoon-hydra (:exit t :column 1)
-"
+             "
 
         ██╗  ██╗ █████╗ ██████╗ ██████╗  ██████╗  ██████╗ ███╗   ██╗
         ██║  ██║██╔══██╗██╔══██╗██╔══██╗██╔═══██╗██╔═══██╗████╗  ██║

Reply via email to