changeset 55264:1a506cc5235d

(cua--convert-rectangle-as): New defmacro. (cua-upcase-rectangle, cua-downcase-rectangle): Use it. (cua-upcase-initials-rectangle, cua-capitalize-rectangle): New commands (suggested by Jordan Breeding)..
author Kim F. Storm <storm@cua.dk>
date Fri, 30 Apr 2004 21:39:07 +0000
parents eb737a4709cb
children 657452e317f5
files lisp/emulation/cua-rect.el
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/cua-rect.el	Fri Apr 30 21:38:44 2004 +0000
+++ b/lisp/emulation/cua-rect.el	Fri Apr 30 21:39:07 2004 +0000
@@ -1,6 +1,6 @@
 ;;; cua-rect.el --- CUA unified rectangle support
 
-;; Copyright (C) 1997-2002 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2002, 2004 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <storm@cua.dk>
 ;; Keywords: keyboard emulations convenience CUA
@@ -1057,19 +1057,30 @@
          (insert (format fmt first))
          (setq first (+ first incr)))))
 
+(defmacro cua--convert-rectangle-as (command)
+  `(cua--rectangle-operation 'clear nil nil nil
+    '(lambda (s e l r)
+       (,command s e))))
+
 (defun cua-upcase-rectangle ()
   "Convert the rectangle to upper case."
   (interactive)
-  (cua--rectangle-operation 'clear nil nil nil
-     '(lambda (s e l r)
-        (upcase-region s e))))
+  (cua--convert-rectangle-as upcase-region))
 
 (defun cua-downcase-rectangle ()
   "Convert the rectangle to lower case."
   (interactive)
-  (cua--rectangle-operation 'clear nil nil nil
-     '(lambda (s e l r)
-        (downcase-region s e))))
+  (cua--convert-rectangle-as downcase-region))
+
+(defun cua-upcase-initials-rectangle ()
+  "Convert the rectangle initials to upper case."
+  (interactive)
+  (cua--convert-rectangle-as upcase-initials-region))
+
+(defun cua-capitalize-rectangle ()
+  "Convert the rectangle to proper case."
+  (interactive)
+  (cua--convert-rectangle-as capitalize-region))
 
 
 ;;; Replace/rearrange text in current rectangle