comparison lisp/ffap.el @ 52731:82315f163e1e

removed defadvice related code from ffap
author Rajesh Vaidheeswarran <rv@gnu.org>
date Thu, 02 Oct 2003 02:21:27 +0000
parents 2b7d168d24b4
children cfde5f632759
comparison
equal deleted inserted replaced
52730:7535333d9c75 52731:82315f163e1e
1247 1247
1248 ;; The rest of this page is just to work with package complete.el. 1248 ;; The rest of this page is just to work with package complete.el.
1249 ;; This code assumes that you load ffap.el after complete.el. 1249 ;; This code assumes that you load ffap.el after complete.el.
1250 ;; 1250 ;;
1251 ;; We must inform complete about whether our completion function 1251 ;; We must inform complete about whether our completion function
1252 ;; will do filename style completion. For earlier versions of 1252 ;; will do filename style completion.
1253 ;; complete.el, this requires a defadvice. For recent versions
1254 ;; there may be a special variable for this purpose.
1255 1253
1256 (defun ffap-complete-as-file-p nil 1254 (defun ffap-complete-as-file-p nil
1257 ;; Will `minibuffer-completion-table' complete the minibuffer 1255 ;; Will `minibuffer-completion-table' complete the minibuffer
1258 ;; contents as a filename? Assumes the minibuffer is current. 1256 ;; contents as a filename? Assumes the minibuffer is current.
1259 ;; Note: t and non-nil mean somewhat different reasons. 1257 ;; Note: t and non-nil mean somewhat different reasons.
1263 1261
1264 (and 1262 (and
1265 (featurep 'complete) 1263 (featurep 'complete)
1266 (if (boundp 'PC-completion-as-file-name-predicate) 1264 (if (boundp 'PC-completion-as-file-name-predicate)
1267 ;; modern version of complete.el, just set the variable: 1265 ;; modern version of complete.el, just set the variable:
1268 (setq PC-completion-as-file-name-predicate 'ffap-complete-as-file-p) 1266 (setq PC-completion-as-file-name-predicate 'ffap-complete-as-file-p)))
1269 (require 'advice)
1270 (defadvice PC-do-completion (around ffap-fix act)
1271 "Work with ffap."
1272 (let ((minibuffer-completion-table
1273 (if (eq t (ffap-complete-as-file-p))
1274 'read-file-name-internal
1275 minibuffer-completion-table)))
1276 ad-do-it))))
1277 1267
1278 1268
1279 ;;; Highlighting (`ffap-highlight'): 1269 ;;; Highlighting (`ffap-highlight'):
1280 ;; 1270 ;;
1281 ;; Based on overlay highlighting in Emacs 19.28 isearch.el. 1271 ;; Based on overlay highlighting in Emacs 19.28 isearch.el.