emacs-devel
[Top][All Lists]
Advanced

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

Re: patch: remove advice from tramp.el, redundant function from complete


From: Richard Stallman
Subject: Re: patch: remove advice from tramp.el, redundant function from complete.el
Date: Mon, 22 Oct 2007 05:00:35 -0400

Would someone please install this, then ack?
Sean, thanks for finding the simplification
and eliminating a defadvice.

To: address@hidden
From: "Sean O'Rourke" <address@hidden>
Date: Sat, 20 Oct 2007 08:21:11 -0700
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Subject: patch: remove advice from tramp.el,
        redundant function from complete.el

--=-=-=

The included patch removes a defadvice from tramp.el and removes
the advised function, which seemed to be redundant with
file-expand-wildcards, from complete.el.  I don't use wildcard
expansion much, so could someone who does please give it a spin?

Thanks,
Sean

2007-10-20  Sean O'Rourke  <address@hidden>

        * complete.el (PC-expand-many-files): removed.
        (PC-do-completion): call file-expand-wildcards instead of
        PC-expand-many-files.
        * tramp.el (tramp-handle-expand-many-files): removed.
        (PC-expand-many-files): remove advice.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=complete.patch

Index: lisp/net/tramp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.147
diff -p -u -w -r1.147 tramp.el
--- lisp/net/tramp.el   18 Oct 2007 22:49:05 -0000      1.147
+++ lisp/net/tramp.el   20 Oct 2007 15:09:31 -0000
@@ -4521,60 +4521,6 @@ Falls back to normal file name handler i
 
 ;;; Interactions with other packages:
 
-;; -- complete.el --
-
-;; This function contributed by Ed Sabol
-(defun tramp-handle-expand-many-files (name)
-  "Like `PC-expand-many-files' for Tramp files."
-  (with-parsed-tramp-file-name name nil
-    (save-match-data
-      (if (or (string-match "\\*" name)
-             (string-match "\\?" name)
-             (string-match "\\[.*\\]" name))
-         (progn
-           (let (bufstr)
-             ;; CCC: To do it right, we should quote certain characters
-             ;; in the file name, but since the echo command is going to
-             ;; break anyway when there are spaces in the file names, we
-             ;; don't bother.
-             ;;-(let ((comint-file-name-quote-list
-             ;;-       (set-difference tramp-file-name-quote-list
-             ;;-                       '(?\* ?\? ?[ ?]))))
-             ;;-  (tramp-send-command
-             ;;-   method user host
-             ;;-   (format "echo %s" (comint-quote-filename localname))))
-             (tramp-send-command v (format "echo %s" localname))
-             (setq bufstr (buffer-substring
-                           (point-min) (tramp-compat-line-end-position)))
-             (with-current-buffer (tramp-get-buffer v)
-               (goto-char (point-min))
-               (if (string-equal localname bufstr)
-                   nil
-                 (insert "(\"")
-                 (while (search-forward " " nil t)
-                   (delete-backward-char 1)
-                   (insert "\" \""))
-                 (goto-char (point-max))
-                 (delete-backward-char 1)
-                 (insert "\")")
-                 (goto-char (point-min))
-                 (mapcar
-                  (function (lambda (x)
-                              (tramp-make-tramp-file-name method user host x)))
-                  (read (current-buffer)))))))
-       (list (expand-file-name name))))))
-
-(eval-after-load "complete"
-  '(progn
-     (defadvice PC-expand-many-files
-       (around tramp-advice-PC-expand-many-files (name) activate)
-       "Invoke `tramp-handle-expand-many-files' for Tramp files."
-       (if (tramp-tramp-file-p name)
-          (setq ad-return-value (tramp-handle-expand-many-files name))
-        ad-do-it))
-     (add-hook 'tramp-unload-hook
-              '(lambda () (ad-unadvise 'PC-expand-many-files)))))
-
 ;;; File name handler functions for completion mode.
 
 (defvar tramp-completion-mode nil
Index: lisp/complete.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/complete.el,v
retrieving revision 1.79
diff -p -u -w -r1.79 complete.el
--- lisp/complete.el    6 Sep 2007 17:12:17 -0000       1.79
+++ lisp/complete.el    20 Oct 2007 15:09:32 -0000
@@ -515,7 +515,7 @@ GOTO-END is non-nil, however, it instead
                                 "*"
                                 (substring pat p))
                     p (+ p 2)))
-            (setq files (PC-expand-many-files (concat pat "*")))
+               (setq files (file-expand-wildcards (concat pat "*")))
             (if files
                 (let ((dir (file-name-directory (car files)))
                       (p files))
@@ -609,7 +609,7 @@ GOTO-END is non-nil, however, it instead
                    (setq
                     basestr ""
                     p nil
-                    poss (PC-expand-many-files
+                      poss (file-expand-wildcards
                           (concat "/"
                                   (mapconcat #'list (match-string 1 str) "*/")
                                   "*"))
@@ -969,61 +969,6 @@ or properties are considered."
      (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)
-    (when (and (file-name-absolute-p name)
-               (not (file-directory-p default-directory)))
-      ;; If the current working directory doesn't exist `shell-command'
-      ;; signals an error.  So if the file names we're looking for don't
-      ;; depend on the working directory, switch to a valid directory first.
-      (setq default-directory "/"))
-    (shell-command (concat "echo " name) t)
-    (goto-char (point-min))
-    ;; CSH-style shells were known to output "No match", whereas
-    ;; SH-style shells tend to simply output `name' when no match is found.
-    (if (looking-at (concat ".*No match\\|\\(^\\| \\)\\("
-                           (regexp-quote name)
-                           "\\|"
-                           (regexp-quote (expand-file-name name))
-                           "\\)\\( \\|$\\)"))
-       nil
-      (insert "(\"")
-      (while (search-forward " " nil t)
-       (delete-backward-char 1)
-       (insert "\" \""))
-      (goto-char (point-max))
-      (delete-backward-char 1)
-      (insert "\")")
-      (goto-char (point-min))
-      (let ((files (read (current-buffer))) (p nil))
-       (kill-buffer (current-buffer))
-       (or (equal completion-ignored-extensions PC-ignored-extensions)
-           (setq PC-ignored-regexp
-                 (concat "\\("
-                         (mapconcat
-                          'regexp-quote
-                          (setq PC-ignored-extensions
-                                completion-ignored-extensions)
-                          "\\|")
-                         "\\)\\'")))
-       (setq p nil)
-       (while files
-          ;; This whole process of going through to shell, to echo, and
-          ;; finally parsing the output is a hack.  It breaks as soon as
-          ;; there are spaces in the file names or when the no-match
-          ;; message changes.  To make up for it, we check that what we read
-          ;; indeed exists, so we may miss some files, but we at least won't
-          ;; list non-existent ones.
-         (or (not (file-exists-p (car files)))
-             (string-match PC-ignored-regexp (car files))
-             (setq p (cons (car files) p)))
-         (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.

--=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel
--=-=-=--







reply via email to

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