From 6c2b37dcd047ce11190a80068c24c891ff31dc08 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 22 Dec 2024 12:59:37 +0100 Subject: [PATCH] update flymake Signed-off-by: Andreas Gerler --- elpa/flymake-1.3.4.signed | 1 - elpa/flymake-1.3.7.signed | 1 + .../flymake-autoloads.el | 73 ++-- .../flymake-pkg.el | 2 +- .../flymake.el | 350 ++++++++++++------ .../flymake-easy-autoloads.el | 26 -- .../flymake-easy-pkg.el | 12 - .../flymake-easy-autoloads.el | 28 ++ .../flymake-easy-pkg.el | 10 + .../flymake-easy.el | 3 +- .../bin/flymake_perlcritic | 44 --- .../flymake-perlcritic-autoloads.el | 27 -- .../flymake-perlcritic-pkg.el | 10 - .../flymake-perlcritic.el | 90 ----- .../flymake-perlcritic-autoloads.el | 32 ++ .../flymake-perlcritic-pkg.el | 10 + .../flymake-perlcritic.el | 165 +++++++++ elpa/flymake-perlcritic-readme.txt | 3 - 18 files changed, 517 insertions(+), 370 deletions(-) delete mode 100644 elpa/flymake-1.3.4.signed create mode 100644 elpa/flymake-1.3.7.signed rename elpa/{flymake-1.3.4 => flymake-1.3.7}/flymake-autoloads.el (79%) rename elpa/{flymake-1.3.4 => flymake-1.3.7}/flymake-pkg.el (71%) rename elpa/{flymake-1.3.4 => flymake-1.3.7}/flymake.el (87%) delete mode 100644 elpa/flymake-easy-20141022.1828/flymake-easy-autoloads.el delete mode 100644 elpa/flymake-easy-20141022.1828/flymake-easy-pkg.el create mode 100644 elpa/flymake-easy-20240624.1702/flymake-easy-autoloads.el create mode 100644 elpa/flymake-easy-20240624.1702/flymake-easy-pkg.el rename elpa/{flymake-easy-20141022.1828 => flymake-easy-20240624.1702}/flymake-easy.el (98%) delete mode 100755 elpa/flymake-perlcritic-20120328.814/bin/flymake_perlcritic delete mode 100644 elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-autoloads.el delete mode 100644 elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-pkg.el delete mode 100644 elpa/flymake-perlcritic-20120328.814/flymake-perlcritic.el create mode 100644 elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-autoloads.el create mode 100644 elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-pkg.el create mode 100644 elpa/flymake-perlcritic-20240229.953/flymake-perlcritic.el delete mode 100644 elpa/flymake-perlcritic-readme.txt diff --git a/elpa/flymake-1.3.4.signed b/elpa/flymake-1.3.4.signed deleted file mode 100644 index 0137ef31..00000000 --- a/elpa/flymake-1.3.4.signed +++ /dev/null @@ -1 +0,0 @@ -Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) (trust undefined) created at 2023-04-13T23:05:02+0200 using RSA \ No newline at end of file diff --git a/elpa/flymake-1.3.7.signed b/elpa/flymake-1.3.7.signed new file mode 100644 index 00000000..2b29588e --- /dev/null +++ b/elpa/flymake-1.3.7.signed @@ -0,0 +1 @@ +Good signature from 645357D2883A0966 GNU ELPA Signing Agent (2023) (trust undefined) created at 2024-03-31T11:25:11+0200 using EDDSA \ No newline at end of file diff --git a/elpa/flymake-1.3.4/flymake-autoloads.el b/elpa/flymake-1.3.7/flymake-autoloads.el similarity index 79% rename from elpa/flymake-1.3.4/flymake-autoloads.el rename to elpa/flymake-1.3.7/flymake-autoloads.el index dae2499a..6be9ff24 100644 --- a/elpa/flymake-1.3.4/flymake-autoloads.el +++ b/elpa/flymake-1.3.7/flymake-autoloads.el @@ -1,12 +1,14 @@ -;;; flymake-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; flymake-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + -;;;### (autoloads nil "flymake" "flymake.el" (0 0 0 0)) ;;; Generated autoloads from flymake.el (autoload 'flymake-log "flymake" "\ @@ -16,8 +18,7 @@ the warning. If this form is included in a file, the generated warning contains an indication of the file that generated it. -\(fn LEVEL MSG &rest ARGS)" nil t) - +(fn LEVEL MSG &rest ARGS)" nil t) (autoload 'flymake-make-diagnostic "flymake" "\ Make a Flymake diagnostic for LOCUS's region from BEG to END. LOCUS is a buffer object or a string designating a file name. @@ -39,8 +40,7 @@ created diagnostic, overriding the default properties and any properties listed in the `flymake-overlay-control' property of the diagnostic's type symbol. -\(fn LOCUS BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)" nil nil) - +(fn LOCUS BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)") (autoload 'flymake-diagnostics "flymake" "\ Get Flymake diagnostics in region determined by BEG and END. @@ -48,32 +48,16 @@ If neither BEG or END is supplied, use whole accessible buffer, otherwise if BEG is non-nil and END is nil, consider only diagnostics at BEG. -\(fn &optional BEG END)" nil nil) - +(fn &optional BEG END)") (autoload 'flymake-diag-region "flymake" "\ Compute BUFFER's region (BEG . END) corresponding to LINE and COL. If COL is nil, return a region just for LINE. Return nil if the region is invalid. This function saves match data. -\(fn BUFFER LINE &optional COL)" nil nil) - +(fn BUFFER LINE &optional COL)") (autoload 'flymake-mode "flymake" "\ Toggle Flymake mode on or off. -This is a minor mode. If called interactively, toggle the -`Flymake mode' mode. If the prefix argument is positive, enable -the mode, and if it is zero or negative, disable the mode. - -If called from Lisp, toggle the mode if ARG is `toggle'. Enable -the mode if ARG is nil, omitted, or is a positive number. -Disable the mode if ARG is a negative number. - -To check whether the minor mode is enabled in the current buffer, -evaluate `flymake-mode'. - -The mode's hook is called both when the mode is enabled and when -it is disabled. - Flymake is an Emacs minor mode for on-the-fly syntax checking. Flymake collects diagnostic information from multiple sources, called backends, and visually annotates the buffer with the @@ -111,26 +95,39 @@ suitable for the current buffer. The commands `flymake-reporting-backends' summarize the situation, as does the special *Flymake log* buffer. -\(fn &optional ARG)" t nil) +This is a minor mode. If called interactively, toggle the `Flymake +mode' mode. If the prefix argument is positive, enable the mode, and if +it is zero or negative, disable the mode. -(autoload 'flymake-mode-on "flymake" "\ -Turn Flymake mode on." nil nil) +If called from Lisp, toggle the mode if ARG is `toggle'. Enable the +mode if ARG is nil, omitted, or is a positive number. Disable the mode +if ARG is a negative number. -(autoload 'flymake-mode-off "flymake" "\ -Turn Flymake mode off." nil nil) +To check whether the minor mode is enabled in the current buffer, +evaluate the variable `flymake-mode'. -(register-definition-prefixes "flymake" '("flymake-")) +The mode's hook is called both when the mode is enabled and when it is +disabled. -;;;*** - -;;;### (autoloads nil nil ("flymake-pkg.el") (0 0 0 0)) +\\{flymake-mode-map} -;;;*** +(fn &optional ARG)" t) +(autoload 'flymake-mode-on "flymake" "\ +Turn Flymake mode on.") +(autoload 'flymake-mode-off "flymake" "\ +Turn Flymake mode off.") +(register-definition-prefixes "flymake" '("flymake-")) +;;; End of scraped data + +(provide 'flymake-autoloads) + ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; flymake-autoloads.el ends here diff --git a/elpa/flymake-1.3.4/flymake-pkg.el b/elpa/flymake-1.3.7/flymake-pkg.el similarity index 71% rename from elpa/flymake-1.3.4/flymake-pkg.el rename to elpa/flymake-1.3.7/flymake-pkg.el index 255f3225..2d97e2a3 100644 --- a/elpa/flymake-1.3.4/flymake-pkg.el +++ b/elpa/flymake-1.3.7/flymake-pkg.el @@ -1,2 +1,2 @@ ;; Generated package description from flymake.el -*- no-byte-compile: t -*- -(define-package "flymake" "1.3.4" "A universal on-the-fly syntax checker" '((emacs "26.1") (eldoc "1.14.0") (project "0.7.1")) :commit "d45f450cff757ed520a7ee36c632ab62387c7bc9" :url "https://elpa.gnu.org/packages/flymake.html" :authors '(("Pavel Kobyakov" . "pk_at_work@yahoo.com")) :maintainer '("João Távora" . "joaotavora@gmail.com") :keywords '("c" "languages" "tools")) +(define-package "flymake" "1.3.7" "A universal on-the-fly syntax checker" '((emacs "26.1") (eldoc "1.14.0") (project "0.7.1")) :commit "309823ff7796416414cee8c6f4d2650615c19f64" :url "https://elpa.gnu.org/packages/flymake.html" :authors '(("Pavel Kobyakov" . "pk_at_work@yahoo.com")) :maintainer '("João Távora" . "joaotavora@gmail.com") :keywords '("c" "languages" "tools")) diff --git a/elpa/flymake-1.3.4/flymake.el b/elpa/flymake-1.3.7/flymake.el similarity index 87% rename from elpa/flymake-1.3.4/flymake.el rename to elpa/flymake-1.3.7/flymake.el index f2fe97cb..fb000517 100644 --- a/elpa/flymake-1.3.4/flymake.el +++ b/elpa/flymake-1.3.7/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.3.4 +;; Version: 1.3.7 ;; Keywords: c languages tools ;; Package-Requires: ((emacs "26.1") (eldoc "1.14.0") (project "0.7.1")) @@ -114,7 +114,7 @@ (require 'thingatpt) ; end-of-thing (require 'warnings) ; warning-numeric-level, display-warning (require 'compile) ; for some faces -;; We need the next require to avoid compiler warnings and run-time +;; We need the next `require' to avoid compiler warnings and run-time ;; errors about mouse-wheel-up/down-event in builds --without-x, where ;; mwheel is not preloaded. (require 'mwheel) @@ -354,8 +354,13 @@ the diagnostic's type symbol." If neither BEG or END is supplied, use whole accessible buffer, otherwise if BEG is non-nil and END is nil, consider only diagnostics at BEG." - (mapcar (lambda (ov) (overlay-get ov 'flymake-diagnostic)) - (flymake--overlays :beg beg :end end))) + (save-restriction + (widen) + (cl-loop for o in + (cond (end (overlays-in beg end)) + (beg (overlays-at beg)) + (t (overlays-in (point-min) (point-max)))) + when (overlay-get o 'flymake-diagnostic) collect it))) (defmacro flymake--diag-accessor (public internal thing) "Make PUBLIC an alias for INTERNAL, add doc using THING." @@ -385,7 +390,7 @@ type." (flymake--lookup-type-property (flymake-diagnostic-type diag) 'echo-face 'flymake-error))))) -(cl-defun flymake--overlays (&key beg end filter compare key) +(cl-defun flymake--really-all-overlays () "Get flymake-related overlays. If BEG is non-nil and END is nil, consider only `overlays-at' BEG. Otherwise consider `overlays-in' the region comprised by BEG @@ -393,19 +398,8 @@ and END, defaulting to the whole buffer. Remove all that do not verify FILTER, a function, and sort them by COMPARE (using KEY)." (save-restriction (widen) - (let ((ovs (cl-remove-if-not - (lambda (ov) - (and (overlay-get ov 'flymake-diagnostic) - (or (not filter) - (funcall filter ov)))) - (if (and beg (null end)) - (overlays-at beg t) - (overlays-in (or beg (point-min)) - (or end (point-max))))))) - (if compare - (cl-sort ovs compare :key (or key - #'identity)) - ovs)))) + (cl-remove-if-not (lambda (o) (overlay-get o 'flymake-overlay)) + (overlays-in (point-min) (point-max))))) (defface flymake-error '((((supports :underline (:style wave))) @@ -434,22 +428,55 @@ verify FILTER, a function, and sort them by COMPARE (using KEY)." (defface flymake-error-echo '((t :inherit compilation-error)) "Face used for showing summarized descriptions of errors." - :package-version '("Flymake" . "1.3.4")) + :package-version '(Flymake . "1.3.4")) (defface flymake-warning-echo '((t :inherit compilation-warning)) "Face used for showing summarized descriptions of warnings." - :package-version '("Flymake" . "1.3.4")) + :package-version '(Flymake . "1.3.4")) (defface flymake-note-echo - '((t :inherit flymake-note)) + '((t :inherit compilation-info)) "Face used for showing summarized descriptions of notes." - :package-version '("Flymake" . "1.3.4")) + :package-version '(Flymake . "1.3.4")) + +(defface flymake-end-of-line-diagnostics-face + '((t :height 0.85 :box (:line-width -1))) + "Face used for end-of-line diagnostics. +See variable `flymake-show-diagnostics-at-end-of-line'." + :package-version '(Flymake . "1.3.5")) + +(defface flymake-error-echo-at-eol + '((t :inherit (flymake-end-of-line-diagnostics-face compilation-error))) + "Face like `flymake-error-echo', but for end-of-line overlays." + :package-version '(Flymake . "1.3.5")) + +(defface flymake-warning-echo-at-eol + '((t :inherit (flymake-end-of-line-diagnostics-face compilation-warning))) + "Face like `flymake-warning-echo', but for end-of-line overlays." + :package-version '(Flymake . "1.3.5")) + +(defface flymake-note-echo-at-eol + '((t :inherit (flymake-end-of-line-diagnostics-face compilation-info))) + "Face like `flymake-note-echo', but for end-of-line overlays." + :package-version '(Flymake . "1.3.5")) + +(defface flymake-eol-information-face + '((t :inherit (flymake-end-of-line-diagnostics-face) + :box nil + :slant italic)) + "Face used for information about end-of-line diagnostics." + :package-version '(Flymake . "1.3.6")) (defcustom flymake-show-diagnostics-at-end-of-line nil - "If non-nil, add diagnostic summary messages at end-of-line." - :type 'boolean - :package-version '("Flymake" . "1.3.4")) + "If non-nil, add diagnostic summary messages at end-of-line. +The value `short' means that only the most severe diagnostic +shall be shown. Any other non-nil value means show all +diagnostic summaries at end-of-line." + :type '(choice (const :tag "Display most severe diagnostic" short) + (const :tag "Display all diagnostics" t) + (const :tag "Don't display diagnostics at end-of-line" nil)) + :package-version '(Flymake . "1.3.6")) (define-obsolete-face-alias 'flymake-warnline 'flymake-warning "26.1") (define-obsolete-face-alias 'flymake-errline 'flymake-error "26.1") @@ -606,7 +633,7 @@ Node `(Flymake)Flymake error types'" (put 'flymake-error 'severity (warning-numeric-level :error)) (put 'flymake-error 'mode-line-face 'flymake-error-echo) (put 'flymake-error 'echo-face 'flymake-error-echo) -(put 'flymake-error 'eol-face 'flymake-error-echo) +(put 'flymake-error 'eol-face 'flymake-error-echo-at-eol) (put 'flymake-error 'flymake-type-name "error") (put 'flymake-warning 'face 'flymake-warning) @@ -614,7 +641,7 @@ Node `(Flymake)Flymake error types'" (put 'flymake-warning 'severity (warning-numeric-level :warning)) (put 'flymake-warning 'mode-line-face 'flymake-warning-echo) (put 'flymake-warning 'echo-face 'flymake-warning-echo) -(put 'flymake-warning 'eol-face 'flymake-warning-echo) +(put 'flymake-warning 'eol-face 'flymake-warning-echo-at-eol) (put 'flymake-warning 'flymake-type-name "warning") (put 'flymake-note 'face 'flymake-note) @@ -622,7 +649,7 @@ Node `(Flymake)Flymake error types'" (put 'flymake-note 'severity (warning-numeric-level :debug)) (put 'flymake-note 'mode-line-face 'flymake-note-echo) (put 'flymake-note 'echo-face 'flymake-note-echo) -(put 'flymake-note 'eol-face 'flymake-note-echo) +(put 'flymake-note 'eol-face 'flymake-note-echo-at-eol) (put 'flymake-note 'flymake-type-name "note") (defun flymake--lookup-type-property (type prop &optional default) @@ -682,9 +709,49 @@ associated `flymake-category' return DEFAULT." (defun flymake--delete-overlay (ov) "Like `delete-overlay', delete OV, but do some more stuff." (let ((eolov (overlay-get ov 'eol-ov))) - (when eolov (delete-overlay eolov)) + (when eolov + (let ((src-ovs (delq ov (overlay-get eolov 'flymake-eol-source-overlays)))) + (overlay-put eolov 'flymake-eol-source-overlays src-ovs))) (delete-overlay ov))) +(defun flymake--eol-overlay-summary (src-ovs) + "Helper function for `flymake--eol-overlay-update'." + (cl-flet ((summarize (d) + (propertize (flymake-diagnostic-oneliner d t) 'face + (flymake--lookup-type-property (flymake--diag-type d) + 'eol-face)))) + (let* ((diags + (cl-sort + (mapcar (lambda (o) (overlay-get o 'flymake-diagnostic)) src-ovs) + #'> + :key (lambda (d) (flymake--severity (flymake-diagnostic-type d))))) + (summary + (concat + " " + (cond ((eq flymake-show-diagnostics-at-end-of-line 'short) + (concat + (summarize (car diags)) + (and (cdr diags) + (concat + " " + (propertize (format "and %s more" + (1- (length diags))) + 'face 'flymake-eol-information-face))))) + (t + (mapconcat #'summarize diags " ")))))) + (put-text-property 0 1 'cursor t summary) + summary))) + +(defun flymake--update-eol-overlays () + "Update the `before-string' property of end-of-line overlays." + (save-excursion + (widen) + (dolist (o (overlays-in (point-min) (point-max))) + (when (overlay-get o 'flymake--eol-overlay) + (if-let ((src-ovs (overlay-get o 'flymake-eol-source-overlays))) + (overlay-put o 'before-string (flymake--eol-overlay-summary src-ovs)) + (delete-overlay o)))))) + (cl-defun flymake--highlight-line (diagnostic &optional foreign) "Attempt to overlay DIAGNOSTIC in current buffer. @@ -720,9 +787,9 @@ Return nil or the overlay created." (setq beg a end b)))) (setf (flymake--diag-beg diagnostic) beg (flymake--diag-end diagnostic) end) - ;; Try to fix the remedy the situation if there is the same - ;; diagnostic is already registered in the same place, which only - ;; happens for clashes between domestic and foreign diagnostics + ;; Try to remedy the situation if the same diagnostic is already + ;; registered in the same place. This happens for clashes between + ;; domestic and foreign diagnostics (cl-loop for e in (flymake-diagnostics beg end) for eov = (flymake--diag-overlay e) when (flymake--equal-diagnostic-p e diagnostic) @@ -741,7 +808,13 @@ Return nil or the overlay created." (flymake--diag-end e) (flymake--diag-orig-end e)) (flymake--delete-overlay eov))) - (setq ov (make-overlay end beg)) + (setq ov (make-overlay beg end)) + (setf (flymake--diag-overlay diagnostic) ov) + (when (= (overlay-start ov) (overlay-end ov)) + ;; Some backends report diagnostics with invalid bounds. Don't + ;; bother. + (delete-overlay ov) + (cl-return-from flymake--highlight-line nil)) (setf (flymake--diag-beg diagnostic) (overlay-start ov) (flymake--diag-end diagnostic) (overlay-end ov)) ;; First set `category' in the overlay @@ -758,37 +831,6 @@ Return nil or the overlay created." (flymake--lookup-type-property type 'flymake-overlay-control)) (alist-get type flymake-diagnostic-types-alist)) do (overlay-put ov ov-prop value)) - ;; Handle `flymake-show-diagnostics-at-end-of-line' - ;; - (when-let ((eol-face (and flymake-show-diagnostics-at-end-of-line - (flymake--lookup-type-property type 'eol-face)))) - (save-excursion - (goto-char (overlay-start ov)) - (let* ((start (line-end-position)) - (end (min (1+ start) (point-max))) - (eolov (car - (cl-remove-if-not - (lambda (o) (overlay-get o 'flymake-source-ovs)) - (overlays-at start)))) - (bs (flymake-diagnostic-oneliner diagnostic t))) - (setq bs (propertize bs 'face eol-face)) - ;; FIXME: 1. no checking if there are unexpectedly more than - ;; one eolov at point. 2. The first regular source ov to - ;; die also kills the eolov (very rare this matters, but - ;; could be improved). - (cond (eolov - (overlay-put eolov 'before-string - (concat (overlay-get eolov 'before-string) " " bs)) - (overlay-put eolov 'flymake-source-ovs - (cons ov (overlay-get eolov 'flymake-source-ovs)))) - (t - (setq eolov (make-overlay start end nil t nil)) - (setq bs (concat " " bs)) - (put-text-property 0 1 'cursor t bs) - (overlay-put eolov 'before-string bs) - (overlay-put eolov 'evaporate (not (= start end))) - (overlay-put eolov 'flymake-source-ovs (list ov)) - (overlay-put ov 'eol-ov eolov)))))) ;; Now ensure some essential defaults are set ;; (cl-flet ((default-maybe @@ -820,8 +862,29 @@ Return nil or the overlay created." ;; Some properties can't be overridden. ;; (overlay-put ov 'evaporate t) + (overlay-put ov 'flymake-overlay t) (overlay-put ov 'flymake-diagnostic diagnostic) - (setf (flymake--diag-overlay diagnostic) ov) + ;; Handle `flymake-show-diagnostics-at-end-of-line' + ;; + (when flymake-show-diagnostics-at-end-of-line + (save-excursion + (goto-char (overlay-start ov)) + (let* ((start (line-end-position)) + (end (min (1+ start) (point-max))) + (eolov (car + (cl-remove-if-not + (lambda (o) (overlay-get o 'flymake-eol-source-overlays)) + (overlays-in start end))))) + ;; FIXME: 1. no checking if there are unexpectedly more than + ;; one eolov at point. + (if eolov + (push ov (overlay-get eolov 'flymake-eol-source-overlays)) + (setq eolov (make-overlay start end nil t nil)) + (overlay-put eolov 'flymake-overlay t) + (overlay-put eolov 'flymake--eol-overlay t) + (overlay-put eolov 'flymake-eol-source-overlays (list ov)) + (overlay-put eolov 'evaporate (not (= start end)))) ; FIXME: fishy + (overlay-put ov 'eol-ov eolov)))) ov)) ;; Nothing in Flymake uses this at all any more, so this is just for @@ -930,6 +993,14 @@ report applies to that region." (float-time (time-since flymake-check-start-time)))))) (setf (flymake--state-reported-p state) t) + ;; All of the above might have touched the eol overlays, so issue + ;; a call to update them. But check running and reporting + ;; backends first to flickering when multiple backends touch the + ;; same eol overlays. + (when (and flymake-show-diagnostics-at-end-of-line + (not (cl-set-difference (flymake-running-backends) + (flymake-reporting-backends)))) + (flymake--update-eol-overlays)) (flymake--update-diagnostics-listings (current-buffer)))) (defun flymake--clear-foreign-diags (state) @@ -942,6 +1013,9 @@ report applies to that region." (defvar-local flymake-mode nil) +(defvar-local flymake--mode-line-counter-cache nil + "A cache used in `flymake-mode-line-counters'.") + (cl-defun flymake--publish-diagnostics (diags &key backend state region) "Helper for `flymake--handle-report'. Publish DIAGS, which contain diagnostics for the current buffer @@ -1002,7 +1076,9 @@ and other buffers." (setf (flymake--diag-locus d) (buffer-file-name)))) (cl-assert (stringp (flymake--diag-locus d))) (push d (gethash (flymake--diag-locus d) - (flymake--state-foreign-diags state)))))))) + (flymake--state-foreign-diags state)))))) + ;; Finally, flush some caches + (setq flymake--mode-line-counter-cache nil))) (defun flymake-make-report-fn (backend &optional token) "Make a suitable anonymous report function for BACKEND. @@ -1071,15 +1147,7 @@ with a report function." (setf (flymake--state-running state) run-token (flymake--state-disabled state) nil (flymake--state-reported-p state) nil)) - ;; FIXME: Should use `condition-case-unless-debug' here, but don't - ;; for two reasons: (1) that won't let me catch errors from inside - ;; `ert-deftest' where `debug-on-error' appears to be always - ;; t. (2) In cases where the user is debugging elisp somewhere - ;; else, and using flymake, the presence of a frequently - ;; misbehaving backend in the global hook (most likely the legacy - ;; backend) will trigger an annoying backtrace. - ;; - (condition-case err + (condition-case-unless-debug err (apply backend (flymake-make-report-fn backend run-token) args) (error @@ -1146,6 +1214,11 @@ Interactively, with a prefix arg, FORCE is t." (cl-reduce #'max (mapcar #'cadr flymake--recent-changes)))))) (setq flymake--recent-changes nil) + (run-hook-wrapped + 'flymake-diagnostic-functions + (lambda (backend) + (flymake--with-backend-state backend state + (setf (flymake--state-reported-p state) nil)))) (run-hook-wrapped 'flymake-diagnostic-functions (lambda (backend) @@ -1216,7 +1289,7 @@ special *Flymake log* buffer." :group 'flymake :lighter ;; existing diagnostic overlays, lest we forget them by blindly ;; reinitializing `flymake--state' in the next line. ;; See https://github.com/joaotavora/eglot/issues/223. - (mapc #'flymake--delete-overlay (flymake--overlays)) + (mapc #'flymake--delete-overlay (flymake--really-all-overlays)) (setq flymake--state (make-hash-table)) (setq flymake--recent-changes nil) @@ -1263,13 +1336,13 @@ special *Flymake log* buffer." :group 'flymake :lighter (when flymake-timer (cancel-timer flymake-timer) (setq flymake-timer nil)) - (mapc #'flymake--delete-overlay (flymake--overlays)) + (mapc #'flymake--delete-overlay (flymake--really-all-overlays)) (when flymake--state (maphash (lambda (_backend state) (flymake--clear-foreign-diags state)) - flymake--state))) + flymake--state)))) ;; turning Flymake on or off has consequences for listings - (flymake--update-diagnostics-listings (current-buffer)))) + (flymake--update-diagnostics-listings (current-buffer))) (defun flymake--schedule-timer-maybe () "(Re)schedule an idle timer for checking the buffer. @@ -1308,12 +1381,29 @@ Do it only if `flymake-no-changes-timeout' is non-nil." (make-obsolete 'flymake-mode-on 'flymake-mode "26.1") (make-obsolete 'flymake-mode-off 'flymake-mode "26.1") -(defun flymake-after-change-function (start stop _len) +(defun flymake-after-change-function (start stop pre-change-len) "Start syntax check for current buffer if it isn't already running. START and STOP and LEN are as in `after-change-functions'." (let((new-text (buffer-substring start stop))) (push (list start stop new-text) flymake--recent-changes) - (flymake--schedule-timer-maybe))) + (flymake--schedule-timer-maybe)) + ;; Some special handling to prevent eol overlays from temporarily + ;; moving to wrong line + (when (and flymake-show-diagnostics-at-end-of-line + (zerop pre-change-len)) + (save-excursion + (goto-char start) + (when-let* ((probe (search-forward "\n" stop t)) + (eolovs (cl-remove-if-not + (lambda (o) + (let ((lbound + (cl-loop for s in (overlay-get o 'flymake-eol-source-overlays) + minimizing (overlay-start s)))) + (and lbound (< lbound (1- probe))))) + (overlays-at (line-end-position))))) + (goto-char start) + (let ((newend (line-end-position))) + (dolist (ov eolovs) (move-overlay ov newend (1+ newend)))))))) (defun flymake-after-save-hook () (when flymake-start-on-save-buffer @@ -1358,20 +1448,17 @@ default) no filter is applied." '(:error :warning)) t)) (let* ((n (or n 1)) - (ovs (flymake--overlays :filter - (lambda (ov) - (let ((diag (overlay-get - ov - 'flymake-diagnostic))) - (and diag - (or - (not filter) - (cl-find - (flymake--severity - (flymake-diagnostic-type diag)) - filter :key #'flymake--severity))))) - :compare (if (cl-plusp n) #'< #'>) - :key #'overlay-start)) + (ovs (cl-loop + for o in (overlays-in (point-min) (point-max)) + for diag = (overlay-get o 'flymake-diagnostic) + when (and diag (or (not filter) (cl-find + (flymake--severity + (flymake-diagnostic-type diag)) + filter :key #'flymake--severity))) + collect o into retval + finally (cl-return + (cl-sort retval (if (cl-plusp n) #'< #'>) + :key #'overlay-start)))) (tail (cl-member-if (lambda (ov) (if (cl-plusp n) (> (overlay-start ov) @@ -1463,7 +1550,7 @@ The counters are only placed if some Flymake backend initialized correctly.") (defvar flymake-mode-line-error-counter - `(:eval (flymake--mode-line-counter :error t))) + `(:eval (flymake--mode-line-counter :error))) (defvar flymake-mode-line-warning-counter `(:eval (flymake--mode-line-counter :warning))) (defvar flymake-mode-line-note-counter @@ -1530,9 +1617,38 @@ correctly.") (defun flymake--mode-line-counters () (when (flymake-running-backends) flymake-mode-line-counter-format)) -(defun flymake--mode-line-counter (type &optional no-space) - "Compute number of diagnostics in buffer with TYPE's severity. -TYPE is usually keyword `:error', `:warning' or `:note'." +(defun flymake--mode-line-counter-scroll-prev (event) + (interactive "e") + (let* ((event-start (event-start event)) + (posn-string (posn-string event-start)) + (type (get-text-property + (cdr posn-string) 'flymake--diagnostic-type (car posn-string)))) + (with-selected-window (posn-window event-start) + (flymake-goto-prev-error 1 (list type) t)))) + +(defun flymake--mode-line-counter-scroll-next (event) + (interactive "e") + (let* ((event-start (event-start event)) + (posn-string (posn-string event-start)) + (type (get-text-property + (cdr posn-string) 'flymake--diagnostic-type (car posn-string)))) + (with-selected-window (posn-window event-start) + (flymake-goto-next-error 1 (list type) t)))) + +(defvar flymake--mode-line-counter-map + (let ((map (make-sparse-keymap))) + (define-key map (vector 'mode-line mouse-wheel-down-event) + #'flymake--mode-line-counter-scroll-prev) + (define-key map [mode-line wheel-down] + #'flymake--mode-line-counter-scroll-prev) + (define-key map (vector 'mode-line mouse-wheel-up-event) + #'flymake--mode-line-counter-scroll-next) + (define-key map [mode-line wheel-up] + #'flymake--mode-line-counter-scroll-next) + map)) + +(defun flymake--mode-line-counter-1 (type) + "Helper for `flymake--mode-line-counter'." (let ((count 0) (face (flymake--lookup-type-property type 'mode-line-face @@ -1549,26 +1665,28 @@ TYPE is usually keyword `:error', `:warning' or `:note'." (warning-numeric-level flymake-suppress-zero-counters))) (t t))) - `(,(if no-space "" '(:propertize " ")) + `(,(if (eq type :error) "" '(:propertize " ")) (:propertize ,(format "%d" count) face ,face mouse-face mode-line-highlight - keymap - ,(let ((map (make-sparse-keymap))) - (define-key map (vector 'mode-line - mouse-wheel-down-event) - (lambda (event) - (interactive "e") - (with-selected-window (posn-window (event-start event)) - (flymake-goto-prev-error 1 (list type) t)))) - (define-key map (vector 'mode-line - mouse-wheel-up-event) - (lambda (event) - (interactive "e") - (with-selected-window (posn-window (event-start event)) - (flymake-goto-next-error 1 (list type) t)))) - map)))))) + help-echo ,(format "Number of %s; scroll mouse to view." + (cond + ((eq type :error) "errors") + ((eq type :warning) "warnings") + ((eq type :note) "notes") + (t (format "%s diagnostics" type)))) + flymake--diagnostic-type ,type + keymap ,flymake--mode-line-counter-map))))) + +(defun flymake--mode-line-counter (type) + "Compute number of diagnostics in buffer with TYPE's severity. +TYPE is usually keyword `:error', `:warning' or `:note'." + (let ((probe (alist-get type flymake--mode-line-counter-cache 'none))) + (if (eq probe 'none) + (setf (alist-get type flymake--mode-line-counter-cache) + (flymake--mode-line-counter-1 type)) + probe))) ;;; Per-buffer diagnostic listing @@ -1859,6 +1977,4 @@ some of this variable's contents the diagnostic listings.") (provide 'flymake) -(require 'flymake-proc) - ;;; flymake.el ends here diff --git a/elpa/flymake-easy-20141022.1828/flymake-easy-autoloads.el b/elpa/flymake-easy-20141022.1828/flymake-easy-autoloads.el deleted file mode 100644 index 1a2e0203..00000000 --- a/elpa/flymake-easy-20141022.1828/flymake-easy-autoloads.el +++ /dev/null @@ -1,26 +0,0 @@ -;;; flymake-easy-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; -;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - - -;;;### (autoloads nil "flymake-easy" "flymake-easy.el" (0 0 0 0)) -;;; Generated autoloads from flymake-easy.el - -(register-definition-prefixes "flymake-easy" '("flymake-easy-")) - -;;;*** - -;;;### (autoloads nil nil ("flymake-easy-pkg.el") (0 0 0 0)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; flymake-easy-autoloads.el ends here diff --git a/elpa/flymake-easy-20141022.1828/flymake-easy-pkg.el b/elpa/flymake-easy-20141022.1828/flymake-easy-pkg.el deleted file mode 100644 index 40493bbf..00000000 --- a/elpa/flymake-easy-20141022.1828/flymake-easy-pkg.el +++ /dev/null @@ -1,12 +0,0 @@ -(define-package "flymake-easy" "20141022.1828" "Helpers for easily building flymake checkers" 'nil :commit "2a24f260cdc3b9c8f9263b653a475d90efa1d392" :authors - '(("Steve Purcell" . "steve@sanityinc.com")) - :maintainers - '(("Steve Purcell" . "steve@sanityinc.com")) - :maintainer - '("Steve Purcell" . "steve@sanityinc.com") - :keywords - '("convenience" "internal") - :url "https://github.com/purcell/flymake-easy") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/flymake-easy-20240624.1702/flymake-easy-autoloads.el b/elpa/flymake-easy-20240624.1702/flymake-easy-autoloads.el new file mode 100644 index 00000000..59651c77 --- /dev/null +++ b/elpa/flymake-easy-20240624.1702/flymake-easy-autoloads.el @@ -0,0 +1,28 @@ +;;; flymake-easy-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + +;;; Code: + +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from flymake-easy.el + +(register-definition-prefixes "flymake-easy" '("flymake-easy-")) + +;;; End of scraped data + +(provide 'flymake-easy-autoloads) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; no-native-compile: t +;; coding: utf-8-emacs-unix +;; End: + +;;; flymake-easy-autoloads.el ends here diff --git a/elpa/flymake-easy-20240624.1702/flymake-easy-pkg.el b/elpa/flymake-easy-20240624.1702/flymake-easy-pkg.el new file mode 100644 index 00000000..140c5e8d --- /dev/null +++ b/elpa/flymake-easy-20240624.1702/flymake-easy-pkg.el @@ -0,0 +1,10 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "flymake-easy" "20240624.1702" + "Helpers for easily building flymake checkers." + () + :url "https://github.com/purcell/flymake-easy" + :commit "1986500f75ea06f006ab1734abcce441117d385d" + :revdesc "1986500f75ea" + :keywords '("convenience" "internal") + :authors '(("Steve Purcell" . "steve@sanityinc.com")) + :maintainers '(("Steve Purcell" . "steve@sanityinc.com"))) diff --git a/elpa/flymake-easy-20141022.1828/flymake-easy.el b/elpa/flymake-easy-20240624.1702/flymake-easy.el similarity index 98% rename from elpa/flymake-easy-20141022.1828/flymake-easy.el rename to elpa/flymake-easy-20240624.1702/flymake-easy.el index 6c452705..8576429e 100644 --- a/elpa/flymake-easy-20141022.1828/flymake-easy.el +++ b/elpa/flymake-easy-20240624.1702/flymake-easy.el @@ -4,7 +4,8 @@ ;; Author: Steve Purcell ;; URL: https://github.com/purcell/flymake-easy -;; Version: DEV +;; Package-Version: 20240624.1702 +;; Package-Revision: 1986500f75ea ;; Keywords: convenience, internal ;; This program is free software; you can redistribute it and/or modify diff --git a/elpa/flymake-perlcritic-20120328.814/bin/flymake_perlcritic b/elpa/flymake-perlcritic-20120328.814/bin/flymake_perlcritic deleted file mode 100755 index 4b931121..00000000 --- a/elpa/flymake-perlcritic-20120328.814/bin/flymake_perlcritic +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# Wrapper around perlcritic and perl -c for Emacs flymake. - -showhelp() { - echo "flymake_perlcritic [-I ] [-h] - -Run perlcritic and \"perl -c\" on in a manner appropriate for use by Emacs flymake-perlcritic.el. - - -I Add the supplied dir to \$PERL5LIB include paths. - -h Display this help. - The source file to run the checks on."; - exit 0; -} - -while getopts "I:h" "OPTNAME"; -do - case $OPTNAME in - I) INCLUDE=$OPTARG ;; - h) showhelp ;; - *) exit -1 ;; - esac -done -shift $(($OPTIND - 1)) - -FILE_NAME="$1" -shift - -if [ -n "$INCLUDE" ]; then - if [ -n "$PERL5LIB" ]; then - export PERL5LIB="$INCLUDE:$PERL5LIB" - else - export PERL5LIB="$INCLUDE" - fi -fi - -# Run perlcritic first. -# TODO: be nice to include severity and have it turn into warning/error. -perlcritic --nocolour "$FILE_NAME" --verbose "%f:%l:%c: Warning: %m. %e.\n" $* - -# Run perl -c too for good measure. -perl -wc -Mstrict "$FILE_NAME" - -exit 0 \ No newline at end of file diff --git a/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-autoloads.el b/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-autoloads.el deleted file mode 100644 index 49630e46..00000000 --- a/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-autoloads.el +++ /dev/null @@ -1,27 +0,0 @@ -;;; flymake-perlcritic-autoloads.el --- automatically extracted autoloads -;; -;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - - -;;;### (autoloads nil "flymake-perlcritic" "flymake-perlcritic.el" -;;;;;; (0 0 0 0)) -;;; Generated autoloads from flymake-perlcritic.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "flymake-perlcritic" '("flymake-perlcritic-"))) - -;;;*** - -;;;### (autoloads nil nil ("flymake-perlcritic-pkg.el") (0 0 0 0)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; flymake-perlcritic-autoloads.el ends here diff --git a/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-pkg.el b/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-pkg.el deleted file mode 100644 index 6f85c8e8..00000000 --- a/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic-pkg.el +++ /dev/null @@ -1,10 +0,0 @@ -(define-package "flymake-perlcritic" "20120328.814" "Flymake handler for Perl to invoke Perl::Critic" - '((flymake "0.3")) - :authors - '(("Sam Graham ")) - :maintainer - '("Sam Graham ") - :url "https://github.com/illusori/emacs-flymake-perlcritic") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic.el b/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic.el deleted file mode 100644 index e7a117b6..00000000 --- a/elpa/flymake-perlcritic-20120328.814/flymake-perlcritic.el +++ /dev/null @@ -1,90 +0,0 @@ -;;; flymake-perlcritic.el --- Flymake handler for Perl to invoke Perl::Critic -;; -;; Copyright (C) 2011-2012 Free Software Foundation, Inc. -;; -;; Author: Sam Graham -;; Maintainer: Sam Graham -;; URL: https://github.com/illusori/emacs-flymake-perlcritic -;; Version: 1.0.3 -;; Package-Requires: ((flymake "0.3")) -;; -;; 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 . -;; -;;; Commentary: -;; -;; flymake-perlcritic.el adds support to flymake.el for running Perl::Critic -;; (http://search.cpan.org/perldoc?Perl::Critic) to perform static -;; analysis of your Perl code in addition to syntax checking. -;; -;;; Usage: -;; (require 'flymake-perlcritic) - -(eval-when-compile (require 'flymake)) - -(defcustom flymake-perlcritic-command (executable-find - (concat (file-name-directory (or load-file-name buffer-file-name)) - "bin/flymake_perlcritic")) - "If flymake_perlcritic isn't in your $PATH, set this to the command needed to run it." - :group 'flymake-perlcritic - :type 'string) - -(defcustom flymake-perlcritic-profile nil - "The path to the profile file to configure perlcritic, if nil then perlcritic will look in its default location (~/.perlcriticrc)." - :group 'flymake-perlcritic - :type 'string) - -(defcustom flymake-perlcritic-severity 4 - "The severity to run perlcritic at, values are 1 to 5 with 1 being strictest." - :group 'flymake-perlcritic - :type 'integer) - -(defun flymake-perlcritic-init () - (let* ((temp-file (flymake-init-create-temp-buffer-copy - 'flymake-create-temp-with-folder-structure)) - (local-file (file-relative-name temp-file - (file-name-directory buffer-file-name))) - (include-dir (if (fboundp 'flymake-find-perl-lib-dir) - (flymake-find-perl-lib-dir buffer-file-name)))) - (if (fboundp 'flymake-perlbrew-path-sync) - (flymake-perlbrew-path-sync)) - (list flymake-perlcritic-command - (append - (if include-dir (list (concat "-I" include-dir))) - (list local-file) - (if flymake-perlcritic-profile (list "--profile" flymake-perlcritic-profile)) - (list "--severity" (number-to-string flymake-perlcritic-severity)))))) - -(defun flymake-perlcritic-cleanup () - "Cleanup after `flymake-perlcritic-init' - delete temp file and dirs." - (flymake-safe-delete-file flymake-temp-source-file-name) - (when flymake-temp-source-file-name - (flymake-delete-temp-directory - (file-name-directory flymake-temp-source-file-name)))) - -(eval-after-load "flymake" - '(progn - ;; Add a new error pattern to catch Perl::Critic output, this is a custom - ;; format defined in perlcritic_flymake since the Perl::Critic default - ;; isn't parsable in a way that flymake.el likes. - (add-to-list 'flymake-err-line-patterns - '("\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): \\(.*\\)" 1 2 3 4)) - (let ((mode-and-masks (flymake-get-file-name-mode-and-masks "example.pm"))) - (setcar mode-and-masks 'flymake-perlcritic-init) - (if (nth 1 mode-and-masks) - (setcar (nthcdr 1 mode-and-masks) 'flymake-perlcritic-cleanup) - (nconc mode-and-masks (list 'flymake-perlcritic-cleanup)))) - (add-hook 'perl-mode-hook (lambda() (flymake-mode 1)) t))) - -(provide 'flymake-perlcritic) -;;; flymake-perlcritic.el ends here diff --git a/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-autoloads.el b/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-autoloads.el new file mode 100644 index 00000000..9d25c169 --- /dev/null +++ b/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-autoloads.el @@ -0,0 +1,32 @@ +;;; flymake-perlcritic-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + +;;; Code: + +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from flymake-perlcritic.el + +(autoload 'flymake-perlcritic-setup "flymake-perlcritic" "\ +Set up Flymake perlcritic. +Add perlcritic to the Flymake diagnostic functions. To use it, +add this function to `perl-mode-hook'.") +(register-definition-prefixes "flymake-perlcritic" '("flymake-perlcritic-")) + +;;; End of scraped data + +(provide 'flymake-perlcritic-autoloads) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; no-native-compile: t +;; coding: utf-8-emacs-unix +;; End: + +;;; flymake-perlcritic-autoloads.el ends here diff --git a/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-pkg.el b/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-pkg.el new file mode 100644 index 00000000..3924db74 --- /dev/null +++ b/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic-pkg.el @@ -0,0 +1,10 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "flymake-perlcritic" "20240229.953" + "Flymake handler for Perl to invoke Perl::Critic." + '((flymake "1.2")) + :url "https://github.com/flymake/emacs-flymake-perlcritic" + :commit "f65ac37608b78ce785808c27fba86a8102a4ff95" + :revdesc "f65ac37608b7" + :authors '(("Sam Graham" . "libflymake-perlcritic-emacsBLAHBLAHillusori.co.uk") + ("gemmaro" . "gemmaro.dev@gmail.com")) + :maintainers '(("Sam Graham" . "libflymake-perlcritic-emacsBLAHBLAHillusori.co.uk"))) diff --git a/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic.el b/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic.el new file mode 100644 index 00000000..c8c00a14 --- /dev/null +++ b/elpa/flymake-perlcritic-20240229.953/flymake-perlcritic.el @@ -0,0 +1,165 @@ +;;; flymake-perlcritic.el --- Flymake handler for Perl to invoke Perl::Critic +;; +;; Copyright (C) 2011-2024 Free Software Foundation, Inc. +;; +;; Author: Sam Graham +;; gemmaro +;; Maintainer: Sam Graham +;; URL: https://github.com/illusori/emacs-flymake-perlcritic +;; Package-Version: 20240229.953 +;; Package-Revision: f65ac37608b7 +;; Package-Requires: ((flymake "1.2")) +;; +;; 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 . +;; +;;; Commentary: +;; +;; `flymake-perlcritic.el' adds support to `flymake.el' for running +;; `Perl::Critic' (http://search.cpan.org/perldoc?Perl::Critic) to +;; perform static analysis of your Perl code in addition to syntax +;; checking. +;; +;;; Usage: +;; (add-hook 'perl-mode-hook 'flymake-perlcritic-setup) + +;;; Code: + +(require 'flymake) + +(defcustom flymake-perlcritic-command (executable-find "perlcritic") + "Command of perlcritic. +If `perlcritic' isn't in your `$PATH', set it to the command +needed to run it." + :group 'flymake-perlcritic + :type '(choice file string)) + +(defcustom flymake-perlcritic-profile nil + "Profile path of perlcritic. +The path to the profile file to configure perlcritic, if nil then +perlcritic will look in its default location (`~/.perlcriticrc')." + :group 'flymake-perlcritic + :type '(choice (const :tag "Default" nil) + file)) + +(defconst flymake-perlcritic--severities + '(choice (const :tag "gentle" 5) + (const :tag "stern" 4) + (const :tag "harsh" 3) + (const :tag "cruel" 2) + (const :tag "brutal" 1)) + "Severities of perlcritic. +See also the `perlcritic' documentation[1]. + +[1] https://metacpan.org/dist/Perl-Critic/view/bin/perlcritic#-severity-NAME") + +(defcustom flymake-perlcritic-severity 4 + "The perlcritic severity. +The severity to run perlcritic at, values are from \"brutal\" (1) +to \"gentle\" (5) with \"brutal\" (1) being the strictest." + :group 'flymake-perlcritic + :type flymake-perlcritic--severities) + +(defcustom flymake-perlcritic-error-threshold 5 + "Error threshold for Flymake diagnostic types. +The lower Severities are considered to be at \"warning\" or \"note\" level." + :group 'flymake-perlcritic + :type `(choice (const :tag "Default" nil) + ,flymake-perlcritic--severities)) + +(defcustom flymake-perlcritic-warning-threshold nil + "Warning threshold for Flymake diagnostic types. +The lower severities are considered to be at \"note\" level." + :group 'flymake-perlcritic + :type `(choice (const :tag "Default" nil) + ,flymake-perlcritic--severities)) + +(defvar-local flymake-perlcritic--proc nil + "Flymake perlcritic process.") + +(defun flymake-perlcritic-backend (report-fn &rest _args) + "Flymake for perlcritic. +This calls REPORT-FN to pass diagnostic objects." + (unless flymake-perlcritic-command + (error "Cannot find a suitable perlcritic")) + (when (process-live-p flymake-perlcritic--proc) + (kill-process flymake-perlcritic--proc)) + (let ((source (current-buffer))) + (save-restriction + (widen) + (setq flymake-perlcritic--proc + (make-process + :name "flymake-perlcritic" + :noquery t + :connection-type 'pipe + :buffer (generate-new-buffer " *Flymake-perlcritic*") + :command (flymake-perlcritic-init) + :sentinel (apply-partially 'flymake-perlcritic--sentinel report-fn source))) + (process-send-region flymake-perlcritic--proc (point-min) (point-max)) + (process-send-eof flymake-perlcritic--proc)))) + +(defun flymake-perlcritic--sentinel (report-fn source proc _event) + "Sentinel for perlcritic process PROC. +SOURCE is the target source for perlcritic. When perlcritic +exits successfully, it calls REPORT-FN to report to Flymake." + (when (memq (process-status proc) '(exit signal)) + (unwind-protect + (if (with-current-buffer source (eq proc flymake-perlcritic--proc)) + (with-current-buffer (process-buffer proc) + (goto-char (point-min)) + (cl-loop + while (search-forward-regexp + (rx (group (+ digit)) ":" + (group (+ digit)) ":" + (group (+ digit)) ":" + (group (+ not-newline)) + line-end) + nil t) + for severity = (string-to-number (match-string 1)) + for line = (string-to-number (match-string 2)) + for column = (string-to-number (match-string 3)) + for msg = (match-string 4) + for (beg . end) = (flymake-diag-region source line column) + for type = (cond + ((and flymake-perlcritic-error-threshold + (>= severity flymake-perlcritic-error-threshold)) + :error) + ((and flymake-perlcritic-warning-threshold + (>= severity flymake-perlcritic-warning-threshold)) + :warning) + (t :note)) + collect (flymake-make-diagnostic source beg end type msg) + into diags + finally (funcall report-fn diags))) + (flymake-log :warning "Canceling obsolete check %s" proc)) + (kill-buffer (process-buffer proc))))) + +(defun flymake-perlcritic-init () + "Initialise perlcritic command." + (let ((command (list "perlcritic" + "--nocolour" + "--verbose" "%s:%l:%c:%m. %e. (%p)\\n" + "--severity" (number-to-string flymake-perlcritic-severity)))) + (if flymake-perlcritic-profile + (append command (list "--profile" flymake-perlcritic-profile)) + command))) + +;;;###autoload +(defun flymake-perlcritic-setup () + "Set up Flymake perlcritic. +Add perlcritic to the Flymake diagnostic functions. To use it, +add this function to `perl-mode-hook'." + (add-hook 'flymake-diagnostic-functions 'flymake-perlcritic-backend nil 'local)) + +(provide 'flymake-perlcritic) +;;; flymake-perlcritic.el ends here. diff --git a/elpa/flymake-perlcritic-readme.txt b/elpa/flymake-perlcritic-readme.txt deleted file mode 100644 index 78633779..00000000 --- a/elpa/flymake-perlcritic-readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -flymake-perlcritic.el adds support to flymake.el for running Perl::Critic -(http://search.cpan.org/perldoc?Perl::Critic) to perform static -analysis of your Perl code in addition to syntax checking. -- 2.47.3