From b8e036108162a1222471a72ba174d9581f5ac3fd Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Mon, 16 Feb 2015 14:57:13 +0900 Subject: [PATCH 1/2] Remove cl-flet We should not use cl-flet because - cl-flet is different from flet on Emacs >=24.3 - We should use for defining local function cl-labels or anonymous function(lambda) + funcall instead of flet (flet should be used for overriding function temporary, however we should use cl-letf for this purpose) - It is unnecessary at all to using cl-flet in php-mode.el now. --- php-mode.el | 68 +++++++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/php-mode.el b/php-mode.el index c7ed5bcc..3443f497 100644 --- a/php-mode.el +++ b/php-mode.el @@ -94,11 +94,8 @@ ;; Use the recommended cl functions in php-mode but alias them to the ;; old names when we detect emacs < 24.3 (if (and (= emacs-major-version 24) (< emacs-minor-version 3)) - (progn - (unless (fboundp 'cl-flet) - (defalias 'cl-flet 'flet)) - (unless (fboundp 'cl-set-difference) - (defalias 'cl-set-difference 'set-difference)))) + (unless (fboundp 'cl-set-difference) + (defalias 'cl-set-difference 'set-difference))) ;; Local variables @@ -1280,27 +1277,24 @@ exists, and nil otherwise. With a prefix argument, prompt (with completion) for a word to search for." (interactive (php--search-documentation-read-arg)) - (cl-flet ((php-file-for (type name) - (expand-file-name - (format "%s.%s.html" type - (replace-regexp-in-string - "_" "-" (downcase name))) - php-manual-path)) - (php-file-url (file) - ;; Some browsers require the file:// prefix. - ;; Others do not seem to care. But it should - ;; never be incorrect to use the prefix. - (if (string-prefix-p "file://" file) - file - (concat "file://" file)))) - (let ((file (catch 'found - (loop for type in php-search-local-documentation-types do - (let ((file (php-file-for type word))) - (when (file-exists-p file) - (throw 'found file))))))) - (when file - (php-browse-documentation-url (php-file-url file)) - t)))) + (let ((file (catch 'found + (loop for type in php-search-local-documentation-types do + (let* ((doc-html (format "%s.%s.html" + type + (replace-regexp-in-string + "_" "-" (downcase word)))) + (file (expand-file-name doc-html php-manual-path))) + (when (file-exists-p file) + (throw 'found file))))))) + (when file + (let ((file-url (if (string-prefix-p "file://" file) + file + (concat "file://" file)))) + (php-browse-documentation-url file-url)) + t))) + +(defsubst php-search-web-documentation (word) + (php-browse-documentation-url (concat php-search-url word))) ;; Define function documentation function (defun php-search-documentation (word) @@ -1315,14 +1309,11 @@ With a prefix argument, prompt for a documentation word to search for. If the local documentation is available, it is used to build a completion list." (interactive (php--search-documentation-read-arg)) - (cl-flet ((php-search-web-documentation (name) - (php-browse-documentation-url - (concat php-search-url name)))) - (if (and (stringp php-manual-path) - (not (string= php-manual-path ""))) - (or (php-search-local-documentation word) - (php-search-web-documentation word)) - (php-search-web-documentation word)))) + (if (and (stringp php-manual-path) + (not (string= php-manual-path ""))) + (or (php-search-local-documentation word) + (php-search-web-documentation word)) + (php-search-web-documentation word))) ;; Define function for browsing manual (defun php-browse-manual () @@ -1447,11 +1438,10 @@ The output will appear in the buffer *PHP*." ;; Calling 'php -r' will fail if we send it code that starts with ;; ' Date: Mon, 16 Feb 2015 23:19:03 +0900 Subject: [PATCH 2/2] Update last modified day --- php-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php-mode.el b/php-mode.el index 3443f497..bf7c9aab 100644 --- a/php-mode.el +++ b/php-mode.el @@ -11,7 +11,7 @@ (defconst php-mode-version-number "1.15.3" "PHP Mode version number.") -(defconst php-mode-modified "2015-01-31" +(defconst php-mode-modified "2015-02-16" "PHP Mode build date.") ;;; License