@@ -1346,11 +1346,12 @@ for \\[find-tag] (which see)."
13461346 (delete-region beg (point ))
13471347 (insert completion))
13481348 (t
1349- (message " Making completion list... " )
1350- (with-output-to-temp-buffer " *Completions*"
1351- (display-completion-list
1352- (all-completions pattern php-functions)))
1353- (message " Making completion list...%s " " done" )))))))
1349+ (let ((selected (completing-read
1350+ " Select completion: "
1351+ (all-completions pattern php-functions)
1352+ nil t pattern)))
1353+ (delete-region beg (point ))
1354+ (insert selected))))))))
13541355
13551356(defun php-completion-table ()
13561357 " Build variable `php-completion-table' on demand.
@@ -1367,7 +1368,8 @@ current `tags-file-name'."
13671368 (cond ((and (not (string= " " php-completion-file))
13681369 (file-readable-p php-completion-file))
13691370 (php-build-table-from-file php-completion-file))
1370- (php-manual-path
1371+ ((and (not (string= " " php-manual-path))
1372+ (file-directory-p php-manual-path))
13711373 (php-build-table-from-path php-manual-path))
13721374 (t nil ))))
13731375 (unless (or php-table tags-table)
@@ -1376,8 +1378,10 @@ current `tags-file-name'."
13761378 " `php-completion-file' or `php-manual-path' set" )))
13771379 (when tags-table
13781380 ; ; Combine the tables.
1379- (mapatoms (lambda (sym ) (intern (symbol-name sym) php-table))
1380- tags-table))
1381+ (if (obarrayp tags-table)
1382+ (mapatoms (lambda (sym ) (intern (symbol-name sym) php-table))
1383+ tags-table)
1384+ (setq php-table (append tags-table php-table))))
13811385 (setq php-completion-table php-table))))
13821386
13831387(defun php-build-table-from-file (filename )
@@ -1394,19 +1398,11 @@ current `tags-file-name'."
13941398 table))
13951399
13961400(defun php-build-table-from-path (path )
1397- (let ((table (make-vector 1022 0 ))
1398- (files (directory-files
1399- path
1400- nil
1401- " ^function\\ ..+\\ .html$" )))
1402- (mapc (lambda (file )
1403- (string-match " \\ .\\ ([-a-zA-Z_0-9]+\\ )\\ .html$" file)
1404- (intern
1405- (replace-regexp-in-string
1406- " -" " _" (substring file (match-beginning 1 ) (match-end 1 )) t )
1407- table))
1408- files )
1409- table))
1401+ " Return list of PHP function name from `PATH' directory."
1402+ (cl-loop for file in (directory-files path nil " ^function\\ ..+\\ .html$" )
1403+ if (string-match " \\ .\\ ([-a-zA-Z_0-9]+\\ )\\ .html$" file)
1404+ collect (replace-regexp-in-string
1405+ " -" " _" (substring file (match-beginning 1 ) (match-end 1 )) t )))
14101406
14111407; ; Find the pattern we want to complete
14121408; ; find-tag-default from GNU Emacs etags.el
0 commit comments