Skip to content

Commit 1e4e93c

Browse files
authored
Merge pull request #737 from emacs-php/apply-monnier-patch
Apply Stefan Monnier's patch (1)
2 parents ca74856 + e45117f commit 1e4e93c

File tree

1 file changed

+20
-41
lines changed

1 file changed

+20
-41
lines changed

lisp/php-mode.el

+20-41
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,13 @@ When CALLED-INTERACTIVE then message the result." t)
138138
(define-obsolete-variable-alias 'php-default-face 'php-mode-default-face "1.20.0")
139139
(defcustom php-mode-default-face 'default
140140
"Default face in `php-mode' buffers."
141-
:group 'php-mode
142141
:tag "PHP Mode Default Face"
143142
:type 'face)
144143

145144
(define-obsolete-variable-alias 'php-speedbar-config 'php-mode-speedbar-config "1.20.0")
146145
(defcustom php-mode-speedbar-config t
147146
"When set to true automatically configures Speedbar to observe PHP files.
148147
Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\)\""
149-
:group 'php-mode
150148
:tag "PHP Mode Speedbar Config"
151149
:type 'boolean
152150
:set (lambda (sym val)
@@ -158,7 +156,6 @@ Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\
158156
(defcustom php-mode-speedbar-open nil
159157
"Normally `php-mode' starts with the speedbar closed.
160158
Turning this on will open it whenever `php-mode' is loaded."
161-
:group 'php-mode
162159
:tag "PHP Mode Speedbar Open"
163160
:type 'boolean
164161
:set (lambda (sym val)
@@ -169,14 +166,12 @@ Turning this on will open it whenever `php-mode' is loaded."
169166
(define-obsolete-variable-alias 'php-template-compatibility 'php-mode-template-compatibility "1.20.0")
170167
(defcustom php-mode-template-compatibility t
171168
"Should detect presence of html tags."
172-
:group 'php-mode
173169
:tag "PHP Mode Template Compatibility"
174170
:type 'boolean)
175171

176172
(define-obsolete-variable-alias 'php-lineup-cascaded-calls 'php-mode-lineup-cascaded-calls "1.20.0")
177173
(defcustom php-mode-lineup-cascaded-calls nil
178174
"Indent chained method calls to the previous line."
179-
:group 'php-mode
180175
:tag "PHP Mode Lineup Cascaded Calls"
181176
:type 'boolean)
182177

@@ -186,15 +181,13 @@ Turning this on will open it whenever `php-mode' is loaded."
186181
(or "namespace" "function" "class" "trait" "interface")
187182
symbol-end))
188183
"Regexp describing line-beginnings that PHP declaration statements."
189-
:group 'php-mode
190184
:tag "PHP Mode Page Delimiter"
191185
:type 'regexp)
192186

193187
(defcustom php-mode-replace-flymake-diag-function
194188
(eval-when-compile (when (boundp 'flymake-diagnostic-functions)
195189
#'php-flymake))
196190
"Flymake function to replace, if NIL do not replace."
197-
:group 'php-mode
198191
:tag "PHP Mode Replace Flymake Diag Function"
199192
:type '(choice 'function
200193
(const :tag "Disable to replace" nil)))
@@ -208,7 +201,6 @@ set to `semantic-create-imenu-index' due to `c-mode' being its
208201
parent. Set this variable to t if you want to use
209202
`imenu-default-create-index-function' even with `semantic-mode'
210203
enabled."
211-
:group 'php-mode
212204
:tag "PHP Mode Do Not Use Semantic Imenu"
213205
:type 'boolean)
214206

@@ -219,44 +211,37 @@ enabled."
219211

220212
(defcustom php-mode-hook nil
221213
"List of functions to be executed on entry to `php-mode'."
222-
:group 'php-mode
223214
:tag "PHP Mode Hook"
224215
:type 'hook)
225216

226217
(defcustom php-mode-pear-hook nil
227218
"Hook called when a PHP PEAR file is opened with `php-mode'."
228-
:group 'php-mode
229219
:tag "PHP Mode Pear Hook"
230220
:type 'hook)
231221

232222
(defcustom php-mode-drupal-hook nil
233223
"Hook called when a Drupal file is opened with `php-mode'."
234-
:group 'php-mode
235224
:tag "PHP Mode Drupal Hook"
236225
:type 'hook)
237226

238227
(defcustom php-mode-wordpress-hook nil
239228
"Hook called when a WordPress file is opened with `php-mode'."
240-
:group 'php-mode
241229
:tag "PHP Mode WordPress Hook"
242230
:type 'hook)
243231

244232
(defcustom php-mode-symfony2-hook nil
245233
"Hook called when a Symfony2 file is opened with `php-mode'."
246-
:group 'php-mode
247234
:tag "PHP Mode Symfony2 Hook"
248235
:type 'hook)
249236

250237
(defcustom php-mode-psr2-hook nil
251238
"Hook called when a PSR-2 file is opened with `php-mode'."
252-
:group 'php-mode
253239
:tag "PHP Mode PSR-2 Hook"
254240
:type 'hook)
255241

256242
(defcustom php-mode-force-pear nil
257243
"Normally PEAR coding rules are enforced only when the filename contains \"PEAR\".
258244
Turning this on will force PEAR rules on all PHP files."
259-
:group 'php-mode
260245
:tag "PHP Mode Force Pear"
261246
:type 'boolean)
262247

@@ -265,7 +250,6 @@ Turning this on will force PEAR rules on all PHP files."
265250
mumamo-mode turned on. Detects if there are any HTML tags in the
266251
buffer before warning, but this is is not very smart; e.g. if you
267252
have any tags inside a PHP string, it will be fooled."
268-
:group 'php-mode
269253
:tag "PHP Mode Warn If MuMaMo Off"
270254
:type '(choice (const :tag "Warn" t) (const "Don't warn" nil)))
271255

@@ -279,15 +263,14 @@ This variable can take one of the following symbol values:
279263
`Drupal' - use coding styles preferred for working with Drupal projects.
280264
`WordPress' - use coding styles preferred for working with WordPress projects.
281265
`Symfony2' - use coding styles preferred for working with Symfony2 projects."
282-
:group 'php-mode
283266
:tag "PHP Mode Coding Style"
284267
:type '(choice (const :tag "Default" php)
285268
(const :tag "PEAR" pear)
286269
(const :tag "Drupal" drupal)
287270
(const :tag "WordPress" wordpress)
288271
(const :tag "Symfony2" symfony2)
289272
(const :tag "PSR-2" psr2))
290-
:initialize 'custom-initialize-default)
273+
:initialize #'custom-initialize-default)
291274

292275
;; Since this function has a bad influence on the environment of many users,
293276
;; temporarily disable it
@@ -296,7 +279,6 @@ This variable can take one of the following symbol values:
296279
297280
If you want to suppress styles from being overwritten by directory / file
298281
local variables, set NIL."
299-
:group 'php-mode
300282
:tag "PHP Mode Enable Project Coding Style"
301283
:type 'boolean)
302284

@@ -305,21 +287,18 @@ local variables, set NIL."
305287
306288
This function may interfere with other hooks and other behaviors.
307289
In that case set to `NIL'."
308-
:group 'php-mode
309290
:tag "PHP Mode Enable Backup Style Variables"
310291
:type 'boolean)
311292

312293
(define-obsolete-variable-alias 'php-mode-disable-parent-mode-hooks 'php-mode-disable-c-mode-hook "1.21.0")
313294
(defcustom php-mode-disable-c-mode-hook t
314295
"When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')."
315-
:group 'php-mode
316296
:tag "PHP Mode Disable C Mode Hook"
317297
:type 'boolean)
318298
(make-obsolete-variable 'php-mode-disable-c-mode-hook nil "1.24.2")
319299

320300
(defcustom php-mode-enable-project-local-variable t
321301
"When set to `T', apply project local variable to buffer local variable."
322-
:group 'php-mode
323302
:tag "PHP Mode Enable Project Local Variable"
324303
:type 'boolean)
325304

@@ -358,31 +337,31 @@ as a function. Call with AS-NUMBER keyword to compare by `version<'.
358337
;;
359338
;; Changing the default to mark-defun provides behavior that users
360339
;; are more likely to expect.
361-
(define-key map (kbd "C-M-h") 'mark-defun)
340+
(define-key map (kbd "C-M-h") #'mark-defun)
362341

363342
;; Many packages based on cc-mode provide the 'C-c C-w' binding
364343
;; to toggle Subword Mode. See the page
365344
;;
366345
;; https://www.gnu.org/software/emacs/manual/html_node/ccmode/Subword-Movement.html
367346
;;
368347
;; for more information about Subword mode.
369-
(define-key map (kbd "C-c C-w") 'subword-mode)
348+
(define-key map (kbd "C-c C-w") #'subword-mode)
370349

371350
;; We inherit c-beginning-of-defun and c-end-of-defun from CC Mode
372351
;; but we have two replacement functions specifically for PHP. We
373352
;; remap the commands themselves and not their default
374353
;; key-bindings so that our PHP-specific versions will work even
375354
;; if the user has reconfigured their keys, e.g. if they rebind
376355
;; c-end-of-defun to something other than C-M-e.
377-
(define-key map [remap c-beginning-of-defun] 'php-beginning-of-defun)
378-
(define-key map [remap c-end-of-defun] 'php-end-of-defun)
379-
(define-key map [remap c-set-style] 'php-set-style)
380-
381-
(define-key map [(control c) (control f)] 'php-search-documentation)
382-
(define-key map [(meta tab)] 'php-complete-function)
383-
(define-key map [(control c) (control m)] 'php-browse-manual)
384-
(define-key map [(control .)] 'php-show-arglist)
385-
(define-key map [(control c) (control r)] 'php-send-region)
356+
(define-key map [remap c-beginning-of-defun] #'php-beginning-of-defun)
357+
(define-key map [remap c-end-of-defun] #'php-end-of-defun)
358+
(define-key map [remap c-set-style] #'php-set-style)
359+
360+
(define-key map [(control c) (control f)] #'php-search-documentation)
361+
(define-key map [(meta tab)] #'php-complete-function)
362+
(define-key map [(control c) (control m)] #'php-browse-manual)
363+
(define-key map [(control .)] #'php-show-arglist)
364+
(define-key map [(control c) (control r)] #'php-send-region)
386365
;; Use the Emacs standard indentation binding. This may upset c-mode
387366
;; which does not follow this at the moment, but I see no better
388367
;; choice.
@@ -863,12 +842,12 @@ plain `php-mode'. To get indentation to work you must use an
863842
Emacs library that supports 'multiple major modes' in a buffer.
864843
Parts of the buffer will then be in `php-mode' and parts in for
865844
example `html-mode'. Known such libraries are:\n\t"
866-
(mapconcat 'identity known-names ", ")
845+
(mapconcat #'identity known-names ", ")
867846
"\n"
868847
(if available-multi-libs
869848
(concat
870849
"You have these available in your `load-path':\n\t"
871-
(mapconcat 'identity available-names ", ")
850+
(mapconcat #'identity available-names ", ")
872851
"\n\n"
873852
"Do you want to turn any of those on? ")
874853
"You do not have any of those in your `load-path'.")))
@@ -964,8 +943,8 @@ This is was done due to the problem reported here:
964943
(defun php-lineup-string-cont (langelem)
965944
"Line up string toward equal sign or dot.
966945
e.g.
967-
$str \= \'some\'
968-
. \'string\';
946+
$str = \\='some'
947+
. \\='string';
969948
this ^ lineup"
970949
(save-excursion
971950
(goto-char (cdr langelem))
@@ -1251,8 +1230,8 @@ After setting the stylevars run hooks according to STYLENAME
12511230
(string-match "\\.php\\'" buffer-file-name)))
12521231
(php-set-style "pear"))
12531232

1254-
(setq indent-line-function 'php-cautious-indent-line)
1255-
(setq indent-region-function 'php-cautious-indent-region)
1233+
(setq indent-line-function #'php-cautious-indent-line)
1234+
(setq indent-region-function #'php-cautious-indent-region)
12561235
(setq c-at-vsemi-p-fn #'php-c-at-vsemi-p)
12571236
(setq c-vsemi-status-unknown-p-fn #'php-c-vsemi-status-unknown-p)
12581237

@@ -1262,8 +1241,8 @@ After setting the stylevars run hooks according to STYLENAME
12621241
;; following two local variables, but we keep them for now until we
12631242
;; are completely sure their removal will not break any current
12641243
;; behavior or backwards compatibility.
1265-
(setq-local beginning-of-defun-function 'php-beginning-of-defun)
1266-
(setq-local end-of-defun-function 'php-end-of-defun)
1244+
(setq-local beginning-of-defun-function #'php-beginning-of-defun)
1245+
(setq-local end-of-defun-function #'php-end-of-defun)
12671246

12681247
(setq-local open-paren-in-column-0-is-defun-start nil)
12691248
(setq-local defun-prompt-regexp

0 commit comments

Comments
 (0)