Devel-PerlySense
view release on metacpan or search on metacpan
lib/Devel/PerlySense/external/emacs/perly-sense-test-class.el view on Meta::CPAN
(defun ps/sub-pos (sub-name)
"Return the buffer position of 'sub sub-name', or nil if none
was found."
(let ((sub-pos
(save-excursion
(goto-char (point-min))
(and (search-forward-regexp (format " *sub +%s[^_a-z0-9]" sub-name) (point-max) t)
(match-beginning 0)))))
sub-pos))
(defvar ps/tc/current-method-overlay nil
"The overlay for the current method ")
(make-variable-buffer-local 'ps/tc/current-method-overlay)
(defun ps/tc/redisplay-method (method-name)
(remove-overlays (point-min) (point-max) 'test-class-method t)
(let ((sub-pos (ps/sub-pos method-name)))
(if sub-pos
(progn
(setq ps/tc/current-method-overlay (make-overlay sub-pos sub-pos))
(overlay-put ps/tc/current-method-overlay 'test-class-method t)
(overlay-put ps/tc/current-method-overlay 'before-string
(propertize "Test::Class --> " 'face 'font-lock-comment-face))
))))
(global-set-key (format "%stm" ps/key-prefix) 'ps/tc/toggle-current-sub)
; (message "(%s)" ps/tc/current-method)
lib/Devel/PerlySense/external/emacs/regex-tool.el view on Meta::CPAN
(defun regex-tool-markup-text (&optional beg end len)
(interactive)
(let ((regex (with-current-buffer regex-expr-buffer
(buffer-string)))
previous-point)
(when (> (length regex) 0)
(with-current-buffer regex-group-buffer
(erase-buffer))
(with-current-buffer regex-text-buffer
(remove-overlays)
(save-excursion
(ignore-errors
(goto-char (point-min))
(if (eq regex-tool-backend 'emacs)
(while (and (setq previous-point (point))
(re-search-forward regex nil t))
(if (= (point) previous-point)
(forward-char 1)
(overlay-put (make-overlay (match-beginning 0)
(match-end 0))
'face 'regex-tool-matched-face)
(dotimes (i 10)
(let ((text (match-string i)))
(if text
(save-match-data
(with-current-buffer regex-group-buffer
(goto-char (point-max))
(insert (format "Group %d: '%s'\n" i text)))))))
(with-current-buffer regex-group-buffer
(insert ?\n))))
(let ((results (regex-render-perl regex (buffer-string))))
(dolist (result results)
(let ((offset (nth 0 result))
(length (nth 1 result))
(matches (nthcdr 2 result)))
(overlay-put (make-overlay (1+ offset) (+ offset length 1))
'face 'regex-tool-matched-face)
(let ((match-zero (buffer-substring (1+ offset)
(+ offset length 1))))
(with-current-buffer regex-group-buffer
(insert (format "Group 0: '%s'\n" match-zero))))
(dolist (match matches)
(with-current-buffer regex-group-buffer
(goto-char (point-max))
(insert (format "Group %d: '%s'\n" (car match)
(cdr match)))))
( run in 0.335 second using v1.01-cache-2.11-cpan-49f99fa48dc )