6

Pre Linux, I used Windows.. (too many years in the wilderness :) ... however there was a ray of sunshine in amongst all the general virus/re-install flack.. and that was Notepad++, a text Editor I really like(d).

I'd probably still be using it, even now that I've shifted fully across to Linux(Ubuntu), but it doesn't behave 100% in 'wine'... (and its regex is stunted)...

There is one feature in Notepad++ which I sorely miss, and that is the ability to display different SIZE fonts within a single document (at the same time)...

At some point, I started learning Hindi, and found that the Devanagari script really needs to be larger than the Latin script (used here)... Devanagari is by nature a "taller" script, with frills above, and below the main line, and has more detail.

Because of this I utilized Notepad++'s Syntax Highlighting to display my learning notes in a manner my eyes could handle...

Now my dilemma, is to find a Linux Text Editor which can (at least) do what Notepad++ can do (ie. allow me to specify my own mix of font SIZES, and also to specify my own comment-delimiters)...

Now, the big ask... What I would really like is an editor which is "Human-Language" aware, or "Font-Type" aware, or "Unicode-Codeblock" aware... so I don't have to fiddle and twiddle with syntax-highlighting, which is really not intended for what I want.. (PS... I don't want a word-processor)

In October, last year, I asked here about SciTe (Scintilla) specifically (Notepad++ is based on Scintilla), but as per one answer, it is too painful :) ... A comment suggested that Emacs could do it, so if that means "at the same time", then I'm interested, but I need some initial pointers on how to go about it...

Here is an example of the Notepad++ presentation..

Here is an example of the Notepad++ presentation

1 Answer 1

4

Emacs has the ability to show fonts with different faces, colors, and sizes in the same buffer. For instance, the following is produced by the AUCTeX major-mode, a useful mode for those who use LaTeX to create documents:

Example of an Emacs Major Mode

The two search terms that will be helpful are "font-locking" and "major mode". Essentially, to accomplish this in Emacs you would have to write your own major mode. Unfortunately, this basically amounts to you having to "fiddle and twiddle with syntax-highlighting", but on steroids.

For your particular purpose, the most difficult part will be properly displaying the Devanagari script. Everything else is relatively straight forward. The best places to get started are the EmacsWiki and the Emacs Manual. The following links might be useful:

Since you really only need your mode to provide font locking, I would take a look at making a "Derived Mode" (see the relevant link above). Creating such a mode basically involves defining regular expressions that will match the various parts of the code you want highlighted in a certain way, and then assigning that either to one of the predefined font-lock faces or a custom face you would define.

3
  • Thanks Steven.. This is looking good.. one step closer, but you have reminded me of the Devanagari hurdle... If you have a momemt could you look at a previous questiion I posted about Unicode in Emacs (askubuntu.com/questions/13157/…)... If I can get the unicode part up and running, its "goodbye gedit, hello emacs" ... any suggestions are welcome
    – Peter.O
    Commented Feb 6, 2011 at 1:21
  • 1
    Hello hello Emacs! ... I've managed to get IBus Unicode working in Emacs... Happy day! ... Thanks again Steven... I'm sure I'll manage to 'twiddle' my way through the Emacs syntax stuff as I familiarize myself with my new editor :)
    – Peter.O
    Commented Feb 6, 2011 at 3:02
  • I suppose that the enthusiasm about using Emacs was not a long term one, but Peter.O is no more active here to ask him about his long-term experience. My own enthusiastic trip from SciTE to Emacs ended finally with SciTE ... For the purpose of OP I would suggest to use the SciTE Python lexer and put the another language in one of the many supported quote styles to get it highlighted as desired.
    – oOosys
    Commented May 9, 2023 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .