From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sean O'Rourke" Newsgroups: gmane.emacs.devel Subject: patch to remove defadvice in complete.el Date: Thu, 21 Jun 2007 06:01:57 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1182430990 14368 80.91.229.12 (21 Jun 2007 13:03:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 21 Jun 2007 13:03:10 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 21 15:03:07 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I1MJP-0007Ee-Uf for ged-emacs-devel@m.gmane.org; Thu, 21 Jun 2007 15:03:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I1MJP-000430-HJ for ged-emacs-devel@m.gmane.org; Thu, 21 Jun 2007 09:02:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I1MIX-0003Tm-MN for emacs-devel@gnu.org; Thu, 21 Jun 2007 09:02:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I1MIW-0003T5-GI for emacs-devel@gnu.org; Thu, 21 Jun 2007 09:02:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I1MIW-0003Sv-A0 for emacs-devel@gnu.org; Thu, 21 Jun 2007 09:02:04 -0400 Original-Received: from outbound1.ucsd.edu ([132.239.1.205]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I1MIV-0005Bp-IR for emacs-devel@gnu.org; Thu, 21 Jun 2007 09:02:03 -0400 Original-Received: from smtp.ucsd.edu (smtp.ucsd.edu [132.239.1.49]) by outbound1.ucsd.edu (8.13.6/8.13.6) with ESMTP id l5LD1xeU089739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Jun 2007 06:02:00 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; s=2007001; d=ucsd.edu; c=simple; q=dns; b=RDlU4nr/OoIWbJ2nUt5+GjP8Z4GlhFZwfPOdNDrb+pNX1PLQj/1oX6Nbdmrls96HM UU2POLOwb9CUVKvlOXWHw== Original-Received: from 0-16-cb-b9-d7-be.dynamic.ucsd.edu ([128.54.220.221]) by smtp.ucsd.edu (8.13.6/8.13.4) with ESMTP id l5LD1wrs095014 for ; Thu, 21 Jun 2007 06:01:59 -0700 (PDT) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin) X-detected-kernel: FreeBSD 6.x (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:73525 Archived-At: --=-=-= Dan Nicolaescu brought to my attention the use of advice in complete.el. The attached patch removes it without (I think) harming the include-file-expanding feature. /s --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=noadvice.diff diff -uw /usr/local/share/emacs/22.1.50/lisp/complete.el.\~1.72\~ /usr/local/share/emacs/22.1.50/lisp/complete.el --- /usr/local/share/emacs/22.1.50/lisp/complete.el.~1.72~ 2007-06-04 14:59:26.000000000 -0700 +++ /usr/local/share/emacs/22.1.50/lisp/complete.el 2007-06-20 18:44:18.000000000 -0700 @@ -231,13 +222,6 @@ (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 ((not partial-completion-mode) - (ad-disable-advice 'read-file-name-internal 'around 'PC-include-file) - (ad-activate 'read-file-name-internal)) - ((not PC-disable-includes) - (ad-enable-advice 'read-file-name-internal 'around 'PC-include-file) - (ad-activate 'read-file-name-internal))) ;; Adjust the completion selection in *Completion* buffers to the way ;; we work. The default minibuffer completion code only completes the ;; text before point and leaves the text after point alone (new in @@ -439,7 +423,9 @@ GOTO-END is non-nil, however, it instead replaces up to END." (or beg (setq beg (minibuffer-prompt-end))) (or end (setq end (point-max))) - (let* ((table minibuffer-completion-table) + (let* ((table (if (eq minibuffer-completion-table 'read-file-name-internal) + 'PC-read-file-name-internal + minibuffer-completion-table)) (pred minibuffer-completion-predicate) (filename (funcall PC-completion-as-file-name-predicate)) (dirname nil) ; non-nil only if a filename is being completed @@ -532,11 +519,11 @@ (insert str) (setq end (+ beg (length str))))) (if origstr - ;; If the wildcards were introduced by us, it's possible - ;; that read-file-name-internal (especially our - ;; PC-include-file advice) can still find matches for the - ;; original string even if we couldn't, so remove the - ;; added wildcards. + ;; If the wildcards were introduced by us, it's + ;; possible that PC-read-file-name-internal can + ;; still find matches for the original string + ;; even if we couldn't, so remove the added + ;; wildcards. (setq str origstr) (setq filename nil table nil pred nil))))) @@ -921,7 +921,7 @@ (point-min) t) (+ (point) 2) (point-min))) - (minibuffer-completion-table 'read-file-name-internal) + (minibuffer-completion-table 'PC-read-file-name-internal) (minibuffer-completion-predicate "") (PC-not-minibuffer t)) (goto-char end) @@ -1107,24 +1107,23 @@ (setq sorted (cdr sorted))) compressed)))) -(defadvice read-file-name-internal (around PC-include-file disable) - (if (string-match "<\\([^\"<>]*\\)>?\\'" (ad-get-arg 0)) - (let* ((string (ad-get-arg 0)) - (action (ad-get-arg 2)) - (name (match-string 1 string)) +(defun PC-read-file-name-internal (string dir action) + "Extend `read-file-name-internal' to handle include files. +This is only used by " + (if (string-match "<\\([^\"<>]*\\)>?\\'" string) + (let* ((name (match-string 1 string)) (str2 (substring string (match-beginning 0))) (completion-table (mapcar (lambda (x) (format (if (string-match "/\\'" x) "<%s" "<%s>") x)) (PC-include-file-all-completions name (PC-include-file-path))))) - (setq ad-return-value (cond ((not completion-table) nil) ((eq action 'lambda) (test-completion str2 completion-table nil)) ((eq action nil) (PC-try-completion str2 completion-table nil)) - ((eq action t) (all-completions str2 completion-table nil))))) - ad-do-it)) + ((eq action t) (all-completions str2 completion-table nil)))) + (read-file-name-internal string dir action))) (provide 'complete) Diff finished. Wed Jun 20 19:17:51 2007 --=-=-= 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 --=-=-=--