From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#18011: 24.4.50; REGRESSION, `help-echo' function value now needs `save-excursion' Date: Sun, 13 Jul 2014 16:11:24 -0700 (PDT) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1405293215 25092 80.91.229.3 (13 Jul 2014 23:13:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Jul 2014 23:13:35 +0000 (UTC) To: 18011@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 14 01:13:28 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X6SxT-0001M1-Aw for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Jul 2014 01:13:27 +0200 Original-Received: from localhost ([::1]:53992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6SxS-0006oF-Go for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Jul 2014 19:13:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6SxF-0006kP-0C for bug-gnu-emacs@gnu.org; Sun, 13 Jul 2014 19:13:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6Sx4-0004yw-MX for bug-gnu-emacs@gnu.org; Sun, 13 Jul 2014 19:13:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6Sx4-0004yl-JL for bug-gnu-emacs@gnu.org; Sun, 13 Jul 2014 19:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X6Sx4-0000Z4-5l for bug-gnu-emacs@gnu.org; Sun, 13 Jul 2014 19:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Jul 2014 23:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18011 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14052931282100 (code B ref -1); Sun, 13 Jul 2014 23:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Jul 2014 23:12:08 +0000 Original-Received: from localhost ([127.0.0.1]:53965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X6SwB-0000Xn-8Q for submit@debbugs.gnu.org; Sun, 13 Jul 2014 19:12:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56051) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X6Sw8-0000XE-Fc for submit@debbugs.gnu.org; Sun, 13 Jul 2014 19:12:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6Svs-0003p3-O9 for submit@debbugs.gnu.org; Sun, 13 Jul 2014 19:11:59 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6Svs-0003ox-LE for submit@debbugs.gnu.org; Sun, 13 Jul 2014 19:11:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6Svj-0006gE-HB for bug-gnu-emacs@gnu.org; Sun, 13 Jul 2014 19:11:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6Sva-0003gT-Pw for bug-gnu-emacs@gnu.org; Sun, 13 Jul 2014 19:11:39 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:50661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6Sva-0003ft-JO for bug-gnu-emacs@gnu.org; Sun, 13 Jul 2014 19:11:30 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s6DNBSEt025889 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 13 Jul 2014 23:11:29 GMT Original-Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s6DNBR5h028458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 13 Jul 2014 23:11:28 GMT Original-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s6DNBRH9007098 for ; Sun, 13 Jul 2014 23:11:27 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91516 Archived-At: I have some code that uses a function value for `help-echo' in Dired buffers. It works fine in Emacs 24.3 and prior. In later builds it has this problem: When you press mouse-1 and hold it down on a date field in Dired, point is not set there as it should be. Instead, the text cursor moves with the mouse after you do that. The oldest post-24.3 build I have is this one, and it exhibits the problem (as do recent builds): In GNU Emacs 24.3.50.1 (i386-mingw-nt6.1.7601) of 2013-05-14 on ODIEONE Bzr revision: 112586 juri@jurta.org-20130514233814-nnkh1ymiqgoq2fk6 Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --with-gcc (4.7) --no-opt --enable-checking --cflags -IC:/Devel/emacs/build/include --ldflags -LC:/Devel/emacs/build/lib' Recipe to repro the problem from emacs -Q: 1. Evaluate this code: (defun my-help (window buffer pos) (with-current-buffer buffer (goto-char pos))) (defun dired-insert-set-properties (beg end) (save-excursion (goto-char beg) (while (< (point) end) (ignore-errors =09(if (not (dired-move-to-filename)) =09 (unless (or (looking-at-p "^$") =09=09=09(looking-at-p dired-subdir-regexp)) =09 (put-text-property (line-beginning-position) =09=09=09=09 (1+ (line-end-position)) =09=09=09=09 'invisible 'dired-hide-details-information)) =09 (put-text-property (+ (line-beginning-position) 1) (1- (point)) =09=09=09 'invisible 'dired-hide-details-detail) =09 (add-text-properties ; @@@@@@@ =09 (line-beginning-position) (line-end-position) =09 '(mouse-face highlight help-echo my-help)) =09 ;; (add-text-properties =09 ;; (point) =09 ;; (progn =09 ;; (dired-move-to-end-of-filename) =09 ;; (point)) =09 ;; '(mouse-face =09 ;; highlight =09 ;; dired-filename t =09 ;; ;; help-echo "mouse-2: visit this file in other window")) =09 (when (< (+ (point) 4) (line-end-position)) =09 (put-text-property (+ (point) 4) (line-end-position) =09=09=09 'invisible 'dired-hide-details-link)))) (forward-line 1)))) 2. Then press & hold mouse-1 on a date field in Dired. Release mouse-1 and move the mouse. You can see that point was not set: the text cursor follows the mouse. The change above to the original `dired-insert-set-properties' is just to substitute the `add-text-properties' sexp indicated by `@@@@@@@' for the one that is commented out. The two differences are these: 1. `mouse-face' is put on the whole line, not just the file-name part. 2. The value of `help-echo' is a function, `my-help', and that function uses `goto-char'. I've fixed my code by wrapping the `goto-char' in `save-excursion'. But I suspect that that workaround papers over a bug (regression). Why should a `help-echo' function need to `save-excursion'? Note that if the mouse-face is not placed over the place where you click (in the test, it is on the whole line, and you click on the date field) then there is no problem. HTH. Close the bug if you don't care about this - I have my fix. In GNU Emacs 24.4.50.1 (i686-pc-mingw32) of 2014-06-28 on ODIEONE Bzr revision: 117431 rgm@gnu.org-20140628015517-eku6hj8mpgcvfnso Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --prefix=3D/c/Devel/emacs/snapshot/trunk --enable-checking=3Dyes,glyphs 'CFLAGS=3D-O0 -g3' LDFLAGS=3D-Lc:/Devel/emacs/lib 'CPPFLAGS=3D-DGC_MCHECK=3D1 -Ic:/Devel/emacs/include''