Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Feature #1569376: Insert doxygen commands interactively.

Signed-off-by: Ryan T. Sammartino <ryants@users.sourceforge.net>
  • Loading branch information...
commit 914d5cc98129d224e15bd68c39ec8836830b08a2 1 parent 7d318b5
authored March 07, 2010
8  ChangeLog
... ...
@@ -1,3 +1,11 @@
  1
+2010-03-07  Ryan T. Sammartino  <ryan.sammartino@gmail.com>
  2
+
  3
+	* lisp/doxymacs.el.in: Feature #1569376: Insert doxygen commands
  4
+	interactively:
  5
+	(doxymacs-insert-command-history, doxymacs-commands,
  6
+	doxymacs-insert-command, doxymacs-read-arg): New variables and
  7
+	functions for feature #1569376.
  8
+
1 9
 2010-02-19  Ryan T. Sammartino  <ryan.sammartino@gmail.com>
2 10
 
3 11
 	* lisp/doxymacs.el.in: Patch #2954452: New C++! documentation
2  INSTALL
@@ -73,6 +73,8 @@ Be sure these are properly configured and installed before proceeding.
73 73
 - Default key bindings are:
74 74
   - C-c d ? will look up documentation for the symbol under the point.
75 75
   - C-c d r will rescan your Doxygen tags file.
  76
+  - C-c d RET will prompt you for a Doxygen command to enter, and its
  77
+    arguments.
76 78
   - C-c d f will insert a Doxygen comment for the next function.
77 79
   - C-c d i will insert a Doxygen comment for the current file.
78 80
   - C-c d ; will insert a Doxygen comment for the current member.
204  lisp/doxymacs.el.in
@@ -113,6 +113,7 @@
113 113
 
114 114
 ;; Change log:
115 115
 ;;
  116
+;; 07/03/2010 - feature #1569376: Interactively insert doxygen commands.
116 117
 ;; 19/02/2010 - patch #2954452: Add new documentation style C++!.
117 118
 ;;              bug #1862867: Remove trailing whitespace in JavaDoc function
118 119
 ;;              template.
@@ -516,6 +517,8 @@ Key bindings:
516 517
 (define-key doxymacs-mode-map "\C-cdr"
517 518
   'doxymacs-rescan-tags)
518 519
 
  520
+(define-key doxymacs-mode-map "\C-cd\r"
  521
+  'doxymacs-insert-command)
519 522
 (define-key doxymacs-mode-map "\C-cdf"
520 523
   'doxymacs-insert-function-comment)
521 524
 (define-key doxymacs-mode-map "\C-cdi"
@@ -1093,6 +1096,207 @@ the completion or nil if canceled by the user."
1093 1096
 (if (not (boundp 'mark-active))
1094 1097
     (defvar mark-active nil))		; Is this correct? Probably not.
1095 1098
 
  1099
+;; Inserting commands with completion
  1100
+
  1101
+(defvar doxymacs-insert-command-history nil)
  1102
+
  1103
+(defvar doxymacs-commands
  1104
+  '(("a" (word "Argument"))
  1105
+    ("addindex" (newline "Text to add to LaTeX index"))
  1106
+    ("addtogroup" (word "Name of group") (newline optional "Title of group"))
  1107
+    ("anchor" (word "Name of anchor"))
  1108
+    ("arg" "Argument description")
  1109
+    ("attention" "Attention text")
  1110
+    ("author" "List of authors")
  1111
+    ("b" (word "Word to display in bold"))
  1112
+    ("brief" "Brief description")
  1113
+    ("bug" "Bug description")
  1114
+    ("c" "Word to display as code")
  1115
+    ("callgraph")
  1116
+    ("callergraph")
  1117
+    ("category" (word "Name of category") (optional word "Header file")
  1118
+     (optional word "Header name"))
  1119
+    ("class" (word "Name of class") (optional word "Header file")
  1120
+     (optional word "Header name"))
  1121
+    ("code")
  1122
+    ("cond" (optional word "Section label"))
  1123
+    ("copybrief" (word "Link object"))
  1124
+    ("copydetails" (word "Link object"))
  1125
+    ("copydoc" (word "Link object"))
  1126
+    ("date" "Date description")
  1127
+    ("def" (word "#define macro name"))
  1128
+    ("defgroup" (word "Name of group") (newline "Group title"))
  1129
+    ("deprecated" "Deprecated description")
  1130
+    ("details" "Detailed description")
  1131
+    ("dir" (word optional "Path fragment"))
  1132
+    ("dontinclude" (word "File name"))
  1133
+    ("dot")
  1134
+    ("dotfile" (word "File name") (optional "Caption (must be in quotes)"))
  1135
+    ("e" (word "Word to display in italics"))
  1136
+    ("else")
  1137
+    ("elseif" (word "Section label"))
  1138
+    ("em" (word "Word to display in italics"))
  1139
+    ("endcode")
  1140
+    ("endcond")
  1141
+    ("enddot")
  1142
+    ("endhtmlonly")
  1143
+    ("endif")
  1144
+    ("endlatexonly")
  1145
+    ("endlink")
  1146
+    ("endmanonly")
  1147
+    ("endmsc")
  1148
+    ("endverbatim")
  1149
+    ("endxmlonly")
  1150
+    ("enum" (word "Enumeration name"))
  1151
+    ("example" (word "File name"))
  1152
+    ("exception" (word "Exception object") "Exception description")
  1153
+    ("extends" (word "Name"))
  1154
+    ("f$")
  1155
+    ("f[")
  1156
+    ("f]")
  1157
+    ("f{" "Environment")
  1158
+    ("f}")
  1159
+    ("file" (optional word "File name"))
  1160
+    ("fn" (newline "Function declaration"))
  1161
+    ("headerfile" (word "Header file") (optional word) "Header name")
  1162
+    ("hideinitializer")
  1163
+    ("htmlinclude" (word "File name"))
  1164
+    ("htmlonly")
  1165
+    ("if" (word "Section label"))
  1166
+    ("ifnot" (word "Section label"))
  1167
+    ("image" (word "Format") (word "File name")
  1168
+     (optional "Caption (must be in quotes)") (optional "Size indication"))
  1169
+    ("implements" (word "Name"))
  1170
+    ("include" (word "File name"))
  1171
+    ("includelineno" (word "File name"))
  1172
+    ("ingroup" (word "Group name"))
  1173
+    ("internal")
  1174
+    ("invariant" "Invariant description")
  1175
+    ("interface" (word "Name") (optional word "Header file")
  1176
+     (optional word "Header Name"))
  1177
+    ("latexonly")
  1178
+    ("li" "Item description")
  1179
+    ("line" (newline "Line pattern"))
  1180
+    ("link" (word "Link object"))
  1181
+    ("mainpage" (newline optional "Title"))
  1182
+    ("manonly")
  1183
+    ("memberof" (word "Name"))
  1184
+    ("msc")
  1185
+    ("n")
  1186
+    ("name" (newline "Header"))
  1187
+    ("namespace" (word "Name"))
  1188
+    ("nosubgrouping")
  1189
+    ("note" "Text of note")
  1190
+    ("overload" (newline optional "Function declaration"))
  1191
+    ("p" (word "Word to display as a parameter"))
  1192
+    ("package" (word "Name"))
  1193
+    ("page" (word "Name") (newline "Title"))
  1194
+    ("par" (newline optional "Title") "Paragraph text")
  1195
+    ("paragraph" (word "Paragraph name") (newline "Paragraph title"))
  1196
+    ("param" (word "Parameter") "Parameter description")
  1197
+    ("param[in]" (word "Parameter") "Parameter description")
  1198
+    ("param[out]" (word "Parameter") "Parameter description")
  1199
+    ("param[in,out]" (word "Parameter") "Parameter description")
  1200
+    ("post" "Post-condition description")
  1201
+    ("pre" "Pre-condition description")
  1202
+    ("private")
  1203
+    ("privatesection")
  1204
+    ("property" (newline "Qualified property name"))
  1205
+    ("protected")
  1206
+    ("protectedsection")
  1207
+    ("protocol" (word "Name") (optional word "Header file")
  1208
+     (optional word "Header name"))
  1209
+    ("public")
  1210
+    ("publicsection")
  1211
+    ("ref" (word "Name") (newline optional "Text"))
  1212
+    ("relates" (word "Name"))
  1213
+    ("relatesalso" (word "Name"))
  1214
+    ("remarks" "Remarks text")
  1215
+    ("return" "Description of return value")
  1216
+    ("retval" (word "Return value") "Description")
  1217
+    ("sa" "References")
  1218
+    ("section" (word "Section name") (newline "Section title"))
  1219
+    ("see" "References")
  1220
+    ("showinitializer")
  1221
+    ("since" "Text")
  1222
+    ("skip" (newline "Pattern"))
  1223
+    ("skipline" (newline "Pattern"))
  1224
+    ("struct" (word "Name") (optional word "Header file")
  1225
+     (optional word "Header name"))
  1226
+    ("subpage" (word "Name") (newline optional "Text"))
  1227
+    ("subsection" (word "Name") (newline optional "Title"))
  1228
+    ("subsubsection" (word "Name") (newline optional "Title"))
  1229
+    ("test" "Paragraph describing test case")
  1230
+    ("throw" (word "Exception object") "Exception description")
  1231
+    ("todo" "Paragraph describing what needs to be done")
  1232
+    ("tparam" (word "Template parameter") "Description")
  1233
+    ("typedef" (newline "Typedef declaration"))
  1234
+    ("union" (word "Name") (optional word "Header file")
  1235
+     (optional word "Header name"))
  1236
+    ("until" (newline "Pattern"))
  1237
+    ("var" (newline "Variable declaration"))
  1238
+    ("verbatim")
  1239
+    ("verbinclude" (word "File name"))
  1240
+    ("version" "Version number")
  1241
+    ("warning" "Warning message")
  1242
+    ("weakgroup" (word "Name") (newline optional "Title"))
  1243
+    ("xmlonly")
  1244
+    ("xrefitem" (word "Key") "Heading (must be in quotes)"
  1245
+     "List title (must be in quotes)" "Text")
  1246
+    ("$")
  1247
+    ("@")
  1248
+    ("\\")
  1249
+    ("&")
  1250
+    ("~" (optional "Language ID"))
  1251
+    ("<")
  1252
+    (">")
  1253
+    ("#")
  1254
+    ("%")
  1255
+    ("\""))
  1256
+  "Available doxygen commands.  Format is
  1257
+
  1258
+'((\"command\" args) ...)
  1259
+
  1260
+where:
  1261
+
  1262
+ - command is the doxygen command.
  1263
+ - args is a list of prompts to display for each argument to the
  1264
+   command.  An element of args could also be a list, the last element of which must be a string to use for the prompt, and other elements may be:
  1265
+   - newline to indicate a newline should be appended to the user's input.
  1266
+   - word to indicate the argument accepts a single word only.
  1267
+   - optional to indicate the argument is optional.")
  1268
+
  1269
+(defun doxymacs-insert-command (cmd)
  1270
+  "Insert a doxymacs command with completion."
  1271
+  (interactive (list (completing-read
  1272
+		      "Insert doxygen command: "
  1273
+		      doxymacs-commands
  1274
+		      nil nil nil 'doxymacs-insert-command-history)))
  1275
+  (insert (concat (doxymacs-doxygen-command-char) cmd))
  1276
+  (dolist (arg-prompt (cdr-safe (assoc cmd doxymacs-commands)))
  1277
+    (let ((arg (doxymacs-read-arg arg-prompt)))
  1278
+      (if (or (= (length arg) 0) (string= "\n" arg))
  1279
+	  ;; If nothing is entered no point in prompting for the rest of
  1280
+	  ;; the args.
  1281
+	  (return)
  1282
+	(insert (concat " " arg))))))
  1283
+
  1284
+(defun doxymacs-read-arg (arg)
  1285
+  (let* ((newline (and (listp arg) (memq 'newline arg)))
  1286
+	 (word (and (listp arg) (memq 'word arg)))
  1287
+	 (optional (and (listp arg) (memq 'optional arg)))
  1288
+	 (prompt (if (listp arg) (car (last arg)) arg))
  1289
+	 (final-prompt (concat prompt
  1290
+			       (if optional (concat " (optional)"))
  1291
+			       (if word (concat " (word)"))
  1292
+			       ": ")))
  1293
+    (concat
  1294
+     (cond (word
  1295
+	    (read-no-blanks-input final-prompt))
  1296
+	   (t
  1297
+	    (read-string final-prompt)))
  1298
+     (if newline "\n"))))
  1299
+
1096 1300
 
1097 1301
 ;; Default templates
1098 1302
 

0 notes on commit 914d5cc

Please sign in to comment.
Something went wrong with that request. Please try again.