emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incompatibility of CC mode


From: Richard Stallman
Subject: Incompatibility of CC mode
Date: Wed, 04 Apr 2007 10:02:11 -0400

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: address@hidden
From: Paul Curry <address@hidden>
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
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
------- End of forwarded message -------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]