summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1997-01-30 19:49:39 (GMT)
committerBarry Warsaw <barry@python.org>1997-01-30 19:49:39 (GMT)
commitf7705782253329a4db70fcce0267a88571362e0b (patch)
tree6910ac059b4ed3d0cf2a794cfc1dd0ac6833ddce /Misc
parentd23d9409f311d53e0968fd65a6cdab1777e410ab (diff)
downloadcpython-f7705782253329a4db70fcce0267a88571362e0b.zip
cpython-f7705782253329a4db70fcce0267a88571362e0b.tar.gz
cpython-f7705782253329a4db70fcce0267a88571362e0b.tar.bz2
(py-parse-partial-sexp-works-p): New variable to work around a bug in
parse-partial-sexp in some Emacsen. (py-goto-beyond-final-line): use py-parse-partial-sexp-works-p.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el26
1 files changed, 23 insertions, 3 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index 99f51d6..40c471e 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -410,6 +410,26 @@ This is only used by `py-current-defun' to find the name for add-log.el.")
If you change this, you probably have to change `py-current-defun' as well.
This is only used by `py-current-defun' to find the name for add-log.el.")
+;; As of 30-Jan-1997, Emacs 19.34 works but XEmacs 19.15b90 and
+;; previous does not. It is suspected that Emacsen before 19.34 are
+;; also broken.
+(defvar py-parse-partial-sexp-works-p
+ (let ((buf (get-buffer-create " ---*---pps---*---"))
+ state status)
+ (save-excursion
+ (set-buffer buf)
+ (erase-buffer)
+ (insert "(line1\n line2)\nline3")
+ (lisp-mode)
+ (goto-char (point-min))
+ (setq state (parse-partial-sexp (point) (save-excursion
+ (forward-line 1)
+ (point))))
+ (parse-partial-sexp (point) (point-max) 0 nil state)
+ (setq status (not (= (point) (point-max))))
+ (kill-buffer buf)
+ status))
+ "Does `parse-partial-sexp' work in this Emacs?")
;; Menu definitions, only relevent if you have the easymenu.el package
@@ -2203,9 +2223,9 @@ local bindings to py-newline-and-indent."))
(if (and (not (zerop (car state)))
(not (eobp)))
(progn
- ;; BUG ALERT: I could swear, from reading the docs, that
- ;; the 3rd argument should be plain 0
- (parse-partial-sexp (point) (point-max) (- 0 (car state))
+ (parse-partial-sexp (point) (point-max)
+ (if py-parse-partial-sexp-works-p
+ 0 (- 0 (car state)))
nil state)
(forward-line 1))))))