From: "Sean O'Rourke" <seano@cs.ucla.edu>
To: emacs-devel@gnu.org
Subject: patch: remove advice from tramp.el, redundant function from complete.el
Date: Sat, 20 Oct 2007 08:21:11 -0700 [thread overview]
Message-ID: <m21wbpg6c8.fsf@cs.ucsd.edu> (raw)
[-- 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
next reply other threads:[~2007-10-20 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-20 15:21 Sean O'Rourke [this message]
2007-10-22 9:00 ` patch: remove advice from tramp.el, redundant function from complete.el Richard Stallman
2007-10-22 9:46 ` Juanma Barranquero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m21wbpg6c8.fsf@cs.ucsd.edu \
--to=seano@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.