Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global, enh: add function for global to update single file #165

Merged

Conversation

norris-young
Copy link
Contributor

global supports updating tags for a single file. we can add this function which might be used in after-save-hook.

@AmaiKinono
Copy link
Member

Thanks, and sorry for the late response.

I've noticed the tramp-file-name-localname, tramp-dissect-file-name and tramp-handle-expand-file-name combination in your patch. I've used file-local-name for similar purpose in other parts of the code. Are they doing the same thing?

Also, seems expand-filename already does what tramp-handle-expand-file-name do:

(expand-file-name "/ssh:kino@localhost:~/.emacs.d/")
;; => "/ssh:kino@localhost:/home/kino/.emacs.d/"

So, could we replace it with something like (file-local-name (expand-file-name filename)), if they are doing the same thing? Then we can remove the dependency on TRAMP.

@norris-young norris-young force-pushed the add.single.file.update branch 2 times, most recently from 316f332 to 8d6b64b Compare June 29, 2024 13:41
Global supports updating tags for a single file. we can add this function
which might be used in after-save-hook.
Besides, we replace tramp functions to avoid dependency on tramp
@norris-young
Copy link
Contributor Author

norris-young commented Jun 29, 2024

So, could we replace it with something like (file-local-name (expand-file-name filename)), if they are doing the same thing? Then we can remove the dependency on TRAMP.

It works and PR has been updated.
Besides, I reworked the fix I submitted before with the same way.

@AmaiKinono AmaiKinono merged commit d994837 into universal-ctags:master Jun 30, 2024
10 checks passed
@AmaiKinono
Copy link
Member

Thanks!

@AmaiKinono
Copy link
Member

We can add this function which might be used in after-save-hook.

I'd like to ask how are you using this, as adding it to after-save-hook will prompt the user to create a global database for every file they save. Are there some special configuration on your side, or could we make it do nothing when no global database is found?

@norris-young
Copy link
Contributor Author

We can add this function which might be used in after-save-hook.

I'd like to ask how are you using this, as adding it to after-save-hook will prompt the user to create a global database for every file they save. Are there some special configuration on your side, or could we make it do nothing when no global database is found?

FYI, I add some conditions.

(lambda ()
  (when (and (eq major-mode 'c-ts-mode)
             (citre-global-dbpath))
    (citre-global-update-file)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants