Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

removed sym-comp dependency to bring up to 26.1 #1

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions README.md

This file was deleted.

17 changes: 17 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#+TITLE: Ren'Py mode

PyTom's old major mode for Ren'Py, previously maintained by treymerkley, now maintained by me.

** Installation

Either install within Emacs directly from MELPA or:
* Download/clone this repo to your desired location.
* In Emacs, use the command =M-x package-install-file= and point it to the renpy.el file location
* This will install it to your =~/.emacs.d/elpa/= directory (or your custom location if you've manually set a different =package-user-dir= in Emacs)
* In your .emacs file, add =(require 'renpy)=

** History

Originally this was PyTom's major mode for Ren'Py but he no longer uses Emacs or Ren'Py anymore. Then maintenance was taken over by Trey Merkley @treymerkley but he was looking for someone else to take it on who was more familiar with Elisp. So now it is maintained by me.

Come at me, parentheses. I dare you.
59 changes: 32 additions & 27 deletions renpy.el
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
; WARNING: This file is automatically generated.
;WARNING: Edit renpy.el.tmpl instead, then run make_renpy_el.py

; -*- emacs-lisp -*-
;;; renpy.el --- silly walks for Renpy -*- coding: iso-8859-1 -*-

;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
;; Free Software Foundation, Inc.
;; Copyright (C) 2018
;; Billy Wade

;; Author: PyTom <[email protected]>

;; Based on python.el, which has the following maintainership:

;; Author: Dave Love <[email protected]>
;; Maintainer: FSF
;; Maintainer: Dave Love <[email protected]>; Quildreen Motta <https://github.com/robotlolita>; Billy Wade <https://github.com/billywade>
;; Created: Nov 2003
;; Version: 0.3
;; Homepage: https://github.com/billywade/renpy-mode
;; Keywords: languages

;;; Commentary:

;; PyTom's old major mode for Ren'Py, the visual studio engine

;;; License:

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -47,7 +52,6 @@
(require 'compile)
(require 'hippie-exp))

(require 'sym-comp)
(autoload 'comint-mode "comint")

(defgroup renpy nil
Expand All @@ -65,7 +69,7 @@

(defvar renpy-font-lock-keywords
`(,(rx symbol-start
;; From v 2.5 reference, � keywords.
;; From v 2.5 reference, � keywords.
;; def and class dealt with separately below
(or "and" "as" "assert" "break" "continue" "del" "elif" "else"
"except" "exec" "finally" "for" "from" "global" "if"
Expand Down Expand Up @@ -176,7 +180,7 @@
"zorder"
)
symbol-end)
(,(rx symbol-start "None" symbol-end) ; see � Keywords in 2.5 manual
(,(rx symbol-start "None" symbol-end) ; see � Keywords in 2.5 manual
. font-lock-constant-face)
;; Definitions
(,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_))))
Expand Down Expand Up @@ -1410,7 +1414,7 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)."

;;;; Utility stuff

(defsubst renpy-in-string/comment ()
(defsubst renpy-in-string-comment ()
"Return non-nil if point is in a Renpy literal (a comment or string)."
;; We don't need to save the match data.
(nth 8 (syntax-ppss)))
Expand All @@ -1421,7 +1425,7 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)."
table)
"`renpy-mode-syntax-table' with backslash given whitespace syntax.")

(defun renpy-skip-comments/blanks (&optional backward)
(defun renpy-skip-comments-blanks (&optional backward)
"Skip comments and blank lines.
BACKWARD non-nil means go backwards, otherwise go forwards.
Backslash is treated as whitespace so that continued blank lines
Expand Down Expand Up @@ -1511,7 +1515,7 @@ The criteria are that the line isn't a comment or in string and
(back-to-indentation)
(and (looking-at (rx (and (or "else" "finally" "except" "elif")
symbol-end)))
(not (renpy-in-string/comment))
(not (renpy-in-string-comment))
;; Ensure there's a previous statement and move to it.
(zerop (renpy-previous-statement))
(not (renpy-close-block-statement-p t))
Expand Down Expand Up @@ -1754,7 +1758,7 @@ corresponding block opening (or nil)."
;; Check we don't have something like:
;; if ...: ...
(if (progn (renpy-end-of-statement)
(renpy-skip-comments/blanks t)
(renpy-skip-comments-blanks t)
(eq ?: (char-before)))
(setq indent (+ renpy-indent indent)))))
(push (cons indent initial) levels))
Expand Down Expand Up @@ -1898,7 +1902,7 @@ reached start of buffer."
;; (and def-line (= in ci))
(= in ci)
(< in ci)))
(not (renpy-in-string/comment)))
(not (renpy-in-string-comment)))
(setq found t)))
found))

Expand All @@ -1918,7 +1922,7 @@ Finds end of innermost nested class or method definition."
(if (zerop (current-indentation))
(unless (renpy-open-block-statement-p)
(while (and (re-search-forward pattern nil 'move)
(renpy-in-string/comment))) ; just loop
(renpy-in-string-comment))) ; just loop
(unless (eobp)
(beginning-of-line)))
;; Don't move before top-level statement that would end defun.
Expand All @@ -1929,7 +1933,7 @@ Finds end of innermost nested class or method definition."
(if (and (bobp) (not (looking-at "def\\|class")))
(while (and (not (eobp))
(re-search-forward pattern nil 'move)
(renpy-in-string/comment)))) ; just loop
(renpy-in-string-comment)))) ; just loop
;; We're at a definition statement (or end-of-buffer).
(unless (eobp)
(renpy-end-of-block)
Expand Down Expand Up @@ -2031,7 +2035,7 @@ Return count of statements left to move."
(renpy-next-statement (- count))
(renpy-beginning-of-statement)
(while (and (> count 0) (not (bobp)))
(renpy-skip-comments/blanks t)
(renpy-skip-comments-blanks t)
(renpy-beginning-of-statement)
(unless (bobp) (setq count (1- count))))
count))
Expand All @@ -2048,7 +2052,7 @@ Return count of statements left to move."
(let (bogus)
(while (and (> count 0) (not (eobp)) (not bogus))
(renpy-end-of-statement)
(renpy-skip-comments/blanks)
(renpy-skip-comments-blanks)
(if (eq 'string (syntax-ppss-context (syntax-ppss)))
(setq bogus t)
(unless (eobp)
Expand All @@ -2071,7 +2075,7 @@ Otherwise return non-nil."
(let ((point (point)))
(if (or (renpy-comment-line-p)
(renpy-blank-line-p))
(renpy-skip-comments/blanks t))
(renpy-skip-comments-blanks t))
(renpy-beginning-of-statement)
(let ((ci (current-indentation)))
(if (zerop ci)
Expand Down Expand Up @@ -2109,7 +2113,7 @@ don't move and return nil. Otherwise return t."
(while (and (> arg 0)
(let* ((point (point))
(_ (if (renpy-comment-line-p)
(renpy-skip-comments/blanks t)))
(renpy-skip-comments-blanks t)))
(ci (current-indentation))
(open (renpy-open-block-statement-p)))
(if (and (zerop ci) (not open))
Expand All @@ -2118,7 +2122,7 @@ don't move and return nil. Otherwise return t."
(while (zerop (renpy-next-statement))
(when (or (and open (<= (current-indentation) ci))
(< (current-indentation) ci))
(renpy-skip-comments/blanks t)
(renpy-skip-comments-blanks t)
(beginning-of-line 2)
(throw 'done t)))))))
(setq arg (1- arg)))
Expand All @@ -2145,7 +2149,7 @@ don't move and return nil. Otherwise return t."
;; renpy-next-statement 2970 1.024717 0.0003450225
;; renpy-end-of-statement 2970 0.4332190000 0.0001458649
;; renpy-beginning-of-defun 265 0.0918479999 0.0003465962
;; renpy-skip-comments/blanks 3125 0.0753319999 2.410...e-05
;; renpy-skip-comments-blanks 3125 0.0753319999 2.410...e-05

(defvar renpy-recursing)
;;;; `Electric' commands.
Expand All @@ -2159,7 +2163,7 @@ just insert a single colon."
(and (not arg)
(eolp)
(renpy-outdent-p)
(not (renpy-in-string/comment))
(not (renpy-in-string-comment))
(> (current-indentation) (renpy-calculate-indentation))
(renpy-indent-line))) ; OK, do it
(put 'renpy-electric-colon 'delete-selection t)
Expand All @@ -2174,7 +2178,7 @@ Repeat ARG times."
(if (or (/= (current-indentation) (current-column))
(bolp)
(renpy-continuation-line-p)
(renpy-in-string/comment))
(renpy-in-string-comment))
(backward-delete-char-untabify arg)
;; Look for the largest valid indentation which is smaller than
;; the current indentation.
Expand Down Expand Up @@ -2422,9 +2426,9 @@ with skeleton expansions for compound statement templates.

(set (make-local-variable 'eldoc-documentation-function)
#'renpy-eldoc-function)
(add-hook 'eldoc-mode-hook
(lambda () (run-renpy nil t)) ; need it running
nil t)
;; (add-hook 'eldoc-mode-hook
;; (lambda () (run-renpy nil t)) ; need it running
;; nil t)
(set (make-local-variable 'symbol-completion-symbol-function)
'renpy-partial-symbol)
(set (make-local-variable 'symbol-completion-completions-function)
Expand Down Expand Up @@ -2538,3 +2542,4 @@ with skeleton expansions for compound statement templates.

(provide 'renpy)

;;; renpy.el ends here