diff options
| author | Simeon Simeonov | 2017-03-08 13:41:14 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2017-03-08 13:41:14 +0100 |
| commit | 380ef3e4b3907c5f4a203947f38bebe4c0498c4c (patch) | |
| tree | cd80beab87b337830fee71789086f7985be25c5c /.emacs.d | |
| parent | 16cd879c8727fcd433fc9cb5575c23cc19905a34 (diff) | |
Upgrade mod-php and yasnippet
Diffstat (limited to '.emacs.d')
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 37 | ||||
| -rw-r--r-- | .emacs.d/lisp/yasnippet.el | 22 |
2 files changed, 42 insertions, 17 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index cd35d7d..da5da0a 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -257,14 +257,33 @@ can be used to match against definitions for that classlike." | |||
| 257 | "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) | 257 | "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) |
| 258 | "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") | 258 | "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") |
| 259 | 259 | ||
| 260 | (defcustom php-manual-url "http://www.php.net/manual/en/" | 260 | (defcustom php-site-url "http://php.net/" |
| 261 | "Default PHP.net site URL. | ||
| 262 | |||
| 263 | The URL to use open PHP manual and search word. | ||
| 264 | You can find a mirror site closer to you." | ||
| 265 | :type 'string | ||
| 266 | :link '(url-link :tag "List of Mirror Sites" "http://php.net/mirrors.php")) | ||
| 267 | |||
| 268 | (defcustom php-manual-url 'en | ||
| 261 | "URL at which to find PHP manual. | 269 | "URL at which to find PHP manual. |
| 262 | You can replace \"en\" with your ISO language code." | 270 | You can replace \"en\" with your ISO language code." |
| 263 | :type 'string) | 271 | :type '(choice (const :tag "English" 'en) |
| 272 | (const :tag "Brazilian Portuguese" 'pt_BR) | ||
| 273 | (const :tag "Chinese (Simplified)" 'zh) | ||
| 274 | (const :tag "French" 'fr) | ||
| 275 | (const :tag "German" 'de) | ||
| 276 | (const :tag "Japanese" 'ja) | ||
| 277 | (const :tag "Romanian" 'ro) | ||
| 278 | (const :tag "Russian" 'ru) | ||
| 279 | (const :tag "Spanish" 'es) | ||
| 280 | (const :tag "Turkish" 'tr) | ||
| 281 | (string :tag "PHP manual URL"))) | ||
| 264 | 282 | ||
| 265 | (defcustom php-search-url "http://www.php.net/" | 283 | (defcustom php-search-url nil |
| 266 | "URL at which to search for documentation on a word." | 284 | "URL at which to search for documentation on a word." |
| 267 | :type 'string) | 285 | :type '(choice (string :tag "URL to search PHP documentation") |
| 286 | (const :tag "Use `php-site-url' variable" nil))) | ||
| 268 | 287 | ||
| 269 | (defcustom php-completion-file "" | 288 | (defcustom php-completion-file "" |
| 270 | "Path to the file which contains the function names known to PHP." | 289 | "Path to the file which contains the function names known to PHP." |
| @@ -1309,12 +1328,12 @@ With a prefix argument, prompt (with completion) for a word to search for." | |||
| 1309 | t))) | 1328 | t))) |
| 1310 | 1329 | ||
| 1311 | (defsubst php-search-web-documentation (word) | 1330 | (defsubst php-search-web-documentation (word) |
| 1312 | (php-browse-documentation-url (concat php-search-url | 1331 | "Return URL to search PHP manual search by `WORD'." |
| 1313 | (replace-regexp-in-string "_" "-" (downcase word))))) | 1332 | (php-browse-documentation-url (concat (or php-search-url php-site-url) word))) |
| 1314 | 1333 | ||
| 1315 | ;; Define function documentation function | 1334 | ;; Define function documentation function |
| 1316 | (defun php-search-documentation (word) | 1335 | (defun php-search-documentation (word) |
| 1317 | "Search PHP documentation for the word at point. | 1336 | "Search PHP documentation for the `WORD' at point. |
| 1318 | 1337 | ||
| 1319 | If `php-manual-path' has a non-empty string value then the command | 1338 | If `php-manual-path' has a non-empty string value then the command |
| 1320 | will first try searching the local documentation. If the requested | 1339 | will first try searching the local documentation. If the requested |
| @@ -1335,7 +1354,9 @@ a completion list." | |||
| 1335 | (defun php-browse-manual () | 1354 | (defun php-browse-manual () |
| 1336 | "Bring up manual for PHP." | 1355 | "Bring up manual for PHP." |
| 1337 | (interactive) | 1356 | (interactive) |
| 1338 | (browse-url php-manual-url)) | 1357 | (browse-url (if (stringp php-manual-url) |
| 1358 | php-manual-url | ||
| 1359 | (format "%smanual/%s/" php-site-url php-manual-url)))) | ||
| 1339 | 1360 | ||
| 1340 | (defconst php-phpdoc-type-keywords | 1361 | (defconst php-phpdoc-type-keywords |
| 1341 | (list "string" "integer" "int" "boolean" "bool" "float" | 1362 | (list "string" "integer" "int" "boolean" "bool" "float" |
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 7b871b9..76e1d25 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el | |||
| @@ -1352,7 +1352,7 @@ Returns (TEMPLATES START END). This function respects | |||
| 1352 | ((debug error) (cdr oops))))) | 1352 | ((debug error) (cdr oops))))) |
| 1353 | 1353 | ||
| 1354 | (defun yas--eval-for-effect (form) | 1354 | (defun yas--eval-for-effect (form) |
| 1355 | (yas--safely-run-hook (apply-partially #'eval form))) | 1355 | (yas--safely-call-fun (apply-partially #'eval form))) |
| 1356 | 1356 | ||
| 1357 | (defun yas--read-lisp (string &optional nil-on-error) | 1357 | (defun yas--read-lisp (string &optional nil-on-error) |
| 1358 | "Read STRING as a elisp expression and return it. | 1358 | "Read STRING as a elisp expression and return it. |
| @@ -3336,18 +3336,19 @@ This renders the snippet as ordinary text." | |||
| 3336 | (setq yas--snippets-to-move nil)) | 3336 | (setq yas--snippets-to-move nil)) |
| 3337 | 3337 | ||
| 3338 | (defun yas--safely-call-fun (fun) | 3338 | (defun yas--safely-call-fun (fun) |
| 3339 | "Call FUN and catch any errors." | ||
| 3339 | (condition-case error | 3340 | (condition-case error |
| 3340 | (funcall fun) | 3341 | (funcall fun) |
| 3341 | ((debug error) | 3342 | ((debug error) |
| 3342 | (yas--message 2 "Error running %s: %s" | 3343 | (yas--message 2 "Error running %s: %s" fun |
| 3343 | (if (symbolp fun) fun "a hook") | ||
| 3344 | (error-message-string error))))) | 3344 | (error-message-string error))))) |
| 3345 | 3345 | ||
| 3346 | (defun yas--safely-run-hook (hook) | 3346 | (defun yas--safely-run-hook (hook) |
| 3347 | "Call HOOK's functions. | ||
| 3348 | HOOK should be a symbol, a hook variable, as in `run-hooks'." | ||
| 3347 | (let ((debug-on-error (and (not (memq yas-good-grace '(t hooks))) | 3349 | (let ((debug-on-error (and (not (memq yas-good-grace '(t hooks))) |
| 3348 | debug-on-error))) | 3350 | debug-on-error))) |
| 3349 | (if (functionp hook) (yas--safely-call-fun hook) | 3351 | (yas--safely-call-fun (apply-partially #'run-hooks hook)))) |
| 3350 | (mapc #'yas--safely-call-fun hook)))) | ||
| 3351 | 3352 | ||
| 3352 | (defun yas--check-commit-snippet () | 3353 | (defun yas--check-commit-snippet () |
| 3353 | "Check if point exited the currently active field of the snippet. | 3354 | "Check if point exited the currently active field of the snippet. |
| @@ -3355,7 +3356,9 @@ This renders the snippet as ordinary text." | |||
| 3355 | If so cleans up the whole snippet up." | 3356 | If so cleans up the whole snippet up." |
| 3356 | (let* ((snippets (yas-active-snippets 'all)) | 3357 | (let* ((snippets (yas-active-snippets 'all)) |
| 3357 | (snippets-left snippets) | 3358 | (snippets-left snippets) |
| 3358 | (snippet-exit-transform nil) | 3359 | (snippet-exit-transform) |
| 3360 | ;; Record the custom snippet `yas-after-exit-snippet-hook' | ||
| 3361 | ;; set in the expand-env field. | ||
| 3359 | (snippet-exit-hook yas-after-exit-snippet-hook)) | 3362 | (snippet-exit-hook yas-after-exit-snippet-hook)) |
| 3360 | (dolist (snippet snippets) | 3363 | (dolist (snippet snippets) |
| 3361 | (let ((active-field (yas--snippet-active-field snippet))) | 3364 | (let ((active-field (yas--snippet-active-field snippet))) |
| @@ -3383,9 +3386,10 @@ If so cleans up the whole snippet up." | |||
| 3383 | (t | 3386 | (t |
| 3384 | nil))))) | 3387 | nil))))) |
| 3385 | (unless (or (null snippets) snippets-left) | 3388 | (unless (or (null snippets) snippets-left) |
| 3386 | (if snippet-exit-transform | 3389 | (when snippet-exit-transform |
| 3387 | (yas--eval-for-effect snippet-exit-transform)) | 3390 | (yas--eval-for-effect snippet-exit-transform)) |
| 3388 | (yas--safely-run-hook snippet-exit-hook)))) | 3391 | (let ((yas-after-exit-snippet-hook snippet-exit-hook)) |
| 3392 | (yas--safely-run-hook 'yas-after-exit-snippet-hook))))) | ||
| 3389 | 3393 | ||
| 3390 | ;; Apropos markers-to-points: | 3394 | ;; Apropos markers-to-points: |
| 3391 | ;; | 3395 | ;; |
