emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/complete.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/complete.el
Date: Sun, 27 Nov 2005 15:53:55 -0500

Index: emacs/lisp/complete.el
diff -c emacs/lisp/complete.el:1.46 emacs/lisp/complete.el:1.47
*** emacs/lisp/complete.el:1.46 Sat Nov 19 12:07:58 2005
--- emacs/lisp/complete.el      Sun Nov 27 20:53:55 2005
***************
*** 216,224 ****
    (PC-bindings partial-completion-mode)
    ;; Deal with include file feature...
    (cond ((not partial-completion-mode)
!        (remove-hook 'find-file-not-found-hooks 'PC-look-for-include-file))
        ((not PC-disable-includes)
!        (add-hook 'find-file-not-found-hooks 'PC-look-for-include-file)))
    ;; ... with some underhand redefining.
    (cond ((and (not partial-completion-mode)
              (functionp PC-old-read-file-name-internal))
--- 216,224 ----
    (PC-bindings partial-completion-mode)
    ;; Deal with include file feature...
    (cond ((not partial-completion-mode)
!        (remove-hook 'find-file-not-found-functions 'PC-look-for-include-file))
        ((not PC-disable-includes)
!        (add-hook 'find-file-not-found-functions 'PC-look-for-include-file)))
    ;; ... with some underhand redefining.
    (cond ((and (not partial-completion-mode)
              (functionp PC-old-read-file-name-internal))
***************
*** 261,268 ****
        ;; and this command is repeated, scroll that window.
        (if (and window (window-buffer window)
               (buffer-name (window-buffer window)))
!         (save-excursion
!           (set-buffer (window-buffer window))
            (if (pos-visible-in-window-p (point-max) window)
                (set-window-start window (point-min) nil)
              (scroll-other-window)))
--- 261,267 ----
        ;; and this command is repeated, scroll that window.
        (if (and window (window-buffer window)
               (buffer-name (window-buffer window)))
!         (with-current-buffer (window-buffer window)
            (if (pos-visible-in-window-p (point-max) window)
                (set-window-start window (point-min) nil)
              (scroll-other-window)))
***************
*** 346,356 ****
  (defvar PC-delims-list nil)
  
  (defvar PC-completion-as-file-name-predicate
!   (function
!    (lambda ()
!      (memq minibuffer-completion-table
!          '(read-file-name-internal read-directory-name-internal))))
!    "A function testing whether a minibuffer completion now will work 
filename-style.
  The function takes no arguments, and typically looks at the value
  of `minibuffer-completion-table' and the minibuffer contents.")
  
--- 345,352 ----
  (defvar PC-delims-list nil)
  
  (defvar PC-completion-as-file-name-predicate
!   (lambda () minibuffer-completing-file-name)
!   "A function testing whether a minibuffer completion now will work 
filename-style.
  The function takes no arguments, and typically looks at the value
  of `minibuffer-completion-table' and the minibuffer contents.")
  
***************
*** 665,672 ****
                        (eq mode 'help))
                    (with-output-to-temp-buffer "*Completions*"
                      (display-completion-list (sort helpposs 'string-lessp))
!                     (save-excursion
!                       (set-buffer standard-output)
                        ;; Record which part of the buffer we are completing
                        ;; so that choosing a completion from the list
                        ;; knows how much old text to replace.
--- 661,667 ----
                        (eq mode 'help))
                    (with-output-to-temp-buffer "*Completions*"
                      (display-completion-list (sort helpposs 'string-lessp))
!                     (with-current-buffer standard-output
                        ;; Record which part of the buffer we are completing
                        ;; so that choosing a completion from the list
                        ;; knows how much old text to replace.
***************
*** 732,747 ****
  or properties are considered."
    (interactive)
    (let* ((end (point))
!        (buffer-syntax (syntax-table))
!        (beg (unwind-protect
!                 (save-excursion
!                   (if lisp-mode-syntax-table
!                       (set-syntax-table lisp-mode-syntax-table))
!                   (backward-sexp 1)
!                   (while (= (char-syntax (following-char)) ?\')
!                     (forward-char 1))
!                   (point))
!               (set-syntax-table buffer-syntax)))
         (minibuffer-completion-table obarray)
         (minibuffer-completion-predicate
          (if (eq (char-after (1- beg)) ?\()
--- 727,738 ----
  or properties are considered."
    (interactive)
    (let* ((end (point))
!        (beg (save-excursion
!                 (with-syntax-table lisp-mode-syntax-table
!                   (backward-sexp 1)
!                   (while (= (char-syntax (following-char)) ?\')
!                     (forward-char 1))
!                   (point))))
         (minibuffer-completion-table obarray)
         (minibuffer-completion-predicate
          (if (eq (char-after (1- beg)) ?\()
***************
*** 767,778 ****
       (goto-char end)
       (PC-do-completion nil beg end)))
  
! ;;; Use the shell to do globbing.
! ;;; This could now use file-expand-wildcards instead.
  
  (defun PC-expand-many-files (name)
!   (save-excursion
!     (set-buffer (generate-new-buffer " *Glob Output*"))
      (erase-buffer)
      (shell-command (concat "echo " name) t)
      (goto-char (point-min))
--- 758,768 ----
       (goto-char end)
       (PC-do-completion nil beg end)))
  
! ;; Use the shell to do globbing.
! ;; This could now use file-expand-wildcards instead.
  
  (defun PC-expand-many-files (name)
!   (with-current-buffer (generate-new-buffer " *Glob Output*")
      (erase-buffer)
      (shell-command (concat "echo " name) t)
      (goto-char (point-min))
***************
*** 804,812 ****
          (setq files (cdr files)))
        p))))
  
! ;;; Facilities for loading C header files.  This is independent from the
! ;;; main completion code.  See also the variable `PC-include-file-path'
! ;;; at top of this file.
  
  (defun PC-look-for-include-file ()
    (if (string-match "[\"<]\\([^\"<>]*\\)[\">]?$" (buffer-file-name))
--- 794,802 ----
          (setq files (cdr files)))
        p))))
  
! ;; Facilities for loading C header files.  This is independent from the
! ;; main completion code.  See also the variable `PC-include-file-path'
! ;; at top of this file.
  
  (defun PC-look-for-include-file ()
    (if (string-match "[\"<]\\([^\"<>]*\\)[\">]?$" (buffer-file-name))
***************
*** 817,824 ****
            new-buf)
        (kill-buffer (current-buffer))
        (if (equal name "")
!           (save-excursion
!             (set-buffer (car (buffer-list)))
              (save-excursion
                (beginning-of-line)
                (if (looking-at
--- 807,813 ----
            new-buf)
        (kill-buffer (current-buffer))
        (if (equal name "")
!           (with-current-buffer (car (buffer-list))
              (save-excursion
                (beginning-of-line)
                (if (looking-at
***************
*** 855,862 ****
              (if path
                  (setq name (concat (file-name-as-directory (car path)) name))
                (error "No such include file: <%s>" name)))
!         (let ((dir (save-excursion
!                      (set-buffer (car (buffer-list)))
                       default-directory)))
            (if (file-exists-p (concat dir name))
                (setq name (concat dir name))
--- 844,850 ----
              (if path
                  (setq name (concat (file-name-as-directory (car path)) name))
                (error "No such include file: <%s>" name)))
!         (let ((dir (with-current-buffer (car (buffer-list))
                       default-directory)))
            (if (file-exists-p (concat dir name))
                (setq name (concat dir name))
***************
*** 865,872 ****
        (if new-buf
            ;; no need to verify last-modified time for this!
            (set-buffer new-buf)
!         (setq new-buf (create-file-buffer name))
!         (set-buffer new-buf)
          (erase-buffer)
          (insert-file-contents name t))
        ;; Returning non-nil with the new buffer current
--- 853,859 ----
        (if new-buf
            ;; no need to verify last-modified time for this!
            (set-buffer new-buf)
!         (set-buffer (create-file-buffer name))
          (erase-buffer)
          (insert-file-contents name t))
        ;; Returning non-nil with the new buffer current
***************
*** 885,891 ****
                env (substring env 0 pos)))
        path)))
  
! ;;; This is adapted from lib-complete.el, by Mike Williams.
  (defun PC-include-file-all-completions (file search-path &optional full)
    "Return all completions for FILE in any directory on SEARCH-PATH.
  If optional third argument FULL is non-nil, returned pathnames should be
--- 872,878 ----
                env (substring env 0 pos)))
        path)))
  
! ;; This is adapted from lib-complete.el, by Mike Williams.
  (defun PC-include-file-all-completions (file search-path &optional full)
    "Return all completions for FILE in any directory on SEARCH-PATH.
  If optional third argument FULL is non-nil, returned pathnames should be




reply via email to

[Prev in Thread] Current Thread [Next in Thread]