Hi. New patch attached. Notes inline Lars Ingebrigtsen writes: > 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)) Sure. New patch does this. >> - (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 ...) > ) That would be nice, but no. This chunk of code was affected by subword-mode in two ways: 1. (forward-word 1) 2. (bounds-of-thing-at-point 'word) The proposed change only takes care of #1, and I don't see an obvious way to make it take care of both. I can do (while (erc-forward-word) ...), but then to get the word, I'd need to backtrack to the previous word marker, and it's not obvious to me that this would be an improvement over the existing change in the patch. The attached patch thus has no changes to this hunk. Let me know if you think of a nicer way to do this. dima