WrapEarnPass created an issue (geany/geany-plugins#1577)

I would like to be able to configure geany to run a command on an action. For 
my specific example, I would like clang-format to run on file saves.

@pztrn in #733 also suggested golint and gofmt

@elextr suggested "What the build system really needs is another source for 
plugins to use, but which would not be saved by Geany"

That sounds ripe for a new plugin.

I propose to create a plugin that hooks to document-before-save and 
document-save
document-before-save should be the target for formatters or pre-processors, as 
the document written to file should have been formatted.
document-save should be the target for linters, or post processors, as they 
should operate on the (already formatted) file.

Following the naming convention of the existing plugins, Auto-run seems like a 
reasonable name.

The plugin should support geany Projects (which I would consider to be a 
session), and not conflict on multiple Projects (i.e. workbench).

The plugin should allow setting the document-before-save, and document-on-save 
actions by Project. Which should override:
The plugin should allow setting the document-before-save, and document-on-save 
actions by filetype, using the existing geany filetypes.FILE paradigm. 
The plugin should support similar syntax to the 
[build](https://wiki.geany.org/howtos/configurebuildmenu) command processor. 
```
    %f - replaced by the filename of the file selected in the editor when the 
menu item is selected.
    %e - replaced by the same filename but without the last extension.
    %d - replaced by the absolute path of the directory of the file selected in 
the editor when the menu item is selected.
    %p - replaced by the absolute path of the base directory of the currently 
open project.
```
It would be user friendly to have a menu available to set the Project level 
Auto-run document-before-save, and document-on-save actions. But not entirely 
necessary for a proof-of-concept. Following the standard convention, this menu 
should be in Tools>Auto-run.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1577
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/issues/[email protected]>

Reply via email to