Next: , Previous: Indentation, Up: Top


6 Editing

M-q
Fill the paragraph to current value of fill-column. The command does the right thing for indented code and PHP comments including Docblock comments.
C-u n C-x f
Set the fill-column to n when using the M-q command (fill-paragraph).
C-M-h
Mark the current function (c-mark-function). Puts the mark at the end and of the function and the point at the beginning. Useful if you want to kill the region with C-w or M-w, or indent the region with C-M-\ or C-x TAB (See Indentation.).
M-x mark-defun
Like C-M-h (c-mark-function), except place the mark at the end of the function even if it's not at the top-level. With functions that are methods defined in a class, they may be indented and not top-level functions, however this command will only mark the current function.

The traditional commands for narrowing to a region in Emacs1 are supported in PHP mode. The following commands are notable to mention for working with PHP or are extensions expressly provided PHP mode.

C-x n d
Narrow the buffer to the contents of the current function (narrow-to-defun). This will narrow to the function as identified to the current function, even if it is nested in an object or another function. The logic to narrow the function is the same as the beginning-of-defun and end-of-defun commands – see Motion, and the mark-defun command – see above.
C-x n w
Undo any narrowing by widening the buffer again by making the rest of the buffer available (widen).

Footnotes

[1] See Narrowing.