From eb2f8b1a6dccd17e31bc486439bf72ee3e81e050 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 26 Oct 2015 12:08:33 +0100 Subject: Upgrade php-mode and yasnippet. Introduce which-function support in .emacs --- .emacs | 11 +- .emacs.d/lisp/php-mode.el | 14 +- .emacs.d/lisp/yasnippet.el | 210 +++++++++++++++------------- .emacs.d/snippets/python-mode/.yas-setup.el | 2 +- 4 files changed, 130 insertions(+), 107 deletions(-) diff --git a/.emacs b/.emacs index fc619f9..c1e37f3 100644 --- a/.emacs +++ b/.emacs @@ -48,8 +48,8 @@ ;; Programming section ;; Indentation -;;(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) -(setq-default c-basic-offset 4 tab-width 4) +(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) +;;(setq-default c-basic-offset 4 tab-width 4) ;; Default coding style (setq c-default-style "bsd") @@ -57,13 +57,16 @@ ;; Don't attempt to guess the Python-indent (setq python-indent-guess-indent-offset nil) +;; Enable which-function-mode for C, C++ and Python +(setq which-func-modes '(python-mode c-mode c++-mode)) +(which-function-mode t) ;; Custom plugins (add-to-list 'load-path "~/.emacs.d/lisp/") ;;PHP -(autoload 'php-mode "php-mode" "Mode for editing PHP source files") -(add-to-list 'auto-mode-alist '("\\.\\(inc\\|php[s34]?\\)" . php-mode)) +;; (autoload 'php-mode "php-mode" "Mode for editing PHP source files") +;; (add-to-list 'auto-mode-alist '("\\.\\(inc\\|php[s34]?\\)" . php-mode)) ;; YAML (require 'yaml-mode) diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index ef31a17..6979e8c 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el @@ -11,7 +11,7 @@ (defconst php-mode-version-number "1.17.0" "PHP Mode version number.") -(defconst php-mode-modified "2015-06-23" +(defconst php-mode-modified "2015-10-02" "PHP Mode build date.") ;;; License @@ -517,7 +517,8 @@ PHP does not have an \"enum\"-like keyword." "null")) (c-lang-defconst c-lambda-kwds - php '("function")) + php '("function" + "use")) (c-lang-defconst c-other-kwds "Keywords not accounted for by any other `*-kwds' language constant." @@ -550,6 +551,7 @@ PHP does not have an \"enum\"-like keyword." "var" "xor" "yield" + "yield from" ;; Below keywords are technically not reserved keywords, but ;; threated no differently by php-mode from actual reserved @@ -558,6 +560,7 @@ PHP does not have an \"enum\"-like keyword." ;;; declare directives: "encoding" "ticks" + "strict_types" ;;; self for static references: "self" @@ -604,6 +607,7 @@ but only if the setting is enabled" (class-open . -) (comment-intro . 0) (inlambda . 0) + (lambda-intro-cont . +) (inline-open . 0) (label . +) (statement-cont . (first php-lineup-cascaded-calls php-lineup-string-cont +)) @@ -1301,7 +1305,8 @@ With a prefix argument, prompt (with completion) for a word to search for." t))) (defsubst php-search-web-documentation (word) - (php-browse-documentation-url (concat php-search-url word))) + (php-browse-documentation-url (concat php-search-url + (replace-regexp-in-string "_" "-" (downcase word))))) ;; Define function documentation function (defun php-search-documentation (word) @@ -1402,6 +1407,9 @@ a completion list." " \\(\\sw+\\)") 1 font-lock-type-face) + ;; Highlight return types in functions and methods. + ("function.+:\\s-?\\(\\sw+\\)" 1 font-lock-type-face) + ;; While c-opt-cpp-* highlights the