unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <jet@gyve.org>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: Incompatibility of CC mode
Date: Mon, 09 Apr 2007 22:20:18 +0900 (JST)	[thread overview]
Message-ID: <20070409.222018.267346327.jet@gyve.org> (raw)
In-Reply-To: <20070404.231748.97433582.jet@gyve.org>

Hi,

I'm the author of cc-subword.

> The functions c-capitalize-subword, c-downcase-subword, c-upcase-subword
> claim to behave like their normal emacs counterparts, but all three
> functions move the point when given a negative argument.  Furthermore,
> c-capitalize-subword doesn't even work with a negative argument on my
> machine.  I changed the functions to better mimic the behavior of
> capitalize/downcase/upcase/-word: they no longer move point with a  
> negative
> argument.

Thank you.

About downcase and upcase, what you say and your code are correct.
So I installed your code to emacs's CVS repository.
Soon cc-mode maintainer will also install it to cc-mode's CVS repository.

    2007-04-09  Paul Curry <dashteacup@gmail.com>  (tiny change)

	    * progmodes/cc-subword.el (c-downcase-subword, c-upcase-subword): 
	    Don't move point if ARG is netagive.


About capitalize, I've written my own code based on your code; and 
installed it.

First of all, in subword, I cannot find expected behavior of capitalize,
which all of people can agree with. As you wrote my old is wrong because
point moves with netagive argument. This is obvious. However, I wonder
which character should be upcase when a netagive argument is given.

I'd like to explain why I modify your code here:

Consider doing "-3 M-c" at xxx.
                             ^ point is here.

[With your original code]      efg bceFghi xxx => Efg BceFghi Xxx
[With my modified code]        efg bceFghi xxx => efg BceFghi Xxx
[With real capitalize-word]    efg bce Fghi xxx => efg Bce Fghi Xxx

I think my modified code is rather similar to the real `capitalize-word'
than your original code. If you have strong objection, please, tell me.

    2007-04-09  Masatake YAMATO  <jet@gyve.org>

	    * progmodes/cc-subword.el (c-capitalize-subword): Implement
	    better mimic the behavior of `capitalize-word'. They no longer 
	    move point with a  negative argument. 
	    Based on code by Paul Curry.


    (defun c-capitalize-subword (arg)
      "Do the same as `capitalize-word' but on subwords.
    See the command `c-subword-mode' for a description of subwords.
    Optional argument ARG is the same as for `capitalize-word'."
      (interactive "p")
      (let ((count (abs arg))
	    (start (point))
	    (advance (if (< arg 0) nil t)))
	(dotimes (i count)
	  (if advance
	      (progn (re-search-forward
		      (concat "[" c-alpha "]")
		      nil t)
		     (goto-char (match-beginning 0)))
	    (c-backward-subword))
	  (let* ((p (point))
		 (pp (1+ p))
		 (np (c-forward-subword)))
	    (upcase-region p pp)
	    (downcase-region pp np)
	    (goto-char (if advance np p))))
	(unless advance
	  (goto-char start))))



Regards,
Masatake YAMATO

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


      parent reply	other threads:[~2007-04-09 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 14:02 Incompatibility of CC mode Richard Stallman
2007-04-04 14:17 ` Masatake YAMATO
2007-04-04 20:19   ` Alan Mackenzie
2007-04-09 13:20   ` Masatake YAMATO [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070409.222018.267346327.jet@gyve.org \
    --to=jet@gyve.org \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).