2

The verilog-mode package contains this code:

(define-skeleton verilog-sk-header-tmpl
  "Insert a comment block containing the module title, author, etc."
  "[Description]: "
  "//                              -*- Mode: Verilog -*-"
  "\n// Filename        : " (buffer-name)
  "\n// Description     : " str
  "\n// Author          : " (user-full-name)
  "\n// Created On      : " (current-time-string)
  "\n// Last Modified By: ."
  "\n// Last Modified On: ."
  "\n// Update Count    : 0"
  "\n// Status          : Unknown, Use with caution!"
  "\n")

What is the cleanest and best way to redefine it in my .emacs init file ?

Kaushal Modi
  • 25,203
  • 3
  • 74
  • 179
adrianf0
  • 23
  • 2

1 Answers1

1

From the verilog-mode.el source, the verilog-sk-header-tmpl is used only in two places:

  1. Where the skeleton is defined
  2. Where the skeleton is used in a verilog-sk-header function

So all you need to do is define your own skeleton using

(define-skeleton my/verilog-sk-header-tmpl
"Insert a comment block containing the module title, author, etc."
  ;; !!INSERT YOUR CUSTOM TEMPLATE DEFINITION HERE!!
  "\n")

and re-define verilog-sk-header function to use that instead of the default skeleton:

(defun verilog-sk-header ()
  "Insert a descriptive header at the top of the file.
See also `verilog-header' for an alternative format."
  (interactive "*")
  (save-excursion
    (goto-char (point-min))
    (my/verilog-sk-header-tmpl)))

As you are re-defining the function, now on calling this function using the keyboard shortcut (C-c C-t h) or from the menu bar will insert your custom header skeleton.

Kaushal Modi
  • 25,203
  • 3
  • 74
  • 179