jEdit Community - Resources for users of the jEdit Text Editor
Console's macro functions in languages other than BeanShell?
Submitted by Anonymous on Tuesday, 21 September, 2004 - 19:28
I can get Console's macro functions (such as runInSystemShell) to work in BeanShell scripts, but not in Ruby scripts (via the SuperScript plugin). Does anyone know how?

Search a word from one EditPane in a second EditPane of a view
Submitted by AndreJRenard on Sunday, 19 September, 2004 - 19:07
I have a view with two EditPanes of two different files. My cursor is on one word of one EditPane. I would like to write a macro to search for that word in the second EditPane.

Selecting the word in the first window is easy but how can I direct the search in the second window? For the time being I only found a way to search in the second file in the SAME EditPane that the first one:

import javax.swing.border.*;

word = textArea.getSelectedText() ;

SearchAndReplace.setSearchFileSet(new CurrentBufferSet());

Also I would like to have the found word sitting at the top of the window. How can I do that?

Thanks for hints.

How to write a macro to Change Auto-Indent Behavior?
Submitted by drefty on Wednesday, 15 September, 2004 - 21:45
PROBLEM: There is one frustrating aspect of auto-indentation with jEdit that I would like to change with a macro. Here is some sample text to demonstrate what I am talking about. ...


If you put the cursor before "1Watermellon" and then press ENTER, jEdit will auto-indent to make it the same indentation level as "4Potato".

This is contrary to what I'd expect because I'm trying to insert some blank non-indented lines in between 'potato' and 'watermellon'. I am *not* trying to make watermellon indented beneath potato.

The problem seems to be that jEdit does auto-indentation based on the previous *non-blank* line, instead of just the previous line.

QUESTION: How can I change this behavior with a macro or with other means, short of recompiling jEdit.
Using arrays in macros ...
Submitted by Lee Elms on Tuesday, 14 September, 2004 - 13:49
I am trying to create an array in a BeanShell macro, e.g.:

int pos[] = new int[4];

gives an error:

Encountered "[" at line 13, column 8.

How do I successfully create an array of 'int' ?
Run Java Programs using Native OS (WinXP) Command Prompt
Submitted by frankiechayc on Wednesday, 1 September, 2004 - 03:49
I have many Java programs that read keyboard input from the command line. The Jedit Console plugin currently does not support reading input from keyboard. So I can't run such programs in Console.

I am trying to write a macro which will run the Java program from the buffer using the native OS shell so that the program can accept keyboard input from users. Help or advice appreciated. Thanks
Execute menu item from macro?
Submitted by kwerle on Tuesday, 31 August, 2004 - 08:18
I have just written a very useful console command. It works just the way I want. Unfortunately, console doesn't seem to let you create shortcuts for commands you wrote (another issue). Is it possible for me to write a macro that will call a specific menu item?

I just want it to do something very simple:

Is there such a thing, and I'm just not seeing it?

Hold down key macro
Submitted by Anonymous on Wednesday, 25 August, 2004 - 09:22
I want to write a macro that allows me to instruct a specific key to be held down for set period of time. For instance, i need to be able to instruct that the spacebar be held down for x seconds.

Is this possible and how do i go about it?

Thanks in advance.
Invoking actions within a macro
Submitted by DanF on Wednesday, 25 August, 2004 - 06:26
Ok, here's how I'm doing it:
... but something's wrong. The action gets executed in some kind of strange silent mode. Messages aren't shown in the status bar (like "Search string not found!"), no confirm dialog box asks "Continue search from beginning?" (if auto-wrap is disabled), etc.

How do I invoke an action inside a macro? Are there other ways of doing this?
how to add reference of other api manuals from within a zip file to jedit help window?
Submitted by Anonymous on Sunday, 18 July, 2004 - 08:58
Is there a way to add the references to manuals of other softwares - such as jdk api - so that the documentation can be loaded from a zip file into the jedit help window. i know that unziping the manual into jedit/doc/api folder along with a simple xml file does the job. However, its a criminal waste of space to unzip the manual (help files).


Opening a file with a local apache server
Submitted by Anonymous on Wednesday, 30 June, 2004 - 12:38

I can't find a way to open a file in my browser from my local Apache server when that file is in a directory.

In MacOS X the default path for Apache is /Library/Webserver/Documents. But if I put a file in a directory /Library/Webserver/Documents/Jedit_file and i open the file from jedit, it always loads as and not as

Does anybody know how i can add this to a macro?


How to deal with buffer.isPerformingIO() ?
Submitted by Anonymous on Friday, 7 May, 2004 - 16:13
Hi I try to load file and perfomes some transformation on it then save on a loop of file.
But I am having a error on I/O perming so I try to wait for the
buffer to do it's job but then I only manage to have a Message instead of a error
Thread.sleep block Jedit an empty loop too.
this is the only working code but I like it to be without Message.

Macros.message(view, nBFichier+" buffer.isPerformingIO()" );
Using external java libraries in macros
Submitted by AndreJRenard on Saturday, 1 May, 2004 - 13:38
Is it possible to use external java libraries in macros?
If yes, where should I put them?
Loading file Macro
Submitted by Anonymous on Monday, 19 April, 2004 - 21:15
Hi All,

I have been using jEdit for a few months and just starting to play with the Macros. I am ultimatly trying to change the permissions of a file and to edit a line of code. I use source safe and a local enviornment and have to modify a struts config file, which is read only until checked out. To make my life simple, I want to remove the read only attribute and find my DB reference line and change it to my local DB.

My problem:
I can change the attribs easily enough with
runCommandInConsole(view,"System","attrib amp-config.xml -r");

But I now need to load the file. I am not sure how I would load it into the buffer so I can see and manipulate it.

Any Suggestions?

Waiting within startup script
Submitted by mbadran on Sunday, 18 April, 2004 - 15:50

I'm trying to write a simple startup script that displays the actionbar and returns focus to the current buffer. The following code does this:


However, I can't seem to get it to execute at the right moment. I've tried a variety of ways, waiting for the view to be initialised, waiting for the buffer to load, etc., but none of it seems to work correctly.

Much appreciated,
How do I modify the classpath of a macro?
Submitted by Anonymous on Friday, 9 April, 2004 - 11:09
I want to use a custom class to interpret a selected message (byte array) and create a new buffer with a nicely formatted, understandable, version of the message. I cant use the addClassPath() method of beanshell, I cant seem to get the instance of the Interpreter class, and I cant find the loadJarClasses.bsh mentioned in the jEdit manual.

Can anybody lend a hand?

How do I modify the classpath of a macro?
Submitted by Anonymous on Friday, 9 April, 2004 - 11:08
I want to use a custom class to interpret a selected message (byte array) and create a new buffer with a nicely formatted, understandable, version of the message. I cant use the addClassPath() method of beanshell, I cant seem to get the instance of the Interpreter class, and I cant find the loadJarClasses.bsh mentioned in the jEdit manual.

Can anybody lend a hand?

Select text in quotes - can macro do this?
Submitted by paulflory on Wednesday, 10 March, 2004 - 20:14
Here's what I'd like to do:

Assign a shortcut key to a macro that selects all the text within whatever quotes my cursor happens to be sitting between.

For example, say the cursor is sitting within the following line:

"How do you go to the stockyards?"

Does anyone an idea how I could write a macro that would select everything within the quotes? This would be quite convenient for doing quick replacements.

Launching DOS window from jEdit
Submitted by tupperduck on Tuesday, 9 March, 2004 - 02:12
(I am new to jEdit, so please bear with me)

I am learning C++ and am using jEdit (v4.1) as my editor of choice. I have noticed that the Console will not run programs requiring user input (e.g. std::cin >> menu_choice;) properly; it just continues through the program without waiting for values. Inconvenient, yes, but nothing major. These same programs function as expected when run from the Windows DOS prompt.

What I am trying to do is create a macro to run such a program in DOS. What I have so far is:

// filename parsing code, blah, blah, blah

Which works BUT as soon as the all the values are entered and the rest of the program executes, the DOS prompt window disappears and focus returns to the jEdit Console. It seems that the DOS prompt is not being spawned independently of jEdit/Console.

Looking through the documentation I tried variations using "&" to create a background process and "%detach" to create a separate process. Same result. I also tried the approach in the Launching External HTML Checker script by specifying the actual application path (C:\WINNT\system32\cmd.exe), but that runs DOS within Console (without spawing a DOS window) and I can't figure out how to send commands to it.

SO I guess my questions are:
1) Is there a way to launch the DOS prompt as an independent window?
2) Is there a way to send commands to a DOS process running in Console?

Hope that makes sense.
Get/set Edit mode?
Submitted by Anonymous on Thursday, 26 February, 2004 - 11:46
Hi! I would like to toggle the edit mode with a key. For this I need to get and set the edit mode with bean shell. How is this done?
Any help appreciated, thanks!

Spookyy problem
Submitted by jcb on Thursday, 19 February, 2004 - 08:45

I'm struggling with the following problem: I wrote a macro which takes the current buffer, saves it at first and runs then a command line utility via runToBuffer() on the saved file. If this was successful it closes the buffer and tries to save the new untitled one (which holds the results of the computation).

jEdit.closeBuffer(view,buffer);, null, true);

But the last statement in my macro -,null,true) does not save the buffer "Untiteld-1". The bean shell variable buffer still points to the formerly closed buffer. Is someone out there who knows how i could save the new buffer created by runToBuffer() in my macro? Any help is greatly appreciated!

Jens-Christoph Brendel
User login
Browse archives
« November 2017  
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
Yes, I'd like to have translations
No, that'd be bad (please comment)
Total votes: 1092
file   ver   dls
German Localization light   50820
Context Free Art (*.cfdg)   0.31   40975
JBuilder scheme   .001   16899
ColdFusion scheme   1.0   16480
BBEdit scheme   1.0   16463
R Edit Mode - extensive version   0.1   14723
Advanced HTML edit mode   1.0   13956
Matlab Edit Mode   1.0   13878
jEdit XP icons   1.0   13337
XP icons for jEdit   1.1   12361