jEdit Community - Resources for users of the jEdit Text Editor
Something similar to old emacs iso-accents-mode would be great!
Submitted by davidbourguignon on Saturday, 24 April, 2004 - 11:19
Dear all,

I recently switched from emacs to jedit with no regret. However, being French and using a qwerty keyboard (for programming), I really miss one emacs feature: iso-accents-mode. This feature seems straightforward and would help thousands of people struggling to find characters such as ß (German), ø (Dane) and ç (French) on their keyboards...

For people frequently typing in an "accented letters language" this emacs thing is much more convenient than the traditional "insert special character" GUI, such as the CharacterMap plugin.

However, if this feature already exist somewhere in a plugin, I will try again to find it on plugin central... Eye-wink

Thanks in advance for your help,

David.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
The following macro may be of
by Anonymous on Mon, 26/04/2004 - 14:44
The following macro may be of help. If you bind it to the SPACE key it should automatically exand the abbreviations listed here: http://www.cs.tut.fi/~jkorpela/emacs-iso.html. Note that it isn't very well tested.
/*
 * Expand_ISO_Accent.bsh - Macro for jEdit that
 * replaces ISO accent character abbreviations
 * with accent characters. The 2-character 
 * abbreviation must be directly to the left of 
 * the caret.
 *
 * By default a space is passed to the text area
 * so this macro can be bound to the SPACE key.
 *
 * Change:
 *
 *   expandISOAccent(view,true);
 *
 * to:
 *
 *   expandISOAccent(view,false);
 *
 * to disable this behavior.
 *
 * Abbreviations taken from:
 *   http://www.cs.tut.fi/~jkorpela/emacs-iso.html
 *
 * Copyright 2004, Ollie Rutherfurd <oliver@jedit.org>
 *
 * $Id$
 */

String[] codes = {
	"`o",
	"'o",
	"\"o",
	"^o",
	"/o",
	"~o",
	"~c",
	"~d",
	"~t",
	"\"s",
	"/a",
	"/e",
	"~<",
	"~>",
	"~!",
	"~?",
	};
String[] chars = {
	"ò",
	"ó",
	"ö",
	"ô",
	"ø",
	"õ",
	"ç",
	"ð",
	"þ",
	"ß",
	"Ã¥",
	"æ",
	"«",
	"»",
	"¡",
	"¿",
	};

Hashtable accents = new Hashtable();
for(int i=0; i < codes.length; i++){
	accents.put(codes[i],chars[i]);
}

void expandISOAccent(View view, boolean sendSpaceToTextArea){
	int caret = view.getTextArea().getCaretPosition();
	boolean	endEdit = false;
	try{
		if(caret > 1){
			String code = accents.get(buffer.getText(caret-2,2));
			if(code != null){
				endEdit = true;
				buffer.beginCompoundEdit();
				buffer.remove(caret-2,2);
				buffer.insert(caret-2,code);
			}
		}
	}finally{
		if(sendSpaceToTextArea)
			view.getTextArea().userInput(' ');
		if(endEdit)
			buffer.endCompoundEdit();
	}
}

if(buffer.isReadOnly())
	Toolkit.getDefaultToolkit().beep();
else{
	expandISOAccent(view,true);
}
 
Thanks Ollie!
by davidbourguignon on Mon, 26/04/2004 - 21:54
Hi Ollie,

Thanks for your answer and the macro code! It works great! I'll add some of the missing key combinations, such as 'e to give é which is very useful in French, and post them to you. I hope this macro will be useful to others.

I would only suggest a very small improvement: in emacs, when you don't want to "magically" replace the last two characters, you can do this by inputing a pseudo SPACE after the "accent" character (the first character).

That is, for exemple, if I want to input the following French words:

il l'a pris (means: he took it)

I will type for the middle words:

l'aSPACE

then get with the current macro:

là (means: there) instead of l'a

emacs allows to type the following:

l'SPACEaSPACE

and the first SPACE is not taken into account as a real SPACE command but rather as a command that cancels the macro effect. If it was possible to add this feature, it would improve even more the usability of the macro.

Thanks again for your help!

David.
User login
Browse archives
« November 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   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300