/[emacs]/emacs/lisp/complete.el
ViewVC logotype

Diff of /emacs/lisp/complete.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.46 by eliz, Sat Nov 19 12:07:58 2005 UTC revision 1.47 by monnier, Sun Nov 27 20:53:55 2005 UTC
# Line 216  the *Completions* buffer." Line 216  the *Completions* buffer."
216    (PC-bindings partial-completion-mode)    (PC-bindings partial-completion-mode)
217    ;; Deal with include file feature...    ;; Deal with include file feature...
218    (cond ((not partial-completion-mode)    (cond ((not partial-completion-mode)
219           (remove-hook 'find-file-not-found-hooks 'PC-look-for-include-file))           (remove-hook 'find-file-not-found-functions 'PC-look-for-include-file))
220          ((not PC-disable-includes)          ((not PC-disable-includes)
221           (add-hook 'find-file-not-found-hooks 'PC-look-for-include-file)))           (add-hook 'find-file-not-found-functions 'PC-look-for-include-file)))
222    ;; ... with some underhand redefining.    ;; ... with some underhand redefining.
223    (cond ((and (not partial-completion-mode)    (cond ((and (not partial-completion-mode)
224                (functionp PC-old-read-file-name-internal))                (functionp PC-old-read-file-name-internal))
# Line 261  Word-delimiters for the purposes of Part Line 261  Word-delimiters for the purposes of Part
261        ;; and this command is repeated, scroll that window.        ;; and this command is repeated, scroll that window.
262        (if (and window (window-buffer window)        (if (and window (window-buffer window)
263                 (buffer-name (window-buffer window)))                 (buffer-name (window-buffer window)))
264            (save-excursion            (with-current-buffer (window-buffer window)
             (set-buffer (window-buffer window))  
265              (if (pos-visible-in-window-p (point-max) window)              (if (pos-visible-in-window-p (point-max) window)
266                  (set-window-start window (point-min) nil)                  (set-window-start window (point-min) nil)
267                (scroll-other-window)))                (scroll-other-window)))
# Line 346  See `PC-complete' for details." Line 345  See `PC-complete' for details."
345  (defvar PC-delims-list nil)  (defvar PC-delims-list nil)
346    
347  (defvar PC-completion-as-file-name-predicate  (defvar PC-completion-as-file-name-predicate
348    (function    (lambda () minibuffer-completing-file-name)
349     (lambda ()    "A function testing whether a minibuffer completion now will work filename-style.
      (memq minibuffer-completion-table  
            '(read-file-name-internal read-directory-name-internal))))  
    "A function testing whether a minibuffer completion now will work filename-style.  
350  The function takes no arguments, and typically looks at the value  The function takes no arguments, and typically looks at the value
351  of `minibuffer-completion-table' and the minibuffer contents.")  of `minibuffer-completion-table' and the minibuffer contents.")
352    
# Line 665  of `minibuffer-completion-table' and the Line 661  of `minibuffer-completion-table' and the
661                          (eq mode 'help))                          (eq mode 'help))
662                      (with-output-to-temp-buffer "*Completions*"                      (with-output-to-temp-buffer "*Completions*"
663                        (display-completion-list (sort helpposs 'string-lessp))                        (display-completion-list (sort helpposs 'string-lessp))
664                        (save-excursion                        (with-current-buffer standard-output
                         (set-buffer standard-output)  
665                          ;; Record which part of the buffer we are completing                          ;; Record which part of the buffer we are completing
666                          ;; so that choosing a completion from the list                          ;; so that choosing a completion from the list
667                          ;; knows how much old text to replace.                          ;; knows how much old text to replace.
# Line 732  Otherwise, all symbols with function def Line 727  Otherwise, all symbols with function def
727  or properties are considered."  or properties are considered."
728    (interactive)    (interactive)
729    (let* ((end (point))    (let* ((end (point))
730           (buffer-syntax (syntax-table))           (beg (save-excursion
731           (beg (unwind-protect                  (with-syntax-table lisp-mode-syntax-table
732                    (save-excursion                    (backward-sexp 1)
733                      (if lisp-mode-syntax-table                    (while (= (char-syntax (following-char)) ?\')
734                          (set-syntax-table lisp-mode-syntax-table))                      (forward-char 1))
735                      (backward-sexp 1)                    (point))))
                     (while (= (char-syntax (following-char)) ?\')  
                       (forward-char 1))  
                     (point))  
                 (set-syntax-table buffer-syntax)))  
736           (minibuffer-completion-table obarray)           (minibuffer-completion-table obarray)
737           (minibuffer-completion-predicate           (minibuffer-completion-predicate
738            (if (eq (char-after (1- beg)) ?\()            (if (eq (char-after (1- beg)) ?\()
# Line 767  or properties are considered." Line 758  or properties are considered."
758       (goto-char end)       (goto-char end)
759       (PC-do-completion nil beg end)))       (PC-do-completion nil beg end)))
760    
761  ;;; Use the shell to do globbing.  ;; Use the shell to do globbing.
762  ;;; This could now use file-expand-wildcards instead.  ;; This could now use file-expand-wildcards instead.
763    
764  (defun PC-expand-many-files (name)  (defun PC-expand-many-files (name)
765    (save-excursion    (with-current-buffer (generate-new-buffer " *Glob Output*")
     (set-buffer (generate-new-buffer " *Glob Output*"))  
766      (erase-buffer)      (erase-buffer)
767      (shell-command (concat "echo " name) t)      (shell-command (concat "echo " name) t)
768      (goto-char (point-min))      (goto-char (point-min))
# Line 804  or properties are considered." Line 794  or properties are considered."
794            (setq files (cdr files)))            (setq files (cdr files)))
795          p))))          p))))
796    
797  ;;; Facilities for loading C header files.  This is independent from the  ;; Facilities for loading C header files.  This is independent from the
798  ;;; main completion code.  See also the variable `PC-include-file-path'  ;; main completion code.  See also the variable `PC-include-file-path'
799  ;;; at top of this file.  ;; at top of this file.
800    
801  (defun PC-look-for-include-file ()  (defun PC-look-for-include-file ()
802    (if (string-match "[\"<]\\([^\"<>]*\\)[\">]?$" (buffer-file-name))    (if (string-match "[\"<]\\([^\"<>]*\\)[\">]?$" (buffer-file-name))
# Line 817  or properties are considered." Line 807  or properties are considered."
807              new-buf)              new-buf)
808          (kill-buffer (current-buffer))          (kill-buffer (current-buffer))
809          (if (equal name "")          (if (equal name "")
810              (save-excursion              (with-current-buffer (car (buffer-list))
               (set-buffer (car (buffer-list)))  
811                (save-excursion                (save-excursion
812                  (beginning-of-line)                  (beginning-of-line)
813                  (if (looking-at                  (if (looking-at
# Line 855  or properties are considered." Line 844  or properties are considered."
844                (if path                (if path
845                    (setq name (concat (file-name-as-directory (car path)) name))                    (setq name (concat (file-name-as-directory (car path)) name))
846                  (error "No such include file: <%s>" name)))                  (error "No such include file: <%s>" name)))
847            (let ((dir (save-excursion            (let ((dir (with-current-buffer (car (buffer-list))
                        (set-buffer (car (buffer-list)))  
848                         default-directory)))                         default-directory)))
849              (if (file-exists-p (concat dir name))              (if (file-exists-p (concat dir name))
850                  (setq name (concat dir name))                  (setq name (concat dir name))
# Line 865  or properties are considered." Line 853  or properties are considered."
853          (if new-buf          (if new-buf
854              ;; no need to verify last-modified time for this!              ;; no need to verify last-modified time for this!
855              (set-buffer new-buf)              (set-buffer new-buf)
856            (setq new-buf (create-file-buffer name))            (set-buffer (create-file-buffer name))
           (set-buffer new-buf)  
857            (erase-buffer)            (erase-buffer)
858            (insert-file-contents name t))            (insert-file-contents name t))
859          ;; Returning non-nil with the new buffer current          ;; Returning non-nil with the new buffer current
# Line 885  or properties are considered." Line 872  or properties are considered."
872                  env (substring env 0 pos)))                  env (substring env 0 pos)))
873          path)))          path)))
874    
875  ;;; This is adapted from lib-complete.el, by Mike Williams.  ;; This is adapted from lib-complete.el, by Mike Williams.
876  (defun PC-include-file-all-completions (file search-path &optional full)  (defun PC-include-file-all-completions (file search-path &optional full)
877    "Return all completions for FILE in any directory on SEARCH-PATH.    "Return all completions for FILE in any directory on SEARCH-PATH.
878  If optional third argument FULL is non-nil, returned pathnames should be  If optional third argument FULL is non-nil, returned pathnames should be

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26