From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#38187: 27.0.50; No mouse-wheel scaling on images Date: Mon, 18 Nov 2019 23:37:15 +0200 Organization: LINKOV.NET Message-ID: <87r224sw6s.fsf@mail.linkov.net> References: <87tv79ksuz.fsf@mail.linkov.net> <83zhgy62u8.fsf@gnu.org> <87y2we7r90.fsf@gnus.org> <83lfse5w04.fsf@gnu.org> <87a78u7ags.fsf@gnus.org> <878soemc79.fsf@marxist.se> <87mucut8ch.fsf@mail.linkov.net> <87ftilsg6q.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="85661"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: Stefan Kangas , 38187@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 18 22:53:18 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWoxR-000M6v-FN for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 22:53:17 +0100 Original-Received: from localhost ([::1]:39900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWoxQ-0005G8-8E for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 16:53:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWoxF-0005BZ-Fr for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWoxE-0008QE-69 for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37561) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWoxE-0008QA-35 for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWoxE-0005Iz-1F for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2019 21:53:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38187 X-GNU-PR-Package: emacs Original-Received: via spool by 38187-submit@debbugs.gnu.org id=B38187.157411395120318 (code B ref 38187); Mon, 18 Nov 2019 21:53:03 +0000 Original-Received: (at 38187) by debbugs.gnu.org; 18 Nov 2019 21:52:31 +0000 Original-Received: from localhost ([127.0.0.1]:46376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWowh-0005He-3e for submit@debbugs.gnu.org; Mon, 18 Nov 2019 16:52:31 -0500 Original-Received: from azure.elm.relay.mailchannels.net ([23.83.212.7]:24627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWowf-0005HV-QX for 38187@debbugs.gnu.org; Mon, 18 Nov 2019 16:52:30 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id AAA5C2114A; Mon, 18 Nov 2019 21:52:28 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (100-96-169-13.trex.outbound.svc.cluster.local [100.96.169.13]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8E1F620B12; Mon, 18 Nov 2019 21:52:27 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Mon, 18 Nov 2019 21:52:28 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Robust-Absorbed: 1b8db67c3058c4d7_1574113947980_3282819105 X-MC-Loop-Signature: 1574113947980:2327320703 X-MC-Ingress-Time: 1574113947980 Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTP id 042ACA7014; Mon, 18 Nov 2019 13:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=kGSxUM/YgielRJFu0KG1LdnSw58=; b= yFZktxfDlZ1las9WSWX5ts0r8ZQXySHUxn/v19n17yEhCFN7Ys2vSspdI6lenBiX XwUwoWK1ryv3yD9voti+OJO6VRJ1KHb+qwXe3FtAnKuXGWKrMM0wPAkv3y7e4hS0 fQmMmCsWpfNiwWjleZQG7/eXDiMg4BX8aeYZ6AKOyq4= Original-Received: from mail.jurta.org (m91-129-102-1.cust.tele2.ee [91.129.102.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTPSA id C2231A7011; Mon, 18 Nov 2019 13:52:18 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a6 In-Reply-To: <87ftilsg6q.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 18 Nov 2019 10:10:37 +0100") 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: 209.51.188.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:171944 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >> In image-mode currently =E2=80=98+=E2=80=99 is bound to the command =E2= =80=98image-increase-size=E2=80=99, >> the same command could be bound to =E2=80=98=E2=80=99 (C-wh= eel-up) as well. >> Same for =E2=80=98-=E2=80=99 (image-decrease-size) and =E2=80=98=E2=80=99 (C-wheel-down). > > Right. I think that's an obvious thing to put in `image-map' to make i= t > easier to change the size of a single image. > > (It's not just in image-mode -- that map is on all images inserted by > `insert-image'.) > > I don't have a mouse myself, so it'd be nice if somebody with one > created a patch so that they could test it. image-map is in image.el. I tested this patch, and it works well: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=mouse-wheel-image-size.patch diff --git a/lisp/image.el b/lisp/image.el index ad2ee6c607..8e8e477865 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -158,6 +158,10 @@ image-map (let ((map (make-sparse-keymap))) (define-key map "-" 'image-decrease-size) (define-key map "+" 'image-increase-size) + (define-key map [C-wheel-down] 'image-decrease-size) + (define-key map [C-mouse-5] 'image-decrease-size) + (define-key map [C-wheel-up] 'image-increase-size) + (define-key map [C-mouse-4] 'image-increase-size) (define-key map "r" 'image-rotate) (define-key map "o" 'image-save) map)) @@ -993,23 +997,33 @@ imagemagick-enabled-types (imagemagick-register-types) -(defun image-increase-size (n) +(defun image-increase-size (&optional n event) "Increase the image size by a factor of N. If N is 3, then the image size will be increased by 30%. The default is 20%." - (interactive "P") - (image--change-size (if n - (1+ (/ n 10.0)) - 1.2))) + (interactive (list current-prefix-arg last-nonmenu-event)) + (let ((e (and (listp event) (event-start event)))) + (save-window-excursion + (when e + (select-window (posn-window e)) + (goto-char (posn-point e))) + (image--change-size (if n + (1+ (/ (prefix-numeric-value n) 10.0)) + 1.2))))) -(defun image-decrease-size (n) +(defun image-decrease-size (&optional n event) "Decrease the image size by a factor of N. If N is 3, then the image size will be decreased by 30%. The default is 20%." - (interactive "P") - (image--change-size (if n - (- 1 (/ n 10.0)) - 0.8))) + (interactive (list current-prefix-arg last-nonmenu-event)) + (let ((e (and (listp event) (event-start event)))) + (save-window-excursion + (when e + (select-window (posn-window e)) + (goto-char (posn-point e))) + (image--change-size (if n + (- 1 (/ (prefix-numeric-value n) 10.0)) + 0.8))))) (defun image--get-image () "Return the image at point." --=-=-=--