Does UE have something similar to EMacs table mode?

Does UE have something similar to EMacs table mode?

5
NewbieNewbie
5

    Dec 15, 2016#1

    Hello,

    Does UE have something similar to EMacs table mode in order to generate text based tables?

    Example:

    Code: Select all

    +-----------------+--------------------------------+-----------------+
    |     Command     |          Description           |   Key Binding   |
    +-----------------+--------------------------------+-----------------+
    |  forward-char   |Move point right N characters   |       C-f       |
    |                 |(left if N is negative).        |                 |
    |                 |                                |                 |
    +-----------------+--------------------------------+-----------------+
    |  backward-char  |Move point left N characters    |       C-b       |
    |                 |(right if N is negative).       |                 |
    |                 |                                |                 |
    +-----------------+--------------------------------+-----------------+

    115
    Power UserPower User
    115

      Dec 15, 2016#2

      It would be possible to create a script to enable this functionality.

      You'll have to explain things more. The example you gave is of how you want the output to look. What we would need to know is what would the user supplied input be like so we can see how to get from input to output. For instance in your example, I would expect that the user would only have to enter lines of text with vertical bar separators and then the script would properly create a table row for each line, with spacing set up to match the longest boxes per row. That wouldn't be too difficult but then we would also need to know how to identify which box top and bottom edges to draw (or not draw). We would need to know if text is centered or justified in a given box, if there is a max line length and if so, how to decide what lines in what boxes would wrap around when necessary to remain within the line length.

      6,681583
      Grand MasterGrand Master
      6,681583

        Dec 16, 2016#3

        Mick is absolutely right. This can be done with an UltraEdit script, but we need the requirements to code the script as Mick described. The user selects the text block and then runs the UltraEdit script to create the "table" or in case of selected text is already a "table", updates the "column" widths.
        Best regards from an UC/UE/UES for Windows user from Austria

        5
        NewbieNewbie
        5

          Dec 16, 2016#4

          In eMacs, it is called Org Mode, or "Organization mode"
          In this mode you can take any table based information that is delimited by any character (Comma, Space, Tab, whatever) into an ASCII text based table as shown above.
          There is a simple 10 minute demonstration on Youtube of the basic features of Orgmode found here:
          This demo shows how easy it is to edit and modify text data to automatically arrange in the table mode shown in my example.

          The eMacs editor also has the ability to convert this Data displayed in Org Mode to html, but I am not interested in that aspect. I am just looking for the ability to quickly generate/create tables in ASCII text files.

          6,681583
          Grand MasterGrand Master
          6,681583

            Dec 17, 2016#5

            Do you know that built-in in UltraEdit is the command Convert to Fixed Column to convert a CSV file with any delimiter to a text file with fixed column width?

            It looks like you are looking for this feature for easier reading CSV data.

            Or do you really want a table look as in your first post?

            I started watching the video, but stopped after 2 minutes only seeing 2 screens. I have speakers disabled in my configuration and didn't want to change the configuration just to hear what the creator of the demo explains. A video is good for demonstrating a feature, but is a very bad source for coding a feature. A requirements list is needed for coding a feature. For example should be interpreted the first line of selected block always as header row with each data value being centered or should have the user the option to define if the first line is a header or a data row? How to define which data columns to left, center or right align? Should it be possible to specify max. characters for each data column?

            But the most important question is: Why using a text editor to get CSV delimited data in table form instead of using a spreadsheet application?
            Best regards from an UC/UE/UES for Windows user from Austria

            5
            NewbieNewbie
            5

              Dec 18, 2016#6

              I guess you assumed that It was my intention to convert CSV into this form. I guess that was my mistake. Apologies.

              I quite often have to write technical information into and escalation and bug management system which uses fixed width font, because it often includes commands, and screen output like directory listings etc, where a fixed width font is necessary.

              In much of the content that I compose, I place much of my information in the form of tables (with cell borders expressed in ASCII charters composed of dashes, plus signs and vertical bars.

              I use UltraEdit for composing this text and then paste it into the Escalation/Bug Management system which is a web based tool. When it comes to representing my text input as tables, I break out of UltraEdit, and use PuTTY to connect to my Linux system where I use the eMacs editor to create the tables, then paste them into UE where appropriate, and then when the text is complete, cut and paste into the Escalation/Bug management system (Bugzilla).

              I can get along just fine with the wonderful tools that I have which includes UE. Since eMacs was an open source editor, I was hoping that UE might have something similar. In the past I had used the "Convert to Fixed Column" then went into over-strike mode to place in the border lines, but that too was a bit labor intensive compared to eMacs' Org Mode.

              I'm fairly adept at UE macros, but not at all with UE scripting.

              Thank you so much for your help thus far. If you have any suggestions for me, I would be very appreciative.

              Jeff Cameron

              6,681583
              Grand MasterGrand Master
              6,681583

                Jan 06, 2017#7

                Jeff, are you still interested in an UltraEdit script to produce a table in text format from selected text using a tab character, or a comma or a semicolon or a pipe character as delimiter?

                Yes, please let me know and I code that for you.

                I have written similar scripts already which can be found in Scripts forum, for example Align text based on quotes and other delimiters?

                The only problem I see is how to interact with the user to get answers on the questions:
                1. Which character is used as delimiter in selected text?
                2. Should the first line be interpreted as header row with all data values centered in their columns or as data row?
                3. Which alignment (left, centered, right, justify) for each data column?
                getString (for first and third question) and getValue (for second question) are more or less all which can be used to interact with the user of the script.

                Or are those user prompts not needed at all as the format of the table to produce is always the same?
                Best regards from an UC/UE/UES for Windows user from Austria

                5
                NewbieNewbie
                5

                  Jan 06, 2017#8

                  Thank you,
                  I appreciate your offer to do this.
                  I don't need to duplicate the entire Org mode functionality, which you can find here:

                  Just basic table capabilities. Let's keep this very simple.

                  Start off by creating a simple cell (one line, by 2 characters) and place the cursor in the middle of it.

                  Code: Select all

                  +--+
                  |  |
                  +--+
                  
                  The corner of a cell uses a "+" (plus) character the top and bottom lines consist of the "-" (hyphen) character, and sides consist of a "|" (pipe) character. Default justification is center.

                  A cell's width is determined by the longest line of any line in the column of cells, +2 to account for one space before and one space after the longest line. A cells height is determined by the largest number of lines in any given row.

                  TAB - Creates a new column to the right of the current cell.
                  Shift+Tab - Creates a new column to the left of the current cell.
                  Shift+Return - Creates a new row below the current cell.
                  Control-return - Creates a new row above the current cell.
                  Return - creates a new line in the current cell.
                  Shift+Arrow Keys - Navigate from cell to cell. If there is no cell in the direction of the arrow play a warning sound.
                  Arrow Keys - move cursor within a cell.
                  Control+C - Set cell alignment to center.
                  Control+L - Set cell alignment to left.
                  Control+R - Set cell alignment to right.
                  ESC - Exit table mode and place cursor on line below table and return to normal text editing.

                  This last item might be very difficult to implement, if it is difficult don't worry about it. I'd be happy if it just had the basic functionality.

                  Whatever command or method for entering table mode is, if it is evoked while the cursor is already in the table, then edit the current table in table mode.

                  1K thanks!

                  6,681583
                  Grand MasterGrand Master
                  6,681583

                    Jan 07, 2017#9

                    There is a misunderstanding what can be done with UltraEdit scripts. It is possible to reformat an existing text, add text or delete text. But it is not possible with an UltraEdit script or macro to add new functionality to UltraEdit itself like a special table editing mode as you have described. The "table editing mode commands" you have described could be each a script which adds rows and columns in current table or change the alignment of text within a cell or column or row or move the caret. Hotkeys or chords (multi-key assignment) can be assigned to scripts for execution by key. But a real "table editing mode" is not possible. But some keys are not available for scripts and macros, like Tab, Shift+Tab, Return, ... as those are assigned built-in in UltraEdit to multiple commands selected automatically depending various criteria.
                    Best regards from an UC/UE/UES for Windows user from Austria

                    5
                    NewbieNewbie
                    5

                      Jan 09, 2017#10

                      I understand, it is not a very big problem, as I just open up a Putty session on one of my Linux nodes and create the text table there, then paste it into UE as needed.

                      I do appreciate your help and eagerness is trying.

                      Thanks again for all your help!