<commit_before>;; Copyright (c) 2014 Microsoft Corporation. All rights reserved.
;; Released under Apache 2.0 license as described in the file LICENSE.
;;
;; Author: <NAME>
;;

(require 'dash)
(require 'f)
(require 'lean-util)

(defalias 'lean-global-search 'tags-apropos)

(defun lean-tags-table-list ()
  (-filter 'f-exists?
           (--map (f-join it "TAGS") (lean-path-list))))

(defun lean-generate-tags ()
  "Run linja TAGS and let emacs use the generated TAGS file."
  (interactive)
  (let ((ltags-file-name (lean-get-executable "linja")))
    (message "Generating TAGS...")
    (apply 'call-process
           (append `(,ltags-file-name nil "*lean-tags*" nil)
                   lean-flycheck-checker-options
                   '("TAGS")))
    (message "TAGS generated.")
    (setq tags-table-list (lean-tags-table-list))))

(defmacro lean-tags-make-advice-to-call-ltags (f)
  (let* ((f-name (symbol-name f))
         (advice-name (concat "lean-tags-advice-"
                              (symbol-name f))))
    `(defadvice ,f
       (before ,(intern advice-name)  first activate)
       ,(concat "Before call " f-name ", run 'linja TAGS'")
       (when (derived-mode-p 'lean-mode)
         (lean-generate-tags)))))<commit_msg>fix(emacs/lean-tags): support windows<commit_after>;; Copyright (c) 2014 Microsoft Corporation. All rights reserved.
;; Released under Apache 2.0 license as described in the file LICENSE.
;;
;; Author: <NAME>
;;

(require 'dash)
(require 'f)
(require 'lean-util)

(defalias 'lean-global-search 'tags-apropos)

(defun lean-tags-table-list ()
  (-filter 'f-exists?
           (--map (f-join it "TAGS") (lean-path-list))))

(defun lean-generate-tags ()
  "Run linja TAGS and let emacs use the generated TAGS file."
  (interactive)
  (let* ((ltags-file-name (lean-get-executable "linja"))
         ltags-command)
    (setq ltags-command
          (cond ((string= system-type "windows-nt")

                 (append '("python" nil "*lean-tags*" nil)
                         `(,ltags-file-name)
                         lean-flycheck-checker-options
                         '("tags")))
                (t
                 (append `(,ltags-file-name nil "*lean-tags*" nil)
                         lean-flycheck-checker-options
                         '("tags")))))
    (message "Generating TAGS...")
    (apply 'call-process ltags-command)
    (message "TAGS generated.")
    (setq tags-table-list (lean-tags-table-list))))

(defmacro lean-tags-make-advice-to-call-ltags (f)
  (let* ((f-name (symbol-name f))
         (advice-name (concat "lean-tags-advice-"
                              (symbol-name f))))
    `(defadvice ,f
       (before ,(intern advice-name)  first activate)
       ,(concat "Before call " f-name ", run 'linja TAGS'")
       (when (derived-mode-p 'lean-mode)
         (lean-generate-tags)))))
{'fraction_non_alphanumeric': 0.16005616005616005, 'fraction_numerical': 0.004212004212004212, 'mean_word_length': 2.3101045296167246, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2061970', 'n_tokens_mistral': 951, 'n_tokens_neox': 936, 'n_words': 230}