Skip to content

Commit bca4c77

Browse files
authored
Merge pull request #605 from emacs-php/remove/php-webmode-constants
Remove php-mode-extra-constants variable and functions
2 parents f1da0be + f389433 commit bca4c77

6 files changed

+0
-73
lines changed

README.ja.md

-8
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,6 @@ PHPモードはデフォルトでは`php-enable-default-coding-style`関数で
294294

295295
このスタイルはSymfony2のコードベースで広く利用されていますが、慣習についての文書で明示的に言及されているものではありません。
296296

297-
### 定数の追加
298-
299-
フレームワークによって一般的な定数群が定義されるならば、変数`php-extra-constants`を値をカスタマイズすることができます。これはPHPモードが追加の定数として扱う定数名の文字列のリストです。これらの定数はPHP組み込みの定数と同じ強調表示を行います。
300-
301-
### Web Mode定数とキーワード
302-
303-
もしあなたが[Web Mode]を使用しているなら、Web Modeに設定された追加のPHP定数をとキーワードを追加しようとします。
304-
305297
### HTMLテンプレートのサポートを無効化する
306298

307299
多くの開発者はPHPモードで純粋なPHPスクリプト(HTMLテンプレートを含まないもの)を編集します。HTMLとの互換レイヤーはPHPモードの歴史的な機能ですが、完全には機能していません。速度の低下や強調表示を破壊するおそれがあるなどの副作用があります。変数`php-template-compatibility``nil`にセットすると、HTMLとの互換性を無効化することができます。HTMLやその他のマークアップ言語のテンプレートエンジンを含むPHPスクリプトを開発する際は[Web Mode][]は優れた選択肢です。

README.md

-8
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,6 @@ With this style method call chains can be formatted with indented continuation a
275275

276276
This style is used widely throughout Symfony2 source code even if it is not explicitly mentioned in their conventions documents.
277277

278-
### Extra Constants
279-
280-
If you commonly use a framework or library that defines a set of constants then you may wish to customize the value of `php-extra-constants`. It is a list of strings that PHP Mode will treat as additional constants, i.e. providing them the same level syntax highlighting that PHP Mode uses for built-in constants.
281-
282-
### Web Mode Constants and Keywords
283-
284-
If you use [Web Mode][] then PHP Mode will attempt to use any additional PHP constants and keywords that Web Mode allows you to define.
285-
286278
### Avoid HTML Template Compatibility
287279

288280
Many developers use PHP Mode to edit pure PHP scripts (e.g. files with only PHP and no HTML). A basic compatibility layer with HTML has historically been part of PHP Mode but it does not work perfectly and can cause some bad side effects such as slowness and incorrect font locking. Configuring the `php-template-compatibility` property with a `nil` will cancel any attempt of HTML compatibility. [Web Mode](http://web-mode.org/) is a great alternative to PHP Mode if you need to work with PHP scripts that do contain HTML and other markup.

php-mode.el

-32
Original file line numberDiff line numberDiff line change
@@ -160,30 +160,6 @@ Turning this on will open it whenever `php-mode' is loaded."
160160
:tag "PHP Mode Template Compatibility"
161161
:type 'boolean)
162162

163-
(defun php-mode-extra-constants-create-regexp (kwds)
164-
"Create regexp for the list of extra constant keywords KWDS."
165-
(concat "[^_$]?\\<\\("
166-
(regexp-opt
167-
(append kwds
168-
(when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants)))
169-
"\\)\\>[^_]?"))
170-
171-
(defun php-mode-extra-constants-set (sym value)
172-
"Apply the list of extra constant keywords `VALUE'.
173-
174-
This function is called when the custom variable php-extra-constants
175-
is updated. The web-mode-extra-constants list is appended to the list
176-
of constants when set."
177-
;; remove old keywords
178-
(when (boundp 'php-extra-constants)
179-
(font-lock-remove-keywords
180-
'php-mode `((,(php-mode-extra-constants-create-regexp php-extra-constants) 1 'php-constant))))
181-
;; add new keywords
182-
(when value
183-
(font-lock-add-keywords
184-
'php-mode `((,(php-mode-extra-constants-create-regexp value) 1 'php-constant))))
185-
(set sym value))
186-
187163
(define-obsolete-variable-alias 'php-lineup-cascaded-calls 'php-mode-lineup-cascaded-calls "1.20.0")
188164
(defcustom php-mode-lineup-cascaded-calls nil
189165
"Indent chained method calls to the previous line."
@@ -201,14 +177,6 @@ of constants when set."
201177
:tag "PHP Mode Page Delimiter"
202178
:type 'regexp)
203179

204-
(define-obsolete-variable-alias 'php-extra-constants 'php-mode-extra-constants "1.20.0")
205-
(defcustom php-mode-extra-constants '()
206-
"A list of additional strings to treat as PHP constants."
207-
:group 'php-mode
208-
:tag "PHP Mode Extra Constants"
209-
:type '(repeat string)
210-
:set 'php-mode-extra-constants-set)
211-
212180
(define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0")
213181
(defcustom php-mode-do-not-use-semantic-imenu t
214182
"Customize `imenu-create-index-function' for `php-mode'.

tests/constants.php

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
no_constant;
1313
no_CONSTANT;
1414

15-
// Test php-extra-constants
16-
extraconstant;
17-
1815
// Everything called statically should be highlighted with the constant face
1916
// (like c++-mode)
2017
ClassName::$test;

tests/constants.php.faces

-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
("IS_CONSTANT99" . php-constant)
3131
(";\nno_constant;\nno_CONSTANT;\n\n")
3232
("// " . font-lock-comment-delimiter-face)
33-
("Test php-extra-constants\n" . font-lock-comment-face)
34-
("extraconstant;\n\n")
35-
("// " . font-lock-comment-delimiter-face)
3633
("Everything called statically should be highlighted with the constant face\n" . font-lock-comment-face)
3734
("// " . font-lock-comment-delimiter-face)
3835
("(like c++-mode)\n" . font-lock-comment-face)

tests/php-mode-test.el

-19
Original file line numberDiff line numberDiff line change
@@ -370,25 +370,6 @@ style from Drupal."
370370

371371
(ert-deftest php-mode-test-constants ()
372372
"Proper highlighting for constants."
373-
(custom-set-variables '(php-extra-constants (quote ("extraconstant"))))
374-
(with-php-mode-test ("constants.php")
375-
(let ((variables '(
376-
"true" "TRUE"
377-
"false" "FALSE"
378-
"null" "NULL"
379-
"IS_CONSTANT"
380-
"__IS_CONSTANT__"
381-
"IS_CONSTANT99"
382-
"extraconstant"
383-
"ClassName")))
384-
(dolist (variable variables)
385-
(search-forward variable)
386-
(goto-char (match-beginning 0))
387-
(should (equal (cons variable 'php-constant)
388-
(cons variable (get-text-property (point) 'face)))))))
389-
390-
;; Set default
391-
(custom-set-variables '(php-extra-constants (quote ())))
392373
(with-php-mode-test ("constants.php" :faces t)))
393374

394375
(ert-deftest php-mode-test-identifiers()

0 commit comments

Comments
 (0)