GNU bug report logs - #17558
24.4.50; global-subword-mode breaks ERC

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Fri, 23 May 2014 09:20:02 UTC

Severity: normal

Tags: fixed

Merged with 20347

Found in versions 24.4.50, 25.0.50

Fixed in version 25.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: Daniel Colascione <dancol <at> dancol.org>, 17558 <at> debbugs.gnu.org
Subject: bug#17558: 24.4.50; global-subword-mode breaks ERC
Date: Thu, 01 Jan 2015 11:42:56 -0500
>> 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.

Indeed, with the new implementation of subword-mode, most of the
word-operating commands should be marked as "interactive use only",
since their behavior is too unreliable for use in Lisp code.

> -    (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))

Yuck.  I suggest you use upcase-region instead (and probably something
like skip-char-forward to find the word's boundaries).

> -      (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))))))))
 
Similarly here, we should use "word" operations at all.
Maybe forward-sexp can be used instead of forward-word, or else
skip-syntax-forward or skip-chars-forward.

The call to (bounds-of-thing-at-point 'word) should be avoided as well
(we already know the end of the bounds is (point) anyway and we can
probably find the other bound at the same time as we skip-chars-forward.


        Stefan




This bug report was last modified 9 years and 161 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.