File: flycheck-maint.el

package info (click to toggle)
flycheck 31-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,660 kB
  • sloc: lisp: 11,831; python: 729; makefile: 243; cpp: 23; ruby: 23; ada: 17; f90: 16; xml: 14; erlang: 14; ansic: 12; haskell: 12; sh: 10; php: 9; perl: 7; fortran: 3; sql: 1
file content (57 lines) | stat: -rw-r--r-- 2,073 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
;;; flycheck-maint.el --- Flycheck: Maintenace library  -*- lexical-binding: t; -*-

;; Copyright (C) 2016  Sebastian Wiesner and Flycheck contributors

;; Author: Sebastian Wiesner <swiesner@lunaryorn.com>
;; This file is not part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; This file provides helper functions for maintenance tools.

;;; Code:

(unless noninteractive
  (error "This file must not be used interactively"))

(defconst flycheck/source-dir (locate-dominating-file load-file-name "Cask")
  "The source directory of Flycheck.")

(defun flycheck/collect-el-files (directory &optional recursive)
  "Collect all Emacs Lisp files in DIRECTORY.

If RECURSIVE is given and non-nil collect files recursively."
  (let ((fn-re (rx ".el" eos)))
    (if recursive
        (directory-files-recursively directory fn-re)
      (directory-files directory 'full fn-re))))

(defun flycheck/all-source-files ()
  "Find all source files of Flycheck."
  (append
   (seq-mapcat (lambda (rel-name)
                 (flycheck/collect-el-files
                  (expand-file-name rel-name flycheck/source-dir)))
               '("." "maint/" "doc/" "test/"))
   (flycheck/collect-el-files
    (expand-file-name "test/specs/" flycheck/source-dir) 'recursive)))

(defun flycheck/already-loaded-p (filename)
  "Whether FILENAME is already loaded."
  (not (null (assoc filename load-history))))

(provide 'flycheck-maint)
;;; flycheck-maint.el ends here