Function: verilog-batch-execute-func

verilog-batch-execute-func is a byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-batch-execute-func FUNREF &optional NO-SAVE)

Documentation

Internal processing of a batch command.

Runs FUNREF on all command arguments. Save the result unless optional NO-SAVE is t.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-batch-execute-func (funref &optional no-save)
  "Internal processing of a batch command.
Runs FUNREF on all command arguments.
Save the result unless optional NO-SAVE is t."
  (verilog-batch-error-wrapper
   ;; Setting global variables like that is *VERY NASTY* !!!  --Stef
   ;; However, this function is called only when Emacs is being used as
   ;; a standalone language instead of as an editor, so we'll live.
   ;;
   ;; General globals needed
   (setq make-backup-files nil)
   (setq-default make-backup-files nil)
   (setq enable-local-variables t)
   (setq enable-local-eval t)
   (setq create-lockfiles nil)
   ;; Make sure any sub-files we read get proper mode
   (setq-default major-mode 'verilog-mode)
   ;; Ditto files already read in
   ;; Remember buffer list, so don't later pickup any verilog-getopt files
   (let ((orig-buffer-list (buffer-list)))
     (mapc (lambda (buf)
             (when (buffer-file-name buf)
               (with-current-buffer buf
                 (set (make-local-variable 'verilog-batch-orig-buffer-string)
                      (buffer-string))
                 (put 'verilog-batch-orig-buffer-string 'permanent-local t)
                 (verilog-mode)
                 (verilog-auto-reeval-locals)
                 (verilog-getopt-flags))))
           orig-buffer-list)
     ;; Process the files
     (mapc (lambda (buf)
             (when (buffer-file-name buf)
               (if (not (file-exists-p (buffer-file-name buf)))
                   (error
                    "File not found: %s" (buffer-file-name buf)))
               (message "Processing %s" (buffer-file-name buf))
               (with-current-buffer buf
                 (funcall funref)
                 (verilog-star-cleanup)
                 (when (and (not no-save)
                            (buffer-modified-p)
                            (not (equal verilog-batch-orig-buffer-string (buffer-string))))
                   (save-buffer)))))
           orig-buffer-list))))