From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.devel Subject: Re: Track mouse drags over an image Date: Thu, 10 Jan 2019 22:55:55 -0600 Message-ID: <87y37rn678.fsf@gnu.org> References: <8336qb3upt.fsf@gnu.org> <20190102211241.GA53734@breton.holly.idiocy.org> <8736q6okqj.fsf_-_@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1547182454 28316 195.159.176.226 (11 Jan 2019 04:54:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2019 04:54:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 11 05:54:10 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghopd-0007F5-ND for ged-emacs-devel@m.gmane.org; Fri, 11 Jan 2019 05:54:09 +0100 Original-Received: from localhost ([127.0.0.1]:53496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghork-0007Nj-Ia for ged-emacs-devel@m.gmane.org; Thu, 10 Jan 2019 23:56:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghore-0007Mq-3L for emacs-devel@gnu.org; Thu, 10 Jan 2019 23:56:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghord-0007LR-7d for emacs-devel@gnu.org; Thu, 10 Jan 2019 23:56:14 -0500 Original-Received: from [195.159.176.226] (port=58963 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghorZ-0007HT-Cc for emacs-devel@gnu.org; Thu, 10 Jan 2019 23:56:11 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ghopN-0006xU-N6 for emacs-devel@gnu.org; Fri, 11 Jan 2019 05:53:53 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:FvIj7m7RaAxuHdmbgCcZUfFbVYo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232305 Archived-At: On Tue, Jan 08 2019, Stefan Monnier wrote: >> implemented in elisp to be usable. Still I am wondering: would it >> make sense to implement such code in a built-in function? > > Not sure what you mean by "such code" nor "built-in". Providing an > Elisp function to help coders like you would be very welcome, indeed. > If you can try and extract the relevant code from djvu-mode, that > would be great. My question was indeed different: is there any possible use for such a feature in other elisp packages that could justify such efforts? Djvu-mode uses this for making annotations. Could something like that be useful for other packages, too (packages I do not know about)? If the answer is yes, one can go from there. > Implementing it in C would only be justified if the performance > difference is relevant or if the semantics can be made cleaner. The elisp implementation in djvu-mode has a terrible performance, as it pushes the cpu load on my computer to 100% while doing its job. Possibly, even elisp might permit a better solution than what djvu-mode is currently doing. But all this is not my area of expertise either. > E.g. make it work for any image rather than only for PPM images of > "depth" 255. Images are pretty far from my area of expertise, tho, so > someone else should look into this. PPM (or PGM) images of "depth" 255 allow most easily to highlight the dragged region as they represent each pixel by three (or one) byte that can easily be addressed and inverted in elisp. I do not know how to do the same thing with, say, PBM images that otherwise could probably be more efficient.