From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: charles@aurox.ch (Charles A. Roelli) Newsgroups: gmane.emacs.bugs Subject: bug#28732: flymake mouse-wheel portability fix Date: Tue, 27 Feb 2018 20:28:42 +0100 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1519759109 18325 195.159.176.226 (27 Feb 2018 19:18:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Feb 2018 19:18:29 +0000 (UTC) Cc: 28732@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 27 20:18:24 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqklc-0004LG-8o for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Feb 2018 20:18:24 +0100 Original-Received: from localhost ([::1]:39569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqkne-00063K-LJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Feb 2018 14:20:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqkmI-000522-Cv for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 14:19:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqkmE-0004Sg-EB for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 14:19:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56303) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqkmE-0004SC-9s for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 14:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqkmE-0006Pd-0g for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 14:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: charles@aurox.ch (Charles A. Roelli) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Feb 2018 19:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28732 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28732-submit@debbugs.gnu.org id=B28732.151975910924612 (code B ref 28732); Tue, 27 Feb 2018 19:19:01 +0000 Original-Received: (at 28732) by debbugs.gnu.org; 27 Feb 2018 19:18:29 +0000 Original-Received: from localhost ([127.0.0.1]:35967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqklh-0006Ot-J3 for submit@debbugs.gnu.org; Tue, 27 Feb 2018 14:18:29 -0500 Original-Received: from sinyavsky.aurox.ch ([37.35.109.145]:50688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqklf-0006Oe-7a for 28732@debbugs.gnu.org; Tue, 27 Feb 2018 14:18:28 -0500 Original-Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 47658226AF for <28732@debbugs.gnu.org>; Tue, 27 Feb 2018 19:18:49 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= references:subject:subject:in-reply-to:to:from:from:message-id :date:date; s=dkim; t=1519759127; x=1520623128; bh=Sb4bmxA2+OzoJ rG8c00aD1OvUANgRQQoqoJT94spOvo=; b=Hn41nIIU7S7a+lFEKG8NyM0ZhAyH9 b+REmfQAdwgsJeOWoku5wvsagpjkwCcNa5DdM+ZHfDKa+V6hXcTwz5CgLJEF7mQL nbsRyqDMXKsvh10lfZmktwdVmcD8YCImcrBpKTsNuTgTaRGgtHA/aeG+2a/3TuZ6 +yk2WRV6MpFgI8= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Original-Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id tiMvWfq-vhgk for <28732@debbugs.gnu.org>; Tue, 27 Feb 2018 19:18:47 +0000 (UTC) Original-Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 6674A22688; Tue, 27 Feb 2018 19:18:47 +0000 (UTC) In-reply-to: (message from Glenn Morris on Mon, 26 Feb 2018 16:38:50 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143718 Archived-At: > From: Glenn Morris > Cc: 28732@debbugs.gnu.org > Date: Mon, 26 Feb 2018 16:38:50 -0500 > > Hi, > > This change causes errors in without-x builds. > At compile-time: > > In flymake--mode-line-format: > progmodes/flymake.el:1086:49:Warning: reference to free variable > `mouse-wheel-down-event' > progmodes/flymake.el:1092:49:Warning: reference to free variable > `mouse-wheel-up-event' > > At run-time: > Error during redisplay: (eval (flymake--mode-line-format)) signaled > (void-variable mouse-wheel-down-event) > > > Charles A. Roelli wrote: > > > The flymake mode line mouse-wheel scroll thing needs the following fix > > to be more portable. > > > > This change also removes an extra newline at the end of the tooltip, > > which doesn't have to be there as far as I can see. > > > > diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el > > index 45f0adf..007de8f 100644 > > --- a/lisp/progmodes/flymake.el > > +++ b/lisp/progmodes/flymake.el > > @@ -951,11 +951,13 @@ flymake--mode-line-format > > keymap > > ,(let ((map (make-sparse-keymap)) > > (type type)) > > - (define-key map [mode-line mouse-4] > > + (define-key map (vector 'mode-line > > + mouse-wheel-down-event) > > (lambda (_event) > > (interactive "e") > > (flymake-goto-prev-error 1 (list type) t))) > > - (define-key map [mode-line mouse-5] > > + (define-key map (vector 'mode-line > > + mouse-wheel-up-event) > > (lambda (_event) > > (interactive "e") > > (flymake-goto-next-error 1 (list type) t))) > > @@ -967,7 +969,9 @@ flymake--mode-line-format > > 'face face) > > (propertize (format "%s" type) > > 'face face)) > > - "mouse-4/mouse-5: previous/next of this type\n")) > > + (format "%s/%s: previous/next of this type" > > + mouse-wheel-down-event > > + mouse-wheel-up-event))) > > into forms > > finally return > > `((:propertize "[") > Thanks. Is the following change (ignoring whitespace differences) good for emacs-26? diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 58bad8f..d58c5943 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1078,7 +1078,9 @@ face ,face mouse-face mode-line-highlight keymap - ,(let ((map (make-sparse-keymap)) + ,(when (and (boundp 'mouse-wheel-down-event) + (boundp 'mouse-wheel-up-event)) + (let ((map (make-sparse-keymap)) (type type)) (define-key map (vector 'mode-line mouse-wheel-down-event) @@ -1092,9 +1094,11 @@ (interactive "e") (with-selected-window (posn-window (event-start event)) (flymake-goto-next-error 1 (list type) t)))) - map) + map)) help-echo - ,(concat (format "%s diagnostics of type %s\n" + ,(when (and (boundp 'mouse-wheel-down-event) + (boundp 'mouse-wheel-up-event)) + (concat (format "%s diagnostics of type %s\n" (propertize (format "%d" (length diags)) 'face face) @@ -1102,7 +1106,7 @@ 'face face)) (format "%s/%s: previous/next of this type" mouse-wheel-down-event - mouse-wheel-up-event))) + mouse-wheel-up-event)))) into forms finally return `((:propertize "[")