Changeset 19141 for lang/elisp
- Timestamp:
- 09/10/08 23:14:13 (2 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/elisp/anything-c-moccur/trunk/anything-c-moccur.el
r18986 r19141 3 3 4 4 ;; Author: Kenji.Imakado <ken.imakaado -at- gmail.com> 5 ;; Version: 0.26 5 ;; Keywords: occur 7 6 ;; Prefix: anything-c-moccur- … … 33 32 ;; '(lambda () 34 33 ;; (local-set-key (kbd "O") 'anything-c-moccur-dired-do-moccur-by-moccur))) 34 ;; (global-set-key (kbd "C-M-s") 'anything-c-moccur-isearch-forward) 35 ;; (global-set-key (kbd "C-M-r") 'anything-c-moccur-isearch-backward) 36 37 ;;; Todo: 38 ;; resume 35 39 36 40 ;;;code: … … 98 102 99 103 ;;; variables 104 (defvar anything-c-moccur-version 0.3) 100 105 (defvar anything-c-moccur-anything-invoking-flag nil) 101 106 (defvar anything-c-moccur-anything-initial-pattern "") … … 230 235 (anything-execute-persistent-action)))) 231 236 237 (defvar anything-c-moccur-last-buffer nil) 232 238 (defmacro anything-c-moccur-with-anything-env (sources &rest body) 233 239 (declare (indent 1)) … … 242 248 (progn 243 249 ,@body) 244 (remove-hook 'anything-c-moccur-anything-after-update-hook 'anything-c-moccur-anything-try-execute-persistent-action)))) 250 (remove-hook 'anything-c-moccur-anything-after-update-hook 'anything-c-moccur-anything-try-execute-persistent-action) 251 (setq anything-c-moccur-last-buffer anything-current-buffer)))) 252 245 253 246 254 (defun anything-c-moccur-clean-up () … … 316 324 ad-do-it))) 317 325 326 (defun anything-c-moccur-bad-regexp-p (re) 327 (or (string-match (rx bol (+ space) eol) re) 328 (string-equal "" re) 329 (string-match (rx bol (* (any "<" ">" "\\" "_" "`")) eol) re))) 330 318 331 (defun anything-c-moccur-moccur-search (regexp arg buffers) 319 332 (ignore-errors … … 324 337 (ad-activate 'moccur-search) 325 338 ;; 空白のみで呼ばれると固まることがあったので追加 326 (when (or (string-match (rx bol (+ space) eol) anything-pattern) 327 (string-equal "" anything-pattern)) 339 (when (anything-c-moccur-bad-regexp-p anything-pattern) 328 340 (error "")) 329 341 … … 374 386 (volatile))) 375 387 376 (defun anything-c-moccur-occur-by-moccur () 377 (interactive) 378 (anything-c-moccur-with-anything-env (list anything-c-source-occur-by-moccur) 379 (let* ((initial-pattern (if anything-c-moccur-enable-initial-pattern 380 (or (thing-at-point 'symbol) "") 381 ""))) 382 (when anything-c-moccur-push-mark-flag 383 (push-mark)) 384 (anything nil initial-pattern)))) 388 (defun anything-c-moccur-occur-by-moccur (&optional prefix) 389 (interactive "P") 390 (if prefix 391 (anything-c-moccur-resume) 392 (anything-c-moccur-with-anything-env (list anything-c-source-occur-by-moccur) 393 (let* ((initial-pattern (if anything-c-moccur-enable-initial-pattern 394 (or (thing-at-point 'symbol) "") 395 ""))) 396 (when anything-c-moccur-push-mark-flag 397 (push-mark)) 398 (anything nil initial-pattern))))) 385 399 386 400 (defun anything-c-moccur-occur-by-moccur-only-function () … … 396 410 (when anything-c-moccur-push-mark-flag 397 411 (push-mark)) 398 (anything ";;; ")))412 (anything nil ";;; "))) 399 413 400 414 (defun anything-c-moccur-query-replace-regexp () … … 538 552 (anything-c-moccur-with-anything-env (list anything-c-source-dired-do-moccur) 539 553 (anything)))) 554 555 ;;; Commands 556 557 (defun anything-c-moccur-last-sources-is-moccur-p () 558 (and (equal anything-c-moccur-last-buffer (current-buffer)) 559 (every (lambda (source) 560 (let ((source (if (listp source) source (symbol-value source)))) 561 (string-match "moccur" (assoc-default 'name source)))) 562 anything-last-sources))) 563 564 (defun anything-c-moccur-resume () 565 (interactive) 566 (if (anything-c-moccur-last-sources-is-moccur-p) 567 (anything-c-moccur-with-anything-env anything-last-sources 568 (anything-c-moccur-initialize) 569 (anything-resume)) 570 (message "last source is not anything-c-moccur source"))) 571 572 (defun anything-c-moccur-isearch-forward () 573 (interactive) 574 (let ((anything-c-moccur-widen-when-goto-line-flag nil)) 575 (save-restriction 576 (narrow-to-region (point-at-bol) (point-max)) 577 (anything-c-moccur-occur-by-moccur)))) 578 579 (defun anything-c-moccur-isearch-backward () 580 (interactive) 581 (let* ((anything-c-moccur-widen-when-goto-line-flag nil) 582 (copied-source (copy-alist anything-c-source-occur-by-moccur)) ;anything-c-source-occur-by-moccur is list. not symbol 583 (anything-c-source-occur-by-moccur (cons '(candidate-transformer . (lambda (-candidates) 584 (reverse -candidates))) 585 copied-source))) 586 (save-restriction 587 (narrow-to-region (point-min) (point-at-eol)) 588 (anything-c-moccur-occur-by-moccur)))) 540 589 541 590 ;;; Commands for `anything-c-moccur-anything-map' … … 650 699 '(anything-c-source-occur-by-moccur) "bbb") 651 700 (kill-buffer buf))))) 701 (desc "anything-c-moccur-bad-regexp-p") 702 (expect t 703 (when (anything-c-moccur-bad-regexp-p "\\_>") t)) 704 652 705 ))) 653 706
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)