From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#17558: 24.4.50; global-subword-mode breaks ERC Date: Wed, 31 Dec 2014 00:46:39 -0800 Message-ID: <87d270mciq.fsf@secretsauce.net> References: <87ppj4ette.fsf@secretsauce.net> <537FB4C8.3080809@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1420059560 26423 80.91.229.3 (31 Dec 2014 20:59:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Dec 2014 20:59:20 +0000 (UTC) Cc: 17558@debbugs.gnu.org To: Daniel Colascione Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 31 21:59:12 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 1Y6QMI-0002Ne-8S for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 21:59:10 +0100 Original-Received: from localhost ([::1]:41364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6QMH-0006h8-Qn for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 15:59:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6QME-0006gq-Cn for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 15:59:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6QMB-0007ZU-24 for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 15:59:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6QMA-0007Yi-Ox for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 15:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y6QMA-0006WU-DC for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 15:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 31 Dec 2014 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17558 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17558-submit@debbugs.gnu.org id=B17558.142005948524992 (code B ref 17558); Wed, 31 Dec 2014 20:59:02 +0000 Original-Received: (at 17558) by debbugs.gnu.org; 31 Dec 2014 20:58:05 +0000 Original-Received: from localhost ([127.0.0.1]:33996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y6QLF-0006V1-6e for submit@debbugs.gnu.org; Wed, 31 Dec 2014 15:58:05 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52977) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y6QLB-0006UU-Em for 17558@debbugs.gnu.org; Wed, 31 Dec 2014 15:58:02 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3272320676 for <17558@debbugs.gnu.org>; Wed, 31 Dec 2014 15:57:59 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Wed, 31 Dec 2014 15:57:59 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=x-sasl-enc:references:from:to:cc:subject:date:in-reply-to :message-id:mime-version:content-type; s=mesmtp; bh=GvRJ4BN7iyuz /hPtfSuj4XAJIHw=; b=ApfgQT7e+kUIMImrRspWafVpONWUVtiBMmmvP/KItxxg VyLEklAvp3ZR9oBT1fy1R/or+keewao2YO3XYmoE1wDMSey3GonWHqjOKhVavAkH kDyIpF96q8JfAAXUT2IznV/AbTGTAg5YC7hyQvyKkMou0mOAdA3AI4u/yPQzkxc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:references:from:to:cc:subject :date:in-reply-to:message-id:mime-version:content-type; s= smtpout; bh=GvRJ4BN7iyuz/hPtfSuj4XAJIHw=; b=okH3EwnPF1S5uJdCriaa fqrCwQ4Jk1UmxFXPyEIcL9/qQSSwswtGBjOXMAIt+llH7EYqnQy0CIgBtO19Lkv1 v1M0iCigX8eYfUFyqLOh1VdYxh315VNUOuerNZKlGOxTgE9REP57XYkX6xo640vS E/xePYfIs3ZbzE7XKiMDi6w= X-Sasl-enc: DcGXdfG2RrItUWGZRAHhl2koONF2r8hzcVlNob3b3lnq 1420059478 Original-Received: from shorty.local (unknown [174.28.80.18]) by mail.messagingengine.com (Postfix) with ESMTPA id 7B92BC00281; Wed, 31 Dec 2014 15:57:58 -0500 (EST) Original-Received: from dima by shorty.local with local (Exim 4.84) (envelope-from ) id 1Y6EwA-0002Of-TT; Wed, 31 Dec 2014 00:47:26 -0800 In-reply-to: <537FB4C8.3080809@dancol.org> 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:97907 Archived-At: --=-=-= Content-Type: text/plain Daniel Colascione writes: > On 05/23/2014 02:19 AM, Dima Kogan wrote: >> Hi. I'm using a very recent build of emacs from the VCS. With this build >> ERC gets very confused if global-subword-mode is on. I believe it worked >> fine just a few months ago. >> >> Recipe: >> >> 1. emacs -Q >> 2. (global-subword-mode) >> 3. M-x erc >> 4. Default values for the server, nickname, password, etc are fine to >> show the issue > > Thanks for the repro. This bug is probably due to my changing how > subword-mode works: now, forward-word will stop at subword boundaries, > and I'm guessing ERC was relying on the old behavior. I can try to take > a look at it if nobody who knows ERC better wants to try first. Here's a patch. It works, but I don't like how un-future-proof it is. An uncareful coder can simply use (forward-word) somewhere and get things to break again. Is there a better way? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ERC-no-longer-gets-confused-by-subword-mode.patch >From 655e7b9b5735bd62aac104645b5a224636ab97ff Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 30 Dec 2014 23:29:21 -0800 Subject: [PATCH] ERC no longer gets confused by subword-mode In commit 6ddc44225e743e2b2a0d5c192f50aefd7a4a915b subword-mode was integrated into the syntax table instead of simply remapping the interactive motion bindings as was done previously. This had the unintended effect of changing the behavior of lisp programs that touch words. In the case of ERC, it completely broke it: emacs now throws an error when ERC is launched, making it unusable when subword-mode is active. This commit temporarily disables subword-mode so that ERC functions that touch words do so the "normal" way. Closes: #17558 --- lisp/erc/erc-backend.el | 9 ++++++++- lisp/erc/erc-button.el | 23 +++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index bedb20f..fa95d7e 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -480,7 +480,14 @@ Currently this is called by `erc-send-input'." (with-temp-buffer (insert str) (goto-char (point-min)) - (upcase-word 1) + + ;; If we're in subword-mode then functions operating on words act + ;; differently. Here I temporarily disable subword-mode before + ;; touching the words + (let ((find-word-boundary-function-table + (if (boundp 'subword-empty-char-table) + subword-empty-char-table find-word-boundary-function-table))) + (upcase-word 1)) (buffer-string))) (defun erc-server-setup-periodical-ping (buffer) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 10e7318..8343425 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -300,14 +300,21 @@ specified by `erc-button-alist'." (when (or (eq t form) (eval form)) (goto-char (point-min)) - (while (forward-word 1) - (setq bounds (bounds-of-thing-at-point 'word)) - (setq word (buffer-substring-no-properties - (car bounds) (cdr bounds))) - (when (or (and (erc-server-buffer-p) (erc-get-server-user word)) - (and erc-channel-users (erc-get-channel-user word))) - (erc-button-add-button (car bounds) (cdr bounds) - fun t (list word))))))) + + ;; If we're in subword-mode then functions operating on words + ;; act differently. Here I temporarily disable subword-mode + ;; before touching the words + (let ((find-word-boundary-function-table + (if (boundp 'subword-empty-char-table) + subword-empty-char-table find-word-boundary-function-table))) + (while (forward-word 1) + (setq bounds (bounds-of-thing-at-point 'word)) + (setq word (buffer-substring-no-properties + (car bounds) (cdr bounds))) + (when (or (and (erc-server-buffer-p) (erc-get-server-user word)) + (and erc-channel-users (erc-get-channel-user word))) + (erc-button-add-button (car bounds) (cdr bounds) + fun t (list word)))))))) (defun erc-button-add-buttons-1 (regexp entry) "Search through the buffer for matches to ENTRY and add buttons." -- 2.1.3 --=-=-=--