From 1adfb1d130c27b4d0f12d956446604a3714c1bc9 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Tue, 8 Jan 2019 10:41:09 +0100 Subject: Add lua-mode.el, update php-mode and yasnippet, add some new C and Python snippets --- .emacs.d/lisp/php-mode.el | 81 +++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 28 deletions(-) (limited to '.emacs.d/lisp/php-mode.el') diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index e1b2597..79bf356 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el @@ -1,5 +1,6 @@ ;;; php-mode.el --- Major mode for editing PHP code +;; Copyright (C) 2018 Friends of Emacs-PHP development ;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad ;; 2008 Aaron S. Hawley ;; 2011, 2012, 2013, 2014, 2015, 2016, 2017 Eric James Michael Ritz @@ -8,14 +9,14 @@ ;; Maintainer: USAMI Kenta ;; URL: https://github.com/emacs-php/php-mode ;; Keywords: languages php -;; Version: 1.19.1 +;; Version: 1.20.0 ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) ;; License: GPL-3.0-or-later -(defconst php-mode-version-number "1.19.1" +(defconst php-mode-version-number "1.20.0" "PHP Mode version number.") -(defconst php-mode-modified "2018-08-28" +(defconst php-mode-modified "2018-12-05" "PHP Mode build date.") ;; This file is free software; you can redistribute it and/or @@ -92,6 +93,7 @@ (eval-when-compile (require 'regexp-opt) + (autoload 'pkg-info-version-info "pkg-info") (defvar c-vsemi-status-unknown-p) (defvar syntax-propertize-via-font-lock)) @@ -122,10 +124,20 @@ ;; Local variables ;;;###autoload (defgroup php nil - "Major mode for editing PHP code." + "Language support for PHP." :tag "PHP" - :prefix "php-" :group 'languages + :group 'php + :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") + :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) + +;;;###autoload +(defgroup php-mode nil + "Major mode for editing PHP code." + :tag "PHP Mode" + :prefix "php-mode-" + :group 'languages + :group 'php :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) @@ -134,13 +146,17 @@ "The location of the PHP executable." :type 'string) -(defcustom php-default-face 'default +(define-obsolete-variable-alias 'php-default-face 'php-mode-default-face "1.20.0") +(defcustom php-mode-default-face 'default "Default face in `php-mode' buffers." + :group 'php-mode :type 'face) -(defcustom php-speedbar-config t +(define-obsolete-variable-alias 'php-speedbar-config 'php-mode-speedbar-config "1.20.0") +(defcustom php-mode-speedbar-config t "When set to true automatically configures Speedbar to observe PHP files. Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\)\"" + :group 'php-mode :type 'boolean :set (lambda (sym val) (set-default sym val) @@ -151,14 +167,17 @@ Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\ (defcustom php-mode-speedbar-open nil "Normally `php-mode' starts with the speedbar closed. Turning this on will open it whenever `php-mode' is loaded." + :group 'php-mode :type 'boolean :set (lambda (sym val) (set-default sym val) (when val - (speedbar 1)))) + (speedbar 1)))) -(defcustom php-template-compatibility t +(define-obsolete-variable-alias 'php-template-compatibility 'php-mode-template-compatibility "1.20.0") +(defcustom php-mode-template-compatibility t "Should detect presence of html tags." + :group 'php-mode :type 'boolean) (defsubst php-in-string-p () @@ -170,7 +189,7 @@ Turning this on will open it whenever `php-mode' is loaded." (defsubst php-in-string-or-comment-p () (nth 8 (syntax-ppss))) -(defun php-mode-extra-constants-create-regexp(kwds) +(defun php-mode-extra-constants-create-regexp (kwds) "Create regexp for the list of extra constant keywords KWDS." (concat "[^_$]?\\<\\(" (regexp-opt @@ -178,7 +197,7 @@ Turning this on will open it whenever `php-mode' is loaded." (when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants))) "\\)\\>[^_]?")) -(defun php-mode-extra-constants-set(sym value) +(defun php-mode-extra-constants-set (sym value) "Apply the list of extra constant keywords `VALUE'. This function is called when the custom variable php-extra-constants @@ -194,14 +213,18 @@ of constants when set." 'php-mode `((,(php-mode-extra-constants-create-regexp value) 1 'php-constant)))) (set sym value)) -(defcustom php-lineup-cascaded-calls nil +(define-obsolete-variable-alias 'php-lineup-cascaded-calls 'php-mode-lineup-cascaded-calls "1.20.0") +(defcustom php-mode-lineup-cascaded-calls nil "Indent chained method calls to the previous line." + :group 'php-mode :type 'boolean) -;;;###autoload -(defcustom php-extra-constants '() + +(define-obsolete-variable-alias 'php-extra-constants 'php-mode-extra-constants "1.20.0") +(defcustom php-mode-extra-constants '() "A list of additional strings to treat as PHP constants." - :type 'list + :group 'php-mode + :type '(repeat string) :set 'php-mode-extra-constants-set) (defun php-create-regexp-for-method (visibility) @@ -265,10 +288,11 @@ can be used to match against definitions for that classlike." "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") -(defcustom php-do-not-use-semantic-imenu t +(define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0") +(defcustom php-mode-do-not-use-semantic-imenu t "Customize `imenu-create-index-function' for `php-mode'. -If using `semantic-mode' `imenu-create-index-function' will be +If using function `semantic-mode' `imenu-create-index-function' will be set to `semantic-create-imenu-index' due to `c-mode' being its parent. Set this variable to t if you want to use `imenu-default-create-index-function' even with `semantic-mode' @@ -394,6 +418,11 @@ This function may interfere with other hooks and other behaviors. In that case set to `NIL'." :type 'boolean) +(defcustom php-mode-disable-parent-mode-hooks t + "When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')." + :type 'boolean + :group 'php-mode) + (defun php-mode-version () "Display string describing the version of PHP Mode." (interactive) @@ -405,9 +434,9 @@ In that case set to `NIL'." (define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0") (defvar php-mode-map - (let ((map (make-sparse-keymap))) - ;; (define-key map [menu-bar php] - ;; (cons "PHP" (make-sparse-keymap "PHP"))) + (let ((map (make-sparse-keymap "PHP Mode"))) + ;; Remove menu item for c-mode + (define-key map [menu-bar C] nil) ;; (define-key map [menu-bar php complete-function] ;; '("Complete function name" . php-complete-function)) @@ -1014,7 +1043,7 @@ this ^ lineup" (defgroup php-faces nil "Faces used in PHP Mode" :tag "PHP Faces" - :group 'php + :group 'php-mode :group 'faces) (defface php-string '((t (:inherit font-lock-string-face))) @@ -1234,7 +1263,9 @@ After setting the stylevars run hooks according to STYLENAME "Major mode for editing PHP code. \\{php-mode-map}" - + (when php-mode-disable-parent-mode-hooks + (setq-local c-mode-hook nil) + (setq-local java-mode-hook nil)) (c-initialize-cc-mode t) (c-init-language-vars php-mode) (c-common-init 'php-mode) @@ -1310,7 +1341,6 @@ After setting the stylevars run hooks according to STYLENAME (save-excursion (php-syntax-propertize-function (point-min) (point-max)))))) - (declare-function semantic-create-imenu-index "semantic/imenu" (&optional stream)) (defvar-mode-local php-mode imenu-create-index-function @@ -1859,9 +1889,4 @@ The output will appear in the buffer *PHP*." t) (provide 'php-mode) - ;;; php-mode.el ends here - -;; Local Variables: -;; firestarter: ert-run-tests-interactively -;; End: -- cgit v1.3