Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ceb9c66
Auto-run Templating new plugin
WrapEarnPass Jun 19, 2026
2436cb6
add filedef iterator impl
WrapEarnPass Jun 19, 2026
3ebe78c
Seperate out the keyfile parsers to cleanup plugin_main
WrapEarnPass Jun 20, 2026
b75829d
update README with known bug and keyfile change
WrapEarnPass Jun 21, 2026
1ea3bdf
add keyfile parser
WrapEarnPass Jun 21, 2026
d8677aa
add parser container
WrapEarnPass Jun 21, 2026
dee1975
disable project-save handler due to geany/geany#4603
WrapEarnPass Jun 21, 2026
deba0e0
FIX cmd allocator
WrapEarnPass Jun 22, 2026
e6198f4
spawn controller should honor order
WrapEarnPass Jun 22, 2026
d1e9708
Update README to remove %e
WrapEarnPass Jun 22, 2026
2890710
Enable before-save interceptor
WrapEarnPass Jun 22, 2026
14a0127
Updated project to use clang for .h as well
WrapEarnPass Jun 22, 2026
ae7e926
cleanup logging
WrapEarnPass Jun 23, 2026
e084369
Enable tmpfile cleaner now that testing completed
WrapEarnPass Jun 23, 2026
1f2d6e5
fix eof marker on *.h to make github happy
WrapEarnPass Jun 23, 2026
eff48f4
add Tool>Auto-run menu to force config reloads
WrapEarnPass Jun 23, 2026
5be2652
Add Tool>Reload and Project>Config menus
WrapEarnPass Jun 24, 2026
c86f2fc
move all output to Compiler
WrapEarnPass Jun 26, 2026
007595d
Add async handler
WrapEarnPass Jun 26, 2026
2d0836c
Fix timer assertion by only starting the progress once.
WrapEarnPass Jun 26, 2026
1c32a20
fix use after free
WrapEarnPass Jun 29, 2026
1c74207
fix actually free cmd
WrapEarnPass Jun 29, 2026
ecb8948
Auto-run update POTFILES with new dependents
WrapEarnPass Jun 29, 2026
06103a4
geany/geany-plugins#1584
WrapEarnPass Jun 30, 2026
e214162
Revert "geany/geany-plugins#1584"
WrapEarnPass Jul 3, 2026
0c32890
improve filename escaping
WrapEarnPass Jul 3, 2026
66525f3
fix xcompiler reserved stderr and stdout
WrapEarnPass Jul 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ M: Pavel Roschin <rpg89(at)post(dot)ru>
W:
S: Maintained

autorun
P:
g: @WrapEarnPass
M:
W:
S: Maintained

codenav
P: Federico Reghenzani <federico(dot)dev(at)reghe(dot)net>
g:
Expand Down
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if ENABLE_AUTOMARK
SUBDIRS += automark
endif

if ENABLE_AUTORUN
SUBDIRS += autorun
endif

if ENABLE_CODENAV
SUBDIRS += codenav
endif
Expand Down
1 change: 1 addition & 0 deletions autorun/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WrapEarnPass
33 changes: 33 additions & 0 deletions autorun/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.27)

set(CMAKE_EXPORT_COMPILE_COMMANDS on)

set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local/lib/geany")

project(
autorun
VERSION 0.0.1
LANGUAGES C
DESCRIPTION "Geany action interceptor plugin")

set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELEASE "-O3")

set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS_DEBUG "-g" )
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

add_compile_definitions(LOCALEDIR="/usr/share/locale")
# the `pkg_check_modules` function is created with this call
find_package(PkgConfig REQUIRED)
# these calls create special `PkgConfig::<MODULE>` variables
pkg_check_modules(geany REQUIRED IMPORTED_TARGET GLOBAL geany)

add_library(${PROJECT_NAME} SHARED src/plugin_main.c src/autorun.c src/utils.c
src/spawn.c src/menu.c src/project.c)
# prevent cmake from prefixing the shared library
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::geany)
# install to users bin
install(TARGETS ${PROJECT_NAME} DESTINATION plugins)
340 changes: 340 additions & 0 deletions autorun/COPYING

Large diffs are not rendered by default.

Empty file added autorun/ChangeLog
Empty file.
4 changes: 4 additions & 0 deletions autorun/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include $(top_srcdir)/build/vars.auxfiles.mk

SUBDIRS = src
plugin = autorun
2 changes: 2 additions & 0 deletions autorun/NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Jun 2026
* Created plugin, initial commit (work in progress)
167 changes: 167 additions & 0 deletions autorun/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
=========
Auto-run
=========

.. contents::

About
=====

The Auto-run plugin is an extension that makes it possible to add action handlers to
geany. The initial release targets document-save and document-before-save

Usage
=====

Enabling the plugin
-------------------
The plugin can be enabled in the plugin manager.
There will also be a new entry in the "Tools" menu.

The Auto-run menu
------------------
The Auto-run menu allows you to manage the Project level Auto-run configs.

Auto-run replacements
---------------------

Auto-run supports the following replacements in CM and WD
%f - the basename of the file being saved.
%a - the absolute path of the file being saved.
%d - the absolute path of the directory of the file being saved.
%p - the absolute path of the base directory of the currently open project.

The BS Intercepted Action by default does not need the %a argument as it
operates on the contents of the Scintilla editor.

Why would BS targets support %a then?
Place the %a replacement in the BS target if you know the CM does not honor STDIN.
In that case Auto-run will dump the contents of Scintilla to a temp file.

clang-format, which reads stdin, would like to the filename for formatting rules.
e.g. clang-format --assume-filename='%f'

cmake-format, which does not read stdin
e.g. cmake-format '%a'

Ensure you're setting the correct quoting for arguments. Windows expects " quoted filenames
Linux expects ' quoted filenames

Manually setting Auto-run configs
---------------------------------
You can manually set Project level Auto-run configs under the keyfile heading [autorun],
using https://wiki.geany.org/howtos/configurebuildmenu#build-menu style entries.
The following is RFC2119 compliant.

FILETYPE_IA_NN_TA

FILETYPE is a Geany filetype label, e.g. (C|C++|C#|JSON) from geany/filetype_extensions.conf

IA(Intercepted Action) = (BS|OS),
* BS is Geany document-before-save
* OS is Geany document-save (on save)

NN = (00|01|...)
NN is a two digit number allowing for multiple tasks for a given entry.

TA(Target Action) = (CM|WD)
* CM is the command to run
* WD is the working directory to run from.
CM SHOULD be quoted appropriate to the OS' expectations.
WD MUST NOT be quoted on Linux.

C_BS_00_CM = formatter
C_BS_00_WD = %d
C_OS_00_CM = linter '%a'
C_OS_00_WD = %p
#Run formatter before file write, and then linter on the newly written %d/%f from %p
#when attempting to save a C file type.

C++_OS_00_CM = cppcheck '%f' --output-file='%p/cppcheck.log'
C++_OS_00_WD = %d
C++_OS_01_CM = clang-tidy -p '%p' --format-style=file '%f'
C++_OS_01_WD = %p
#Run cppcheck on %f from %d, and clang-tidy on %f from %p after file write when saving a C++ file type.

Set Auto-run actions across Projects
------------------------------------
To set Autorun across Projects without having to edit each .geany file, you can use filedefs
https://www.geany.org/manual/#filetype-definition-files under the keyfile heading [autorun]
with a syntax similar to the Project configs.

IA_NN_TA
where
IA = (BS|OS), NN = (00|01|...), TA=(CM|WD)

BS_00_CM = formatter
OS_00_CM = linter '%f'


When Auto-run loads, it will scan all User config dir filedefs/filetypes.*
for any [autorun] sections and set actions for all matching filetypes.
User config dir filedefs settings will be overridden by any Project settings.

Example:
(userconfigdir)/filedefs/filetypes.c
BS_00_CM = formatter '%f'
(userprojectdir)/project.geany
CBS_00_CM = fancyformatter '%f'

Autorun will run fancyformatter before save for C files as long as project.geany is open.

All Auto-run output will be in the Geany Compiler status window.

Known issues
============

Auto-run runs before-save targets synchronously. This may cause Geany to freeze.
Move slow commands to on-save to run asynchronously.
geany/geany#4603 may impact reloading the Project configs in realtime.
Tools>Auto-run>Reload will force a reload.
Compiler won't follow links unless at least one Build command has run.
https://github.com/geany/geany/issues/4609
Auto-run attempts a best effort to make filenames safe for the OS, but
some external tools do not correctly handle file and directory names on Linux
https://gitlab.kitware.com/cmake/cmake/-/work_items/27918
https://github.com/llvm/llvm-project/issues/207396

License
=======

The Auto-run plugin is distributed under the terms of the GNU General
Public License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. A copy
of this license can be found in the file COPYING included with the source
code of this program.

Downloads
=========

The Auto-run plugin is part of the combined Geany Plugins release.
For more information and downloads, please visit
http://plugins.geany.org/geany-plugins/

Development Code
================

Get the code from::

git clone https://github.com/geany/geany-plugins.git

Ideas, questions, patches and bug reports
=========================================

Please post any ideas, feature requests, questions and bugs in the
github issue tracker.

History
=======

This is a short release history showing the major changes:

**0.1:**
Created plugin
Implemented filetypes and project config readers
Implemented sync and async launch for handlers
Implemented Project menu, and Tool menu
Tested against Geany 2.1 and 2.2
17 changes: 17 additions & 0 deletions autorun/THANKS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
What's this file about?
-----------------------
This file lists all external people that have contributed to this project.

Workbench Plugin:
-------------------------
This plugin is heavily based on working with the Workbench plugin.
Thanks to LarsGit223.

Project Organizer Plugin:
-------------------------
This plugin is heavily based on working with the Project Organizer plugin.
Thanks to Jiri Techet.

Geany and Geany plugins:
------------------------
Thanks to all Geany developers for creating the best IDE a dev could ask for.
Loading