107 lines
3.1 KiB
EmacsLisp
107 lines
3.1 KiB
EmacsLisp
(defun swg-comment-block ()
|
|
"Insert an empty comment block, in the Javadoc style."
|
|
(interactive)
|
|
(insert "/** \n")
|
|
(insert " *\n")
|
|
(insert " * @param \n")
|
|
(insert " * @return \n")
|
|
(insert " * @see \n")
|
|
(insert " */\n"))
|
|
|
|
(defun swg-single-line ()
|
|
"Insert a line of dashes, for separating functions or sections of a file."
|
|
(interactive)
|
|
(insert "// ----------------------------------------------------------------------\n"))
|
|
|
|
(defun swg-double-line ()
|
|
"Insert a line of equals, for separating functions or sections of a file."
|
|
(interactive)
|
|
(insert "// ======================================================================\n"))
|
|
|
|
(defun swg-new-source ()
|
|
"Add template for a new source file. Assumes filename ends in .cpp"
|
|
(interactive)
|
|
(let* ((bufname (buffer-name (current-buffer)))
|
|
(chopname (substring bufname 0 -4)))
|
|
(swg-double-line)
|
|
(insert "//\n")
|
|
(insert (concat "// " (buffer-name (current-buffer)) "\n"))
|
|
(insert "// copyright (c) 2004 Sony Online Entertainment\n")
|
|
(insert "//\n")
|
|
(swg-double-line)
|
|
(insert "\n")
|
|
(insert "#include \"FirstGame.h\"\n")
|
|
(insert (concat "#include \"" chopname ".h\"\n"))
|
|
(insert "\n")
|
|
(swg-double-line)
|
|
(insert "\n")
|
|
(swg-double-line)))
|
|
|
|
(defun swg-new-header ()
|
|
"Add template for a new header file. Assumes filename ends in .h"
|
|
(interactive)
|
|
(let* ((bufname (buffer-name (current-buffer)))
|
|
(chopname (substring bufname 0 -2)))
|
|
(swg-double-line)
|
|
(insert "//\n")
|
|
(insert (concat "// " bufname "\n"))
|
|
(insert "// copyright (c) 2004 Sony Online Entertainment\n")
|
|
(insert "//\n")
|
|
(swg-double-line)
|
|
(insert "\n")
|
|
(insert (concat "#ifndef INCLUDED_" chopname "_H\n"))
|
|
(insert (concat "#define INCLUDED_" chopname "_H\n"))
|
|
(insert "\n")
|
|
(swg-double-line)
|
|
(insert "\n")
|
|
(swg-double-line)
|
|
(insert "\n")
|
|
(insert "#endif\n")))
|
|
|
|
(defun swg-insert-classname ()
|
|
"Insert the likely classname (based on the current filename)"
|
|
(interactive)
|
|
(let* ((bufname (buffer-name (current-buffer)))
|
|
(chopname (substring bufname 0 -4)))
|
|
(insert chopname)))
|
|
|
|
(defun swg-new-class (classname)
|
|
"Template to create a new class declaration"
|
|
(interactive "sClassName: ")
|
|
(insert (concat "class " classname "\n"))
|
|
(insert "{\n")
|
|
(insert "public:\n")
|
|
(insert "\n")
|
|
(insert "};\n")
|
|
(previous-line 2))
|
|
|
|
(defun swg-lint ()
|
|
"Run Lint on the current buffer."
|
|
(interactive)
|
|
(let (old-command compile-command)
|
|
(compile (concat "swglint.sh " (buffer-file-name)))
|
|
(setq compile-command old-command)))
|
|
|
|
(defun swg-perforce-comment (reviewedby keyfrom)
|
|
"Create a Perforce checkin description with all the necessary tags"
|
|
(interactive "sReviewed by: \nsKey from: ")
|
|
(insert "\t[key-from ")
|
|
(insert keyfrom)
|
|
(insert " ")
|
|
(call-process "getP4KeyFrom.pl" nil t nil keyfrom)
|
|
(delete-backward-char 1)
|
|
(insert "]\n")
|
|
(insert "\t[internal]\n")
|
|
(insert "\n")
|
|
(insert "\t[public]\n")
|
|
(insert "\tnone\n")
|
|
(insert "\t[testplan]\n")
|
|
(insert "\tnone\n")
|
|
(insert (concat "\t[reviewed-by " reviewedby "]\n"))
|
|
(insert "\t[linted]\n")
|
|
(previous-line 7)
|
|
(insert "\t")
|
|
)
|
|
|
|
(provide 'swg)
|