Function: vhdl--visit-file
vhdl--visit-file is a byte-compiled function defined in
vhdl-mode.el.gz.
Signature
(vhdl--visit-file FILE-NAME ISSUE-ERROR BODY-FUN)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl--visit-file (file-name issue-error body-fun)
(if (null file-name)
(funcall body-fun)
(unless (file-directory-p file-name)
(let ((source-buffer (current-buffer))
(visiting-buffer (find-buffer-visiting file-name))
file-opened)
(when (or (and visiting-buffer (set-buffer visiting-buffer))
(condition-case ()
(progn (set-buffer (create-file-buffer file-name))
(setq file-opened t)
(vhdl-insert-file-contents file-name)
(let ((st (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?\- ". 12" st)
(modify-syntax-entry ?\n ">" st)
(modify-syntax-entry ?\^M ">" st)
(modify-syntax-entry ?_ "w" st)
;; FIXME: We should arguably reset the
;; syntax-table after running `body-fun'.
(set-syntax-table st))
t)
(error
(if issue-error
(progn
(when file-opened (kill-buffer (current-buffer)))
(set-buffer source-buffer)
(error "ERROR: File cannot be opened: \"%s\"" file-name))
(vhdl-warning (format "File cannot be opened: \"%s\"" file-name) t)
nil))))
(condition-case info
(funcall body-fun)
(error
(if issue-error
(progn
(when file-opened (kill-buffer (current-buffer)))
(set-buffer source-buffer)
(error (cadr info)))
(vhdl-warning (cadr info))))))
(when file-opened (kill-buffer (current-buffer)))
(set-buffer source-buffer)))))