all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* erc and notify-via-dbus breaks scroll position in channel buffers
@ 2013-06-13 18:57 Barry Warsaw
  2013-06-14  7:09 ` Michael Albinus
  0 siblings, 1 reply; 3+ messages in thread
From: Barry Warsaw @ 2013-06-13 18:57 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2624 bytes --]

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-dbus
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 like
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: erc and notify-via-dbus breaks scroll position in channel buffers
  2013-06-13 18:57 erc and notify-via-dbus breaks scroll position in channel buffers Barry Warsaw
@ 2013-06-14  7:09 ` Michael Albinus
  2013-06-14 14:24   ` Barry Warsaw
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Albinus @ 2013-06-14  7:09 UTC (permalink / raw)
  To: Barry Warsaw; +Cc: emacs-devel

Barry Warsaw <barry@python.org> writes:

Hi Barry,

> 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.

This problem has been reported here:
<http://thread.gmane.org/gmane.emacs.devel/159200/focus=159828>.

> I'm wondering if anybody has any further ideas about what could be going on.

It is fixed in Emacs' trunk. You could apply that patch.

> Cheers,
> -Barry

Best regards, Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: erc and notify-via-dbus breaks scroll position in channel buffers
  2013-06-14  7:09 ` Michael Albinus
@ 2013-06-14 14:24   ` Barry Warsaw
  0 siblings, 0 replies; 3+ messages in thread
From: Barry Warsaw @ 2013-06-14 14:24 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

On Jun 14, 2013, at 09:09 AM, Michael Albinus wrote:

>> 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.
>
>This problem has been reported here:
><http://thread.gmane.org/gmane.emacs.devel/159200/focus=159828>.
>
>> I'm wondering if anybody has any further ideas about what could be going on.
>
>It is fixed in Emacs' trunk. You could apply that patch.

Thanks for the info!  I'll test the patch and get it applied in Ubuntu.

Cheers,
-Barry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-14 14:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-13 18:57 erc and notify-via-dbus breaks scroll position in channel buffers Barry Warsaw
2013-06-14  7:09 ` Michael Albinus
2013-06-14 14:24   ` Barry Warsaw

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.