From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: bug#16190: 23.4; M-x captialize-word works incorrectly Date: Sat, 28 Dec 2013 12:31:16 -0700 Message-ID: References: <52AA8710.4030706@twcny.rr.com> <83sitpbis9.fsf@gnu.org> <87ppotuti1.fsf@rosalinde.fritz.box> <83haa4bubq.fsf@gnu.org> <52B7BA11.10004@twcny.rr.com> <8361qf8s1t.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1388259136 5236 80.91.229.3 (28 Dec 2013 19:32:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Dec 2013 19:32:16 +0000 (UTC) To: 16190@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 28 20:32:21 2013 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 1VwzcS-00042c-1n for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Dec 2013 20:32:20 +0100 Original-Received: from localhost ([::1]:53122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwzcR-0004Mk-Ew for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Dec 2013 14:32:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwzcH-0004MQ-T5 for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 14:32:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwzcB-0006X3-AJ for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 14:32:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwzcB-0006Wk-77 for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 14:32:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VwzcA-00015T-G4 for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 14:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kevin Rodgers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Dec 2013 19:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16190 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13882591114158 (code B ref -1); Sat, 28 Dec 2013 19:32:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Dec 2013 19:31:51 +0000 Original-Received: from localhost ([127.0.0.1]:48974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vwzby-00014z-0A for submit@debbugs.gnu.org; Sat, 28 Dec 2013 14:31:50 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52976) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vwzbt-00014m-Vy for submit@debbugs.gnu.org; Sat, 28 Dec 2013 14:31:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vwzbn-0006NE-4q for submit@debbugs.gnu.org; Sat, 28 Dec 2013 14:31:45 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vwzbn-0006NA-2A for submit@debbugs.gnu.org; Sat, 28 Dec 2013 14:31:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vwzbh-0004LG-4e for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 14:31:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vwzbb-0006Lu-AP for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 14:31:33 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:57706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vwzbb-0006Ln-2o for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 14:31:27 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VwzbY-0003Zm-NP for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 20:31:24 +0100 Original-Received: from 70-59-41-30.hlrn.qwest.net ([70.59.41.30]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 Dec 2013 20:31:24 +0100 Original-Received: from kevin.d.rodgers by 70-59-41-30.hlrn.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 Dec 2013 20:31:24 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 54 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 70-59-41-30.hlrn.qwest.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:82696 Archived-At: On 12/27/13 10:31 PM, Josh wrote: > On Thu, Dec 26, 2013 at 7:30 PM, Kevin Rodgers > wrote: >> On 12/23/13 11:59 AM, Josh wrote: >>> >>> On Mon, Dec 23, 2013 at 8:12 AM, Eli Zaretskii wrote: >>>> >>>> If you want a function that capitalizes the word at point after >>>> looking back for its beginning, you need to code that using >>>> thing-at-point or some such. >>> >>> >>> When point is not already at the start of the word, `capitalize-word' >>> can already do this pretty easily via `M-- M-c'. >> >> (defun capitalize-word-at-point () >> "Capitalize the word at point (i.e. around point), without moving point." >> (interactive) >> (capitalize-word -1)) > > Unfortunately it's not quite that simple, because calling that function > when point is before the first character of a word will capitalize the > preceding word instead of the word following point. Something like > (defun capitalize-word-at-point () > "Capitalize the word at point." > (interactive) > (save-excursion > (forward-word) > (backward-word) > (capitalize-word 1))) > should suffice, though there are probably more elegant approaches. How about: (defun capitalize-word-at-point () "Capitalize the word at point. If point is within a word, don't move point." (interactive) (if (looking-at "\\b") (capitalize-word 1) (capitalize-word -1))) Or: (defadvice capitalize-word (before point-within-word activate) "When point is within a word, capitalize the word around point -- but only when called interactively." (if (and (called-interactively-p 'any) (not (looking-at "\\b"))) (backward-word (prefix-numeric-value current-prefix-arg)))) -- Kevin Rodgers Denver, Colorado, USA