Skip to content

Commit e46c80f

Browse files
committedFeb 16, 2015
Merge pull request #225 from ejmr/remove-cl-flet
Remove cl-flet
2 parents 25a923f + 9816877 commit e46c80f

File tree

1 file changed

+30
-40
lines changed

1 file changed

+30
-40
lines changed
 

‎php-mode.el

+30-40
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
(defconst php-mode-version-number "1.15.3"
1212
"PHP Mode version number.")
1313

14-
(defconst php-mode-modified "2015-01-31"
14+
(defconst php-mode-modified "2015-02-16"
1515
"PHP Mode build date.")
1616

1717
;;; License
@@ -94,11 +94,8 @@
9494
;; Use the recommended cl functions in php-mode but alias them to the
9595
;; old names when we detect emacs < 24.3
9696
(if (and (= emacs-major-version 24) (< emacs-minor-version 3))
97-
(progn
98-
(unless (fboundp 'cl-flet)
99-
(defalias 'cl-flet 'flet))
100-
(unless (fboundp 'cl-set-difference)
101-
(defalias 'cl-set-difference 'set-difference))))
97+
(unless (fboundp 'cl-set-difference)
98+
(defalias 'cl-set-difference 'set-difference)))
10299

103100

104101
;; Local variables
@@ -1280,27 +1277,24 @@ exists, and nil otherwise.
12801277
12811278
With a prefix argument, prompt (with completion) for a word to search for."
12821279
(interactive (php--search-documentation-read-arg))
1283-
(cl-flet ((php-file-for (type name)
1284-
(expand-file-name
1285-
(format "%s.%s.html" type
1286-
(replace-regexp-in-string
1287-
"_" "-" (downcase name)))
1288-
php-manual-path))
1289-
(php-file-url (file)
1290-
;; Some browsers require the file:// prefix.
1291-
;; Others do not seem to care. But it should
1292-
;; never be incorrect to use the prefix.
1293-
(if (string-prefix-p "file://" file)
1294-
file
1295-
(concat "file://" file))))
1296-
(let ((file (catch 'found
1297-
(loop for type in php-search-local-documentation-types do
1298-
(let ((file (php-file-for type word)))
1299-
(when (file-exists-p file)
1300-
(throw 'found file)))))))
1301-
(when file
1302-
(php-browse-documentation-url (php-file-url file))
1303-
t))))
1280+
(let ((file (catch 'found
1281+
(loop for type in php-search-local-documentation-types do
1282+
(let* ((doc-html (format "%s.%s.html"
1283+
type
1284+
(replace-regexp-in-string
1285+
"_" "-" (downcase word))))
1286+
(file (expand-file-name doc-html php-manual-path)))
1287+
(when (file-exists-p file)
1288+
(throw 'found file)))))))
1289+
(when file
1290+
(let ((file-url (if (string-prefix-p "file://" file)
1291+
file
1292+
(concat "file://" file))))
1293+
(php-browse-documentation-url file-url))
1294+
t)))
1295+
1296+
(defsubst php-search-web-documentation (word)
1297+
(php-browse-documentation-url (concat php-search-url word)))
13041298

13051299
;; Define function documentation function
13061300
(defun php-search-documentation (word)
@@ -1315,14 +1309,11 @@ With a prefix argument, prompt for a documentation word to search
13151309
for. If the local documentation is available, it is used to build
13161310
a completion list."
13171311
(interactive (php--search-documentation-read-arg))
1318-
(cl-flet ((php-search-web-documentation (name)
1319-
(php-browse-documentation-url
1320-
(concat php-search-url name))))
1321-
(if (and (stringp php-manual-path)
1322-
(not (string= php-manual-path "")))
1323-
(or (php-search-local-documentation word)
1324-
(php-search-web-documentation word))
1325-
(php-search-web-documentation word))))
1312+
(if (and (stringp php-manual-path)
1313+
(not (string= php-manual-path "")))
1314+
(or (php-search-local-documentation word)
1315+
(php-search-web-documentation word))
1316+
(php-search-web-documentation word)))
13261317

13271318
;; Define function for browsing manual
13281319
(defun php-browse-manual ()
@@ -1447,11 +1438,10 @@ The output will appear in the buffer *PHP*."
14471438
;; Calling 'php -r' will fail if we send it code that starts with
14481439
;; '<?php', which is likely. So we run the code through this
14491440
;; function to check for that prefix and remove it.
1450-
(cl-flet ((clean-php-code (code)
1451-
(if (string-prefix-p "<?php" code t)
1452-
(substring code 5)
1453-
code)))
1454-
(call-process "php" nil php-buffer nil "-r" (clean-php-code code)))))
1441+
(let ((cleaned-php-code (if (string-prefix-p "<?php" code t)
1442+
(substring code 5)
1443+
code)))
1444+
(call-process "php" nil php-buffer nil "-r" cleaned-php-code))))
14551445

14561446

14571447
(defface php-annotations-annotation-face '((t . (:inherit font-lock-constant-face)))

0 commit comments

Comments
 (0)
Please sign in to comment.