summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1996-07-24 18:26:53 (GMT)
committerBarry Warsaw <barry@python.org>1996-07-24 18:26:53 (GMT)
commit9e5a9c8c99b90fbcbf0c63e5f3fdb97c0a024460 (patch)
tree474ae24295b2dcee4a68229720b67e4303312ed7 /Misc
parent57d091557cfc7900243d8d51ba491632646be35a (diff)
downloadcpython-9e5a9c8c99b90fbcbf0c63e5f3fdb97c0a024460.zip
cpython-9e5a9c8c99b90fbcbf0c63e5f3fdb97c0a024460.tar.gz
cpython-9e5a9c8c99b90fbcbf0c63e5f3fdb97c0a024460.tar.bz2
(py-forward-into-nomenclature, py-backward-into-nomenclature): New functions.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index 80cc0f5..82670c1 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -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))
+
+
;; Documentation functions