diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-05-11 13:45:20 +0530 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-05-11 13:45:20 +0530 |
commit | eacfab80dd04777650b4ea665c0fb4b3bfae73de (patch) | |
tree | d165d1def5a150f7f5b59b552f70393deecb00a7 /Emacs | |
parent | 5567f2647d01b78108085aa8eb5ffefc9dd7c119 (diff) | |
download | dotfiles-eacfab80dd04777650b4ea665c0fb4b3bfae73de.tar.gz dotfiles-eacfab80dd04777650b4ea665c0fb4b3bfae73de.tar.bz2 dotfiles-eacfab80dd04777650b4ea665c0fb4b3bfae73de.zip |
(Emacs/config)+Custom function to generate tags from project root
Diffstat (limited to 'Emacs')
-rw-r--r-- | Emacs/.config/emacs/config.org | 35 | ||||
-rw-r--r-- | Emacs/.config/emacs/core.org | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 235957c..2871505 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -1107,6 +1107,41 @@ setups for programming without heavier packages like [[*Eglot][Eglot]]. "g" #'xref-revert-buffer "q" #'quit-window)) #+end_src +** Project.el +An inbuilt solution for creating and managing projects that doesn't +require a dependency. Where possible we should try to use Emacs +defaults (admittedly this is a philosophy I've only recently adopted) +so when setting up a new computer it takes a bit less time. + +Here I write a TAGS command, mimicking projectile's one, so I can +quickly generate them in C/C++ projects. + +#+begin_src emacs-lisp +(use-package project + :straight nil + :general + (general-def + :keymaps 'project-prefix-map + "R" #'+project/generate-tags) + :config + (defun +project/generate-tags () + (interactive) + (let ((project (project-current))) + (if (not project) + (message "+project/generate-tags: Not in project.") + (let ((tags-file (concat (project-root project) "TAGS")) + (files (format "%s" (project-files project)))) + (set-process-sentinel + (start-process-shell-command + "PROJECT-GENERATE-TAGS" + "*gen-tags*" + (format "ctags -Re -f %s %s" + tags-file + (substring files 1 (- (length files) 1)))) + (lambda (p event) + (when (string= event "finished\n") + (message "Finished generating tags!"))))))))) +#+end_src ** WAIT Projectile :PROPERTIES: :header-args:emacs-lisp: :tangle no diff --git a/Emacs/.config/emacs/core.org b/Emacs/.config/emacs/core.org index 1fc4f98..cb9d19f 100644 --- a/Emacs/.config/emacs/core.org +++ b/Emacs/.config/emacs/core.org @@ -783,6 +783,7 @@ for all snippets I've got. :defer t :hook (prog-mode-hook . yas-minor-mode) + (text-mode-hook . yas-minor-mode) :general (insert-leader "i" #'yas-insert-snippet) |