GNU ELPA - php-fill

php-fill Atom Feed

Description
Additional fill commands for PHP code editing
Latest
php-fill-1.1.1.tar (.sig), 2026-Mar-06, 2.19 MiB
Maintainer
Ariel Del Valle Lozano <arielmazatlan@gmail.com>
Website
https://github.com/arielenter/php-fill.el
Browse ELPA's repository
CGit or Gitweb
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

1. php-fill.el

Additional fill commands for PHP code editing.

1.1. Fills string literals by breaking them into smaller ones.

1.2. Conditionally use ‘NOSQUEEZ’ on c and c++ style comments.

1.3. Use “<return>” to break or add a new line to string literals and doc blocks.

1.4. Use “<backspace>” or “<delete>” at the beginning and at the end to join them.

1.5. Minor mode Php-Refill.

1.6. Add it to your init.el

We recommend using this package with a major mode for PHP, like the ones supply by packages like php-mode and phps-mode, to get the indentation right and for the hook.

The following example uses ‘php-mode’, but if a different major mode were to be used, just change ‘php-mode’ with something else like ‘phps-mode’ instead.

While in the process of being accepted in elpa.gnu.org (see the following archive Here), please download ‘php-fill.el’ and add it by using its holding location, shown here as "~/.emacs.d/lisp/" as an example.

(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp/"))
(use-package php-fill
  :load-path "~/.emacs.d/lisp/"
  :requires 'php-mode
  ;; :custom
  ;; (php-fill-fill-column 120) ;; Default is 80.
  ;; (php-fill-sentence-end-double-space t) ;; Default is nil.
  ;; (php-fill-nosqueeze-c-comments nil) ;; Default is t
  ;; (php-fill-nosqueeze-c++-comments t) ;; Default is nil
  ;; Add commands that conflict with php-fill-refill-mode
  ;; (php-fill-refill-black-list
  ;;  (append '(some-command some-other-command)
  ;; 	   php-fill-refill-black-list))
  :hook
  (php-mode . php-fill-set-local-variables)
  ;; You migth omit the follwong if you want to fill literals manually
  ;; with ‘M-q’.
  (php-mode . php-fill-refill-mode)
  ;; The following is recommended unless you are already usign them.
  (php-mode . display-fill-column-indicator-mode)
  (php-mode . display-line-numbers-mode)
  :bind
  (:map php-mode-map
        ("M-q" . php-fill-paragraph)
        ("<return>" . php-fill-newline)
        ("C-<return>" . newline) ;; Literal newline on string literals
        ("<backspace>" . php-fill-backward-delete)
        ("<delete>" . php-fill-delete-forward)))

1.7. Special thanks to

  • The code of commands fill-paragraph, c-fill-paragraph and refill-mode, and their respective developers.
  • Jen-Chieh Shen's ellsp and his patience 🙏
  • Xah Lee invaluable pages on Emacs. I don't think I can pay the full tutorial right now though 😅. But a $20 donation soon for sure 👍.
  • gnu.org's wonderful manuals on Emacs.
  • In a lesser degree the sites masteringemacs.org and emacsdocs.org.

Finally thanks to the patience of the people of the emacs-devel mailing list. Thank you all.

News

Version 1.1.1

- Major refractory.
- SQUEEZE typo fixed.
- Additional information about what ‘squeeze’ means in the context of
  fill prefixed functions.

Version 1.1.0

- Customizable variable `php-fill-refill-black-list' added, so that
  if a command that conflicts with `php-fill-refill-mode' is found,
  that command can be added by the user.