Skip to content

Commit f58ecbb

Browse files
committed
Fix byte-compile warnings in phpactor.el and company-phpactor.el
- Use a valid :type for `phpactor-history-size' - Compare the index buffer hashes so the "updated" message is correct - Wrap docstrings to 80 columns - Ignore the unused `value' in `phpactor-action--fill-vars' - Ignore the unused `edits' argument of `phpactor-action-update-file-source' - Rename the unused `ignored' argument of `company-phpactor' to `_ignored'
1 parent c85643c commit f58ecbb

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

‎company-phpactor.el‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Here we create a temporary syntax table in order to add $ to symbols."
102102
(funcall callback (company-phpactor--get-candidates suggestions)))))))
103103

104104
;;;###autoload
105-
(defun company-phpactor (command &optional arg &rest ignored)
105+
(defun company-phpactor (command &optional arg &rest _ignored)
106106
"`company-mode' completion backend for Phpactor."
107107
(interactive (list 'interactive))
108108
(when phpactor-executable

‎phpactor.el‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
(defcustom phpactor-history-size nil
8282
"If non-NIL, keep RPC command history."
8383
:group 'phpactor
84-
:type '(choice nil integer))
84+
:type '(choice (const :tag "Disabled" nil) integer))
8585

8686
;; Variables
8787
(defvar phpactor--debug nil)
@@ -266,8 +266,8 @@ Otherwise, use cached results if the buffer already exists and is populated."
266266
(prog1 buf
267267
(when (called-interactively-p 'interactive)
268268
(message "Buffer %S has %s" buf-name (cond ((null original-hash) "loaded from cache")
269-
((equal original-hash (buffer-hash)) "updated")
270-
("not updated")))))))
269+
((equal original-hash new-hash) "not updated")
270+
("updated")))))))
271271

272272
(defun phpactor--index-symbols-as-alist ()
273273
"Return result of Phpactor `index:search' command as alist."
@@ -323,7 +323,8 @@ If FORCE-UPDATE is non-NIL, purge index before building."
323323
(phpactor--parse-json output))))
324324

325325
(defun phpactor--rpc-async (action arguments callback)
326-
"Async execute Phpactor ACTION subcommand with ARGUMENTS and calling CALLBACK after process."
326+
"Async execute Phpactor ACTION subcommand with ARGUMENTS and calling
327+
CALLBACK after process."
327328
(declare (indent 2))
328329
(phpactor--add-history 'phpactor--rpc-async (list action arguments))
329330
(let* ((json (phpactor--serialize-json (list :action action
@@ -397,7 +398,8 @@ If FORCE-UPDATE is non-NIL, purge index before building."
397398

398399
;; Helper functions:
399400
(cl-defun phpactor--action-input-parameters (value-type &key default label choices type multi keyMap)
400-
"Request user input by VALUE-TYPE, DEFAULT, LABEL, CHOICES, TYPE, MULTI. Unuse KEYMAP."
401+
"Request user input by VALUE-TYPE, DEFAULT, LABEL, CHOICES, TYPE, MULTI.
402+
Unuse KEYMAP."
401403
(unless (eval-when-compile t) keyMap)
402404
(if multi
403405
(cl-loop for input = (phpactor--action-input-parameters-1
@@ -407,7 +409,8 @@ If FORCE-UPDATE is non-NIL, purge index before building."
407409
(phpactor--action-input-parameters-1 value-type default label choices type)))
408410

409411
(defun phpactor--action-input-parameters-1 (value-type default label choices type)
410-
"Inner function of `phpactor--action-input-parameters' with VALUE-TYPE, DEFAULT, LABEL, CHOICES and TYPE."
412+
"Inner function of `phpactor--action-input-parameters' with VALUE-TYPE,
413+
DEFAULT, LABEL, CHOICES and TYPE."
411414
(when (eq type :null)
412415
(setq type nil))
413416
(let ((use-dialog-box nil)
@@ -435,7 +438,7 @@ If FORCE-UPDATE is non-NIL, purge index before building."
435438
(cl-loop for (key value) on parameters by #'cddr
436439
when (or (null value) (eq :null value))
437440
do (setq parameters (plist-put parameters key (plist-get input-vars key))))
438-
(cl-loop for (key value) on input-vars by #'cddr
441+
(cl-loop for (key _) on input-vars by #'cddr
439442
unless (plist-member parameters key)
440443
do (setq parameters (plist-put parameters key (plist-get input-vars key))))
441444
parameters)
@@ -641,6 +644,8 @@ function."
641644
(cl-defun phpactor-action-update-file-source (&key path source edits)
642645
"Replace the source code in the current file."
643646
(interactive)
647+
;; Phpactor also sends EDITS, but the new SOURCE is diffed instead.
648+
(ignore edits)
644649
(let ((tmpfile (make-temp-file "phpactor" nil ".php"))
645650
(patchbuf (get-buffer-create "*Phpactor patch*"))
646651
(coding-system-for-read 'utf-8)

0 commit comments

Comments
 (0)