X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.theimps.com X-Spam-Level: X-Spam-Status: No, score=-100.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.3.1 From: Peter TB Brett To: Nathan Stewart Cc: geda-user AT delorie DOT com Subject: [geda-user] Re: gschem actions References: Date: Fri, 16 Aug 2013 19:50:11 +0100 In-Reply-To: (Nathan Stewart's message of "Mon, 12 Aug 2013 09:45:39 -0400") Message-ID: <87siy9ii70.fsf@harrington.peter-b.co.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Nathan Stewart writes: > In your June 30,2011=C2=A0 blog post you mention: > "It's not currently feasible to create a meaningful new action in > gschem without writing it mostly in C. " > > Unfortunately, gschem development folks aren't real open to outside > input. (Which explains the xfigian feel I guess)=C2=A0 I'm trying to figu= re > out how to add my own new custom action to a component, based on > attributes, with the presupposition in mind that this will never be > accepted into core. Hi Nathan, Fortunately my old blog post is no longer up-to-date! It is now much easier to create a meaningful new action. In the most recent versions of gschem, you can use the new Scheme API to access quite a lot of the design data (see the `geda-scheme' info manual or http://geda.peter-b.co.uk/geda-scheme/1.8.1/). To add a new action, there are a few steps. 1) Write a Scheme file which defines a function with a unique name and no arguments. For example: (define (my-action) ...) 2) Load the Scheme file (let's say it's called my-action.scm) from your gschem startup file. You have two options: a. Put the Scheme file in one of the directories on your gEDA Scheme load path. You can get a list of these directories by running: gaf shell -c '(display %load-path)' Then add this line to any of your gschemrc files: (load-from-path "my-action.scm") b. Put the Scheme file in the same directory as a project-specific gschemrc file. Then add this line to the project's gschemrc file: (load "my-action.scm") 3) Next you need to be able to run your action. The simplest way is to use the command prompt: simply type ":" to show the prompt, and then: (my-action) to execute it. At the moment, adding things to menus is tricky; you can edit the menus in the system-gschemrc but not elsewhere. If you want to try this, search system-gschemrc for "menu-items". However, it's *much* easier to add a keybinding. For example, to make your action run whenever you pless "!", add this to any gschemrc file: (global-set-key "exclam" 'my-action) I hope this gives you some pointers. Thanks, Peter > What I have in mind is that a Spice-Include component could contain > both a file and either a source attribute, or alternative use the > current page. I'd like to add an action to run the netlister on the > schematic, then run spice on the netlist. I'm new to scheme, but the > part that puzzles me is adding a new action.=20 > > It doesn't look like it's currently possible to add anything to > popup_items in x_menus.c, which is where I think such a new action > should probably go. Is there another route to add=C2=A0 brand new actions? > Nathan =2D-=20 Dr Peter Brett --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) iEYEARECAAYFAlIOdGMACgkQZ7Gbq7g7vpooSwCdHS/+6npKOFgo/8GuyOHdD0rT Z8AAnidC47csBTbyokQzaHCQD4OvlQV2 =6MwZ -----END PGP SIGNATURE----- --=-=-=--