From f06d75a1b7b5513201c8ef59ba9bec8366ec2e42 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 11 Jun 2011 19:55:09 +0200 Subject: [PATCH] EMACS: add some filter constants to fontlocking --- emacs.d/elisp/php-mode-improved.el | 46 +++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/emacs.d/elisp/php-mode-improved.el b/emacs.d/elisp/php-mode-improved.el index 1cf9f36..dcf4fb9 100644 --- a/emacs.d/elisp/php-mode-improved.el +++ b/emacs.d/elisp/php-mode-improved.el @@ -2,14 +2,14 @@ ;; This is a version of the php-mode from http://php-mode.sourceforge.net that ;; fixes a few bugs which make using php-mode much more palatable, namely: -;; +;; ;; 1. New customisation options for some of the syntax highlighting ;; features. I personally use the 'Gauchy' level of syntax ;; highlighting -- I want variables and function calls fontified -- ;; but there were several very annoying "features" in this level of ;; syntax highlighting, particularly the ones that warn you about ;; perfectly valid code. I've added: -;; +;; ;; * `php-mode-dollar-property-warning', which, if non-nil, warns on ;; $foo->$bar. (Default is nil.) ;; * `php-mode-dot-property-warning', which, if non-nil, warns on @@ -19,20 +19,20 @@ ;; * `php-mode-warn-if-mumamo-off', which, if nil, suppresses the ;; once-per-file warning about indenting with mumamo-mode turned ;; off. (Default is t) -;; +;; ;; 2. Bugfix in `php-show-arglist': this function no longer jumps to the ;; function definition if that definition is in the current buffer. -;; +;; ;; 3. Bugfix: 'class' keywords at the beginning of a line are now ;; correctly fontified. -;; +;; ;; This has been submitted to the php-mode maintainer, but I've not yet had a ;; response. ;; ;; This was branched from the php-mode in nxhtml-mode, so if you have problems, ;; download the latest nxhtml-mode, and replace related/php-mode.el in the ;; nxhtml distribution with this file. -;; +;; ;; -- David House, dmhouse@gmail.com ;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad @@ -156,7 +156,7 @@ (require 'etags) (eval-when-compile (require 'regexp-opt)) - + ;; Local variables (defgroup php nil "Major mode `php-mode' for editing PHP code." @@ -281,7 +281,7 @@ have any tags inside a PHP string, it will be fooled." :type '(choice (const :tag "Warn" t) (const "Don't warn" nil)) :group 'php) - + (eval-when-compile (defconst php-mode-modified (save-excursion @@ -328,7 +328,7 @@ See `php-beginning-of-defun'." (interactive "p") (php-beginning-of-defun (- (or arg 1)))) - + (defvar php-completion-table nil "Obarray of tag names defined in current tags table and functions know to PHP.") @@ -511,7 +511,7 @@ See `php-beginning-of-defun'." php-beginning-of-defun-regexp) (run-hooks 'php-mode-hook)) - + ;; Make a menu keymap (with a prompt string) ;; and make it the menu bar item's definition. (define-key php-mode-map [menu-bar] (make-sparse-keymap)) @@ -527,7 +527,7 @@ See `php-beginning-of-defun'." (define-key php-mode-map [menu-bar php search-documentation] '("Search documentation" . php-search-documentation)) - + ;; Define function name completion function (defun php-complete-function () "Perform function completion on the text around point. @@ -653,7 +653,7 @@ for \\[find-tag] (which see)." (if arglist (message "Arglist for %s: %s" tagname arglist) (message "Unknown function: %s" tagname)))) - + ;; Define function documentation function (defun php-search-documentation () "Search PHP documentation for the word at the point." @@ -685,7 +685,7 @@ for \\[find-tag] (which see)." (define-key php-mode-map '[(control .)] 'php-show-arglist) - + (defconst php-constants (eval-when-compile (regexp-opt @@ -732,6 +732,26 @@ for \\[find-tag] (which see)." "LOG_LOCAL6" "LOG_LOCAL7" "LOG_PID" "LOG_CONS" "LOG_ODELAY" "LOG_NDELAY" "LOG_NOWAIT" "LOG_PERROR" + ;; filters + "FILTER_VALIDATE_BOOLEAN" "FILTER_VALIDATE_EMAIL" + "FILTER_VALIDATE_FLOAT" "FILTER_VALIDATE_INT" + "FILTER_VALIDATE_IP" "FILTER_VALIDATE_REGEXP" + "FILTER_VALIDATE_URL" "FILTER_NULL_ON_FAILURE" + "FILTER_FLAG_ALLOW_THOUSAND" "FILTER_FLAG_ALLOW_OCTAL" + "FILTER_FLAG_ALLOW_HEX" "FILTER_FLAG_IPV4" "FILTER_FLAG_IPV6" + "FILTER_FLAG_NO_PRIV_RANGE" "FILTER_FLAG_NO_RES_RANGE" + "FILTER_FLAG_PATH_REQUIRED" "FILTER_FLAG_QUERY_REQUIRED" + "FILTER_SANITIZE_EMAIL" "FILTER_SANITIZE_ENCODED" + "FILTER_SANITIZE_MAGIC_QUOTES" "FILTER_SANITIZE_NUMBER_FLOAT" + "FILTER_SANITIZE_NUMBER_INT" "FILTER_SANITIZE_SPECIAL_CHARS" + "FILTER_SANITIZE_STRING" "FILTER_SANITIZE_STRIPPED" + "FILTER_SANITIZE_URL" "FILTER_UNSAFE_RAW" + "FILTER_FLAG_STRIP_LOW" "FILTER_FLAG_STRIP_HIGH" + "FILTER_FLAG_ENCODE_LOW" "FILTER_FLAG_ENCODE_HIGH" + "FILTER_FLAG_ALLOW_FRACTION" "FILTER_FLAG_ALLOW_SCIENTIFIC" + "FILTER_FLAG_NO_ENCODE_QUOTES" "FILTER_FLAG_ENCODE_AMP" + "FILTER_CALLBACK" "FILTER_REQUIRE_ARRAY" + ;; Disabled by default because they slow buffer loading ;; If you have use for them, uncomment the strings ;; that you want colored.