summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2023-04-11 13:35:43 +0100
committerJoão Távora <joaotavora@gmail.com>2023-04-11 13:35:43 +0100
commit560950468588117b264a9f916fb578e0eb2a124a (patch)
tree7770a72a6b0ea1915fdefd3700b975965c548a96 /lisp
parentfb66e4d58bbc24abf44157078e8ca51ffed93113 (diff)
downloademacs-560950468588117b264a9f916fb578e0eb2a124a.tar.gz
Flymake: take advantage of new Eldoc options
Only echo the first line of a potentially very large error message. * lisp/progmodes/flymake.el: (flymake-diagnostic-oneliner): New helper. (flymake--tabulated-entries-1) (flymake-eldoc-function): Use it. (Version): Bump to 1.3.2. (Package-Requires): Use Eldoc 1.14.0.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/flymake.el28
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index a352adbba19..1cd9f0a6b0c 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -4,9 +4,9 @@
;; Author: Pavel Kobyakov <pk_at_work@yahoo.com>
;; Maintainer: João Távora <joaotavora@gmail.com>
-;; Version: 1.2.2
+;; Version: 1.3.2
;; Keywords: c languages tools
-;; Package-Requires: ((emacs "26.1") (eldoc "1.1.0") (project "0.7.1"))
+;; Package-Requires: ((emacs "26.1") (eldoc "1.14.0") (project "0.7.1"))
;; This is a GNU ELPA :core package. Avoid functionality that is not
;; compatible with the version of Emacs recorded above.
@@ -371,6 +371,12 @@ diagnostics at BEG."
(flymake--diag-accessor flymake-diagnostic-end flymake--diag-end end)
(flymake--diag-accessor flymake-diagnostic-buffer flymake--diag-locus locus)
+(defun flymake-diagnostic-oneliner (diag)
+ "Get truncated one-line text string for diagnostic DIAG."
+ (let ((txt (flymake-diagnostic-text diag)))
+ (substring txt 0 (cl-loop for i from 0 for a across txt
+ when (eq a ?\n) return i))))
+
(cl-defun flymake--overlays (&key beg end filter compare key)
"Get flymake-related overlays.
If BEG is non-nil and END is nil, consider only `overlays-at'
@@ -1254,10 +1260,17 @@ START and STOP and LEN are as in `after-change-functions'."
(defun flymake-eldoc-function (report-doc &rest _)
"Document diagnostics at point.
Intended for `eldoc-documentation-functions' (which see)."
- (let ((diags (flymake-diagnostics (point))))
- (when diags
- (funcall report-doc
- (mapconcat #'flymake-diagnostic-text diags "\n")))))
+ (when-let ((diags (flymake-diagnostics (point))))
+ (funcall report-doc
+ (mapconcat #'flymake-diagnostic-text diags "\n")
+ :echo (mapconcat (lambda (d)
+ (propertize (flymake-diagnostic-oneliner d)
+ 'face
+ (flymake--lookup-type-property
+ (flymake-diagnostic-type d)
+ 'face
+ 'flymake-error)))
+ diags "\n"))))
(defun flymake-goto-next-error (&optional n filter interactive)
"Go to Nth next Flymake diagnostic that matches FILTER.
@@ -1582,8 +1595,7 @@ filename of the diagnostic relative to that directory."
"\\1\\2" bname)
"(anon)")
'help-echo (format "From `%s' backend" backend))
- (,(replace-regexp-in-string "\n.*" ""
- (flymake-diagnostic-text diag))
+ (,(flymake-diagnostic-oneliner diag)
mouse-face highlight
help-echo "mouse-2: visit this diagnostic"
face nil