From eacfab80dd04777650b4ea665c0fb4b3bfae73de Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 11 May 2024 13:45:20 +0530 Subject: (Emacs/config)+Custom function to generate tags from project root --- Emacs/.config/emacs/config.org | 35 +++++++++++++++++++++++++++++++++++ Emacs/.config/emacs/core.org | 1 + 2 files changed, 36 insertions(+) (limited to 'Emacs/.config/emacs') 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) -- cgit v1.2.3-13-gbd6f