Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair this mode #4

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open

Conversation

morganwillcock
Copy link

These changes are effectively a reset of the what was modified in the original python mode and then a re-implementation of what I think the changes were actually meant to do. It is difficult to know for sure because the package is not functional in its current state (it looks like some parts were never finished and it doesn't match the renpy mode which was once in renpy git repository) but I think I've implemented what the original intentions were, so this covers:

  • indentation for renpy strings to align with the string opening position
  • paragraph filling for renpy strings that matches the indentation
  • indentation calculation and cycling for renpy blocks

Beyond that I've cleaned up other parts of the package which looked to be wrong or wouldn't apply to renpy, this includes clearing all flymake and package-lint warnings and errors.

The font-locking is re-implemented using rx-let which raises the minimum Emacs version to 27.1. It only aims for partial coverage of keywords to try and minimise issues of highlighting in the wrong context. It won't be perfect, and there are likely still too many to be correct in every case, but it should be enough to be useful and look reasonable most of the time.

Imenu support is re-implemented to separate some matches into sub-menus . Only labels show at the top level of the menu. It is now bound to the same key sequence that the current python.el uses.

Outline mode support should allow any block to collapse. There will be some false matches within multi-line strings and comments, so collapsing everything may not make sense, but it is enough to manually collapse and expand what is under point (someone would probably bind a key to 'outline-cycle' if they wanted to use it).

The only change that might be opinionated was to remove the 3 characters from comments which prevented the file being encoded as ASCII. For the sake of portability, the fancier comments didn't seem worth it.

I haven't done anything with renpy-current-defun or modified the definitions of what a "defun" is. These remain python specific.

I haven't re-indented sections of the original python.el which don't match the default indentation positions that Emacs wants to apply by default.

I haven't increased the package version number.

Closes #2, fixes #3.

Morgan Willcock added 30 commits January 28, 2023 19:42
The existing code indents using tabs.
The existing code is filled to 80 characters at its widest.
The version used it taken from https://github.com/leoliu/python-el
which has additional changes by Leo Liu.
imenu needs to loaded if imenu is going to be setup.
rx should be pre-loaded but make the dependency clear.
This is left over from the original python mode but requires the
comint integration which was already removed.
This is user preference and so shouldn't be touched.
The newer one calls functions that don't exist. Presumably someone was
trying to modify the fill behaviour for strings but didn't actually
finish it.
Track copyright based commit history.

Use a single meta-data block for this mode, remove data that
relates to python.el, fix maintainer information.

This file is not part of GNU Emacs.

Ren'Py is not Visual Studio.
Removes the original python checks.

Fixes the modified code to deal with comments appearing after the
colon.
Update docstring.
Remove reference to an Emacs version.
Add tag and prefix.
Morgan Willcock added 6 commits February 1, 2023 20:59
Show labels at the top level of menu.

Other entries are under sub-menus which are prefixed with "/" (which
is not a valid character to begin a label name, so typing "/" with the
default completion system will just show the sub-menus).
Skip backwards over comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant