jEdit Community - Resources for users of the jEdit Text Editor
Formatter doesn't work
Submitted by Robert Schwenn on Sunday, 12 February, 2006 - 21:46
Running a beanshell script I got an error at the following expression, because the method "format" is not found:

java.lang.String.format("%d", 1234)

In a java sourcefile it works fine.
==> What's on with the beanshell?

Robert
Open a file at the specified line number (Textmate error handling...)
Submitted by dunnil on Sunday, 12 February, 2006 - 00:22
Hi folks,
There is a rails plugin [1] that convert errors to a url that can be opened by textmate.
Here is the main point:
html = "#{line}"
Is there a way for us to do something like this?

Thanks in advance,
- H


[1] code extracted from the plugin
def add_links_to_backtrace(lines)
lines.collect do |line|
expanded = line.gsub '#{RAILS_ROOT}', RAILS_ROOT
if match = expanded.match(/^(.+):(\d+):in/) or match = expanded.match(/^(.+):(\d+)\s*$/)
file = File.expand_path(match[1])
line_number = match[2]
html = "#{line}"
else
line
end
end
end
Reference for macros
Submitted by mariuszn3 on Thursday, 2 February, 2006 - 17:56
I miss some kind of reference for building macros in jEdit (I can't find it anywhere).. like what properties (if there's any) textArea has etc. Is there any reference on web?

My issue:
I have macro:
------------
textArea.collapseFold();
textArea.expandFold(true);
------------

I'd like first line to be exectuted only if focused line start of not folded content. I thought of something like:
------------------
if (!textArea.folded) {
textArea.collapseFold();
}
textArea.expandFold(true);
---------------------

Of course as I'm just guessing what properties or syntax to use.. it don't work.

Any help?

Thank you.
Go To Line
Submitted by uh on Monday, 30 January, 2006 - 11:16
I am looking for a "goToLine"-function, which does not open the "Go To Line"-Dialog. Is such a function available?
Setting buffer properties -- two questions
Submitted by clif2 on Tuesday, 24 January, 2006 - 00:03
In a macro how do I set the following properties?

1. buffer title
2. character encoding

Thanks,

Clif2
Duplicate Line/Selection
Submitted by Dario_Insane on Monday, 23 January, 2006 - 12:35
i'm new to jedit. and it looks promising. but also a bit overwhelming.. Smiling

how do i implement a 'duplicate line/selection' feature? i assume i have to do this with a macro?

i tried using a copy/paste approach to get at least a 'duplicate line' feature working. but it doesnt do what i want.. :/

i found some text macros for moving lines up/down.. maybe they will help me..

anyway.. any help really appreciated!

regards,

dario
How to close Console after running program in system shell?
Submitted by davmay on Tuesday, 10 January, 2006 - 17:19
I am using this one-line macro to run a program in the system shell:

runInSystemShell(view,"C:\\WINDOWS\\SYSTEM32\\mspaint.exe");

This works fine, but when I have run and closed the program I am left with a jEdit window containing the Console which I have to close manually. Can someone show me how to add a line to my macro to close that Console window? Thanks.

David
Detecting current edit mode in a macro
Submitted by Lee Elms on Monday, 12 December, 2005 - 11:50
How do you determine the current edit mode within a macro ?
Placing selection in clipboard after replacing certain characters
Submitted by ghoetker on Thursday, 24 November, 2005 - 15:29
Hi all. I'm trying to write my first macro and am stuck at multiple points. The task at hand is this. I have text in jEdit of the following format

file write `output' _tab ///
`mformat' (`r(sd)') _tab `mformat' ///
(`r(max)') _tab

I would like to be able to select this text, have the "///" and new_line characters stripped, and the remaining text put in the clipboard, so I can paste it into another application. Thus, the line I would be pasting would be

file write `output' _tab `mformat' (`r(sd)') _tab `mformat' (`r(max)') _tab

I have the sense that the code to do this would be pretty simple, but I'm stuck since it's my first attempt. Could anyone provide me some help?

Thank you in advance.
Macros encoding
Submitted by jojaba on Sunday, 13 November, 2005 - 07:10
Hello,
I'm translating jEdit 4.2 in french (see the link in my signature).
someone use my translation on unbutu (Linux) and said that the accentuated caracters didn't display correctly especially the title of the *.bsh files (macros) and the tips. I do think that's a problem of encoding.
How do I resolve this problem ?

Thanks a lot.
Do "return 1;"?
Submitted by a992400 on Monday, 24 October, 2005 - 04:14
Is there any point to doing "return 1;" instead of "return;" at the end of a macro? Or even "return;" at all? I've seen that in a few of them, but haven't been doing it in mine.
How convert string to number.
Submitted by Driezas on Tuesday, 27 September, 2005 - 07:24
Hi all, Currently i'm trying to write macro to convert degrees to decimal form and back and have some problems. Input is string and I need convert that string after splitting into parts to numbers, but macro ends with error complaining that unable to casto sting to integer. parseInt also not working. What's wrong ? Thanks for answers Here is code:
 void convert_coordinates() {
   private int Laipsniai;
   if (textArea.getSelectedText().contains(" ") == true ) {
     format = 1;
     Macros.message(view,"Degrees");
   } else {
     format = 0;
     Macros.message(view,"Decimal degrees");
   };
   
   switch (format) {
     case 1:
       Elements = textArea.getSelectedText().split(" ");
       Laipsniai = Elements[0];
       Macros.message(view,"Laipsniai: "+Laipsniai);
       textArea.setSelectedText(Laipsniai);
     break;
     
     case 0:
       Elements = textArea.getSelectedText().split("[.,]");
       textArea.setSelectedText("1:"+Elements[0]+" 2:"+Elements[1]);
     break;
   };
 }

 if (textArea.getSelectedText() == null) {
   Macros.error(view,"No coordinates selected !!!");
 } else {
   convert_coordinates();
 };
Retaining variables between calls to a macro?
Submitted by stretch6555 on Monday, 8 August, 2005 - 12:18
Hi,

I'm writing a macro which, during its execution, creates a few variables. I'd like
to somehow save or retain these variables (and their contents) when the macro ends, so
that they can be referred to the next time I execute the same macro (or indeed some other
macro). Is this possible?

At first, I thought maybe I could declare the variables as 'static', but this doesn't seem
to work. I suppose another way of saving information between calls, might be to put
the data into some of the JEdit clipboard registers. Can someone suggest a good
solution to this problem?

Also, is there some class or method that my macro can call that will tell it what the
last key the user pressed was? And what about the last macro that was executed?

Any help would be most appreciated.


Thanks.
Problem with a Ansi To Oem macro
Submitted by Anonymous on Saturday, 7 May, 2005 - 18:53
I am trying to make a macro of conversion ANSI for OEM, and OEM you the ANSI.
The macro works in ANSI to OEM, but does not work ANSI to OEM.
Somebody could help me. the macro is basically this.

Sorry my english.


boolean bAnsiToOem = true;

String[] Ansi = {"â","Â","à","À","�","ã","Ã","á","ê","Ê","è","é","É",
"í","�","õ","Õ","ô","Ô","ó","Ó","ü","Ü","ú","Ú","ç","Ç"};

String[] Oem = {"ƒ","¶","…","·","µ","Æ","Ç"," ","ˆ","Ò","Š","‚","?",
"¡","Ö","ä","å","“","â","¢","à","?","š","£","é","‡","€"};


if(Ansi.length != Oem.length) {
Macros.error(view, "Erro na codificação Ansi ou Oem");
return;
}
for( i=0; i < Ansi.length; i++ ) {
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(false);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.replaceAll(view);
if(bAnsiToOem){
SearchAndReplace.setSearchString( Ansi[i] );
SearchAndReplace.setReplaceString( Oem[i] );
}else{
SearchAndReplace.setSearchString( Oem[i] );
SearchAndReplace.setReplaceString( Ansi[i] );
}
}
Macros.confirm example doesnt run
Submitted by Anonymous on Thursday, 3 March, 2005 - 23:14
Hi folks,
Please forgive my newbiness... I'm sure there's a pretty simple solution to this.
I've simply cut and paste the following statement from http://jedit.org/users-guide/helpful-methods.html to display a confirmation box:

int result = Macros.confirm("Do you really want to learn"
+ " about BeanShell?",JOptionPane.YES_NO_OPTION);

I get the following error:

Typed variable declaration : Error in method invocation: Static method confirm( java.lang.String, int ) not found in class'org.gjt.sp.jedit.Macros' : at Line: 1 :

So, if I understand this correctly, the macro doesnt know what an int is? I take it then I have to include a class somehow...

Any suggestions?

Cheers all,
Tim
A simple filter macro?
Submitted by Anonymous on Tuesday, 8 February, 2005 - 17:08
Hi all,

I am after a simple macro which would pass the selected text to an external process through stdin and replace the selected text by the stdout output of the external process. Any idea how to do that?

Thanks a lot.

Victor.
Beanshell: How to load/define a class?
Submitted by malyvelky on Saturday, 5 February, 2005 - 14:51
Hi, I'm using beanshell in my jedit development to test my classes. If I compile the class how can I load it into beanshell so that I could instantiate (without an URLClassLoader and that stuff)? The original beanshell let you load a class but the necessary package bsh.classpath is not in jEdit. Thanks!
unescape a unicode escape sequence
Submitted by Anonymous on Friday, 4 February, 2005 - 16:27
Hi, I'm trying to convert unicode escape sequences to characters. Can someone recommend a good strategy for writing a macro ( or a BeanShell snippet for use in Search Replace dialog? )?

Basically I want to search for this pattern:

(\\u00[[:alnum:]][[:alnum:]]) which matches things like \u00E9

and I want to replace it with:

new Character( $1 ); where $1 is the match from the pattern search.

Is there a way to do this using SearchReplace? Or do I need to iterate through the lines of the current buffer and do replacements on each line?

Thanks for any tips. jEdit Rules my world!!

-Travis McCauley
Toronto
search on a php var
Submitted by Anonymous on Wednesday, 2 February, 2005 - 08:57
hello all,

i ve got problem to write the topic ( because of the echo(''); ) so here is a link where i explain it:

http://lycoch.free.fr/macro.htm


thanks
Using EVAL to make Commando definitions remember its variables/settings ?
Submitted by Sasq on Tuesday, 25 January, 2005 - 13:50
I'm trying to make a Commando files remember it's settings instead of setting the same default value each time.
Instead of this:
<ENTRY LABEL="Custom rule name" VARNAME="ruleName" DEFAULT="all"/>
I want something like this:
<ENTRY LABEL="Custom rule name" VARNAME="ruleName" EVAL="if(ruleName != null) ruleName else "all" "/>
(except the last one obviously doesnt work). Any suggestions?
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82349
Context Free Art (*.cfdg)   0.31   46055
BBEdit scheme   1.0   18595
JBuilder scheme   .001   18495
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293