|
130 | 130 | :group 'php-format) |
131 | 131 |
|
132 | 132 | ;; Internal functions |
| 133 | +(defsubst php-format--register-timer (sec command-args) |
| 134 | + "Register idle-timer with SEC and COMMAND-ARGS." |
| 135 | + (unless php-format--idle-timer |
| 136 | + (setq php-format--idle-timer |
| 137 | + (run-with-idle-timer sec nil #'php-format--execute-delayed-format |
| 138 | + default-directory command-args)))) |
| 139 | + |
133 | 140 | (defun php-format--execute-format (files) |
134 | 141 | "Execute PHP formatter with FILES." |
135 | 142 | (let* ((default-directory (php-project-get-root-dir)) |
|
143 | 150 | (`(idle ,sec) (php-format--register-timer sec command-args)) |
144 | 151 | ('idle (php-format--register-timer php-format-default-idle-time command-args)) |
145 | 152 | ('async (apply #'call-process-shell-command (car command-args) nil nil nil |
146 | | - (append (cdr command-args) (list "&")))) |
| 153 | + (append (cdr command-args) (list "&")))) |
147 | 154 | ('compile (compile command-line)) |
148 | 155 | ('silent (shell-command-to-string command-line)) |
149 | 156 | ('nil (shell-command command-line)) |
150 | 157 | (_ (user-error "`%s' is unexpected php-format--exec-method" php-format--exec-method))))) |
151 | 158 |
|
152 | | -(defsubst php-format--register-timer (sec command-args) |
153 | | - "Register idle-timer with SEC and COMMAND-ARGS." |
154 | | - (unless php-format--idle-timer |
155 | | - (setq php-format--idle-timer |
156 | | - (run-with-idle-timer sec nil #'php-format--execute-delayed-format |
157 | | - default-directory command-args)))) |
158 | | - |
159 | 159 | (defun php-format--get-command-args () |
160 | 160 | "Return a list of command and arguments." |
161 | 161 | (if (listp php-format-command) |
|
0 commit comments