Changeset 4140 for trunk/lisp/complete.el
- Timestamp:
- 08/10/06 11:19:54 (2 years ago)
- Files:
-
- trunk/lisp/complete.el (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/complete.el
r4098 r4140 544 544 (file-name-nondirectory (substring str 0 p)) 545 545 (substring str 0 p)) 546 table547 pred)))546 table 547 pred))) 548 548 (setq p compl) 549 549 (while p … … 553 553 (setq poss (cons (car p) poss)))) 554 554 (setq p (cdr p))))) 555 556 ;; Handle completion-ignored-extensions 557 (and filename 558 (not (eq mode 'help)) 559 (let ((p2 poss)) 560 561 ;; Build a regular expression representing the extensions list 562 (or (equal completion-ignored-extensions PC-ignored-extensions) 563 (setq PC-ignored-regexp 564 (concat "\\(" 565 (mapconcat 566 'regexp-quote 567 (setq PC-ignored-extensions 568 completion-ignored-extensions) 569 "\\|") 570 "\\)\\'"))) 571 572 ;; Check if there are any without an ignored extension. 573 ;; Also ignore `.' and `..'. 574 (setq p nil) 575 (while p2 576 (or (string-match PC-ignored-regexp (car p2)) 577 (string-match "\\(\\`\\|/\\)[.][.]?/?\\'" (car p2)) 578 (setq p (cons (car p2) p))) 579 (setq p2 (cdr p2))) 580 581 ;; If there are "good" names, use them 582 (and p (setq poss p)))) 555 583 556 584 ;; Now we have a list of possible completions … … 576 604 (memq mode '(help word))) 577 605 578 ;; Handle completion-ignored-extensions579 (and filename580 (not (eq mode 'help))581 (let ((p2 poss))582 583 ;; Build a regular expression representing the extensions list584 (or (equal completion-ignored-extensions PC-ignored-extensions)585 (setq PC-ignored-regexp586 (concat "\\("587 (mapconcat588 'regexp-quote589 (setq PC-ignored-extensions590 completion-ignored-extensions)591 "\\|")592 "\\)\\'")))593 594 ;; Check if there are any without an ignored extension.595 ;; Also ignore `.' and `..'.596 (setq p nil)597 (while p2598 (or (string-match PC-ignored-regexp (car p2))599 (string-match "\\(\\`\\|/\\)[.][.]?/?\\'" (car p2))600 (setq p (cons (car p2) p)))601 (setq p2 (cdr p2)))602 603 ;; If there are "good" names, use them604 (and p (setq poss p))))605 606 606 ;; Is the actual string one of the possible completions? 607 607 (setq p (and (not (eq mode 'help)) poss)) … … 624 624 ;; Check if next few letters are the same in all cases 625 625 (if (and (not (eq mode 'help)) 626 (setq prefix (try-completion (PC-chunk-after basestr skip) (mapcar 'list poss)))) 626 (setq prefix (try-completion (PC-chunk-after basestr skip) 627 poss))) 627 628 (let ((first t) i) 628 629 ;; Retain capitalization of user input even if … … 670 671 skip) 671 672 (mapcar 672 (function 673 (lambda (x) 674 (list 675 (and (string-match skip x) 676 (substring 677 x 678 (match-end 0)))))) 673 (lambda (x) 674 (when (string-match skip x) 675 (substring x (match-end 0)))) 679 676 poss))) 680 677 (or (> i 0) (> (length prefix) 0)) … … 812 809 (with-current-buffer (generate-new-buffer " *Glob Output*") 813 810 (erase-buffer) 811 (when (and (file-name-absolute-p name) 812 (not (file-directory-p default-directory))) 813 ;; If the current working directory doesn't exist `shell-command' 814 ;; signals an error. So if the file names we're looking for don't 815 ;; depend on the working directory, switch to a valid directory first. 816 (setq default-directory "/")) 814 817 (shell-command (concat "echo " name) t) 815 818 (goto-char (point-min))
