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 ?

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.