Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optional renamimg of compilation buffer #3

Merged
merged 5 commits into from
Dec 24, 2024
Merged

Conversation

csantosb
Copy link
Contributor

When using hdlmake and helm-make, for example, compilation buffer name is automatically set. Mandatory renaming breaks this functionality.

With this change, using a nil value as fpga-xilinx-vivado-buf would be enough.

@gmlarumbe
Copy link
Owner

Hi @csantosb ,

Thanks a lot for your contribution.

I tested these changes in my environment and got this error:
Wrong type argument: stringp, nil

The following patch in fpga-utils-define-compile-fn seems to fix it:

diff --git a/fpga-utils.el b/fpga-utils.el
index 9f57ab3..ae15f0a 100644
--- a/fpga-utils.el
+++ b/fpga-utils.el
@@ -166,7 +166,7 @@ COMP-MODE is the name of the compilation derived mode created by macro
   (declare (indent 1) (debug 1))
   `(defun ,name (command)
      ,docstring
-     (when (get-buffer ,buf)
+     (when (and ,buf (get-buffer ,buf))
        (if (y-or-n-p (format "Buffer %s is in use, kill its process and start new compilation?" ,buf))
            (kill-buffer ,buf)
          (user-error "Aborted")))

Could you try it in your environment and add it to the PR if it works well?

Thanks!

@csantosb
Copy link
Contributor Author

csantosb commented Dec 21, 2024 via email

@gmlarumbe
Copy link
Owner

I push a variant of yours, where I think I stay closer to the original
code.

I do not think you can hardcode *vivado* in the fpga-utils-define-compilation-mode macro since it is also used for other vendors. For example, buf in that macro also refers to fpga-siemens-vsim-buf or to fpga-cadence-xrun-buf.

If you want to use the default compilation buffer names (i.e. *compilation*) with these functions by setting its fpga-<vendor>-<tool>-buf customizable variable to nil (e.g. fpga-xilinx-vivado-buf) while preserving the option of using the default name (i.e. *vivado*) for other users, it is needed to check first if the buffer exists to keep using it for subsequent compilations and to avoid errors with get-buffer since it requires a string as an argument.

However I might be missing something. Let me know if that is the case.

@csantosb
Copy link
Contributor Author

You're right, your patch applies and fits my needs. To me, this is more than enough.

@gmlarumbe
Copy link
Owner

You're right, your patch applies and fits my needs. To me, this is more than enough.

Thanks! :)

Do you prefer to add the patch to this PR and rebase the changes or should I merge it and fix it in a subsequent commit?

@csantosb
Copy link
Contributor Author

csantosb commented Dec 24, 2024 via email

@gmlarumbe gmlarumbe merged commit 7ba6413 into gmlarumbe:main Dec 24, 2024
5 checks passed
@gmlarumbe
Copy link
Owner

I'm glad it helps Emacs users :)

Thanks a lot for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants