* Incompatibility of CC mode
@ 2007-04-04 14:02 Richard Stallman
2007-04-04 14:17 ` Masatake YAMATO
0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2007-04-04 14:02 UTC (permalink / raw)
To: bug-cc-mode; +Cc: emacs-devel
Is there any good reason for this incompatibility?
If not, let's get rid of it.
------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY
autolearn=failed version=3.1.0
DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta;
h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer;
b=dTIuFhXeJa1XzScGibBwsvdZozFDIredsI5PPbrUpWmgu46kECkDaB39BkotrBhmcTA1bfRnZsfRJRW43M0hcxmZsOK961kXDmqGSofe63dYoQ60HNZ9Ps43xDen9/w/blSp7/yvJSIP9APBajtKPsf9e9WypGhd4pqBpiNBRD8=
Mime-Version: 1.0 (Apple Message framework v752.3)
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
To: bug-gnu-emacs@gnu.org
From: Paul Curry <dashteacup@gmail.com>
Date: Mon, 2 Apr 2007 15:46:32 -0500
Subject: c-subword-mode - inconsistent behavior
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.
Here's my code:
(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)))
(dotimes (i count)
(when (if (< arg 0)
(re-search-backward
(concat "\\<[" c-alpha "]")
nil t)
(re-search-forward
(concat "[" c-alpha "]")
nil t))
(goto-char (match-beginning 0)))
(let* ((p (point))
(pp (1+ p))
(np (c-forward-subword)))
(upcase-region p pp)
(downcase-region pp np)
(if (< arg 0)
(c-backward-subword)
(goto-char np))))
(if (< arg 0) (goto-char start))))
(defun c-downcase-subword (arg)
"Do the same as `downcase-word' but on subwords.
See the command `c-subword-mode' for a description of subwords.
Optional argument ARG is the same as for `downcase-word'."
(interactive "p")
(let ((start (point)))
(downcase-region (point) (c-forward-subword arg))
(if (< arg 0) (goto-char start))))
(defun c-upcase-subword (arg)
"Do the same as `upcase-word' but on subwords.
See the command `c-subword-mode' for a description of subwords.
Optional argument ARG is the same as for `upcase-word'."
(interactive "p")
(let ((start (point)))
(upcase-region (point) (c-forward-subword arg))
(if (< arg 0) (goto-char start))))
_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
------- End of forwarded message -------
-------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Incompatibility of CC mode
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
0 siblings, 2 replies; 4+ messages in thread
From: Masatake YAMATO @ 2007-04-04 14:17 UTC (permalink / raw)
To: rms; +Cc: bug-cc-mode, emacs-devel
> Is there any good reason for this incompatibility?
> If not, let's get rid of it.
>
> ------- Start of forwarded message -------
> X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY
> autolearn=failed version=3.1.0
> DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta;
> h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer;
> b=dTIuFhXeJa1XzScGibBwsvdZozFDIredsI5PPbrUpWmgu46kECkDaB39BkotrBhmcTA1bfRnZsfRJRW43M0hcxmZsOK961kXDmqGSofe63dYoQ60HNZ9Ps43xDen9/w/blSp7/yvJSIP9APBajtKPsf9e9WypGhd4pqBpiNBRD8=
> Mime-Version: 1.0 (Apple Message framework v752.3)
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> To: bug-gnu-emacs@gnu.org
> From: Paul Curry <dashteacup@gmail.com>
> Date: Mon, 2 Apr 2007 15:46:32 -0500
> Subject: c-subword-mode - inconsistent behavior
>
> 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.
It seems that Paul's argument is correct.
I will review Paul's version of code.
Masatake YAMATO
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Incompatibility of CC mode
2007-04-04 14:17 ` Masatake YAMATO
@ 2007-04-04 20:19 ` Alan Mackenzie
2007-04-09 13:20 ` Masatake YAMATO
1 sibling, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2007-04-04 20:19 UTC (permalink / raw)
To: Masatake YAMATO; +Cc: bug-cc-mode, rms, emacs-devel
On Wed, Apr 04, 2007 at 11:17:48PM +0900, Masatake YAMATO wrote:
> > Is there any good reason for this incompatibility?
> > If not, let's get rid of it.
> > ------- Start of forwarded message -------
> > X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY
> > autolearn=failed version=3.1.0
> > DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta;
> > h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer;
> > b=dTIuFhXeJa1XzScGibBwsvdZozFDIredsI5PPbrUpWmgu46kECkDaB39BkotrBhmcTA1bfRnZsfRJRW43M0hcxmZsOK961kXDmqGSofe63dYoQ60HNZ9Ps43xDen9/w/blSp7/yvJSIP9APBajtKPsf9e9WypGhd4pqBpiNBRD8=
> > Mime-Version: 1.0 (Apple Message framework v752.3)
> > Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> > To: bug-gnu-emacs@gnu.org
> > From: Paul Curry <dashteacup@gmail.com>
> > Date: Mon, 2 Apr 2007 15:46:32 -0500
> > Subject: c-subword-mode - inconsistent behavior
> > 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.
> It seems that Paul's argument is correct.
> I will review Paul's version of code.
Masatake: if Paul's code is OK, would you please commit it yourself.
Then I will pick up the change and apply to CC Mode at SourceForge.
Thanks in advance!
> Masatake YAMATO
--
Alan Mackenzie (Ittersbach, Germany).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Incompatibility of CC mode
2007-04-04 14:17 ` Masatake YAMATO
2007-04-04 20:19 ` Alan Mackenzie
@ 2007-04-09 13:20 ` Masatake YAMATO
1 sibling, 0 replies; 4+ messages in thread
From: Masatake YAMATO @ 2007-04-09 13:20 UTC (permalink / raw)
Cc: bug-cc-mode, emacs-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-09 13:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.