From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Warsaw Newsgroups: gmane.emacs.devel Subject: erc and notify-via-dbus breaks scroll position in channel buffers Date: Thu, 13 Jun 2013 14:57:38 -0400 Organization: Damn Crazy Followers of the Horn Message-ID: <20130613145738.3b88cae7@limelight.wooz.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA256; boundary="Sig_/CUYkQY/12HD=74Tq2Bz=a.S"; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1371149884 28529 80.91.229.3 (13 Jun 2013 18:58:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Jun 2013 18:58:04 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 13 20:58:04 2013 Return-path: Envelope-to: ged-emacs-devel@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 1UnCic-00077H-0X for ged-emacs-devel@m.gmane.org; Thu, 13 Jun 2013 20:57:58 +0200 Original-Received: from localhost ([::1]:59173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnCib-00043p-OH for ged-emacs-devel@m.gmane.org; Thu, 13 Jun 2013 14:57:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnCiY-00043A-7j for emacs-devel@gnu.org; Thu, 13 Jun 2013 14:57:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnCiX-0002qE-9V for emacs-devel@gnu.org; Thu, 13 Jun 2013 14:57:54 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:36941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnCiX-0002q3-2t for emacs-devel@gnu.org; Thu, 13 Jun 2013 14:57:53 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UnCiU-0006zQ-Md for emacs-devel@gnu.org; Thu, 13 Jun 2013 20:57:50 +0200 Original-Received: from mail.wooz.org ([216.15.33.194]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Jun 2013 20:57:50 +0200 Original-Received: from barry by mail.wooz.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Jun 2013 20:57:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 94 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: mail.wooz.org X-Newsreader: Claws Mail 3.8.1 (GTK+ 2.24.18; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:160417 Archived-At: --Sig_/CUYkQY/12HD=74Tq2Bz=a.S Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable I recently upgraded to Emacs 24.3 from 24.2 in Ubuntu 13.10 and I noticed a weird regression in erc. When someone pinged my nick, the channel buffer would scroll the current line to the top, so I'd have to manually recenter = the buffer to read the scrollback. After a lengthy debugging session, I traced the problem down to notify-via-dbus. AFAICT, here's what's happening. I add a hook to erc-text-matched-hook so that when my nick appears in a channel, I get a notification in the on-screen display (osd). This was working beautifully in 24.2. It calls (notify) which in turn calls whatever notify-method is set too. In 24.3 and 24.2 this is set by default to notify-via-dbus. e.g: (defun baw-notify-erc (match-type nickuserhost message) "Notify when a message to my nick is received" (notify (format "%s in %s" ;; Username of sender (car (split-string nickuserhost "!")) ;; Channel (or (erc-default-target) "#unknown")) ;; Remove duplicate spaces. (replace-regexp-in-string " +" " " message) :icon "emacs-snapshot" :timeout -1)) (add-hook 'erc-text-matched-hook 'baw-notify-erc t) The problem is that it seems like something in notify-via-dbus is causing a non-local exit, such that the (save-excursion (save-restriction ...)) in erc-match-message is not able to restore the buffer's scroll position. This obviously worked fine in 24.2, and when I switch notify-method to notify-via-libnotify, proper behavior is restored in 24.3. OTOH, notify-via-dbus isn't throwing an error that I can find, either when I toggle-debug-on-error, or look in *Messages*, or edebug my way through erc-match-message. Also, when I run (notify-via-dbus "title" "body") everything seems fine too. The one weird thing I've seen is when notify-method is set to notify-via-db= us and I run this little test in an erc buffer with a bunch of output: (defun baw-test () (save-excursion (save-restriction (widen) (goto-char 409) (save-restriction (narrow-to-region 409 438) (notify "hello" "there") :icon "emacs-snapshot" :timeout -1) ))) I see a couple of seconds of flashing in the erc buffer, but it does seem l= ike the buffer's scroll state eventually gets restored. When it's set to notify-via-libnotify, there's no flashing. Anyway, this seems highly weird, but at least now I have a workaround. I'm wondering if anybody has any further ideas about what could be going on. Cheers, -Barry --Sig_/CUYkQY/12HD=74Tq2Bz=a.S Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCAAGBQJRuhYjAAoJEBJutWOnSwa/sgQP/2ZGjgIMTQMkxvKtjx78bbS1 nzAY5tfcbr2lgmzRLnzPhLyPm8frnpZ3woy+Vqa4PvgyfGX+W54a8Bbi3qH0/RAa weBEFtiOIh/lvwo/wfqXa4BDXhXxIDqtAEsyVDK4Ma2UbWRMqlsXhAsWltvgAQxQ tQhhUnifg5DHpvtSpdJvr5o4J5DotgNXyC8RJX4aDZueqEucRfG1aadknUdg5VPt 2y6XmlVJBaLctvqcWccvz1kS3UAVlxOxinwrxefUURM4Tb+Kc1GyJNMnswR3AhG5 bqGvYiPdBMOMPdlzJVL7QHSc0Qq41LoGDTgTfI+evLbRbHKN0JDl+6sn5ayKq3Wp DV+df6Ul5zmaJwyb8Qs2+zRtvzjNOAp4cN5PqFcUZn9qCZFQdqOALYl7Gn2oG/D3 1Nb5N9mPDjBJxVUhFLGOa/HK/CSg45gbM8aclJEHlkk3HZK4E1p+CsVTAgkXAja/ Gjx1j4KUr6OO3/Tcomi1brNqZcn1/dcpylUTu47WoNnuEhiJ3r8Y26FOr59fL3zD L2NySCgllfwRc9/WrZUhcrJ8JMyOktFFPPO7w3xkxOaeCRiNJBT3jRihv4d7wowH HpFJWRmqY6+hZtk1TqtrwTcnTQce2VX7om/Mo5FcWOuFf98PA6go6FU1t9YxbQCd HPAcZ12tH3SSSPFzM1lj =DwxM -----END PGP SIGNATURE----- --Sig_/CUYkQY/12HD=74Tq2Bz=a.S--