Some patches for AP 4.7.9 I found useful

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 60
Joined: Tue Aug 21, 2012 11:17 am
Location: UK

Some patches for AP 4.7.9 I found useful

Post by tmsg »

AP is a great editor though there are a few rough edges. So I looked into changing/adding some of the things I'd like to see, mostly patches to modify AP's command line options and add some INI file options.

I hope my changes are sensible and don't break any vital bits. However, given that the AP source code is quite substantial and that I really have looked only into them for a short while, there's every possibility that I do something pretty stupid or that there are undiscovered bugs (there must be some;-)).

Here's a concise list of the changes:
  • command line: wildcard filenames like "*.h" or "a??.c" are supported (a wildcard pattern terminated by a "+" triggers a recursive load, ie "AkelPad win*.h+" loads win*.h files in the current directory and all subdirectories) [1]
    command line: @FILELIST loads all files listed (one per line) in file FILELIST [2]
    command line: /LINE[:COLUMN] following a filename goes to line:column in that file
    command line: /IniName=ININAME loads ININAME.ini from the AP executable directory. Default (if this switch is not used) remains AkelPad.ini. [3]
  • ini file: window positions for Find/Replace/Goto dialogs are remembered
    ini file: manual parameter "MainClassName" sets AP main window's class name [4]
    ini file: manual parameter "PluginIniPrefix" sets a prefix for plugin ini filenames [3][5]
    ini file: "%w" in StatusUserFormat shows word wrap status (either "on" or "off")
Notes:
[1] This feature requires that the script plugin is installed and that script openWildcard.js (included in zip) is installed in the scripts directory.
[2] This feature requires that the script plugin is installed and that script openFileList.js (included in zip) is installed in the scripts directory.
[3] If options are loaded from the registry, this switch/parameter has no effect (in other words, there's only one set of registry-based options). It is certainly possible to change this but as I don't use the registry, I haven't looked into this.
[4] This is useful if you use two or more ini files and AP is restricted to a single instance (see "Options/Don't open a program twice"). By assigning specific class names in the ini files, you can direct further invocations or commands to a specific instance. If you don't see the point of this feature, you probably don't need it.
[5] The PluginIniPrefix string is exactly that: a textual prefix added to the inifile name. A PluginIniPrefix value of "AkelTest-" means that, say, the Coder plugin will store its ini values in file AkelTest-Coder.ini in directory .\AkelFiles\Plugs\. On the other hand, a PluginIniPrefix value of "AkelTest\" will store ini values in file Coder.ini in subdirectory .\AkelFiles\Plugs\AkelTest\. Attention: such subdirectories must be created manually, they are not created automatically!

The zip file only contains the changed source files (based on AP 4.7.9) and the two required JS scripts. All source code changes should be marked with "// TM!!!" (if I forgot something, just drop me a note).

Hopefully some of these changes will find their way into a future version of AP.

TM

Offline
Posts: 876
Joined: Tue Jul 24, 2007 8:54 am

Post by Fr0sT »

Command-line options which require 1) Certain plugin installed and 2) Certain script present? I don't think so. Moreover, you can achieve the same functionality via calling the script directly with parameters.

"manual parameter "MainClassName"" - would be better if AP detected its instances smarter, also using the path from where it had been started.

"PluginIniPrefix" - you could vote for AP profiles here

Offline
Posts: 60
Joined: Tue Aug 21, 2012 11:17 am
Location: UK

Post by tmsg »

Fr0sT wrote:Command-line options which require 1) Certain plugin installed and 2) Certain script present? I don't think so. Moreover, you can achieve the same functionality via calling the script directly with parameters.
Well, I simply needed this functionality (and I wanted it without having to remember/type complex command lines) so I implemented it in the simplest and fastest way I could find.

If you don't need/like it, fair enough. Indeed, I'd be the first to agree that this method isn't viable for general distribution. However, it works well for me and someone else might have a use for it. That's why I've shared it. YMMV.

TM

Offline
Posts: 876
Joined: Tue Jul 24, 2007 8:54 am

Post by Fr0sT »

tmsg
of course it's up to you but you could create some helper batches launching AP with appropriate parameters. It would be much simpler than modifying sources.

>AkelWild.bat *.cpp

AkelWild.bat:
@call AkelPad /Call("Scripts::Main", 1, "openWildcard.js", "%1%")

Offline
Posts: 60
Joined: Tue Aug 21, 2012 11:17 am
Location: UK

Post by tmsg »

Fr0sT wrote: of course it's up to you but you could create some helper batches launching AP with appropriate parameters.
I certainly tried that first, but with the different options I wanted to support (for instance multiple wildcard arguments) the batch simply grew too complicated for my liking.
Fr0sT wrote:It would be much simpler than modifying sources.
That specific feature needed just four lines in C.

TM
Post Reply