summaryrefslogtreecommitdiff
path: root/lisp/cedet/semantic/complete.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/semantic/complete.el')
-rw-r--r--lisp/cedet/semantic/complete.el123
1 files changed, 61 insertions, 62 deletions
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index c83505818f5..d6ef7960473 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -1,4 +1,4 @@
-;;; semantic/complete.el --- Routines for performing tag completion
+;;; semantic/complete.el --- Routines for performing tag completion -*- lexical-binding: t; -*-
;; Copyright (C) 2003-2005, 2007-2021 Free Software Foundation, Inc.
@@ -154,8 +154,8 @@ Presumably if you call this you will insert something new there."
(defun semantic-completion-message (fmt &rest args)
"Display the string FMT formatted with ARGS at the end of the minibuffer."
(if semantic-complete-inline-overlay
- (apply 'message fmt args)
- (apply 'message (concat "%s" fmt) (buffer-string) args)))
+ (apply #'message fmt args)
+ (apply #'message (concat "%s" fmt) (buffer-string) args)))
;;; ------------------------------------------------------------
;;; MINIBUFFER: Option Selection harnesses
@@ -171,14 +171,14 @@ Value should be a ... what?")
(defvar semantic-complete-key-map
(let ((km (make-sparse-keymap)))
- (define-key km " " 'semantic-complete-complete-space)
- (define-key km "\t" 'semantic-complete-complete-tab)
- (define-key km "\C-m" 'semantic-complete-done)
- (define-key km "\C-g" 'abort-recursive-edit)
- (define-key km "\M-n" 'next-history-element)
- (define-key km "\M-p" 'previous-history-element)
- (define-key km "\C-n" 'next-history-element)
- (define-key km "\C-p" 'previous-history-element)
+ (define-key km " " #'semantic-complete-complete-space)
+ (define-key km "\t" #'semantic-complete-complete-tab)
+ (define-key km "\C-m" #'semantic-complete-done)
+ (define-key km "\C-g" #'abort-recursive-edit)
+ (define-key km "\M-n" #'next-history-element)
+ (define-key km "\M-p" #'previous-history-element)
+ (define-key km "\C-n" #'next-history-element)
+ (define-key km "\C-p" #'previous-history-element)
;; Add history navigation
km)
"Keymap used while completing across a list of tags.")
@@ -488,7 +488,7 @@ If PARTIAL, do partial completion stopping at spaces."
)
(t nil))))
-(defun semantic-complete-do-completion (&optional partial inline)
+(defun semantic-complete-do-completion (&optional partial _inline)
"Do a completion for the current minibuffer.
If PARTIAL, do partial completion stopping at spaces.
if INLINE, then completion is happening inline in a buffer."
@@ -550,12 +550,12 @@ if INLINE, then completion is happening inline in a buffer."
;; push ourselves out of this mode on alternate keypresses.
(defvar semantic-complete-inline-map
(let ((km (make-sparse-keymap)))
- (define-key km "\C-i" 'semantic-complete-inline-TAB)
- (define-key km "\M-p" 'semantic-complete-inline-up)
- (define-key km "\M-n" 'semantic-complete-inline-down)
- (define-key km "\C-m" 'semantic-complete-inline-done)
- (define-key km "\C-\M-c" 'semantic-complete-inline-exit)
- (define-key km "\C-g" 'semantic-complete-inline-quit)
+ (define-key km "\C-i" #'semantic-complete-inline-TAB)
+ (define-key km "\M-p" #'semantic-complete-inline-up)
+ (define-key km "\M-n" #'semantic-complete-inline-down)
+ (define-key km "\C-m" #'semantic-complete-inline-done)
+ (define-key km "\C-\M-c" #'semantic-complete-inline-exit)
+ (define-key km "\C-g" #'semantic-complete-inline-quit)
(define-key km "?"
(lambda () (interactive)
(describe-variable 'semantic-complete-inline-map)))
@@ -620,7 +620,7 @@ Similar to `minibuffer-contents' when completing in the minibuffer."
"Exit inline completion mode."
(interactive)
;; Remove this hook FIRST!
- (remove-hook 'pre-command-hook 'semantic-complete-pre-command-hook)
+ (remove-hook 'pre-command-hook #'semantic-complete-pre-command-hook)
(condition-case nil
(progn
@@ -649,7 +649,7 @@ Similar to `minibuffer-contents' when completing in the minibuffer."
;; Remove this hook LAST!!!
;; This will force us back through this function if there was
;; some sort of error above.
- (remove-hook 'post-command-hook 'semantic-complete-post-command-hook)
+ (remove-hook 'post-command-hook #'semantic-complete-post-command-hook)
;;(message "Exiting inline completion.")
)
@@ -770,8 +770,8 @@ END is at the end of the current symbol being completed."
(overlay-put semantic-complete-inline-overlay
'semantic-original-start start)
;; Install our command hooks
- (add-hook 'pre-command-hook 'semantic-complete-pre-command-hook)
- (add-hook 'post-command-hook 'semantic-complete-post-command-hook)
+ (add-hook 'pre-command-hook #'semantic-complete-pre-command-hook)
+ (add-hook 'post-command-hook #'semantic-complete-post-command-hook)
;; Go!
(semantic-complete-inline-force-display)
)
@@ -929,8 +929,8 @@ The only options available for completion are those which can be logically
inserted into the current context.")
(cl-defmethod semantic-collector-calculate-completions-raw
- ((obj semantic-collector-analyze-completions) prefix completionlist)
- "calculate the completions for prefix from completionlist."
+ ((obj semantic-collector-analyze-completions) prefix _completionlist)
+ "calculate the completions for prefix from COMPLETIONLIST."
;; if there are no completions yet, calculate them.
(if (not (slot-boundp obj 'first-pass-completions))
(oset obj first-pass-completions
@@ -943,7 +943,7 @@ inserted into the current context.")
prefix
(oref obj first-pass-completions)))))
-(cl-defmethod semantic-collector-cleanup ((obj semantic-collector-abstract))
+(cl-defmethod semantic-collector-cleanup ((_obj semantic-collector-abstract))
"Clean up any mess this collector may have."
nil)
@@ -1004,7 +1004,7 @@ Output must be in semanticdb Find result format."
(list (cons table result)))))
(cl-defmethod semantic-collector-calculate-completions
- ((obj semantic-collector-abstract) prefix partial)
+ ((obj semantic-collector-abstract) prefix _partial)
"Calculate completions for prefix as setup for other queries."
(let* ((case-fold-search semantic-case-fold)
(same-prefix-p (semantic-collector-last-prefix= obj prefix))
@@ -1014,7 +1014,8 @@ Output must be in semanticdb Find result format."
(cond ((or same-prefix-p
(and last-prefix (eq (compare-strings
last-prefix 0 nil
- prefix 0 (length last-prefix)) t)))
+ prefix 0 (length last-prefix))
+ t)))
;; We have the same prefix, or last-prefix is a
;; substring of the of new prefix, in which case we are
;; refining our symbol so just re-use cache.
@@ -1023,7 +1024,8 @@ Output must be in semanticdb Find result format."
(> (length prefix) 1)
(eq (compare-strings
prefix 0 nil
- last-prefix 0 (length prefix)) t))
+ last-prefix 0 (length prefix))
+ t))
;; The new prefix is a substring of the old
;; prefix, and it's longer than one character.
;; Perform a full search to pull in additional
@@ -1134,7 +1136,7 @@ into a buffer."
(semanticdb-find-result-nth-in-buffer (oref obj current-exact-match) 0)))
(cl-defmethod semantic-collector-all-completions
- ((obj semantic-collector-abstract) prefix)
+ ((obj semantic-collector-abstract) _prefix)
"For OBJ, retrieve all completions matching PREFIX.
The returned list consists of all the tags currently
matching PREFIX."
@@ -1142,7 +1144,7 @@ matching PREFIX."
(oref obj last-all-completions)))
(cl-defmethod semantic-collector-try-completion
- ((obj semantic-collector-abstract) prefix)
+ ((obj semantic-collector-abstract) _prefix)
"For OBJ, attempt to match PREFIX.
See `try-completion' for details on how this works.
Return nil for no match.
@@ -1153,7 +1155,7 @@ with that name."
(oref obj last-completion)))
(cl-defmethod semantic-collector-calculate-cache
- ((obj semantic-collector-abstract))
+ ((_obj semantic-collector-abstract))
"Calculate the completion cache for OBJ."
nil
)
@@ -1176,7 +1178,7 @@ These collectors track themselves on a per-buffer basis."
:abstract t)
(cl-defmethod make-instance ((this (subclass semantic-collector-buffer-abstract))
- &rest args)
+ &rest _args)
"Reuse previously created objects of this type in buffer."
(let ((old nil)
(bl semantic-collector-per-buffer-list))
@@ -1193,7 +1195,7 @@ These collectors track themselves on a per-buffer basis."
old))
;; Buffer specific collectors should flush themselves
-(defun semantic-collector-buffer-flush (newcache)
+(defun semantic-collector-buffer-flush (_newcache)
"Flush all buffer collector objects.
NEWCACHE is the new tag table, but we ignore it."
(condition-case nil
@@ -1204,7 +1206,7 @@ NEWCACHE is the new tag table, but we ignore it."
(error nil)))
(add-hook 'semantic-after-toplevel-cache-change-hook
- 'semantic-collector-buffer-flush)
+ #'semantic-collector-buffer-flush)
;;; DEEP BUFFER SPECIFIC COMPLETION
;;
@@ -1246,8 +1248,8 @@ Uses semanticdb for searching all tags in the current project."
(cl-defmethod semantic-collector-calculate-completions-raw
- ((obj semantic-collector-project) prefix completionlist)
- "Calculate the completions for prefix from completionlist."
+ ((obj semantic-collector-project) prefix _completionlist)
+ "Calculate the completions for prefix from COMPLETIONLIST."
(semanticdb-find-tags-for-completion prefix (oref obj path)))
;;; Brutish Project search
@@ -1259,8 +1261,8 @@ Uses semanticdb for searching all tags in the current project."
"semantic/db-find")
(cl-defmethod semantic-collector-calculate-completions-raw
- ((obj semantic-collector-project-brutish) prefix completionlist)
- "Calculate the completions for prefix from completionlist."
+ ((obj semantic-collector-project-brutish) prefix _completionlist)
+ "Calculate the completions for prefix from COMPLETIONLIST."
(require 'semantic/db-find)
(semanticdb-brute-deep-find-tags-for-completion prefix (oref obj path)))
@@ -1273,8 +1275,8 @@ Uses semanticdb for searching all tags in the current project."
"Completion engine for tags in a project.")
(cl-defmethod semantic-collector-calculate-completions-raw
- ((obj semantic-collector-local-members) prefix completionlist)
- "Calculate the completions for prefix from completionlist."
+ ((obj semantic-collector-local-members) prefix _completionlist)
+ "Calculate the completions for prefix from COMPLETIONLIST."
(let* ((scope (or (oref obj scope)
(oset obj scope (semantic-calculate-scope))))
(localstuff (oref scope scope)))
@@ -1323,7 +1325,7 @@ a collector, and tracking tables of completion to display."
(define-obsolete-function-alias 'semantic-displayor-cleanup
#'semantic-displayer-cleanup "27.1")
-(cl-defmethod semantic-displayer-cleanup ((obj semantic-displayer-abstract))
+(cl-defmethod semantic-displayer-cleanup ((_obj semantic-displayer-abstract))
"Clean up any mess this displayer may have."
nil)
@@ -1348,37 +1350,37 @@ a collector, and tracking tables of completion to display."
(define-obsolete-function-alias 'semantic-displayor-show-request
#'semantic-displayer-show-request "27.1")
-(cl-defmethod semantic-displayer-show-request ((obj semantic-displayer-abstract))
+(cl-defmethod semantic-displayer-show-request ((_obj semantic-displayer-abstract))
"A request to show the current tags table."
(ding))
(define-obsolete-function-alias 'semantic-displayor-focus-request
#'semantic-displayer-focus-request "27.1")
-(cl-defmethod semantic-displayer-focus-request ((obj semantic-displayer-abstract))
+(cl-defmethod semantic-displayer-focus-request ((_obj semantic-displayer-abstract))
"A request to for the displayer to focus on some tag option."
(ding))
(define-obsolete-function-alias 'semantic-displayor-scroll-request
#'semantic-displayer-scroll-request "27.1")
-(cl-defmethod semantic-displayer-scroll-request ((obj semantic-displayer-abstract))
+(cl-defmethod semantic-displayer-scroll-request ((_obj semantic-displayer-abstract))
"A request to for the displayer to scroll the completion list (if needed)."
(scroll-other-window))
(define-obsolete-function-alias 'semantic-displayor-focus-previous
#'semantic-displayer-focus-previous "27.1")
-(cl-defmethod semantic-displayer-focus-previous ((obj semantic-displayer-abstract))
+(cl-defmethod semantic-displayer-focus-previous ((_obj semantic-displayer-abstract))
"Set the current focus to the previous item."
nil)
(define-obsolete-function-alias 'semantic-displayor-focus-next
#'semantic-displayer-focus-next "27.1")
-(cl-defmethod semantic-displayer-focus-next ((obj semantic-displayer-abstract))
+(cl-defmethod semantic-displayer-focus-next ((_obj semantic-displayer-abstract))
"Set the current focus to the next item."
nil)
(define-obsolete-function-alias 'semantic-displayor-current-focus
#'semantic-displayer-current-focus "27.1")
-(cl-defmethod semantic-displayer-current-focus ((obj semantic-displayer-abstract))
+(cl-defmethod semantic-displayer-current-focus ((_obj semantic-displayer-abstract))
"Return a single tag currently in focus.
This object type doesn't do focus, so will never have a focus object."
nil)
@@ -1452,7 +1454,7 @@ which have the same name."
(define-obsolete-function-alias 'semantic-displayor-set-completions
#'semantic-displayer-set-completions "27.1")
(cl-defmethod semantic-displayer-set-completions ((obj semantic-displayer-focus-abstract)
- table prefix)
+ _table _prefix)
"Set the list of tags to be completed over to TABLE."
(cl-call-next-method)
(slot-makeunbound obj 'focus))
@@ -1663,7 +1665,7 @@ This will not happen if you directly set this variable via `setq'."
"Display completions options in a tooltip.
Display mechanism using tooltip for a list of possible completions.")
-(cl-defmethod initialize-instance :after ((obj semantic-displayer-tooltip) &rest args)
+(cl-defmethod initialize-instance :after ((_obj semantic-displayer-tooltip) &rest _args)
"Make sure we have tooltips required."
(require 'tooltip))
@@ -1681,16 +1683,16 @@ Display mechanism using tooltip for a list of possible completions.")
(table (semantic-unique-tag-table-by-name tablelong))
(completions (mapcar semantic-completion-displayer-format-tag-function table))
(numcompl (length completions))
- (typing-count (oref obj typing-count))
+ ;; (typing-count (oref obj typing-count))
(mode (oref obj mode))
(max-tags (oref obj max-tags-initial))
(matchtxt (semantic-completion-text))
msg msg-tail)
;; Keep a count of the consecutive completion commands entered by the user.
- (if (and (stringp (this-command-keys))
- (string= (this-command-keys) "\C-i"))
- (oset obj typing-count (1+ (oref obj typing-count)))
- (oset obj typing-count 0))
+ (oset obj typing-count
+ (if (equal (this-command-keys) "\C-i")
+ (1+ (oref obj typing-count))
+ 0))
(cond
((eq mode 'quiet)
;; Switch back to standard mode if user presses key more than 5 times.
@@ -1730,7 +1732,7 @@ Display mechanism using tooltip for a list of possible completions.")
(when semantic-idle-scheduler-verbose-flag
(setq msg "[NO MATCH]"))))
;; Create the tooltip text.
- (setq msg (concat msg (mapconcat 'identity completions "\n"))))
+ (setq msg (concat msg (mapconcat #'identity completions "\n"))))
;; Add any tail info.
(setq msg (concat msg msg-tail))
;; Display tooltip.
@@ -1828,12 +1830,10 @@ text using overlay options.")
(define-obsolete-function-alias 'semantic-displayor-set-completions
#'semantic-displayer-set-completions "27.1")
(cl-defmethod semantic-displayer-set-completions ((obj semantic-displayer-ghost)
- table prefix)
+ _table _prefix)
"Set the list of tags to be completed over to TABLE."
(cl-call-next-method)
-
- (semantic-displayer-cleanup obj)
- )
+ (semantic-displayer-cleanup obj))
(define-obsolete-function-alias 'semantic-displayor-show-request
@@ -2058,9 +2058,8 @@ prompts. these are calculated from the CONTEXT variable passed in."
(semantic-displayer-traditional-with-focus-highlight)
(with-current-buffer (oref context buffer)
(goto-char (cdr (oref context bounds)))
- (concat prompt (mapconcat 'identity syms ".")
- (if syms "." "")
- ))
+ (concat prompt (mapconcat #'identity syms ".")
+ (if syms "." "")))
nil
inp
history)))