Skip to content

Fix the example for editor.cmd#1313

Merged
mosteo merged 1 commit into
alire-project:masterfrom
mgrojo:patch-1
Feb 7, 2023
Merged

Fix the example for editor.cmd#1313
mosteo merged 1 commit into
alire-project:masterfrom
mgrojo:patch-1

Conversation

@mgrojo

@mgrojo mgrojo commented Jan 28, 2023

Copy link
Copy Markdown
Contributor

Using double quotes, the ${GPR_FILE} is interpreted as a variable by Bourne-like shells and evaluated to an empty string or whatever value has when executed. Single quotes is a way to avoid that evaluation.

This example will not make Emacs select and load the GPR_FILE as the project file for ada-mode, that would be more cumbersome (and requires ada-mode 8.0.3), but I didn't want to complicate the example:

alr config --set --global editor.cmd 'emacs --eval=(ada-build-prompt-select-prj-file"${GPR_FILE}") ${GPR_FILE}'

Using double quotes, the  ${GPR_FILE} is interpreted as a variable by Bourne-like shells and evaluated to an empty string or whatever value has when executed. Single quotes is a way to avoid that evaluation.

This example will not make Emacs select and load the GPR_FILE as the project file for ada-mode, that would be more cumbersome (and requires ada-mode 8.0.3), but I didn't want to complicate the example:
```
alr config --set --global editor.cmd 'emacs --eval=(ada-build-prompt-select-prj-file"${GPR_FILE}") ${GPR_FILE}'
```
@mgrojo

mgrojo commented Jan 28, 2023

Copy link
Copy Markdown
Contributor Author

Regarding the real command working for Emacs:

alr config --set --global editor.cmd 'emacs --eval=(ada-build-prompt-select-prj-file"${GPR_FILE}") ${GPR_FILE}'

Note that there is no space between the function ada-build-prompt-select-prj-file and the string argument, which is working but not the usual way of writting Lisp. Otherwise, Alire splits the argument and Emacs is not able to evaluate it correctly, because the --eval argument requires its value to be a single argument, usually requiring some escaping. Don't know if that could be considered a bug in Alire or not, but I couldn't find a proper way to escape the space to accommodate both Alire and Emacs.

@mosteo mosteo merged commit 3b7b139 into alire-project:master Feb 7, 2023
@mgrojo mgrojo deleted the patch-1 branch April 7, 2023 12:05
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.

3 participants