emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/flymake-guile eb5e2c0f97: Improve diagnostic for `unused v


From: ELPA Syncer
Subject: [nongnu] elpa/flymake-guile eb5e2c0f97: Improve diagnostic for `unused variable` and `unused local top`
Date: Tue, 5 Sep 2023 21:59:22 -0400 (EDT)

branch: elpa/flymake-guile
commit eb5e2c0f97639a200d6b709601834b304118b4df
Author: Distopico <distopico@riseup.net>
Commit: Distopico <distopico@riseup.net>

    Improve diagnostic for `unused variable` and `unused local top`
---
 NEWS             |  4 ++++
 flymake-guile.el | 37 +++++++++++++++++++++++++------------
 guix.scm         | 19 ++++---------------
 3 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/NEWS b/NEWS
index ceaf639934..0913ca5c6b 100644
--- a/NEWS
+++ b/NEWS
@@ -3,5 +3,9 @@
 #+TITLE: flymake-guile NEWS – history of user-visible changes
 
 * NEWS
+** 0.5
+- Improve diagnostic position for `unused variable` and `unused local top`
+** 0.4
+- Remove flymake-quickdef dependency
 ** 0.3
 - Improve diagnostic column position
diff --git a/flymake-guile.el b/flymake-guile.el
index b6dd73c822..caad45207c 100644
--- a/flymake-guile.el
+++ b/flymake-guile.el
@@ -5,7 +5,7 @@
 ;; Author: Distopico <distopico@riseup.net>
 ;; Package-Requires: ((emacs "26.1") (flymake "1.2.1"))
 ;; Keywords: language, tools
-;; Version: 0.4
+;; Version: 0.5
 
 ;; 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
@@ -72,8 +72,10 @@ The list of supported warning types/levels can be found by 
running
 (defvar-local flymake-guile--diag-lnum-rx
   ":\\([[:digit:]]+\\):\\([[:digit:]]+\\):\s")
 
-(defvar-local flymake-guile--fix-col-rule-rx
-  "unbound variable")
+(defvar-local flymake-guile--fix-col-rule
+  '(("unbound variable" . +1)
+    ("unused variable" . +2)
+    ("unused local top" . +2)))
 
 (defun flymake-guile--project-path ()
   "Determine project paths from geiser configuration."
@@ -108,6 +110,16 @@ The list of supported warning types/levels can be found by 
running
        ((string= severity "In procedure raise-exception") :error)
        (t :note)))
 
+(defun flymake-guile--get-col-fix (text)
+  "Get diagnostic column position fix base on `TEXT'.
+The column of some types of errors/warning are not consistent and
+will mark all the lines in a multi-line definition so this try to
+fix and getter a better position."
+  (catch 'rule-match
+    (dolist (col-rule flymake-guile--fix-col-rule)
+      (when (string-match-p (car col-rule) text)
+       (throw 'rule-match (cdr col-rule))))))
+
 (defun flymake-guile--get-diagnostic (stack-msg stack-lnum stack-cnum 
stack-file source)
   "Get the diagnostic line and message for the `SOURCE'.
 If the diagnostic has additional information for the source file
@@ -140,15 +152,16 @@ Also verify if the `STACK-FILE' and the source file are 
te same."
       ;; e.g "ice-9/boot-9".
       (setq lnum "0")
       (setq cnum "0"))
-    (cons (cons (string-to-number lnum)
-               (let ((col (string-to-number cnum)))
-                 (if (and (> col 0)
-                          ;; The column in this type of errors are not
-                          ;; consistent And will mark all the lines in a
-                          ;; multi-line definition.
-                          (string-match-p flymake-guile--fix-col-rule-rx text))
-                     (+ col 1)
-                   (- col 1))))
+    (cons (let ((line (string-to-number lnum))
+               (col (string-to-number cnum))
+               (col-fix (flymake-guile--get-col-fix text)))
+           (cons line
+                 (if (and col-fix
+                          (or (> col 0)
+                              (> line 0)))
+                     ;; Try to report in a better position
+                     (+ col col-fix)
+                   col)))
          text)))
 
 (defun flymake-guile--prep-diagnostic (source proc)
diff --git a/guix.scm b/guix.scm
index 277142e95a..74d5afda41 100644
--- a/guix.scm
+++ b/guix.scm
@@ -1,24 +1,13 @@
 (use-modules (guix packages)
+            (guix git)
             (guix build-system emacs)
-            (guix git-download)
-            ((guix licenses) #:prefix license:)
-            (gnu packages emacs-xyz))
+            ((guix licenses) #:prefix license:))
 
 (package
   (name "emacs-flymake-guile")
-  (version "0.4")
-  (source
-   (origin
-     (method git-fetch)
-     (uri
-      (git-reference
-       (url "https://framagit.org/flymake-backends/flymake-guile.git";)
-       (commit version)))
-     (file-name (git-file-name name version))
-     (sha256
-      (base32 "06x237qhvnbyxngbqinjg417n341h652jkagr1a5whximlsaw2c8"))))
+  (version "0.5")
+  (source (git-checkout (url (dirname (current-filename)))))
   (build-system emacs-build-system)
-  (propagated-inputs (list emacs-flymake-quickdef))
   (home-page "https://framagit.org/flymake-backends/flymake-guile";)
   (synopsis "GNU Guile support for Flymake")
   (description



reply via email to

[Prev in Thread] Current Thread [Next in Thread]