Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qdoc-mode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Jörg Bornemann
qdoc-mode
Commits
00adbd6b
Commit
00adbd6b
authored
3 years ago
by
Jörg Bornemann
Browse files
Options
Downloads
Patches
Plain Diff
Initial revision
parents
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+4
-0
4 additions, 0 deletions
README.md
qdoc-mode.el
+182
-0
182 additions, 0 deletions
qdoc-mode.el
with
186 additions
and
0 deletions
README.md
0 → 100644
+
4
−
0
View file @
00adbd6b
# qdoc-mode
Emacs major mode for .qdoc files.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
qdoc-mode.el
0 → 100644
+
182
−
0
View file @
00adbd6b
;;; qdoc-mode.el --- Major mode for editing qdoc files. -*- coding: utf-8; lexical-binding: t; -*-
;; Copyright © 2021, by Jörg Bornemann
;; Author: Jörg Bornemann <joerg.bornemann@qt.io>
;; Version: 1.0.0
;; Created: 11.08.2021
;; Keywords: languages
;; Homepage: n/a
;; This file is not part of GNU Emacs.
;;; License:
;; You can redistribute this program and/or modify it under the terms of the GNU General Public License version 2.
;;; Commentary:
;; This file provides a major mode for editing qdoc files.
;;; Code:
;;; TODO Suggest the replacements somehow
(
defvar
qdoc-deprecated-commands
'
((
"bold"
.
"b"
)
(
"i"
.
"e"
)
(
"o"
.
"li"
)
(
"qmlclass"
.
"qmltype"
))
"List of deprecated qdoc commands.
Each entry of this list is a cons (\"deprecated_command\" . \"replacement\")."
)
(
defvar
qdoc-known-commands
'
(
"a"
"abstract"
"annotatedlist"
"b"
"badcode"
"brief"
"c"
"caption"
"class"
"code"
"codeline"
"default"
"div"
"dots"
"e"
"else"
"endcode"
"endif"
"endlist"
"endtable"
"enum"
"example"
"externalpage"
"fn"
"footnote"
"generatelist"
"group"
"header"
"headerfile"
"if"
"image"
"include"
"ingroup"
"inheaderfile"
"inherits"
"inlineimage"
"inmodule"
"inqmlmodule"
"instantiates"
"internal"
"keyword"
"l"
"legalese"
"li"
"list"
"macro"
"meta"
"module"
"namespace"
"newcode"
"nextpage"
"noautolist"
"nonreentrant"
"note"
"obsolete"
"oldcode"
"omit"
"omitvalue"
"overload"
"page"
"preliminary"
"previouspage"
"printline"
"printto"
"printuntil"
"property"
"qml"
"qmlabstract"
"qmlattachedproperty"
"qmlattachedsignal"
"qmlbasictype"
"qmlmethod"
"qmlmodule"
"qmlproperty"
"qmlsignal"
"qmltype"
"quotation"
"quotefile"
"quotefromfile"
"raw"
"readonly"
"reentrant"
"reimp"
"relates"
"row"
"sa"
"section1"
"section2"
"section3"
"section4"
"since"
"skipline"
"skipto"
"skipuntil"
"snippet"
"span"
"startpage"
"sub"
"subtitle"
"sup"
"table"
"tableofcontents"
"target"
"threadsafe"
"title"
"tt"
"typealias"
"typedef"
"uicontrol"
"underline"
"value"
"variable"
"warning"
)
"Plain list of known qdoc commands, excluding deprecated commands."
)
(
defun
qdoc--create-command-regexp
(
command-list
)
"Turn COMMAND-LIST (command names without backslash) into a regular expression."
(
concat
"\\\\"
(
regexp-opt
command-list
'symbols
)))
(
defvar
qdoc-builtin-command-regexp
(
qdoc--create-command-regexp
qdoc-known-commands
))
(
defvar
qdoc-user-command-regexp
"\\\\[[:alpha:]][[:alnum:]]+"
)
(
defvar
qdoc-deprecated-command-regexp
(
qdoc--create-command-regexp
(
mapcar
#'
car
qdoc-deprecated-commands
)))
(
defvar
qdoc-font-lock-default
`
((
,
qdoc-builtin-command-regexp
.
font-lock-builtin-face
)
(
,
qdoc-deprecated-command-regexp
.
font-lock-warning-face
)
(
,
qdoc-user-command-regexp
.
font-lock-function-name-face
)))
;;;###autoload
(
define-derived-mode
qdoc-mode
text-mode
"qdoc"
"Major mode for editing Qt's .qdoc files."
(
setq
font-lock-defaults
'
(
qdoc-font-lock-default
))
(
setq
fill-column
80
)
(
setq-local
sentence-end-double-space
nil
)
(
qdoc-imenu-setup
))
;;;###autoload
(
add-to-list
'auto-mode-alist
'
(
"\\.qdoc\\'"
.
qdoc-mode
))
(
defun
qdoc-imenu-setup
()
"Set up imenu for qdoc-mode."
(
setq
imenu-case-fold-search
t
)
(
setq
imenu-generic-expression
'
((
"\\page"
"\\\\page \\(.*$\\)"
1
)
(
"\\title"
"\\\\title \\(.*$\\)"
1
)))
)
(
provide
'qdoc-mode
)
;;; qdoc-mode.el ends here
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