Ymacs 0.5

Ymacs is a DynarchLIB widget. As such, it can be included in any widget container. The demo embeds it in a DlLayout, which also displays a sample menu bar. The layout in turn is embedded in a DlDialog which shows up in maximized state. As you can see from the demo, it`s quite easy to add a menu, or a toolbar; I don`t think the basic Ymacs widget should provide these. DEFINE_CLASS Ymacs is written in what I began calling “DynarchLIB new style”. I wrote a PDF that explains what`s going on with the DEFINE_CLASS statements. You should read it if you plan on hacking Ymacs, but in short here`s what happens: as you might know, JavaScript doesn`t provide very nice syntax for defining objects. You have to do all that weird stuff with the prototype and have to instantiate an object of the base class type in order to setup inheritance. Kind of ugly. The DEFINE_CLASS “macro” provides a more convenient syntax and it`s deeply integrated into DynarchLIB. It receives 3 arguments: the name of the new class (a string), a base class constructor (or null if there`s no base class) and a function. The function (in bold next, so you know that I`m referring to it) is called immediately given 3 arguments which I`m calling D, P and DOM. These args are convenient shortcuts to frequently used objects during the definition of a class. D is a reference to the new class constructor, which already exists when the function is called. P is a reference to the new class` prototype. And DOM is an alias to DynarchDomUtils, to save some typing. The function that you supply to DEFINE_CLASS should construct the class` methods and properties. Create a method by inserting it into P, or a “static” method by inserting it into D. There are some “magic” keywords that you can add to these, such as D.CONSTRUCT—the constructor, or D.DEFAULT_ARGS—a specification of the arguments that the new object can receive in the constructor, along with their default values. Well, for more information you should really read my article (the implementation in DynarchLIB is a bit different, but not in essential ways). Objects Ymacs is centered around the following essential objects:


  • Ymacs_Buffer — that`s where everything started; initially all code was written in a single object. Currently a buffer inherits from DlEventProxy and it represents, well, a buffer. The text is split into lines which are saved in an array. The object provides sufficient operations to access and modify the text, and handles key press events forwarded by the active frame. A buffer also maintains a set of markers (see below), two of which are essential: the current cursor position, and the “mark” position. In Emacs, the “region” is defined by these two markers. You set the mark to one place, then move the cursor to define the region. You can swap the cursor and the mark using C-x C-x.

  • Ymacs_Marker — a marker (another idea stolen from Emacs) is a simple object that holds an integer—a position within a buffer. It doesn`t inherit from anything, currently, though in the beginnings it was a DlEventProxy. Each marker is attached to a buffer. When the buffer text is modified, the attached markers receive an event which tells them the position where the buffer is modified, and an offset—the amount of characters that were inserted or removed (newlines are counted!). If the modified position is smaller than or equal to the position that the marker had saved, then the marker`s position is updated by the given offset. This way you can maintain “stable positions” through a text, even while the text is modified. The “changed” event that affects a marker also sends a “minimum allowed position”, which tells the marker the minimum location it should be set to, in the event position + offset becomes smaller. This is useful, for example, when you store a marker at position 5 and remove the text starting with position 2 through to 10. The marker would receive position: 2, offset: -8, which would make it calculate the new location as 5 - 8, a negative value (not allowed). The minimum, in this case, would be 2, so the marker won`t fall below this position, which intuitively seems to be what we want. When a marker`s position has changed, an onChange event is triggered which the editor can catch back. This is used, for example, to draw the caret at the right location. When a marker is no longer needed, it should be destroy()-ed, so that the buffer won`t keep updating it pointlessly for each text operation. Text filling Markers are useful for a lot of operations. For example imagine text filling, which breaks paragraphs into lines. Text filling is implemented in a “Logo-style programming”, which turns out to be very convenient. It moves the caret to the start of the paragraph and first removes any existing newlines, so that the paragraph becomes one big line of text. Then, again starting at the beginning of the paragraph, it moves to the next whitespace character and checks the column. If it`s bigger than “fill_column”, it moves back one word and inserts a newline. Then it continues until the end of the paragraph. All this is done in a “save_excursion” closure. The “save_excursion" command creates a marker at the current cursor position (which shall be named point location), then executes the given function. After the function finishes execution, the point is restored at the position of the saved marker. Remember, since the marker is updated as the text is inserted or removed, at the end of the execution the cursor will be at the same “stable” location as it was previously, so if you press M-q to fill a paragraph and your cursor is in front of some word, you can be sure that it will be in front of the same word after the text is rearranged. Turns out, Logo-style programming is very convenient for a lot of text editing algorithms, even if a bit slow. Take a look in ymacs-commands.js and search for “fill_paragraph” to see the implementation of text filling (it`s a bit more complicated than I described because I wanted it to understand certain paragraph prefixes).

  • Ymacs_Frame — an widget that inherits from DlContainer which is responsible for drawing a buffer and the cursor, and intercepting keyboard commands and forwarding them to the buffer. When a buffer is attached to a frame, the frame immediately displays the contents, moves the cursor to position zero, and attaches some event listeners to the buffer object, so that it can update the screen when the buffer is modified. The previous buffer, if any, is completely forgotten—event listeners removed etc.

  • Ymacs_Keymap — a keymap is an object that holds a set of key strings and their associated functions. It provides some helper functions for defining new keys, or “parsing” key events to transform them into key definition strings. In essence you shouldn`t have much to deal with it, because it makes defining new keymaps so easy that you don`t need to know the internals.


User's rating:

  • Currently 2.98/5
  • 1
  • 2
  • 3
  • 4
  • 5
Enlarge the screenshot of Ymacs
[ Enlarge Image ]
Download 0.33MB Ymacs

Download Direct

(0.33MB, Extension: GZ)

Download alternate to Ymacs solution

Look at the free or trial alternatives and similar apps to Ymacs software by the tags. It's possible also to find substitutes for the most popular titles in the Software Development category.

| Ymacs | Source Code | Emacs-like Editor | Dynarchlib | Ajax |

Average review rating :

Useful independent reviews and opinions of the users

Review YmacsWrite a review « Be the first to post a review for Ymacs download!

Predicted future versions and notices:

The doDownload.com constantly monitors the update of all programs, including information from the Ymacs 0.5 changelog file, however sometimes it can happen that data are not complete or are outdated.We assume that author continue's to develop 0.6 version with further advanced features, and soon you will be informed. Equally important 1.0 upgrades of the program we will continue to monitor. Full Ymacs description has been compared with the overall software database and our algorithm has found the following applications (are showed below).