GNU bug report logs -
#17558
24.4.50; global-subword-mode breaks ERC
Previous Next
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
Message #52 received at 17558 <at> debbugs.gnu.org (full text, mbox):
Dima Kogan <dima <at> secretsauce.net> 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
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.