harpoon.el
harpoon.el copied to clipboard
Suggestion: bring ability to use harpoon.el without a project function
Hi there!
Just adding an issue to give feedback on the current state of the customizability of the package. In my opinion, we are opinionated in the way that package users should use it, and we should have as a tenet to bring the most amount of customizability as possible, so the user base grows along with the different workflows supported.
In my case, I use harpoon to move between the files in a single tab from tab-bar.el
and that allows me to have the notes on the first file change, and code on the second, to jump back and forth between them. With the current changes (say, fixing the project.el
function), I'm not able to do that, and basically it means that I end up using harpoon less, or close to nothing.
As a way to implement it, we could have a defvar
or defcustom
to actually apply the project finding logic, or instead of enforcing the project functionality, we could just add a variable to be the function that we use for harpoon (similar to the harpoon-without-project-function
, but as the default).
We could assign a default value to that function to the project one for now, to avoid any breaking changes, but give the possiblity to override the function used for all the harpooning.
What do you think? Thanks for the package, avid user (until very recently for the reasons I state above).
Best, Quique.
I second this. I often need to bring up org buffers that are not part of a project, and right now I'm not able to do that.
@betaprior As a workaround, I have overwritten the functions that harpoon uses for defining the project root, so it fallbacks to the harpoon-without-project-function
that we define. I use use-package
but you should be able to pick anything you need from this snippet:
(use-package harpoon
:elpaca (harpoon :host github :repo "otavioschwanck/harpoon.el")
:hook (harpoon-mode . auto-revert-mode)
:init
(defun qk-tab-bar-get-current-tab-name ())
(setq
harpoon-cache-file (concat no-littering-var-directory "harpoon/")
harpoon-without-project-function 'qk-tab-bar-get-current-tab-name)
:general
(+general-global-help
"c" 'harpoon-clear
"t" 'harpoon-toggle-file
"a" 'harpoon-add-file)
(global-definer
"'" 'harpoon-go-to-1
"," 'harpoon-go-to-2
"." 'harpoon-go-to-3)
:config
(defun qk-tab-bar-get-current-tab-name ()
(alist-get 'name (tab-bar--current-tab)))
(defun harpoon-project-root-function () nil)
(defun harpoon--has-project () nil))
If we place the functions we need on the :config
property, we override the functions after initializing them, and it works.