]> granicus.if.org Git - python/commitdiff
(py-forward-into-nomenclature, py-backward-into-nomenclature): New functions.
authorBarry Warsaw <barry@python.org>
Wed, 24 Jul 1996 18:26:53 +0000 (18:26 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 24 Jul 1996 18:26:53 +0000 (18:26 +0000)
Misc/python-mode.el

index 80cc0f5723fdbda26a6b322644902d85cfc7d3df..82670c12e29050e6428c8494de8141c094659044 100644 (file)
@@ -57,6 +57,8 @@
 ;; - New py-electric-colon (:) command for improved outdenting.  Also
 ;;   py-indent-line (TAB) should handle outdented lines better.
 ;; - improved (I think) C-c > and C-c <
+;; - py-(forward|backward)-into-nomenclature, not bound, but useful on
+;;   M-f and M-b respectively.
 
 ;; Here's a brief to do list:
 ;;
@@ -1413,6 +1415,35 @@ pleasant."
                  ;; no comment, so go back
                  (goto-char start))))))))
 
+;; ripped from cc-mode
+(defun py-forward-into-nomenclature (&optional arg)
+  "Move forward to end of a nomenclature section or word.
+With arg, to it arg times.
+
+A `nomenclature' is a fancy way of saying AWordWithMixedCaseNotUnderscores."
+  (interactive "p")
+  (let ((case-fold-search nil))
+    (if (> arg 0)
+       (re-search-forward "\\W*\\([A-Z]*[a-z0-9]*\\)" (point-max) t arg)
+      (while (and (< arg 0)
+                 (re-search-backward
+                  "\\(\\(\\W\\|[a-z0-9]\\)[A-Z]+\\|\\W\\w+\\)"
+                  (point-min) 0))
+       (forward-char 1)
+       (setq arg (1+ arg)))))
+  (py-keep-region-active))
+
+(defun py-backward-into-nomenclature (&optional arg)
+  "Move backward to beginning of a nomenclature section or word.
+With optional ARG, move that many times.  If ARG is negative, move
+forward.
+
+A `nomenclature' is a fancy way of saying AWordWithMixedCaseNotUnderscores."
+  (interactive "p")
+  (py-forward-into-nomenclature (- arg))
+  (py-keep-region-active))
+
+
 \f
 ;; Documentation functions