1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

Rename displayor to displayer in CEDET

* doc/misc/sem-user.texi (Idle Completions Mode): Rename
displayor->displayer throughout.
(Idle Completions Mode): Ditto.

* lisp/cedet/semantic/complete.el: Rename displayor->displayer
throughout and add aliases for all the methods that used that name.
This commit is contained in:
Lars Ingebrigtsen 2019-06-27 18:13:18 +02:00
parent 8a11e430ec
commit 2fbcda71a9
3 changed files with 227 additions and 178 deletions

View File

@ -670,7 +670,7 @@ Tag Completions} menu item in the @samp{Development} menu.
If the tag at point has at least one completion, Semantic Idle
Completions mode displays that completion inline---i.e., as part of
the buffer text (you can change the display method by customizing
@code{semantic-complete-inline-analyzer-idle-displayor-class}, as
@code{semantic-complete-inline-analyzer-idle-displayer-class}, as
described below). The completed part is highlighted, to indicate that
it is not yet properly inserted into the buffer. The echo area shows
the completion, and whether there are other possible completions, like
@ -717,20 +717,20 @@ also call it yourself. It returns immediately, leaving the buffer in
a state for inline completion.
@end deffn
@deffn Option semantic-complete-inline-analyzer-idle-displayor-class
@deffn Option semantic-complete-inline-analyzer-idle-displayer-class
The value of this variable determines how
@code{semantic-complete-analyze-inline-idle} shows its completions.
Possible values include:
@table @code
@item semantic-displayor-ghost
@item semantic-displayer-ghost
Display completions ``inline'' with the buffer text, as described
above. This is the default value.
@item semantic-displayor-tooltip
@item semantic-displayer-tooltip
Display completions in a tooltip.
@item semantic-displayor-traditional
@item semantic-displayer-traditional
Display completions in a separate window.
@end table
@end deffn
@ -798,21 +798,21 @@ explicitly, whereas Semantic Idle Completions mode completes during
idle time (@pxref{Idle Completions Mode}).
@end deffn
@deffn Option semantic-complete-inline-analyzer-idle-displayor-class
@deffn Option semantic-complete-inline-analyzer-idle-displayer-class
The value of this variable determines how
@code{semantic-complete-analyze-inline} shows its completions.
Possible values include:
@table @code
@item semantic-displayor-traditional
@item semantic-displayer-traditional
Display completions in a separate window. This is the default value.
@item semantic-displayor-ghost
@item semantic-displayer-ghost
Display completions ``inline'' with the buffer text, similar to the
default behavior of Semantic Idle Completions mode (@pxref{Idle
Completions Mode}).
@item semantic-displayor-tooltip
@item semantic-displayer-tooltip
Display completions in a tooltip.
@end table
@end deffn

View File

@ -72,17 +72,17 @@
;; plain name format, a postfix name such as method:class, or a
;; prefix name such as class.method.
;;
;; DISPLAYORS
;; DISPLAYERS
;;
;; A displayor is in charge if showing the user interesting things
;; A displayer is in charge if showing the user interesting things
;; about available completions, and can optionally provide a focus.
;; The simplest display just lists all available names in a separate
;; window. It may even choose to show short names when there are
;; many to choose from, or long names when there are fewer.
;;
;; A complex displayor could opt to help the user 'focus' on some
;; A complex displayer could opt to help the user 'focus' on some
;; range. For example, if 4 tags all have the same name, subsequent
;; calls to the displayor may opt to show each tag one at a time in
;; calls to the displayer may opt to show each tag one at a time in
;; the buffer. When the user likes one, selection would cause the
;; 'focus' item to be selected.
;;
@ -190,22 +190,22 @@ Keeps STRINGS only in the history.")
(defvar semantic-complete-active-default)
(defvar semantic-complete-current-matched-tag)
(defun semantic-complete-read-tag-engine (collector displayor prompt
(defun semantic-complete-read-tag-engine (collector displayer prompt
default-tag initial-input
history)
"Read a semantic tag, and return a tag for the selection.
Argument COLLECTOR is an object which can be used to calculate
a list of possible hits. See `semantic-completion-collector-engine'
for details on COLLECTOR.
Argument DISPLAYOR is an object used to display a list of possible
Argument DISPLAYER is an object used to display a list of possible
completions for a given prefix. See`semantic-completion-display-engine'
for details on DISPLAYOR.
for details on DISPLAYER.
PROMPT is a string to prompt with.
DEFAULT-TAG is a semantic tag or string to use as the default value.
If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
HISTORY is a symbol representing a variable to story the history in."
(let* ((semantic-completion-collector-engine collector)
(semantic-completion-display-engine displayor)
(semantic-completion-display-engine displayer)
(semantic-complete-active-default nil)
(semantic-complete-current-matched-tag nil)
(default-as-tag (semantic-complete-default-to-tag default-tag))
@ -241,7 +241,7 @@ HISTORY is a symbol representing a variable to story the history in."
'semantic-completion-default-history)
default-tag)
(semantic-collector-cleanup semantic-completion-collector-engine)
(semantic-displayor-cleanup semantic-completion-display-engine)
(semantic-displayer-cleanup semantic-completion-display-engine)
)
;;
;; Extract the tag from the completion machinery.
@ -312,10 +312,10 @@ HISTORY is a symbol representing a variable to story the history in."
(defvar semantic-complete-current-matched-tag nil
"Variable used to pass the tags being matched to the prompt.")
;; semantic-displayor-focus-abstract-child-p is part of the
;; semantic-displayor-focus-abstract class, defined later in this
;; semantic-displayer-focus-abstract-child-p is part of the
;; semantic-displayer-focus-abstract class, defined later in this
;; file.
(declare-function semantic-displayor-focus-abstract-child-p "semantic/complete"
(declare-function semantic-displayer-focus-abstract-child-p "semantic/complete"
t t)
(defun semantic-complete-current-match ()
@ -327,7 +327,7 @@ Return value can be:
string - a message to show in the minibuffer."
;; Query the environment for an active completion.
(let ((collector semantic-completion-collector-engine)
(displayor semantic-completion-display-engine)
(displayer semantic-completion-display-engine)
(contents (semantic-completion-text))
matchlist
answer)
@ -339,20 +339,20 @@ Return value can be:
(semantic-collector-calculate-completions collector contents nil))
(semantic-complete-try-completion)
(cond
;; Input match displayor focus entry
((setq answer (semantic-displayor-current-focus displayor))
;; Input match displayer focus entry
((setq answer (semantic-displayer-current-focus displayer))
;; We have answer, continue
)
;; One match from the collector
((setq matchlist (semantic-collector-current-exact-match collector))
(if (= (semanticdb-find-result-length matchlist) 1)
(setq answer (semanticdb-find-result-nth-in-buffer matchlist 0))
(if (semantic-displayor-focus-abstract-child-p displayor)
;; For focusing displayors, we can claim this is
(if (semantic-displayer-focus-abstract-child-p displayer)
;; For focusing displayers, we can claim this is
;; not unique. Multiple focuses can choose the correct
;; one.
(setq answer "Not Unique")
;; If we don't have a focusing displayor, we need to do something
;; If we don't have a focusing displayer, we need to do something
;; graceful. First, see if all the matches have the same name.
(let ((allsame t)
(firstname (semantic-tag-name
@ -493,7 +493,7 @@ If PARTIAL, do partial completion stopping at spaces."
If PARTIAL, do partial completion stopping at spaces.
if INLINE, then completion is happening inline in a buffer."
(let* ((collector semantic-completion-collector-engine)
(displayor semantic-completion-display-engine)
(displayer semantic-completion-display-engine)
(contents (semantic-completion-text))
(ans nil))
@ -514,8 +514,8 @@ if INLINE, then completion is happening inline in a buffer."
;; We need to display the completions.
;; Set the completions into the display engine
((or (eq na 'display) (eq na 'displayend))
(semantic-displayor-set-completions
displayor
(semantic-displayer-set-completions
displayer
(or
;; For the below - This caused problems for Chong Yidong
;; when experimenting with the completion engine. I don't
@ -526,14 +526,14 @@ if INLINE, then completion is happening inline in a buffer."
;; (semantic-collector-current-exact-match collector))
(semantic-collector-all-completions collector contents))
contents)
;; Ask the displayor to display them.
(semantic-displayor-show-request displayor))
;; Ask the displayer to display them.
(semantic-displayer-show-request displayer))
((eq na 'scroll)
(semantic-displayor-scroll-request displayor)
(semantic-displayer-scroll-request displayer)
)
((eq na 'focus)
(semantic-displayor-focus-next displayor)
(semantic-displayor-focus-request displayor)
(semantic-displayer-focus-next displayer)
(semantic-displayer-focus-request displayer)
)
((eq na 'empty)
(semantic-completion-message " [No Match]"))
@ -589,8 +589,8 @@ Similar to `minibuffer-contents' when completing in the minibuffer."
(defun semantic-complete-inline-done ()
"This completion thing is DONE, OR, insert a newline."
(interactive)
(let* ((displayor semantic-completion-display-engine)
(tag (semantic-displayor-current-focus displayor)))
(let* ((displayer semantic-completion-display-engine)
(tag (semantic-displayer-current-focus displayer)))
(if tag
(let ((txt (semantic-completion-text)))
(insert (substring (semantic-tag-name tag)
@ -627,7 +627,7 @@ Similar to `minibuffer-contents' when completing in the minibuffer."
(when semantic-completion-collector-engine
(semantic-collector-cleanup semantic-completion-collector-engine))
(when semantic-completion-display-engine
(semantic-displayor-cleanup semantic-completion-display-engine))
(semantic-displayer-cleanup semantic-completion-display-engine))
(when semantic-complete-inline-overlay
(let ((wc (overlay-get semantic-complete-inline-overlay
@ -725,29 +725,29 @@ DO NOT CALL THIS IF THE INLINE COMPLETION ENGINE IS NOT ACTIVE."
(condition-case e
(save-excursion
(let ((collector semantic-completion-collector-engine)
(displayor semantic-completion-display-engine)
(displayer semantic-completion-display-engine)
(contents (semantic-completion-text)))
(when collector
(semantic-collector-calculate-completions
collector contents nil)
(semantic-displayor-set-completions
displayor
(semantic-displayer-set-completions
displayer
(semantic-collector-all-completions collector contents)
contents)
;; Ask the displayor to display them.
(semantic-displayor-show-request displayor))
;; Ask the displayer to display them.
(semantic-displayer-show-request displayer))
))
(error (message "Bug Showing Completions: %S" e))))
(defun semantic-complete-inline-tag-engine
(collector displayor buffer start end)
(collector displayer buffer start end)
"Perform completion based on semantic tags in a buffer.
Argument COLLECTOR is an object which can be used to calculate
a list of possible hits. See `semantic-completion-collector-engine'
for details on COLLECTOR.
Argument DISPLAYOR is an object used to display a list of possible
Argument DISPLAYER is an object used to display a list of possible
completions for a given prefix. See`semantic-completion-display-engine'
for details on DISPLAYOR.
for details on DISPLAYER.
BUFFER is the buffer in which completion will take place.
START is a location for the start of the full symbol.
If the symbol being completed is \"foo.ba\", then START
@ -755,7 +755,7 @@ is on the \"f\" character.
END is at the end of the current symbol being completed."
;; Set us up for doing completion
(setq semantic-completion-collector-engine collector
semantic-completion-display-engine displayor)
semantic-completion-display-engine displayer)
;; Create an overlay
(setq semantic-complete-inline-overlay
(make-overlay start end buffer nil t))
@ -791,19 +791,19 @@ END is at the end of the current symbol being completed."
)
(defun semantic-complete-inline-down()
"Focus forwards through the displayor."
"Focus forwards through the displayer."
(interactive)
(let ((displayor semantic-completion-display-engine))
(semantic-displayor-focus-next displayor)
(semantic-displayor-focus-request displayor)
(let ((displayer semantic-completion-display-engine))
(semantic-displayer-focus-next displayer)
(semantic-displayer-focus-request displayer)
))
(defun semantic-complete-inline-up ()
"Focus backwards through the displayor."
"Focus backwards through the displayer."
(interactive)
(let ((displayor semantic-completion-display-engine))
(semantic-displayor-focus-previous displayor)
(semantic-displayor-focus-request displayor)
(let ((displayer semantic-completion-display-engine))
(semantic-displayer-focus-previous displayer)
(semantic-displayer-focus-request displayer)
))
@ -811,13 +811,13 @@ END is at the end of the current symbol being completed."
;;; Interactions between collection and displaying
;;
;; Functional routines used to help collectors communicate with
;; the current displayor, or for the previous section.
;; the current displayer, or for the previous section.
(defun semantic-complete-next-action (partial)
"Determine what the next completion action should be.
PARTIAL is non-nil if we are doing partial completion.
First, the collector can determine if we should perform a completion or not.
If there is nothing to complete, then the displayor determines if we are
If there is nothing to complete, then the displayer determines if we are
to show a completion list, scroll, or perhaps do a focus (if it is capable.)
Expected return values are:
done -> We have a singular match
@ -827,21 +827,21 @@ Expected return values are:
display -> Show the list of completions
scroll -> The completions have been shown, and the user keeps hitting
the complete button. If possible, scroll the completions
focus -> The displayor knows how to shift focus among possible completions.
focus -> The displayer knows how to shift focus among possible completions.
Let it do that.
displayend -> Whatever options the displayor had for repeating options, there
displayend -> Whatever options the displayer had for repeating options, there
are none left. Try something new."
(let ((ans1 (semantic-collector-next-action
semantic-completion-collector-engine
partial))
(ans2 (semantic-displayor-next-action
(ans2 (semantic-displayer-next-action
semantic-completion-display-engine))
)
(cond
;; No collector answer, use displayor answer.
;; No collector answer, use displayer answer.
((not ans1)
ans2)
;; Displayor selection of 'scroll, 'display, or 'focus trumps
;; Displayer selection of 'scroll, 'display, or 'focus trumps
;; 'done
((and (eq ans1 'done) ans2)
ans2)
@ -909,7 +909,7 @@ When tokens are matched, they are added to this list.")
)
"Root class for completion engines.
The baseclass provides basic functionality for interacting with
a completion displayor object, and tracking the current progress
a completion displayer object, and tracking the current progress
of a completion."
:abstract t)
@ -962,7 +962,7 @@ PARTIAL indicates if we are doing a partial completion."
(cond ((and cem (= cemlen 1)
cac (> caclen 1)
(eq last-command this-command))
;; Defer to the displayor...
;; Defer to the displayer...
nil)
((and cem (= cemlen 1))
'done)
@ -1289,44 +1289,48 @@ Uses semanticdb for searching all tags in the current project."
;;; ------------------------------------------------------------
;;; Tag List Display Engines
;;
;; A typical displayor accepts a pre-determined list of completions
;; A typical displayer accepts a pre-determined list of completions
;; generated by a collector. This format is in semanticdb search
;; form. This vaguely standard form is a bit challenging to navigate
;; because the tags do not contain buffer info, but the file associated
;; with the tags precedes the tag in the list.
;;
;; Basic displayors don't care, and can strip the results.
;; Advanced highlighting displayors need to know when they need
;; Basic displayers don't care, and can strip the results.
;; Advanced highlighting displayers need to know when they need
;; to load a file so that the tag in question can be highlighted.
;;
;; Key interface methods to a displayor are:
;; * semantic-displayor-next-action
;; * semantic-displayor-set-completions
;; * semantic-displayor-current-focus
;; * semantic-displayor-show-request
;; * semantic-displayor-scroll-request
;; * semantic-displayor-focus-request
;; Key interface methods to a displayer are:
;; * semantic-displayer-next-action
;; * semantic-displayer-set-completions
;; * semantic-displayer-current-focus
;; * semantic-displayer-show-request
;; * semantic-displayer-scroll-request
;; * semantic-displayer-focus-request
(defclass semantic-displayor-abstract ()
(defclass semantic-displayer-abstract ()
((table :type (or null semanticdb-find-result-with-nil)
:initform nil
:protection :protected
:documentation "List of tags this displayor is showing.")
:documentation "List of tags this displayer is showing.")
(last-prefix :type string
:protection :protected
:documentation "Prefix associated with slot `table'")
)
"Abstract displayor baseclass.
"Abstract displayer baseclass.
Manages the display of some number of tags.
Provides the basics for a displayor, including interacting with
Provides the basics for a displayer, including interacting with
a collector, and tracking tables of completion to display."
:abstract t)
(cl-defmethod semantic-displayor-cleanup ((obj semantic-displayor-abstract))
"Clean up any mess this displayor may have."
(define-obsolete-function-alias 'semantic-displayor-cleanup
#'semantic-displayer-cleanup "27.1")
(cl-defmethod semantic-displayer-cleanup ((obj semantic-displayer-abstract))
"Clean up any mess this displayer may have."
nil)
(cl-defmethod semantic-displayor-next-action ((obj semantic-displayor-abstract))
(define-obsolete-function-alias 'semantic-displayor-next-action
#'semantic-displayer-next-action "27.1")
(cl-defmethod semantic-displayer-next-action ((obj semantic-displayer-abstract))
"The next action to take on the minibuffer related to display."
(if (and (slot-boundp obj 'last-prefix)
(or (eq this-command 'semantic-complete-inline-TAB)
@ -1335,65 +1339,82 @@ a collector, and tracking tables of completion to display."
'scroll
'display))
(cl-defmethod semantic-displayor-set-completions ((obj semantic-displayor-abstract)
(define-obsolete-function-alias 'semantic-displayor-set-completions
#'semantic-displayer-set-completions "27.1")
(cl-defmethod semantic-displayer-set-completions ((obj semantic-displayer-abstract)
table prefix)
"Set the list of tags to be completed over to TABLE."
(oset obj table table)
(oset obj last-prefix prefix))
(cl-defmethod semantic-displayor-show-request ((obj semantic-displayor-abstract))
(define-obsolete-function-alias 'semantic-displayor-show-request
#'semantic-displayer-show-request "27.1")
(cl-defmethod semantic-displayer-show-request ((obj semantic-displayer-abstract))
"A request to show the current tags table."
(ding))
(cl-defmethod semantic-displayor-focus-request ((obj semantic-displayor-abstract))
"A request to for the displayor to focus on some tag option."
(define-obsolete-function-alias 'semantic-displayor-focus-request
#'semantic-displayer-focus-request "27.1")
(cl-defmethod semantic-displayer-focus-request ((obj semantic-displayer-abstract))
"A request to for the displayer to focus on some tag option."
(ding))
(cl-defmethod semantic-displayor-scroll-request ((obj semantic-displayor-abstract))
"A request to for the displayor to scroll the completion list (if needed)."
(define-obsolete-function-alias 'semantic-displayor-scroll-request
#'semantic-displayer-scroll-request "27.1")
(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))
(cl-defmethod semantic-displayor-focus-previous ((obj semantic-displayor-abstract))
(define-obsolete-function-alias 'semantic-displayor-focus-previous
#'semantic-displayer-focus-previous "27.1")
(cl-defmethod semantic-displayer-focus-previous ((obj semantic-displayer-abstract))
"Set the current focus to the previous item."
nil)
(cl-defmethod semantic-displayor-focus-next ((obj semantic-displayor-abstract))
(define-obsolete-function-alias 'semantic-displayor-focus-next
#'semantic-displayer-focus-next "27.1")
(cl-defmethod semantic-displayer-focus-next ((obj semantic-displayer-abstract))
"Set the current focus to the next item."
nil)
(cl-defmethod semantic-displayor-current-focus ((obj semantic-displayor-abstract))
(define-obsolete-function-alias 'semantic-displayor-current-focus
#'semantic-displayer-current-focus "27.1")
(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)
;; Traditional displayor
(defcustom semantic-completion-displayor-format-tag-function
;; Traditional displayer
(defcustom semantic-completion-displayer-format-tag-function
#'semantic-format-tag-name
"A Tag format function to use when showing completions."
:group 'semantic
:type semantic-format-tag-custom-list)
(defclass semantic-displayor-traditional (semantic-displayor-abstract)
(defclass semantic-displayer-traditional (semantic-displayer-abstract)
()
"Display options in *Completions* buffer.
Traditional display mechanism for a list of possible completions.
Completions are showin in a new buffer and listed with the ability
to click on the items to aid in completion.")
(cl-defmethod semantic-displayor-show-request ((obj semantic-displayor-traditional))
(define-obsolete-function-alias 'semantic-displayor-show-request
#'semantic-displayer-show-request "27.1")
(cl-defmethod semantic-displayer-show-request ((obj semantic-displayer-traditional))
"A request to show the current tags table."
;; NOTE TO SELF. Find the character to type next, and emphasize it.
(with-output-to-temp-buffer "*Completions*"
(display-completion-list
(mapcar semantic-completion-displayor-format-tag-function
(mapcar semantic-completion-displayer-format-tag-function
(semanticdb-strip-find-results (oref obj table))))
)
)
;;; Abstract baseclass for any displayor which supports focus
(defclass semantic-displayor-focus-abstract (semantic-displayor-abstract)
;;; Abstract baseclass for any displayer which supports focus
(defclass semantic-displayer-focus-abstract (semantic-displayer-abstract)
((focus :type number
:protection :protected
:documentation "A tag index from `table' which has focus.
@ -1405,13 +1426,15 @@ given tag, by highlighting its location.")
:documentation
"Non-nil if focusing requires a tag's buffer be in memory.")
)
"Abstract displayor supporting `focus'.
A displayor which has the ability to focus in on one tag.
"Abstract displayer supporting `focus'.
A displayer which has the ability to focus in on one tag.
Focusing is a way of differentiating among multiple tags
which have the same name."
:abstract t)
(cl-defmethod semantic-displayor-next-action ((obj semantic-displayor-focus-abstract))
(define-obsolete-function-alias 'semantic-displayor-next-action
#'semantic-displayer-next-action "27.1")
(cl-defmethod semantic-displayer-next-action ((obj semantic-displayer-focus-abstract))
"The next action to take on the minibuffer related to display."
(if (and (slot-boundp obj 'last-prefix)
(string= (oref obj last-prefix) (semantic-completion-text))
@ -1427,13 +1450,17 @@ which have the same name."
'focus)
'display))
(cl-defmethod semantic-displayor-set-completions ((obj semantic-displayor-focus-abstract)
(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)
"Set the list of tags to be completed over to TABLE."
(cl-call-next-method)
(slot-makeunbound obj 'focus))
(cl-defmethod semantic-displayor-focus-previous ((obj semantic-displayor-focus-abstract))
(define-obsolete-function-alias 'semantic-displayor-focus-previous
#'semantic-displayer-focus-previous "27.1")
(cl-defmethod semantic-displayer-focus-previous ((obj semantic-displayer-focus-abstract))
"Set the current focus to the previous item.
Not meaningful return value."
(when (and (slot-boundp obj 'table) (oref obj table))
@ -1445,7 +1472,9 @@ Not meaningful return value."
)
)))
(cl-defmethod semantic-displayor-focus-next ((obj semantic-displayor-focus-abstract))
(define-obsolete-function-alias 'semantic-displayor-focus-next
#'semantic-displayer-focus-next "27.1")
(cl-defmethod semantic-displayer-focus-next ((obj semantic-displayer-focus-abstract))
"Set the current focus to the next item.
Not meaningful return value."
(when (and (slot-boundp obj 'table) (oref obj table))
@ -1458,13 +1487,17 @@ Not meaningful return value."
(oset obj focus 0))
)))
(cl-defmethod semantic-displayor-focus-tag ((obj semantic-displayor-focus-abstract))
(define-obsolete-function-alias 'semantic-displayor-focus-tag
#'semantic-displayer-focus-tag "27.1")
(cl-defmethod semantic-displayer-focus-tag ((obj semantic-displayer-focus-abstract))
"Return the next tag OBJ should focus on."
(when (and (slot-boundp obj 'table) (oref obj table))
(with-slots (table) obj
(semanticdb-find-result-nth table (oref obj focus)))))
(cl-defmethod semantic-displayor-current-focus ((obj semantic-displayor-focus-abstract))
(define-obsolete-function-alias 'semantic-displayor-current-focus
#'semantic-displayer-current-focus "27.1")
(cl-defmethod semantic-displayer-current-focus ((obj semantic-displayer-focus-abstract))
"Return the tag currently in focus, or call parent method."
(if (and (slot-boundp obj 'focus)
(slot-boundp obj 'table)
@ -1482,24 +1515,26 @@ Not meaningful return value."
;; Do whatever
(cl-call-next-method)))
;;; Simple displayor which performs traditional display completion,
;;; Simple displayer which performs traditional display completion,
;; and also focuses with highlighting.
(defclass semantic-displayor-traditional-with-focus-highlight
(semantic-displayor-focus-abstract semantic-displayor-traditional)
(defclass semantic-displayer-traditional-with-focus-highlight
(semantic-displayer-focus-abstract semantic-displayer-traditional)
((find-file-focus :initform t))
"Display completions in *Completions* buffer, with focus highlight.
A traditional displayor which can focus on a tag by showing it.
Same as `semantic-displayor-traditional', but with selection between
A traditional displayer which can focus on a tag by showing it.
Same as `semantic-displayer-traditional', but with selection between
multiple tags with the same name done by focusing on the source
location of the different tags to differentiate them.")
(cl-defmethod semantic-displayor-focus-request
((obj semantic-displayor-traditional-with-focus-highlight))
(define-obsolete-function-alias 'semantic-displayor-focus-request
#'semantic-displayer-focus-request "27.1")
(cl-defmethod semantic-displayer-focus-request
((obj semantic-displayer-traditional-with-focus-highlight))
"Focus in on possible tag completions.
Focus is performed by cycling through the tags and highlighting
one in the source buffer."
(let* ((tablelength (semanticdb-find-result-length (oref obj table)))
(focus (semantic-displayor-focus-tag obj))
(focus (semantic-displayer-focus-tag obj))
;; Raw tag info.
(rtag (car focus))
(rtable (cdr focus))
@ -1558,22 +1593,22 @@ one in the source buffer."
;; * Don't use 'avoid package for tooltip positioning.
;;;###autoload
(defcustom semantic-displayor-tooltip-mode 'standard
(defcustom semantic-displayer-tooltip-mode 'standard
"Mode for the tooltip inline completion.
Standard: Show only `semantic-displayor-tooltip-initial-max-tags'
Standard: Show only `semantic-displayer-tooltip-initial-max-tags'
number of completions initially. Pressing TAB will show the
extended set.
Quiet: Only show completions when we have narrowed all
possibilities down to a maximum of
`semantic-displayor-tooltip-initial-max-tags' tags. Pressing TAB
`semantic-displayer-tooltip-initial-max-tags' tags. Pressing TAB
multiple times will also show completions.
Verbose: Always show all completions available.
The absolute maximum number of completions for all mode is
determined through `semantic-displayor-tooltip-max-tags'."
determined through `semantic-displayer-tooltip-max-tags'."
:group 'semantic
:version "24.3"
:type '(choice (const :tag "Standard" standard)
@ -1581,14 +1616,14 @@ determined through `semantic-displayor-tooltip-max-tags'."
(const :tag "Verbose" verbose)))
;;;###autoload
(defcustom semantic-displayor-tooltip-initial-max-tags 5
(defcustom semantic-displayer-tooltip-initial-max-tags 5
"Maximum number of tags to be displayed initially.
See doc-string of `semantic-displayor-tooltip-mode' for details."
See doc-string of `semantic-displayer-tooltip-mode' for details."
:group 'semantic
:version "24.3"
:type 'integer)
(defcustom semantic-displayor-tooltip-max-tags 25
(defcustom semantic-displayer-tooltip-max-tags 25
"The maximum number of tags to be displayed.
Maximum number of completions where we have activated the
extended completion list through typing TAB or SPACE multiple
@ -1606,17 +1641,17 @@ This will not happen if you directly set this variable via `setq'."
(setcdr x-max-tooltip-size (max (1+ var) (cdr x-max-tooltip-size))))))
(defclass semantic-displayor-tooltip (semantic-displayor-traditional)
(defclass semantic-displayer-tooltip (semantic-displayer-traditional)
((mode :initarg :mode
:initform
(symbol-value 'semantic-displayor-tooltip-mode)
(symbol-value 'semantic-displayer-tooltip-mode)
:documentation
"See `semantic-displayor-tooltip-mode'.")
"See `semantic-displayer-tooltip-mode'.")
(max-tags-initial :initarg max-tags-initial
:initform
(symbol-value 'semantic-displayor-tooltip-initial-max-tags)
(symbol-value 'semantic-displayer-tooltip-initial-max-tags)
:documentation
"See `semantic-displayor-tooltip-initial-max-tags'.")
"See `semantic-displayer-tooltip-initial-max-tags'.")
(typing-count :type integer
:initform 0
:documentation
@ -1629,7 +1664,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-displayor-tooltip) &rest args)
(cl-defmethod initialize-instance :after ((obj semantic-displayer-tooltip) &rest args)
"Make sure we have tooltips required."
(condition-case nil
(require 'tooltip)
@ -1638,7 +1673,9 @@ Display mechanism using tooltip for a list of possible completions.")
(defvar tooltip-mode)
(cl-defmethod semantic-displayor-show-request ((obj semantic-displayor-tooltip))
(define-obsolete-function-alias 'semantic-displayor-show-request
#'semantic-displayer-show-request "27.1")
(cl-defmethod semantic-displayer-show-request ((obj semantic-displayer-tooltip))
"A request to show the current tags table."
(if (or (not (featurep 'tooltip)) (not tooltip-mode))
;; If we cannot use tooltips, then go to the normal mode with
@ -1646,7 +1683,7 @@ Display mechanism using tooltip for a list of possible completions.")
(cl-call-next-method)
(let* ((tablelong (semanticdb-strip-find-results (oref obj table)))
(table (semantic-unique-tag-table-by-name tablelong))
(completions (mapcar semantic-completion-displayor-format-tag-function table))
(completions (mapcar semantic-completion-displayer-format-tag-function table))
(numcompl (length completions))
(typing-count (oref obj typing-count))
(mode (oref obj mode))
@ -1671,15 +1708,15 @@ Display mechanism using tooltip for a list of possible completions.")
(setq msg "...")))
((eq mode 'verbose)
;; Always show extended match set.
(oset obj max-tags-initial semantic-displayor-tooltip-max-tags)
(setq max-tags semantic-displayor-tooltip-max-tags)))
(oset obj max-tags-initial semantic-displayer-tooltip-max-tags)
(setq max-tags semantic-displayer-tooltip-max-tags)))
(unless msg
(oset obj shown t)
(cond
((> numcompl max-tags)
;; We have too many items, be brave and truncate 'completions'.
(setcdr (nthcdr (1- max-tags) completions) nil)
(if (= max-tags semantic-displayor-tooltip-initial-max-tags)
(if (= max-tags semantic-displayer-tooltip-initial-max-tags)
(setq msg-tail (concat "\n[<TAB> " (number-to-string (- numcompl max-tags)) " more]"))
(setq msg-tail (concat "\n[<n/a> " (number-to-string (- numcompl max-tags)) " more]"))
(when (>= (oref obj typing-count) 2)
@ -1702,12 +1739,12 @@ Display mechanism using tooltip for a list of possible completions.")
(setq msg (concat msg msg-tail))
;; Display tooltip.
(when (not (eq msg ""))
(semantic-displayor-tooltip-show msg)))))
(semantic-displayer-tooltip-show msg)))))
;;; Compatibility
;;
(defun semantic-displayor-point-position ()
(defun semantic-displayer-point-position ()
"Return the location of POINT as positioned on the selected frame.
Return a cons cell (X . Y)"
(let* ((frame (selected-frame))
@ -1729,9 +1766,9 @@ Return a cons cell (X . Y)"
(defvar tooltip-frame-parameters)
(declare-function tooltip-show "tooltip" (text &optional use-echo-area))
(defun semantic-displayor-tooltip-show (text)
(defun semantic-displayer-tooltip-show (text)
"Display a tooltip with TEXT near cursor."
(let ((point-pix-pos (semantic-displayor-point-position))
(let ((point-pix-pos (semantic-displayer-point-position))
(tooltip-frame-parameters
(append tooltip-frame-parameters nil)))
(push
@ -1742,19 +1779,21 @@ Return a cons cell (X . Y)"
tooltip-frame-parameters)
(tooltip-show text)))
(cl-defmethod semantic-displayor-scroll-request ((obj semantic-displayor-tooltip))
"A request to for the displayor to scroll the completion list (if needed)."
(define-obsolete-function-alias 'semantic-displayor-scroll-request
#'semantic-displayer-scroll-request "27.1")
(cl-defmethod semantic-displayer-scroll-request ((obj semantic-displayer-tooltip))
"A request to for the displayer to scroll the completion list (if needed)."
;; Do scrolling in the tooltip.
(oset obj max-tags-initial 30)
(semantic-displayor-show-request obj)
(semantic-displayer-show-request obj)
)
;; End code contributed by Masatake YAMATO <yamato@redhat.com>
;;; Ghost Text displayor
;;; Ghost Text displayer
;;
(defclass semantic-displayor-ghost (semantic-displayor-focus-abstract)
(defclass semantic-displayer-ghost (semantic-displayer-focus-abstract)
((ghostoverlay :type overlay
:documentation
@ -1764,11 +1803,13 @@ Return a cons cell (X . Y)"
"Non nil if we have not seen our first show request.")
)
"Cycle completions inline with ghost text.
Completion displayor using ghost chars after point for focus options.
Completion displayer using ghost chars after point for focus options.
Whichever completion is currently in focus will be displayed as ghost
text using overlay options.")
(cl-defmethod semantic-displayor-next-action ((obj semantic-displayor-ghost))
(define-obsolete-function-alias 'semantic-displayor-next-action
#'semantic-displayer-next-action "27.1")
(cl-defmethod semantic-displayer-next-action ((obj semantic-displayer-ghost))
"The next action to take on the inline completion related to display."
(let ((ans (cl-call-next-method))
(table (when (slot-boundp obj 'table)
@ -1780,28 +1821,34 @@ text using overlay options.")
nil
ans)))
(cl-defmethod semantic-displayor-cleanup ((obj semantic-displayor-ghost))
"Clean up any mess this displayor may have."
(define-obsolete-function-alias 'semantic-displayor-cleanup
#'semantic-displayer-cleanup "27.1")
(cl-defmethod semantic-displayer-cleanup ((obj semantic-displayer-ghost))
"Clean up any mess this displayer may have."
(when (slot-boundp obj 'ghostoverlay)
(delete-overlay (oref obj ghostoverlay)))
)
(cl-defmethod semantic-displayor-set-completions ((obj semantic-displayor-ghost)
(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)
"Set the list of tags to be completed over to TABLE."
(cl-call-next-method)
(semantic-displayor-cleanup obj)
(semantic-displayer-cleanup obj)
)
(cl-defmethod semantic-displayor-show-request ((obj semantic-displayor-ghost))
(define-obsolete-function-alias 'semantic-displayor-show-request
#'semantic-displayer-show-request "27.1")
(cl-defmethod semantic-displayer-show-request ((obj semantic-displayer-ghost))
"A request to show the current tags table."
; (if (oref obj first-show)
; (progn
; (oset obj first-show nil)
(semantic-displayor-focus-next obj)
(semantic-displayor-focus-request obj)
(semantic-displayer-focus-next obj)
(semantic-displayer-focus-request obj)
; )
;; Only do the traditional thing if the first show request
;; has been seen. Use the first one to start doing the ghost
@ -1810,13 +1857,15 @@ text using overlay options.")
; )
)
(cl-defmethod semantic-displayor-focus-request
((obj semantic-displayor-ghost))
(define-obsolete-function-alias 'semantic-displayor-focus-request
#'semantic-displayer-focus-request "27.1")
(cl-defmethod semantic-displayer-focus-request
((obj semantic-displayer-ghost))
"Focus in on possible tag completions.
Focus is performed by cycling through the tags and showing a possible
completion text in ghost text."
(let* ((tablelength (semanticdb-find-result-length (oref obj table)))
(focus (semantic-displayor-focus-tag obj))
(focus (semantic-displayer-focus-tag obj))
(tag (car focus))
)
(if (not tag)
@ -1863,14 +1912,14 @@ completion text in ghost text."
(list 'const
:tag doc1
C)))
(eieio-build-class-alist 'semantic-displayor-abstract t))
(eieio-build-class-alist 'semantic-displayer-abstract t))
)
"Possible options for inline completion displayors.
"Possible options for inline completion displayers.
Use this to enable custom editing.")
(defcustom semantic-complete-inline-analyzer-displayor-class
'semantic-displayor-traditional
"Class for displayor to use with inline completion."
(defcustom semantic-complete-inline-analyzer-displayer-class
'semantic-displayer-traditional
"Class for displayer to use with inline completion."
:group 'semantic
:type semantic-complete-inline-custom-type
)
@ -1889,8 +1938,8 @@ If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
HISTORY is a symbol representing a variable to store the history in."
(semantic-complete-read-tag-engine
(semantic-collector-buffer-deep prompt :buffer (current-buffer))
(semantic-displayor-traditional-with-focus-highlight)
;;(semantic-displayor-tooltip)
(semantic-displayer-traditional-with-focus-highlight)
;;(semantic-displayer-tooltip)
prompt
default-tag
initial-input
@ -1911,8 +1960,8 @@ If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
HISTORY is a symbol representing a variable to store the history in."
(semantic-complete-read-tag-engine
(semantic-collector-local-members prompt :buffer (current-buffer))
(semantic-displayor-traditional-with-focus-highlight)
;;(semantic-displayor-tooltip)
(semantic-displayer-traditional-with-focus-highlight)
;;(semantic-displayer-tooltip)
prompt
default-tag
initial-input
@ -1936,7 +1985,7 @@ HISTORY is a symbol representing a variable to store the history in."
:buffer (current-buffer)
:path (current-buffer)
)
(semantic-displayor-traditional-with-focus-highlight)
(semantic-displayer-traditional-with-focus-highlight)
prompt
default-tag
initial-input
@ -1948,7 +1997,7 @@ HISTORY is a symbol representing a variable to store the history in."
This is similar to `semantic-complete-read-tag-project', except
that the completion interaction is in the buffer where the context
was calculated from.
Customize `semantic-complete-inline-analyzer-displayor-class'
Customize `semantic-complete-inline-analyzer-displayer-class'
to control how completion options are displayed.
See `semantic-complete-inline-tag-engine' for details on how
completion works."
@ -1982,8 +2031,8 @@ completion works."
;; There are several options. Do the completion.
(semantic-complete-inline-tag-engine
collector
(funcall semantic-complete-inline-analyzer-displayor-class)
;;(semantic-displayor-tooltip)
(funcall semantic-complete-inline-analyzer-displayer-class)
;;(semantic-displayer-tooltip)
(current-buffer)
start end))
)))
@ -2010,7 +2059,7 @@ prompts. these are calculated from the CONTEXT variable passed in."
prompt
:buffer (oref context buffer)
:context context)
(semantic-displayor-traditional-with-focus-highlight)
(semantic-displayer-traditional-with-focus-highlight)
(with-current-buffer (oref context buffer)
(goto-char (cdr (oref context bounds)))
(concat prompt (mapconcat 'identity syms ".")
@ -2026,7 +2075,7 @@ This is similar to `semantic-complete-read-tag-analyze', except
that the completion interaction is in the buffer where the context
was calculated from.
CONTEXT is the semantic analyzer context to start with.
Customize `semantic-complete-inline-analyzer-displayor-class'
Customize `semantic-complete-inline-analyzer-displayer-class'
to control how completion options are displayed.
See `semantic-complete-inline-tag-engine' for details on how
@ -2060,17 +2109,17 @@ completion works."
;; There are several options. Do the completion.
(semantic-complete-inline-tag-engine
collector
(funcall semantic-complete-inline-analyzer-displayor-class)
;;(semantic-displayor-tooltip)
(funcall semantic-complete-inline-analyzer-displayer-class)
;;(semantic-displayer-tooltip)
(oref context buffer)
(car (oref context bounds))
(cdr (oref context bounds))
))
)))
(defcustom semantic-complete-inline-analyzer-idle-displayor-class
'semantic-displayor-ghost
"Class for displayor to use with inline completion at idle time."
(defcustom semantic-complete-inline-analyzer-idle-displayer-class
'semantic-displayer-ghost
"Class for displayer to use with inline completion at idle time."
:group 'semantic
:type semantic-complete-inline-custom-type
)
@ -2081,13 +2130,13 @@ CONTEXT is the semantic analyzer context to start with.
This function is used from `semantic-idle-completions-mode'.
This is the same as `semantic-complete-inline-analyzer', except that
it uses `semantic-complete-inline-analyzer-idle-displayor-class'
it uses `semantic-complete-inline-analyzer-idle-displayer-class'
to control how completions are displayed.
See `semantic-complete-inline-tag-engine' for details on how
completion works."
(let ((semantic-complete-inline-analyzer-displayor-class
semantic-complete-inline-analyzer-idle-displayor-class))
(let ((semantic-complete-inline-analyzer-displayer-class
semantic-complete-inline-analyzer-idle-displayer-class))
(semantic-complete-inline-analyzer context)
))
@ -2168,7 +2217,7 @@ The result is inserted as a replacement of the text that was there."
possible values.
The function returns immediately, leaving the buffer in a mode that
will perform the completion.
Configure `semantic-complete-inline-analyzer-displayor-class' to change
Configure `semantic-complete-inline-analyzer-displayer-class' to change
how completion options are displayed."
(interactive)
;; Only do this if we are not already completing something.
@ -2190,7 +2239,7 @@ how completion options are displayed."
possible values.
The function returns immediately, leaving the buffer in a mode that
will perform the completion.
Configure `semantic-complete-inline-analyzer-idle-displayor-class'
Configure `semantic-complete-inline-analyzer-idle-displayer-class'
to change how completion options are displayed."
(interactive)
;; Only do this if we are not already completing something.

View File

@ -980,7 +980,7 @@ This minor mode only takes effect if Semantic is active and
When enabled, Emacs displays a list of possible completions at
idle time. The method for displaying completions is given by
`semantic-complete-inline-analyzer-idle-displayor-class'; the
`semantic-complete-inline-analyzer-idle-displayer-class'; the
default is to show completions inline.
While a completion is displayed, RET accepts the completion; M-n