<commit_before>;;; custom-tags.el

;; WIP

(defvar doom-ctags-alist
  '((ruby-mode :exec "ripper-tags -R -f %t --emacs")
    (c++-mode :ext "cpp")
    (c-mode :ext "c")
    (all :exec "find . -type f -iname \"*.%e\" | ctags -e -f %t -")
    ;; TODO add c-mode/c++-mode ctags
    ))


(add-hook 'find-file-hook 'doom|init-tags)
(defun doom|init-tags ()
  (awhen (doom/tags-p)
    (setq tags-table-list (list it))))

;; TODO
;; (defun doom/tags-generate ()
;;   (interactive)
;;   (let ((command (assoc major-mode doom-ctags-alist))
;;         (default-directory (doom/project-root)))
;;     (unless command
;;       (user-error "No tag generator for %s" major-mode))
;;     (async-shell-command command "*doom:generate-tags*")))

;;;###autoload
(defun doom/find-def ()
  "Find definition using tags, falling back to dumb-jump otherwise."
  (interactive)
  (let ((orig-pt (point))
        (orig-file (buffer-file-name)))
    (cond ((and (doom/tags-p)
                (progn (call-interactively 'helm-etags-select)
                       (and (/= orig-pt (point))
                            (f-same? orig-file buffer-file-name)))))
          ((progn (dumb-jump-go)
                  (and (/= orig-pt (point))
                       (f-same? orig-file buffer-file-name))))
          (t (call-interactively 'evil-goto-definition)))))

;;;###autoload
(defun doom/tags-p ()
  (let ((path (expand-file-name ".tags" (doom/project-root))))
    (and (f-exists? path) path)))
<commit_msg>tags: remove helm-etags-select references (no longer using helm)<commit_after>;;; custom-tags.el

;; WIP

(defvar doom-ctags-alist
  '((ruby-mode :exec "ripper-tags -R -f %t --emacs")
    (c++-mode :ext "cpp")
    (c-mode :ext "c")
    (all :exec "find . -type f -iname \"*.%e\" | ctags -e -f %t -")
    ;; TODO add c-mode/c++-mode ctags
    ))


(add-hook 'find-file-hook 'doom|init-tags)
(defun doom|init-tags ()
  (awhen (doom/tags-p)
    (setq tags-table-list (list it))))

;; TODO
;; (defun doom/tags-generate ()
;;   (interactive)
;;   (let ((command (assoc major-mode doom-ctags-alist))
;;         (default-directory (doom/project-root)))
;;     (unless command
;;       (user-error "No tag generator for %s" major-mode))
;;     (async-shell-command command "*doom:generate-tags*")))

;;;###autoload
(defun doom/find-def ()
  "Find definition using tags, falling back to dumb-jump otherwise."
  (interactive)
  (let ((orig-pt (point))
        (orig-file (buffer-file-name)))
    (cond ((and (doom/tags-p)
                ;; TODO
                ;; (progn (call-interactively 'helm-etags-select)
                ;;        (and (/= orig-pt (point))
                ;;             (f-same? orig-file buffer-file-name)))
                ))
          ((progn (dumb-jump-go)
                  (and (/= orig-pt (point))
                       (f-same? orig-file buffer-file-name))))
          (t (call-interactively 'evil-goto-definition)))))

;;;###autoload
(defun doom/tags-p ()
  (let ((path (expand-file-name ".tags" (doom/project-root))))
    (and (f-exists? path) path)))

{'fraction_non_alphanumeric': 0.1967266775777414, 'fraction_numerical': 0.0, 'mean_word_length': 2.314533622559653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7622322', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1076, 'n_words': 248}