Function: go-tag--proc
go-tag--proc is a natively compiled function defined in go-tag.el.
Signature
(go-tag--proc CMD-ARGS)
Documentation
Modify field tags based on CMD-ARGS.
The tool used can be set via ‘go-tag-command` (default: go-tag)
and additional arguments can be set as a list via ‘go-tag-args`.
Source Code
;; Defined in /nix/store/4jjjcvfszn24ybwdg82skyc9bkmmzbb9-emacs-packages-deps/share/emacs/site-lisp/elpa/go-tag-20230111.651/go-tag.el
(defun go-tag--proc (cmd-args)
"Modify field tags based on CMD-ARGS.
The tool used can be set via ‘go-tag-command` (default: go-tag)
and additional arguments can be set as a list via ‘go-tag-args`."
(let ((tmpfile (make-temp-file "go-tag" nil ".go"))
(patchbuf (get-buffer-create "*Go-Tag patch*"))
(errbuf (if go-tag-show-errors
(get-buffer-create "*Go-Tag Errors*")))
(coding-system-for-read 'utf-8)
(coding-system-for-write 'utf-8))
(unwind-protect
(save-restriction
(widen)
(if errbuf
(with-current-buffer errbuf
(setq buffer-read-only nil)
(erase-buffer)))
(with-current-buffer patchbuf
(erase-buffer))
(write-region nil nil tmpfile)
(setq cmd-args (append cmd-args (list "-file" tmpfile "-w")))
(message "Calling go-tag: %s %s" go-tag-command cmd-args)
(if (zerop (apply #'call-process go-tag-command nil errbuf nil cmd-args))
(progn
(if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
(message "Buffer is already go-tag")
(go--apply-rcs-patch patchbuf)
(message "Applied go-tag"))
(if errbuf (go-tag--kill-error-buffer errbuf)))
(message "Could not apply go-tag")
(if errbuf
(progn
(message (with-current-buffer errbuf (buffer-string)))
(go-tag--kill-error-buffer errbuf)))))
(kill-buffer patchbuf)
(delete-file tmpfile))))