• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics in ~comp with the tag "text editors". Back to normal view / Search all groups
    1. Multi-format text editor with chain-of-command processing

      A while back I developed a desktop-based text editor (Scrivenvar) that uses the Chain-of-Responsibility design pattern to help me author fairly involved text documents. The editor's high-level...

      A while back I developed a desktop-based text editor (Scrivenvar) that uses the Chain-of-Responsibility design pattern to help me author fairly involved text documents. The editor's high-level architecture resembles the following diagram:

      https://i.imgur.com/8IMpAkN.png

      Am I reinventing the wheel here? Are there any modern, cross-platform, liberal open-source (LGPL, MIT, Apache 2), text editor frameworks (such as xi or Visual Studio Code), that would enable (re)development of such a tool?

      Scrivenvar is written in Java, but to my chagrin, Java 9+ no longer bundles JavaFX. The text editor was based on MarkdownWriterFX, itself based on JavaFX. This means there's no easy upgrade path, so I'm looking to rebuild the editor either as a cross-platform desktop application or as a web application.

      8 votes
    2. Please tell me what you think about this idea for a text editor/Linux Distribution combo

      I know there are similar products I could buy in the US that would give me this experience, but I'm not in the US and I don't have much money. In the old days, my father had some kind of machine...

      I know there are similar products I could buy in the US that would give me this experience, but I'm not in the US and I don't have much money.

      In the old days, my father had some kind of machine that was not a proper laptop and not a proper typewriter. It opened instantly to a text editor. As far as I remember, there was no noticeable boot time. It had a keyboard and an entry for a floppy disk. You typed your stuff, saved it to the floppy disk, probably to send via email or to print in another machine. I loved that machine.

      I love these little gadgets that do one thing and one thing only. And, as someone with severe ADHD, they're often a necessity. If my Kindle had Youtube I would never read a book. If my PS4 had Emacs I would never play a game. The list goes on, but the principle is this: a lot of things are useful to me precisely because of what they cannot do.

      And that is why I wanna recreate my father's crazy computer-typewriter.

      Because I know how to use the command line, it really needs to be in total lockdown: I open it up, it shows a very simple text editor (with a few handy features that make it works even more like a typewriter) that I cannot configure, tinker or alter in any way. It's focused on writing (not editing) literature because that's what I need and other kinds of writing require an internet connection.

      It would save and back up automatically (like a typewriter) to one or more drives at your choice.

      There would need to be a few options because of different screen sizes, the number of screens etc, with an interface to make it easier.

      So the idea is an ultra-minimal, kiosk-mode Linux distribution that can either go on a flash drive or be installed on an old laptop. No package management, no internet connection, no access to the command line, no configuration files, no distractions whatsoever. I wanna forget I'm even using Linux. I wanna recreate my father's typewriter/computer that he never let me touch.

      How do I do this?

      14 votes
    3. What is your personal preference and why: vim or emacs?

      This is of course the age old debate, which on other sites has been known to quickly devolve (one of the Internet ‘holy wars’ of yore). Nonetheless, I am curious. I personally use vim. Part of the...

      This is of course the age old debate, which on other sites has been known to quickly devolve (one of the Internet ‘holy wars’ of yore). Nonetheless, I am curious.

      I personally use vim. Part of the reason is surely that it is just the first one of the two that I happened to use, and thus by the time I tried emacs I was used to vim. But more broadly, I enjoy using vim because once you get over the hump of ‘weird’ commands and modes, I feel that vim most closely emulates the feelings and thought process that you have when building something with your hands. You can pick up different tools, yank pieces out and rearrange them, turn the object around in your hands to see different parts, etc etc. Once you internalize the movement and editing you really start flying around. At that point the interface seems less like a barrier between you and the text and more like a way to ‘hold’ it.

      Of course, people have different preferences.

      15 votes
    4. Make Emacs write (part of) your git commit messages

      I was fed up with the chores of writing consistent git commit messages, so a while ago I started developing a hook in Emacs which I used with Magit (actually git-commit-mode) which uses some crude...

      I was fed up with the chores of writing consistent git commit messages, so a while ago I started developing a hook in Emacs which I used with Magit (actually git-commit-mode) which uses some crude heuristics to fill out the COMMIT_EDITMSG buffer for me. Here is what it does (| stands for the cursor):

      • If only a single file modified, insert <filename>: |

        • If can figure out function name, insert <filename> (<functionname>): |
      • If only a single file added, insert Add <filename>|

      • If a TODO added to Readme.org, insert ; TODO <headline>|

      • If a TODO was DONE, insert ; DONE <headline>|

      • If the files are Readme.org and Readme.org_archive, and no new TODO's were added anywhere, insert ; Archive DONE|

      • If the file is .gitignore, insert ; Ignore |

      • If the file is TAGS, insert ; Update TAGS|

      I extend this when I find new cases where I repeatedly do the same thing. The code is below. It's probably a good idea to use it as a starting point and personalise it because this reflects how I like to write my commit messages (and I like pretending how they do it over at Emacs git repo). It is sloppy and probably buggy, but I don't think it can be destructive.

      Final note: I can't figure out how to set this up so that after this takes effect, the buffer is marked as modified. I want to flip the modified bit so that in some cases I can just hit C-c C-c and go. But I need to modify the buffer somehow to commit in some cases (I just type C-o to open a new line in those cases). Here is the function:

      (defun gk-git-commit-mode-hook ()
        "Set up git commit buffer."
        ;; If a single file is modified, prefix the message w/ it.
        (let ((modified-re "^#	modified:")
              (new-re "^#	new file:")
              (issue-re "^[+\\- ]\\*+ \\(TODO\\|DONE\\) ")
              current-defun filename addp onlyp issuep)
          (save-excursion
            (with-current-buffer "COMMIT_EDITMSG"
              (goto-char (point-min))
              (re-search-forward "^# Changes to be committed:" nil t)
              (forward-line)
              (beginning-of-line)
              (cond ((looking-at modified-re)
                     (re-search-forward ":   " nil t)
                     (setf filename (thing-at-point 'filename t)))
                    ((looking-at new-re)
                     (re-search-forward ":   " nil t)
                     (setf filename (thing-at-point 'filename t)
                           addp t)))
              (setq onlyp (progn
                            (forward-line)
                            (not (or (looking-at modified-re)
                                     (looking-at new-re)))))
              (when (and onlyp (equal filename "Readme.org"))
                (goto-char (point-min))
                (when-let* ((pos (re-search-forward issue-re nil t)))
                  (setq issuep (progn
                                 (re-search-backward "\\*" nil t)
                                 (buffer-substring (1+ (point))
                                                   (line-end-position))))))
              ;; Try to set ‘current-defun’.
              (when onlyp
                (save-excursion
                  (goto-char (point-min))
                  ;; Error if not found, means verbose diffs
                  ;; not enabled.
                  (re-search-forward "^diff --git")
                  (goto-char (line-beginning-position))
                  (let ((str (buffer-substring (point) (point-max)))
                        (default-directory (expand-file-name "..")))
                    (with-temp-buffer
                      (insert str)
                      (diff-mode)
                      (goto-char (point-min))
                      (setq current-defun (diff-current-defun))))))))
          (if onlyp
              (cond
               ((and issuep (not addp))
                (goto-char (point-min))
                (insert ";" issuep))
               ((equal filename "TAGS")
                (goto-char (point-min))
                (insert "; Update TAGS"))
               ((equal filename ".gitignore")
                (goto-char (point-min))
                (insert "; Ignore "))
               (filename
                (goto-char (point-min))
                (if addp
                    (insert "Add " filename)
                  (insert
                   filename
                   (if (and current-defun)
                       (format " (%s)" current-defun)
                     "")
                   ": "))))
            (when (and (equal filename "Readme.org")
                       (save-excursion
                         (goto-char (point-min))
                         (re-search-forward (concat modified-re " +Readme.org_archive")
                                            nil t))
                       (save-excursion
                         (goto-char (point-min))
                         (re-search-forward "\\-\\*+ DONE" nil t))
                       (not
                        (save-excursion
                          (goto-char (point-min))
                          (re-search-forward "\\+\\*[\\+\\-] TODO" nil t))))
              (goto-char (point-min))
              (insert "; Archive DONE")))))
      
      (add-hook 'git-commit-mode-hook #'gk-git-commit-mode-hook)
      

      Hope you find it useful.

      12 votes
    5. I need a good text editor on Windows 10

      Disclaimer: I'm on Windows 10 I keep hopping between text editors because I can't find one that suits my needs. I need something simplistic, non-bloated, beginner friendly, open source, and...

      Disclaimer: I'm on Windows 10

      I keep hopping between text editors because I can't find one that suits my needs. I need something simplistic, non-bloated, beginner friendly, open source, and preferably with Dracula theme. I'll list off the ones that I've tried that I don't like too much:

      • Atom
      • Vim
      • Emacs
      • Notepad++
      • VS Code

      Honestly, I'd really like something that's like very similar to Sublime but FOSS. Is there one like that?

      10 votes