Skip to content
Cayetano Santos edited this page Jul 17, 2019 · 14 revisions

Table of Contents

Guidelines

VHDL-tools expects a correct setup of the packages it relies on

  • configure ggtags
  • setup your root project directory so that vc-root-dir may find it (by putting it under version control with git, for example)

Set vhdl-tools-use-outshine to t if you plan to use outshine feature; additionally, setting vhdl-tools-manage-folding (off by default) to true will allow auto folding when jumping around, and vhdl-tools-recenter-nb-lines will be used as number of lines from top after jumping. vhdl-tools-verbose makes the package verbose.

Finally, have a look at all customization possibilities with

M-x customize-group vhdl-tools.

Example configuration file

This example code may be used as emacs init file /tmp/emacs.d/init.el when starting emacs as

emacs -q -l /tmp/emacs.d/init.el

It assumes /tmp/emacs.d as user-emacs-directory to avoid overwritting the default user directory.

;; Tested under emacs 26.2.90.
;; It assumes network available to download necessary stuff
;; First run may be a bit slow as all this stuff will be installed


;; Define user variables

(setq user-emacs-directory "/tmp/emacs.d"
      package-user-dir (format "%s/elpa" user-emacs-directory)
      load-prefer-newer t)


;; Package handling

(setq package-enable-at-startup t
      ;; package-archive-priorities
      ;; '( ("gnu" . 15)
      ;;    ("melpa-stable" . 20)
      ;;    ("melpa" . 10))
      )

;; (when (boundp 'package-pinned-packages)
;;   (setq package-pinned-packages
;;         '((outshine . "melpa"))))

(package-initialize)

;; Declare remote repository where to download packages from

(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)

(package-refresh-contents)

;; Install use-package if necessary

(when (not (package-installed-p 'use-package))
  (package-install 'use-package))


;; Configure Outshine

(use-package outshine
  :ensure t
  :defer t
  :config
  (setq outshine-use-speed-commands t
        outshine-startup-folded-p nil)

  ;; In order to outshine to deal correctly with indented headings, it is
  ;; necessary to comment out line 989, and uncomment line 991 in outshine.el.
  ;; This may be done instead with help of this piece of advice

  (defadvice outshine-calc-outline-level (around titi activate)
    (require 'cl)
    (cl-flet ((outshine-calc-outline-regexp () outline-regexp))
      ad-do-it))

  ;; Optionally define some keys to navigate headings

  (define-key outline-minor-mode-map (kbd "<backtab>") 'outshine-cycle-buffer)
  (define-key outline-minor-mode-map (kbd "C-RET") 'outshine-insert-heading)

  (outshine-define-key-with-fallback
      outshine-mode-map (kbd "C-c C-n")
    (outshine-speed-move-safe (quote outline-next-visible-heading))
    t)

  (outshine-define-key-with-fallback
      outshine-mode-map (kbd "C-c C-p")
    (outshine-speed-move-safe (quote outline-previous-visible-heading))
    t)

  (outshine-define-key-with-fallback
      outshine-mode-map (kbd "C-c C-f")
    (outshine-speed-move-safe (quote outline-forward-same-level))
    (outline-on-heading-p))

  (outshine-define-key-with-fallback
      outshine-mode-map (kbd "C-c C-b")
    (outshine-speed-move-safe (quote outline-backward-same-level))
    (outline-on-heading-p))

  (outshine-define-key-with-fallback
      outshine-mode-map (kbd "C-c C-u")
    (outshine-speed-move-safe (quote outline-up-heading))
    (outline-on-heading-p)))


;; Configure Vhdl-tools

(use-package vhdl-tools
  :ensure t
  :defer t
  :config
  (setq vhdl-tools-manage-folding t
        vhdl-tools-verbose t
        vhdl-tools-use-outshine t
        vhdl-tools-vorg-tangle-comments-link t
        vhdl-tools-recenter-nb-lines '(4)))


;; Configure vhdl mode

(use-package vhdl
  :defer t
  :hook (vhdl-mode . (lambda ()
                       (vhdl-tools-mode 1))))
Clone this wiki locally