From: João Távora Date: Tue, 29 Dec 2020 14:07:03 +0000 (+0000) Subject: Revert "Allow the flymake mode line indicator to be customized" X-Git-Tag: emacs-28.0.90~4509 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ecd9264372a61cf35696288d2d0c8afe77dd084f;p=emacs.git Revert "Allow the flymake mode line indicator to be customized" This reverts commit 37049ee78c4576d340781179317e6cbaaf73b6c3. It's not ready to be used, contains some fundamental errors. See bug#33740. --- diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index b8744f0323f..8f2954bdf4f 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -213,9 +213,6 @@ This section summarizes customization variables used for the configuration of the Flymake user interface. @vtable @code -@item flymake-mode-line-indicator-format -Format to use for the Flymake mode line indicator. - @item flymake-no-changes-timeout If any changes are made to the buffer, syntax check is automatically started after this many seconds, unless the user makes another change, diff --git a/etc/NEWS b/etc/NEWS index a5247a9aea8..0231c167112 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1738,11 +1738,6 @@ height of lines or width of chars. When non-nil, use a new xwidget webkit session after bookmark jump. Otherwise, it will use 'xwidget-webkit-last-session'. -** Flymake mode - -+++ -*** New user option 'flymake-mode-line-indicator-format'. - ** Flyspell mode +++ diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index e78d5d32fff..40bb90d0f15 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1190,16 +1190,6 @@ default) no filter is applied." (put 'flymake--mode-line-format 'risky-local-variable t) -(defcustom flymake-mode-line-indicator-format " Flymake%s[%e %w %n]" - "Format to use for the Flymake mode line indicator. -The following format characters can be used: - -%s: The status. -%e: The number of errors. -%w: The number of warnings. -%n: The number of notes." - :version "28.1" - :type 'string) (defun flymake--mode-line-format () "Produce a pretty minor mode indicator." @@ -1217,97 +1207,102 @@ The following format characters can be used: diags-by-type))) (flymake--backend-state-diags state))) flymake--backend-state) - (format-spec - (propertize - flymake-mode-line-indicator-format - 'mouse-face 'mode-line-highlight - 'help-echo (concat (format "%s known backends\n" (length known)) - (format "%s running\n" (length running)) - (format "%s disabled\n" (length disabled)) - "mouse-1: Display minor mode menu\n" - "mouse-2: Show help for minor mode") - 'keymap (let ((map (make-sparse-keymap))) - (define-key map [mode-line down-mouse-1] - flymake-menu) - (define-key map [mode-line mouse-2] - (lambda () - (interactive) - (describe-function 'flymake-mode))) - map)) - (cons - (cons - ?s (pcase-let ((`(,ind ,face ,explain) - (cond ((null known) - '("?" nil "No known backends")) - (some-waiting - `("Wait" compilation-mode-line-run - ,(format "Waiting for %s running backend(s)" - (length some-waiting)))) - (all-disabled - '("!" compilation-mode-line-run - "All backends disabled")) - (t - '(nil nil nil))))) - (if (not ind) - "" - (concat - ":" (propertize ind - 'face face - 'help-echo explain - 'keymap (let ((map (make-sparse-keymap))) - (define-key map [mode-line mouse-1] - 'flymake-switch-to-log-buffer) - map)))))) - (cl-loop - with types = (hash-table-keys diags-by-type) - with _augmented = (cl-loop for extra in '(:error :warning) - do (cl-pushnew extra types - :key #'flymake--severity)) - for type in (cl-sort types #'> :key #'flymake--severity) - for diags = (gethash type diags-by-type) - for face = (flymake--lookup-type-property - type 'mode-line-face 'compilation-error) - when (or diags - (cond ((eq flymake-suppress-zero-counters t) - nil) - (flymake-suppress-zero-counters - (>= (flymake--severity type) - (warning-numeric-level - flymake-suppress-zero-counters))) - (t t))) - collect (cons - (elt (format "%s" type) 1) - (propertize - (format "%d" (length diags)) - 'face face - 'mouse-face 'mode-line-highlight - 'keymap - (let ((map (make-sparse-keymap)) - (type type)) - (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 - (concat (format "%s diagnostics of type %s\n" - (propertize (format "%d" - (length diags)) - 'face face) - (propertize (format "%s" type) - 'face face)) - (format "%s/%s: previous/next of this type" - mouse-wheel-down-event - mouse-wheel-up-event)))))) - nil t))) + `((:propertize " Flymake" + mouse-face mode-line-highlight + help-echo + ,(concat (format "%s known backends\n" (length known)) + (format "%s running\n" (length running)) + (format "%s disabled\n" (length disabled)) + "mouse-1: Display minor mode menu\n" + "mouse-2: Show help for minor mode") + keymap + ,(let ((map (make-sparse-keymap))) + (define-key map [mode-line down-mouse-1] + flymake-menu) + (define-key map [mode-line mouse-2] + (lambda () + (interactive) + (describe-function 'flymake-mode))) + map)) + ,@(pcase-let ((`(,ind ,face ,explain) + (cond ((null known) + '("?" nil "No known backends")) + (some-waiting + `("Wait" compilation-mode-line-run + ,(format "Waiting for %s running backend(s)" + (length some-waiting)))) + (all-disabled + '("!" compilation-mode-line-run + "All backends disabled")) + (t + '(nil nil nil))))) + (when ind + `((":" + (:propertize ,ind + face ,face + help-echo ,explain + keymap + ,(let ((map (make-sparse-keymap))) + (define-key map [mode-line mouse-1] + 'flymake-switch-to-log-buffer) + map)))))) + ,@(unless (or all-disabled + (null known)) + (cl-loop + with types = (hash-table-keys diags-by-type) + with _augmented = (cl-loop for extra in '(:error :warning) + do (cl-pushnew extra types + :key #'flymake--severity)) + for type in (cl-sort types #'> :key #'flymake--severity) + for diags = (gethash type diags-by-type) + for face = (flymake--lookup-type-property type + 'mode-line-face + 'compilation-error) + when (or diags + (cond ((eq flymake-suppress-zero-counters t) + nil) + (flymake-suppress-zero-counters + (>= (flymake--severity type) + (warning-numeric-level + flymake-suppress-zero-counters))) + (t t))) + collect `(:propertize + ,(format "%d" (length diags)) + face ,face + mouse-face mode-line-highlight + keymap + ,(let ((map (make-sparse-keymap)) + (type type)) + (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 + ,(concat (format "%s diagnostics of type %s\n" + (propertize (format "%d" + (length diags)) + 'face face) + (propertize (format "%s" type) + 'face face)) + (format "%s/%s: previous/next of this type" + mouse-wheel-down-event + mouse-wheel-up-event))) + into forms + finally return + `((:propertize "[") + ,@(cl-loop for (a . rest) on forms by #'cdr + collect a when rest collect + '(:propertize " ")) + (:propertize "]"))))))) ;;; Diagnostics buffer