Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CMake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
André Pedro
CMake
Commits
3af47e34
Commit
3af47e34
authored
11 years ago
by
Philipp Möller
Committed by
Brad King
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cmake-mode.el: Add auto-completion to cmake-help-command
parent
2a131415
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Auxiliary/cmake-mode.el
+19
-8
19 additions, 8 deletions
Auxiliary/cmake-mode.el
with
19 additions
and
8 deletions
Auxiliary/cmake-mode.el
+
19
−
8
View file @
3af47e34
...
...
@@ -281,7 +281,6 @@ optional argument topic will be appended to the argument list."
(
select-window
(
display-buffer
buffer
'not-this-window
))
(
cmake-mode
)
(
toggle-read-only
t
))
(
setq
resize-mini-windows
resize-mini-windows-save
)
)
)
...
...
@@ -293,18 +292,30 @@ optional argument topic will be appended to the argument list."
)
(
defvar
cmake-help-command-history
nil
"Topic read history."
)
(
defvar
cmake-help-commands
'
()
"List of available topics for --help-command."
)
(
defun
cmake-command-list-as-list
()
"Run cmake --help-command-list and return a list where each element is a cmake command."
(
let
((
temp-buffer-name
"*CMake Commands Temporary*"
))
(
save-window-excursion
(
cmake-command-run
"--help-command-list"
nil
temp-buffer-name
)
(
with-current-buffer
temp-buffer-name
(
cdr
(
split-string
(
buffer-substring-no-properties
(
point-min
)
(
point-max
))
"\n"
t
)))))
)
(
require
'thingatpt
)
;;;###autoload
(
defun
cmake-get-
topic
(
type
)
(
defun
cmake-get-
command
(
)
"Gets the topic from the minibuffer input. The default is the word the cursor is on."
(
interactive
)
(
let*
((
default-entry
(
word-at-point
))
(
input
(
read-string
(
format
"CMake %s (default %s): "
type
default-entry
)
; prompt
nil
; initial input
(
input
(
completing-read
"CMake command: "
; prompt
((
lambda
()
(
if
cmake-help-commands
cmake-help-commands
(
setq
cmake-help-commands
(
cmake-command-list-as-list
)))))
; completions
nil
; predicate
t
; require-match
default-entry
; initial-input
'cmake-help-command-history
; command history
default-entry
; default-value
)))
(
if
(
string=
input
""
)
(
error
"No argument given"
)
...
...
@@ -315,7 +326,7 @@ optional argument topic will be appended to the argument list."
(
defun
cmake-help-command
()
"Prints out the help message corresponding to the command the cursor is on."
(
interactive
)
(
cmake-command-run
"--help-command"
(
downcase
(
cmake-get-
topic
"
command
"
))
"*CMake Help*"
))
(
cmake-command-run
"--help-command"
(
downcase
(
cmake-get-command
))
"*CMake Help*"
))
;;;###autoload
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment