(py-forward-into-nomenclature, py-backward-into-nomenclature): New functions.

This commit is contained in:
Barry Warsaw 1996-07-24 18:26:53 +00:00
parent 57d091557c
commit 9e5a9c8c99
1 changed files with 31 additions and 0 deletions

View 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))
;; Documentation functions