all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* patch: remove advice from tramp.el, redundant function from complete.el
@ 2007-10-20 15:21 Sean O'Rourke
  2007-10-22  9:00 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Sean O'Rourke @ 2007-10-20 15:21 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

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  <sorourke@cs.ucsd.edu>

	* 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: complete.patch --]
[-- Type: text/x-patch, Size: 5987 bytes --]

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.

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch: remove advice from tramp.el, redundant function from complete.el
  2007-10-20 15:21 patch: remove advice from tramp.el, redundant function from complete.el Sean O'Rourke
@ 2007-10-22  9:00 ` Richard Stallman
  2007-10-22  9:46   ` Juanma Barranquero
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2007-10-22  9:00 UTC (permalink / raw)
  To: emacs-devel

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

To: emacs-devel@gnu.org
From: "Sean O'Rourke" <seano@cs.ucla.edu>
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  <sorourke@cs.ucsd.edu>

	* 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
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
--=-=-=--

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch: remove advice from tramp.el, redundant function from complete.el
  2007-10-22  9:00 ` Richard Stallman
@ 2007-10-22  9:46   ` Juanma Barranquero
  0 siblings, 0 replies; 3+ messages in thread
From: Juanma Barranquero @ 2007-10-22  9:46 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

On 10/22/07, Richard Stallman <rms@gnu.org> wrote:

> Would someone please install this, then ack?

ACK

             Juanma

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-22  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-20 15:21 patch: remove advice from tramp.el, redundant function from complete.el Sean O'Rourke
2007-10-22  9:00 ` Richard Stallman
2007-10-22  9:46   ` Juanma Barranquero

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.