branch: elpa/javelin
commit 7f3abf7158f787cf1bd5c4a4ccd59f3b17203893
Author: Damian Barabonkov <[email protected]>
Commit: Damian Barabonkov <[email protected]>

    refactor: Rename harpoon to javelin
---
 javelin.el | 540 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 270 insertions(+), 270 deletions(-)

diff --git a/javelin.el b/javelin.el
index 766fa2a4894..af362e620bd 100644
--- a/javelin.el
+++ b/javelin.el
@@ -1,11 +1,11 @@
-;;; harpoon.el --- Bookmarks on steroids    -*- lexical-binding: t; -*-
+;;; javelin.el --- Bookmarks on steroids    -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2022  Otávio Schwanck, 2025 Damian Barabonkov
+;; Copyright (C) 2025 Damian Barabonkov
+;; Based on harpoon.el, Copyright (C) 2022 Otávio Schwanck
 
 ;; Author: Damian Barabonkov
 ;; Keywords: tools languages
-;; Homepage: https://github.com/DamianB-BitFlipper/harpoon.el
-;; Based on: https://github.com/otavioschwanck/harpoon.el
+;; Homepage: https://github.com/DamianB-BitFlipper/javelin.el
 ;; Version: 0.1
 ;; Package-Requires: ((emacs "28.1") (f "0.20.0"))
 
@@ -26,8 +26,8 @@
 
 ;; This is a plugin based on harpoon from vim (by ThePrimeagen).
 ;;
-;; It is a buffer quick-bookmark manager on steroids. Each "bookmark" is 
called a harpoon
-;; position, and you can easily assign and delete buffers to harpoon 
positions. Harpoon
+;; It is a buffer quick-bookmark manager on steroids. Each "bookmark" is 
called a javelin
+;; position, and you can easily assign and delete buffers to javelin 
positions. Javelin
 ;; positions are namespaced by project and branch if within a git repository. 
Otherwise,
 ;; just by project if not within git. Globally namespaced otherwise.
 
@@ -35,175 +35,175 @@
 (require 'subr-x)
 
 ;;; --- Customizable variables ---
-(defgroup harpoon nil
+(defgroup javelin nil
   "Organize bookmarks by project and branch."
   :group 'tools)
 
-(defcustom harpoon-cache-dir (concat user-emacs-directory ".local/harpoon/")
+(defcustom javelin-cache-dir (concat user-emacs-directory ".local/javelin/")
   "Where the cache will be saved."
   :type 'string)
 
-(defcustom harpoon-separate-by-branch t
-  "Harpoon separated by branch."
+(defcustom javelin-separate-by-branch t
+  "Javelin separated by branch."
   :type 'boolean)
 
-(defcustom harpoon-default-positions-namespace "harpoon"
-  "Namespace for harpoon positions when not in a project.
-Used as a fallback identifier for the cache file when harpoon cannot
-detect a project root. The namespace helps isolate harpoon positions
+(defcustom javelin-default-positions-namespace "javelin"
+  "Namespace for javelin positions when not in a project.
+Used as a fallback identifier for the cache file when javelin cannot
+detect a project root. The namespace helps isolate javelin positions
 for different contexts."
   :type 'string)
 ;;; --- Customizable variables ---
 
-(defvar harpoon-project-provider (if (featurep 'projectile) 'projectile 
'project)
+(defvar javelin-project-provider (if (featurep 'projectile) 'projectile 
'project)
   "Project provider to use for getting project root.
 Can be `projectile' or `project'.")
 
-(defvar harpoon-git-branch-provider (if (featurep 'magit) 'magit 'git)
+(defvar javelin-git-branch-provider (if (featurep 'magit) 'magit 'git)
   "Git branch provider to use for getting current branch.
 Can be `magit' or `git'.")
 
-(defun harpoon--get-project-root ()
+(defun javelin--get-project-root ()
   "Get the project root.
 Returns the project root path as a string, or nil if there is no project."
   (cond
-   ((eq harpoon-project-provider 'projectile) (projectile-project-root))
-   ((eq harpoon-project-provider 'project)
+   ((eq javelin-project-provider 'projectile) (projectile-project-root))
+   ((eq javelin-project-provider 'project)
     (when-let ((proj (project-current)))
       (expand-file-name (project-root proj))))))
 
-(defun harpoon--get-project-name ()
-  "Get the harpoon project name.
+(defun javelin--get-project-name ()
+  "Get the javelin project name.
 Returns the project name as a string, or nil if there is no project."
-  (when (harpoon--get-project-root)
+  (when (javelin--get-project-root)
     (cond
-     ((eq harpoon-project-provider 'projectile) (projectile-project-name))
+     ((eq javelin-project-provider 'projectile) (projectile-project-name))
      ;; The `project' package has no built-in way to get the project name.
      ;; Extract it by splitting the project root path by "/" and taking
      ;; the second-to-last element (the directory name before the trailing 
slash).
      ;; e.g., "/home/user/projects/myproject/" -> "myproject"
-     ((eq harpoon-project-provider 'project)
-      (let* ((project-path (harpoon--get-project-root))
+     ((eq javelin-project-provider 'project)
+      (let* ((project-path (javelin--get-project-root))
              (path-parts (split-string project-path "/"))
              (name-index (- (length path-parts) 2)))
         (nth name-index path-parts))))))
 
-(defun harpoon--get-branch-name ()
-  "Get the branch name for harpoon.
-Uses `harpoon-git-branch-provider' to determine the method.
+(defun javelin--get-branch-name ()
+  "Get the branch name for javelin.
+Uses `javelin-git-branch-provider' to determine the method.
 Returns nil if not in a git repository."
   (cond
-   ((eq harpoon-git-branch-provider 'magit)
+   ((eq javelin-git-branch-provider 'magit)
     (magit-get-current-branch))
-   ((eq harpoon-git-branch-provider 'git)
+   ((eq javelin-git-branch-provider 'git)
     (condition-case nil
         (string-trim
          (shell-command-to-string
-          (concat "cd " (harpoon--get-project-root) "; git rev-parse 
--abbrev-ref HEAD")))
+          (concat "cd " (javelin--get-project-root) "; git rev-parse 
--abbrev-ref HEAD")))
       (error nil)))))
 
-(defun harpoon--cache-key ()
+(defun javelin--cache-key ()
   "Key to save current file on cache.
-Returns `harpoon-default-positions-namespace' if there is no project."
+Returns `javelin-default-positions-namespace' if there is no project."
   ;; Use `url-hexify-string' to percent-encode the cache key, making it
   ;; filename-friendly by escaping "/" and other forbidden characters.
-  (let ((project-name (or (harpoon--get-project-name) 
harpoon-default-positions-namespace)))
+  (let ((project-name (or (javelin--get-project-name) 
javelin-default-positions-namespace)))
     (url-hexify-string
-     (if-let ((branch (and harpoon-separate-by-branch 
(harpoon--get-branch-name))))
+     (if-let ((branch (and javelin-separate-by-branch 
(javelin--get-branch-name))))
          (concat project-name "#" branch)
        project-name))))
 
-(defun harpoon--cache-file-name ()
-  "File name for harpoon on current project."
-  (concat harpoon-cache-dir (harpoon--cache-key) ".json"))
+(defun javelin--cache-file-name ()
+  "File name for javelin on current project."
+  (concat javelin-cache-dir (javelin--cache-key) ".json"))
 
-(defun harpoon--ensure-cache-file ()
-  "Create harpoon cache dir and file if they don't exist."
-  (unless (f-directory? harpoon-cache-dir)
-    (make-directory harpoon-cache-dir t))
-  (unless (file-exists-p (harpoon--cache-file-name))
-    (f-write-text (json-serialize '()) 'utf-8 (harpoon--cache-file-name))))
+(defun javelin--ensure-cache-file ()
+  "Create javelin cache dir and file if they don't exist."
+  (unless (f-directory? javelin-cache-dir)
+    (make-directory javelin-cache-dir t))
+  (unless (file-exists-p (javelin--cache-file-name))
+    (f-write-text (json-serialize '()) 'utf-8 (javelin--cache-file-name))))
 
-(defun harpoon--sort-positions (data)
-  "Sort DATA by `harpoon_position' in increasing order."
+(defun javelin--sort-positions (data)
+  "Sort DATA by `javelin_position' in increasing order."
   (seq-sort (lambda (a b)
-              (< (alist-get 'harpoon_position a)
-                 (alist-get 'harpoon_position b)))
+              (< (alist-get 'javelin_position a)
+                 (alist-get 'javelin_position b)))
             data))
 
-(defun harpoon--read-harpoon-positions ()
-  "Read and parse the harpoon positions cache JSON file.
-Returns a list of alists with `harpoon_position' and `filepath' keys."
-  (let ((data (if (file-exists-p (harpoon--cache-file-name))
+(defun javelin--read-javelin-positions ()
+  "Read and parse the javelin positions cache JSON file.
+Returns a list of alists with `javelin_position' and `filepath' keys."
+  (let ((data (if (file-exists-p (javelin--cache-file-name))
                   (condition-case nil
-                      (json-parse-string (f-read (harpoon--cache-file-name) 
'utf-8)
+                      (json-parse-string (f-read (javelin--cache-file-name) 
'utf-8)
                                          :object-type 'alist
                                          :array-type 'list)
                     ;; JSON file got corrupted, delete it and return empty list
                     (error
-                     (delete-file (harpoon--cache-file-name))
+                     (delete-file (javelin--cache-file-name))
                      '()))
                 '())))
-    (harpoon--sort-positions data)))
+    (javelin--sort-positions data)))
 
-(defun harpoon--write-harpoon-positions (data)
-  "Write DATA to the harpoon JSON file.
-DATA should be a list of alists with `harpoon_position' and `filepath' keys.
-Entries are sorted by `harpoon_position' in increasing order before writing.
+(defun javelin--write-javelin-positions (data)
+  "Write DATA to the javelin JSON file.
+DATA should be a list of alists with `javelin_position' and `filepath' keys.
+Entries are sorted by `javelin_position' in increasing order before writing.
 Creates the cache file if it does not exist.
 If DATA is empty, deletes the cache file instead."
   (if (null data)
-      (when (file-exists-p (harpoon--cache-file-name))
-        (delete-file (harpoon--cache-file-name)))
-    (harpoon--ensure-cache-file)
-    (f-write-text (json-serialize (vconcat (harpoon--sort-positions data))) 
'utf-8 (harpoon--cache-file-name))))
+      (when (file-exists-p (javelin--cache-file-name))
+        (delete-file (javelin--cache-file-name)))
+    (javelin--ensure-cache-file)
+    (f-write-text (json-serialize (vconcat (javelin--sort-positions data))) 
'utf-8 (javelin--cache-file-name))))
 
-(defun harpoon--get-filepath-by-position (harpoon-position)
-  "Get the filepath for a given HARPOON-POSITION.
+(defun javelin--get-filepath-by-position (javelin-position)
+  "Get the filepath for a given JAVELIN-POSITION.
 Returns nil if not found."
-  (let ((data (harpoon--read-harpoon-positions)))
+  (let ((data (javelin--read-javelin-positions)))
     (alist-get 'filepath
                (seq-find (lambda (item)
-                           (= (alist-get 'harpoon_position item) 
harpoon-position))
+                           (= (alist-get 'javelin_position item) 
javelin-position))
                          data))))
 
-(defun harpoon--set-filepath-by-position (harpoon-position filepath)
-  "Set FILEPATH for a given HARPOON-POSITION.
+(defun javelin--set-filepath-by-position (javelin-position filepath)
+  "Set FILEPATH for a given JAVELIN-POSITION.
 Updates existing entry or adds a new one."
-  (let* ((data (harpoon--read-harpoon-positions))
+  (let* ((data (javelin--read-javelin-positions))
          (existing (seq-find (lambda (item)
-                               (= (alist-get 'harpoon_position item) 
harpoon-position))
+                               (= (alist-get 'javelin_position item) 
javelin-position))
                              data)))
     (if existing
         ;; Update existing entry
         (setf (alist-get 'filepath existing) filepath)
       ;; Add new entry
-      (push `((harpoon_position . ,harpoon-position) (filepath . ,filepath)) 
data))
-    (harpoon--write-harpoon-positions data)))
+      (push `((javelin_position . ,javelin-position) (filepath . ,filepath)) 
data))
+    (javelin--write-javelin-positions data)))
 
-(defun harpoon--remove-filepath-by-position (harpoon-position)
-  "Remove entry with HARPOON-POSITION from the harpoon list."
-  (let ((data (harpoon--read-harpoon-positions)))
-    (harpoon--write-harpoon-positions
+(defun javelin--remove-filepath-by-position (javelin-position)
+  "Remove entry with JAVELIN-POSITION from the javelin list."
+  (let ((data (javelin--read-javelin-positions)))
+    (javelin--write-javelin-positions
      (seq-remove (lambda (item)
-                   (= (alist-get 'harpoon_position item) harpoon-position))
+                   (= (alist-get 'javelin_position item) javelin-position))
                  data))))
 
-(defun harpoon--next-available-position ()
-  "Get the next available harpoon position.
+(defun javelin--next-available-position ()
+  "Get the next available javelin position.
 Scans positions 1-9 and returns the first gap found.
 Returns nil if all positions 1-9 are taken."
-  (let ((data (harpoon--read-harpoon-positions)))
+  (let ((data (javelin--read-javelin-positions)))
     (cl-loop for pos from 1 to 9
              unless (seq-find (lambda (item)
-                                (= (alist-get 'harpoon_position item) pos))
+                                (= (alist-get 'javelin_position item) pos))
                               data)
              return pos)))
 
-(defun harpoon--buffer-filepath-relative-to-root ()
+(defun javelin--buffer-filepath-relative-to-root ()
   "Get buffer file name relative to project root.
 Returns the relative path if in a project, otherwise the absolute path."
-  (let ((project-root (harpoon--get-project-root)))
+  (let ((project-root (javelin--get-project-root)))
     (if project-root
         (file-relative-name (buffer-file-name) project-root)
       (buffer-file-name))))
@@ -211,333 +211,333 @@ Returns the relative path if in a project, otherwise 
the absolute path."
 ;;; --- Go-to functions ---
 
 ;;;###autoload
-(defun harpoon-go-to (harpoon-number)
-  "Go to specific file on harpoon by HARPOON-NUMBER."
-  (let* ((file-name (harpoon--get-filepath-by-position harpoon-number))
-         (project-root (harpoon--get-project-root))
+(defun javelin-go-to (javelin-number)
+  "Go to specific file on javelin by JAVELIN-NUMBER."
+  (let* ((file-name (javelin--get-filepath-by-position javelin-number))
+         (project-root (javelin--get-project-root))
          (full-file-name (when file-name
                            (if project-root
                                (concat project-root file-name)
                              file-name))))
     (cond
      ((null file-name)
-      (message "No file harpooned to position %d" harpoon-number))
+      (message "No file javelined to position %d" javelin-number))
      ((file-exists-p full-file-name)
       (find-file full-file-name))
      (t
       (message "%s not found." full-file-name)))))
 
 ;;;###autoload
-(defun harpoon-go-to-1 ()
-  "Go to file 1 on harpoon."
+(defun javelin-go-to-1 ()
+  "Go to file 1 on javelin."
   (interactive)
-  (harpoon-go-to 1))
+  (javelin-go-to 1))
 
 ;;;###autoload
-(defun harpoon-go-to-2 ()
-  "Go to file 2 on harpoon."
+(defun javelin-go-to-2 ()
+  "Go to file 2 on javelin."
   (interactive)
-  (harpoon-go-to 2))
+  (javelin-go-to 2))
 
 ;;;###autoload
-(defun harpoon-go-to-3 ()
-  "Go to file 3 on harpoon."
+(defun javelin-go-to-3 ()
+  "Go to file 3 on javelin."
   (interactive)
-  (harpoon-go-to 3))
+  (javelin-go-to 3))
 
 ;;;###autoload
-(defun harpoon-go-to-4 ()
-  "Go to file 4 on harpoon."
+(defun javelin-go-to-4 ()
+  "Go to file 4 on javelin."
   (interactive)
-  (harpoon-go-to 4))
+  (javelin-go-to 4))
 
 ;;;###autoload
-(defun harpoon-go-to-5 ()
-  "Go to file 5 on harpoon."
+(defun javelin-go-to-5 ()
+  "Go to file 5 on javelin."
   (interactive)
-  (harpoon-go-to 5))
+  (javelin-go-to 5))
 
 ;;;###autoload
-(defun harpoon-go-to-6 ()
-  "Go to file 6 on harpoon."
+(defun javelin-go-to-6 ()
+  "Go to file 6 on javelin."
   (interactive)
-  (harpoon-go-to 6))
+  (javelin-go-to 6))
 
 ;;;###autoload
-(defun harpoon-go-to-7 ()
-  "Go to file 7 on harpoon."
+(defun javelin-go-to-7 ()
+  "Go to file 7 on javelin."
   (interactive)
-  (harpoon-go-to 7))
+  (javelin-go-to 7))
 
 ;;;###autoload
-(defun harpoon-go-to-8 ()
-  "Go to file 8 on harpoon."
+(defun javelin-go-to-8 ()
+  "Go to file 8 on javelin."
   (interactive)
-  (harpoon-go-to 8))
+  (javelin-go-to 8))
 
 ;;;###autoload
-(defun harpoon-go-to-9 ()
-  "Go to file 9 on harpoon."
+(defun javelin-go-to-9 ()
+  "Go to file 9 on javelin."
   (interactive)
-  (harpoon-go-to 9))
+  (javelin-go-to 9))
 
 ;;; --- Go-to functions ---
 
 ;;; --- Delete functions ---
 
 ;;;###autoload
-(defun harpoon-delete (harpoon-number)
-  "Delete an item on harpoon. HARPOON-NUMBER: Position to delete."
-  (harpoon--remove-filepath-by-position harpoon-number)
-  (message "Deleted harpoon position %d" harpoon-number))
+(defun javelin-delete (javelin-number)
+  "Delete an item on javelin. JAVELIN-NUMBER: Position to delete."
+  (javelin--remove-filepath-by-position javelin-number)
+  (message "Deleted javelin position %d" javelin-number))
 
 ;;;###autoload
-(defun harpoon-delete-1 ()
-  "Delete item harpoon on position 1."
+(defun javelin-delete-1 ()
+  "Delete item javelin on position 1."
   (interactive)
-  (harpoon-delete 1))
+  (javelin-delete 1))
 
 ;;;###autoload
-(defun harpoon-delete-2 ()
-  "Delete item harpoon on position 2."
+(defun javelin-delete-2 ()
+  "Delete item javelin on position 2."
   (interactive)
-  (harpoon-delete 2))
+  (javelin-delete 2))
 
 ;;;###autoload
-(defun harpoon-delete-3 ()
-  "Delete item harpoon on position 3."
+(defun javelin-delete-3 ()
+  "Delete item javelin on position 3."
   (interactive)
-  (harpoon-delete 3))
+  (javelin-delete 3))
 
 ;;;###autoload
-(defun harpoon-delete-4 ()
-  "Delete item harpoon on position 4."
+(defun javelin-delete-4 ()
+  "Delete item javelin on position 4."
   (interactive)
-  (harpoon-delete 4))
+  (javelin-delete 4))
 
 ;;;###autoload
-(defun harpoon-delete-5 ()
-  "Delete item harpoon on position 5."
+(defun javelin-delete-5 ()
+  "Delete item javelin on position 5."
   (interactive)
-  (harpoon-delete 5))
+  (javelin-delete 5))
 
 ;;;###autoload
-(defun harpoon-delete-6 ()
-  "Delete item harpoon on position 6."
+(defun javelin-delete-6 ()
+  "Delete item javelin on position 6."
   (interactive)
-  (harpoon-delete 6))
+  (javelin-delete 6))
 
 ;;;###autoload
-(defun harpoon-delete-7 ()
-  "Delete item harpoon on position 7."
+(defun javelin-delete-7 ()
+  "Delete item javelin on position 7."
   (interactive)
-  (harpoon-delete 7))
+  (javelin-delete 7))
 
 ;;;###autoload
-(defun harpoon-delete-8 ()
-  "Delete item harpoon on position 8."
+(defun javelin-delete-8 ()
+  "Delete item javelin on position 8."
   (interactive)
-  (harpoon-delete 8))
+  (javelin-delete 8))
 
 ;;;###autoload
-(defun harpoon-delete-9 ()
-  "Delete item harpoon on position 9."
+(defun javelin-delete-9 ()
+  "Delete item javelin on position 9."
   (interactive)
-  (harpoon-delete 9))
+  (javelin-delete 9))
 
 ;;; --- Delete functions ---
 
 ;;; --- Assign to functions ---
 
 ;;;###autoload
-(defun harpoon-assign-to (harpoon-number)
-  "Assign the current buffer to a specific position in harpoon.
-HARPOON-NUMBER: The position (1-9) to assign the current file to."
-  (let ((file-to-add (harpoon--buffer-filepath-relative-to-root)))
-    (harpoon--set-filepath-by-position harpoon-number file-to-add)
-    (message "Assigned %s to harpoon position %d" file-to-add harpoon-number)))
+(defun javelin-assign-to (javelin-number)
+  "Assign the current buffer to a specific position in javelin.
+JAVELIN-NUMBER: The position (1-9) to assign the current file to."
+  (let ((file-to-add (javelin--buffer-filepath-relative-to-root)))
+    (javelin--set-filepath-by-position javelin-number file-to-add)
+    (message "Assigned %s to javelin position %d" file-to-add javelin-number)))
 
 ;;;###autoload
-(defun harpoon-assign-to-1 ()
-  "Assign current buffer to position 1 on harpoon."
+(defun javelin-assign-to-1 ()
+  "Assign current buffer to position 1 on javelin."
   (interactive)
-  (harpoon-assign-to 1))
+  (javelin-assign-to 1))
 
 ;;;###autoload
-(defun harpoon-assign-to-2 ()
-  "Assign current buffer to position 2 on harpoon."
+(defun javelin-assign-to-2 ()
+  "Assign current buffer to position 2 on javelin."
   (interactive)
-  (harpoon-assign-to 2))
+  (javelin-assign-to 2))
 
 ;;;###autoload
-(defun harpoon-assign-to-3 ()
-  "Assign current buffer to position 3 on harpoon."
+(defun javelin-assign-to-3 ()
+  "Assign current buffer to position 3 on javelin."
   (interactive)
-  (harpoon-assign-to 3))
+  (javelin-assign-to 3))
 
 ;;;###autoload
-(defun harpoon-assign-to-4 ()
-  "Assign current buffer to position 4 on harpoon."
+(defun javelin-assign-to-4 ()
+  "Assign current buffer to position 4 on javelin."
   (interactive)
-  (harpoon-assign-to 4))
+  (javelin-assign-to 4))
 
 ;;;###autoload
-(defun harpoon-assign-to-5 ()
-  "Assign current buffer to position 5 on harpoon."
+(defun javelin-assign-to-5 ()
+  "Assign current buffer to position 5 on javelin."
   (interactive)
-  (harpoon-assign-to 5))
+  (javelin-assign-to 5))
 
 ;;;###autoload
-(defun harpoon-assign-to-6 ()
-  "Assign current buffer to position 6 on harpoon."
+(defun javelin-assign-to-6 ()
+  "Assign current buffer to position 6 on javelin."
   (interactive)
-  (harpoon-assign-to 6))
+  (javelin-assign-to 6))
 
 ;;;###autoload
-(defun harpoon-assign-to-7 ()
-  "Assign current buffer to position 7 on harpoon."
+(defun javelin-assign-to-7 ()
+  "Assign current buffer to position 7 on javelin."
   (interactive)
-  (harpoon-assign-to 7))
+  (javelin-assign-to 7))
 
 ;;;###autoload
-(defun harpoon-assign-to-8 ()
-  "Assign current buffer to position 8 on harpoon."
+(defun javelin-assign-to-8 ()
+  "Assign current buffer to position 8 on javelin."
   (interactive)
-  (harpoon-assign-to 8))
+  (javelin-assign-to 8))
 
 ;;;###autoload
-(defun harpoon-assign-to-9 ()
-  "Assign current buffer to position 9 on harpoon."
+(defun javelin-assign-to-9 ()
+  "Assign current buffer to position 9 on javelin."
   (interactive)
-  (harpoon-assign-to 9))
+  (javelin-assign-to 9))
 
 ;;; --- Assign to functions ---
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to (harpoon-number &optional force)
-  "Go to harpoon position if occupied, otherwise assign current buffer to it.
-HARPOON-NUMBER: The position (1-9) to go to or assign.
+(defun javelin-go-or-assign-to (javelin-number &optional force)
+  "Go to javelin position if occupied, otherwise assign current buffer to it.
+JAVELIN-NUMBER: The position (1-9) to go to or assign.
 With FORCE (or prefix arg C-u), always assign even if position is occupied."
-  (if (and (not force) (harpoon--get-filepath-by-position harpoon-number))
-      (harpoon-go-to harpoon-number)
-    (harpoon-assign-to harpoon-number)))
+  (if (and (not force) (javelin--get-filepath-by-position javelin-number))
+      (javelin-go-to javelin-number)
+    (javelin-assign-to javelin-number)))
 
 ;;; --- Go or assign to functions ---
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-1 ()
+(defun javelin-go-or-assign-to-1 ()
   "Go to position 1 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 1 current-prefix-arg))
+  (javelin-go-or-assign-to 1 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-2 ()
+(defun javelin-go-or-assign-to-2 ()
   "Go to position 2 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 2 current-prefix-arg))
+  (javelin-go-or-assign-to 2 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-3 ()
+(defun javelin-go-or-assign-to-3 ()
   "Go to position 3 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 3 current-prefix-arg))
+  (javelin-go-or-assign-to 3 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-4 ()
+(defun javelin-go-or-assign-to-4 ()
   "Go to position 4 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 4 current-prefix-arg))
+  (javelin-go-or-assign-to 4 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-5 ()
+(defun javelin-go-or-assign-to-5 ()
   "Go to position 5 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 5 current-prefix-arg))
+  (javelin-go-or-assign-to 5 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-6 ()
+(defun javelin-go-or-assign-to-6 ()
   "Go to position 6 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 6 current-prefix-arg))
+  (javelin-go-or-assign-to 6 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-7 ()
+(defun javelin-go-or-assign-to-7 ()
   "Go to position 7 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 7 current-prefix-arg))
+  (javelin-go-or-assign-to 7 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-8 ()
+(defun javelin-go-or-assign-to-8 ()
   "Go to position 8 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 8 current-prefix-arg))
+  (javelin-go-or-assign-to 8 current-prefix-arg))
 
 ;;;###autoload
-(defun harpoon-go-or-assign-to-9 ()
+(defun javelin-go-or-assign-to-9 ()
   "Go to position 9 if occupied, otherwise assign current buffer to it.
 With prefix arg C-u, always assign even if position is occupied."
   (interactive)
-  (harpoon-go-or-assign-to 9 current-prefix-arg))
+  (javelin-go-or-assign-to 9 current-prefix-arg))
 
 ;;; --- Go or assign to functions ---
 
 ;;;###autoload
-(defun harpoon-go-to-next ()
-  "Go to the next file in harpoon."
+(defun javelin-go-to-next ()
+  "Go to the next file in javelin."
   (interactive)
-  (let* ((data (harpoon--read-harpoon-positions))
+  (let* ((data (javelin--read-javelin-positions))
          (files (mapcar (lambda (item) (alist-get 'filepath item)) data))
-         (current-file (harpoon--buffer-filepath-relative-to-root))
+         (current-file (javelin--buffer-filepath-relative-to-root))
          (current-index (or (cl-position current-file files :test 'string=) 
-1))
          (next-index (mod (+ current-index 1) (length files)))
          (next-item (nth next-index data)))
     (when next-item
-      (harpoon-go-to (alist-get 'harpoon_position next-item)))))
+      (javelin-go-to (alist-get 'javelin_position next-item)))))
 
 ;;;###autoload
-(defun harpoon-go-to-prev ()
-  "Go to the previous file in harpoon."
+(defun javelin-go-to-prev ()
+  "Go to the previous file in javelin."
   (interactive)
-  (let* ((data (harpoon--read-harpoon-positions))
+  (let* ((data (javelin--read-javelin-positions))
          (files (mapcar (lambda (item) (alist-get 'filepath item)) data))
-         (current-file (harpoon--buffer-filepath-relative-to-root))
+         (current-file (javelin--buffer-filepath-relative-to-root))
          (current-index (or (cl-position current-file files :test 'string=) 
-1))
          (prev-index (mod (+ current-index (length files) -1) (length files)))
          (prev-item (nth prev-index data)))
     (when prev-item
-      (harpoon-go-to (alist-get 'harpoon_position prev-item)))))
+      (javelin-go-to (alist-get 'javelin_position prev-item)))))
 
 ;;;###autoload
-(defun harpoon-add-file ()
-  "Add current file to harpoon."
+(defun javelin-add-file ()
+  "Add current file to javelin."
   (interactive)
-  (let* ((file-to-add (harpoon--buffer-filepath-relative-to-root))
-         (data (harpoon--read-harpoon-positions))
+  (let* ((file-to-add (javelin--buffer-filepath-relative-to-root))
+         (data (javelin--read-javelin-positions))
          (existing (seq-find (lambda (item)
                                (string= (alist-get 'filepath item) 
file-to-add))
                              data)))
     (if existing
-        (message "This file is already on harpoon.")
-      (let ((next-num (harpoon--next-available-position)))
-        (harpoon--set-filepath-by-position next-num file-to-add)
-        (message "File added to harpoon at position %d." next-num)))))
+        (message "This file is already on javelin.")
+      (let ((next-num (javelin--next-available-position)))
+        (javelin--set-filepath-by-position next-num file-to-add)
+        (message "File added to javelin at position %d." next-num)))))
 
 ;;;###autoload
-(defun harpoon-toggle-quick-menu ()
-  "Open quick menu to select a harpooned file."
+(defun javelin-toggle-quick-menu ()
+  "Open quick menu to select a javelined file."
   (interactive)
-  (let* ((data (harpoon--read-harpoon-positions))
+  (let* ((data (javelin--read-javelin-positions))
          (candidates (mapcar (lambda (item)
                                (cons (format "%d: %s"
-                                             (alist-get 'harpoon_position item)
+                                             (alist-get 'javelin_position item)
                                              (alist-get 'filepath item))
                                      item))
                              data))
@@ -548,76 +548,76 @@ With prefix arg C-u, always assign even if position is 
occupied."
                            '(metadata (display-sort-function . identity)
                              (cycle-sort-function . identity))
                          (complete-with-action action candidate-strings string 
pred)))))
-    (when-let ((selection (completing-read "Harpoon to file: " collection)))
-      (harpoon-go-to (alist-get 'harpoon_position (cdr (assoc selection 
candidates)))))))
+    (when-let ((selection (completing-read "Javelin to file: " collection)))
+      (javelin-go-to (alist-get 'javelin_position (cdr (assoc selection 
candidates)))))))
 
 ;;;###autoload
-(defun harpoon-clear ()
-  "Clear all harpoon positions."
+(defun javelin-clear ()
+  "Clear all javelin positions."
   (interactive)
-  (when (yes-or-no-p "Do you really want to clear harpoon all harpoon 
positions? ")
-    (harpoon--write-harpoon-positions '())
-    (message "Harpoon positions cleaned.")))
+  (when (yes-or-no-p "Do you really want to clear javelin all javelin 
positions? ")
+    (javelin--write-javelin-positions '())
+    (message "Javelin positions cleaned.")))
 
 ;;;###autoload
-(defun harpoon-clear-all ()
-  "Delete all harpoon position namespaces."
+(defun javelin-clear-all ()
+  "Delete all javelin position namespaces."
   (interactive)
-  (when (yes-or-no-p "Do you really want to clear all harpoon positions across 
all harpoon projects? ")
-    (let ((files (directory-files harpoon-cache-dir t "\\.json$")))
+  (when (yes-or-no-p "Do you really want to clear all javelin positions across 
all javelin projects? ")
+    (let ((files (directory-files javelin-cache-dir t "\\.json$")))
       (dolist (file files)
         (delete-file file))
-      (message "Deleted all harpoon positions across %d project(s)." (length 
files)))))
+      (message "Deleted all javelin positions across %d project(s)." (length 
files)))))
 
 ;;; --- Minor mode ---
 
-(defvar harpoon-minor-mode-map
+(defvar javelin-minor-mode-map
   (let ((map (make-sparse-keymap))
         (delete-map (make-sparse-keymap)))
     ;; Go or assign to position
-    (define-key map (kbd "M-1") #'harpoon-go-or-assign-to-1)
-    (define-key map (kbd "M-2") #'harpoon-go-or-assign-to-2)
-    (define-key map (kbd "M-3") #'harpoon-go-or-assign-to-3)
-    (define-key map (kbd "M-4") #'harpoon-go-or-assign-to-4)
-    (define-key map (kbd "M-5") #'harpoon-go-or-assign-to-5)
-    (define-key map (kbd "M-6") #'harpoon-go-or-assign-to-6)
-    (define-key map (kbd "M-7") #'harpoon-go-or-assign-to-7)
-    (define-key map (kbd "M-8") #'harpoon-go-or-assign-to-8)
-    (define-key map (kbd "M-9") #'harpoon-go-or-assign-to-9)
+    (define-key map (kbd "M-1") #'javelin-go-or-assign-to-1)
+    (define-key map (kbd "M-2") #'javelin-go-or-assign-to-2)
+    (define-key map (kbd "M-3") #'javelin-go-or-assign-to-3)
+    (define-key map (kbd "M-4") #'javelin-go-or-assign-to-4)
+    (define-key map (kbd "M-5") #'javelin-go-or-assign-to-5)
+    (define-key map (kbd "M-6") #'javelin-go-or-assign-to-6)
+    (define-key map (kbd "M-7") #'javelin-go-or-assign-to-7)
+    (define-key map (kbd "M-8") #'javelin-go-or-assign-to-8)
+    (define-key map (kbd "M-9") #'javelin-go-or-assign-to-9)
     ;; Delete position (M-0 prefix)
-    (define-key delete-map (kbd "0") #'harpoon-clear)
-    (define-key delete-map (kbd "1") #'harpoon-delete-1)
-    (define-key delete-map (kbd "2") #'harpoon-delete-2)
-    (define-key delete-map (kbd "3") #'harpoon-delete-3)
-    (define-key delete-map (kbd "4") #'harpoon-delete-4)
-    (define-key delete-map (kbd "5") #'harpoon-delete-5)
-    (define-key delete-map (kbd "6") #'harpoon-delete-6)
-    (define-key delete-map (kbd "7") #'harpoon-delete-7)
-    (define-key delete-map (kbd "8") #'harpoon-delete-8)
-    (define-key delete-map (kbd "9") #'harpoon-delete-9)
+    (define-key delete-map (kbd "0") #'javelin-clear)
+    (define-key delete-map (kbd "1") #'javelin-delete-1)
+    (define-key delete-map (kbd "2") #'javelin-delete-2)
+    (define-key delete-map (kbd "3") #'javelin-delete-3)
+    (define-key delete-map (kbd "4") #'javelin-delete-4)
+    (define-key delete-map (kbd "5") #'javelin-delete-5)
+    (define-key delete-map (kbd "6") #'javelin-delete-6)
+    (define-key delete-map (kbd "7") #'javelin-delete-7)
+    (define-key delete-map (kbd "8") #'javelin-delete-8)
+    (define-key delete-map (kbd "9") #'javelin-delete-9)
     (define-key map (kbd "M-0") delete-map)
     ;; Quick menu
-    (define-key map (kbd "M--") #'harpoon-toggle-quick-menu)
+    (define-key map (kbd "M--") #'javelin-toggle-quick-menu)
     map)
-  "Keymap for `harpoon-minor-mode'.")
+  "Keymap for `javelin-minor-mode'.")
 
 ;;;###autoload
-(define-minor-mode harpoon-minor-mode
-  "Minor mode for quick file navigation with harpoon.
-Provides keybindings for jumping to harpooned files:
+(define-minor-mode javelin-minor-mode
+  "Minor mode for quick file navigation with javelin.
+Provides keybindings for jumping to javelined files:
   M-1 to M-9: Go to position (or assign if empty, C-u to force assign)
   M-0 0: Clear all positions
   M-0 1-9: Delete position
   M--: Toggle quick menu"
   :lighter " Harp"
-  :keymap harpoon-minor-mode-map
+  :keymap javelin-minor-mode-map
   :global nil)
 
 ;;;###autoload
-(define-globalized-minor-mode global-harpoon-minor-mode
-  harpoon-minor-mode
-  (lambda () (harpoon-minor-mode 1))
-  :group 'harpoon)
+(define-globalized-minor-mode global-javelin-minor-mode
+  javelin-minor-mode
+  (lambda () (javelin-minor-mode 1))
+  :group 'javelin)
 
-(provide 'harpoon)
-;;; harpoon.el ends here
+(provide 'javelin)
+;;; javelin.el ends here


Reply via email to