From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#17558: 24.4.50; global-subword-mode breaks ERC Date: Sat, 26 Dec 2015 22:46:18 +0100 Message-ID: <87wps0opcl.fsf@gnus.org> References: <87ppj4ette.fsf@secretsauce.net> <537FB4C8.3080809@dancol.org> <87a924mbuk.fsf@secretsauce.net> <8rvbghcp9y.fsf@fencepost.gnu.org> <553EB8A7.7070103@dancol.org> <55404294.40908@dancol.org> <87y4iiw0p3.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451166443 32335 80.91.229.3 (26 Dec 2015 21:47:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Dec 2015 21:47:23 +0000 (UTC) Cc: 17558@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 26 22:47:12 2015 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 1aCwgA-0005mX-82 for geb-bug-gnu-emacs@m.gmane.org; Sat, 26 Dec 2015 22:47:10 +0100 Original-Received: from localhost ([::1]:39941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCwg9-0003YA-6o for geb-bug-gnu-emacs@m.gmane.org; Sat, 26 Dec 2015 16:47:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCwg5-0003Xn-El for bug-gnu-emacs@gnu.org; Sat, 26 Dec 2015 16:47:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aCwg2-0000Ci-86 for bug-gnu-emacs@gnu.org; Sat, 26 Dec 2015 16:47:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aCwg2-0000Cd-4a for bug-gnu-emacs@gnu.org; Sat, 26 Dec 2015 16:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aCwg1-0004PK-OY for bug-gnu-emacs@gnu.org; Sat, 26 Dec 2015 16:47:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Dec 2015 21:47:01 +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.145116640216905 (code B ref 17558); Sat, 26 Dec 2015 21:47:01 +0000 Original-Received: (at 17558) by debbugs.gnu.org; 26 Dec 2015 21:46:42 +0000 Original-Received: from localhost ([127.0.0.1]:42240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCwfi-0004Ob-HB for submit@debbugs.gnu.org; Sat, 26 Dec 2015 16:46:42 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:54578) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCwfh-0004OU-BP for 17558@debbugs.gnu.org; Sat, 26 Dec 2015 16:46:41 -0500 Original-Received: from 2.150.58.24.tmi.telenormobil.no ([2.150.58.24] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aCwfL-0005UO-7F; Sat, 26 Dec 2015 22:46:19 +0100 In-Reply-To: <87y4iiw0p3.fsf@secretsauce.net> (Dima Kogan's message of "Tue, 14 Jul 2015 20:37:28 -0700") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aCwfL-0005UO-7F MailScanner-NULL-Check: 1451771180.14896@iwEA2ndpXbcI5971jVnYjA X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:110749 Archived-At: Dima Kogan writes: > Hi. Can somebody please apply this patch? ERC from HEAD is completely > broken without it. I've got a couple of comments about the code... > (goto-char (point-min)) > - (upcase-word 1) > + > + ;; this is (upcase-word 1), but working even with subword-mode > + ;; active > + (skip-syntax-forward "^w") > + (let* > + ((word-start (point)) > + (word-end > + (progn (skip-syntax-forward "w") (point)))) > + (upcase-region word-start word-end)) > + If you had a function `erc-forward-word' that did all the syntax skipping, you could basically just say (upcase-region (point) (erc-forward-word)) > - (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))))))) > + > + (while > + (progn > + > + ;; I move forward a word (independent of subword-mode) ... > + (skip-syntax-forward "^w") > + (let* > + ((word-start (point)) > + (word-end > + (progn (skip-syntax-forward "w") (point)))) > + > + ;; ... if the word was empty we're at the end of buffer ... > + (and (/= word-start word-end) > + > + ;; ... otherwise, we do stuff with this word > + (progn > + (setq word (buffer-substring-no-properties > + word-start word-end)) > + (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 word-start word-end > + fun t (list word))))))))))) Similarly here, you could use that erc-forward-word to avoid rewriting this code so much. It would be just (while (erc-forward-word) (setq bound-stuff ...) ) Or something. I think. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no