diff options
author | 2001-08-10 12:56:40 +0000 | |
---|---|---|
committer | 2001-08-10 12:56:40 +0000 | |
commit | a6842f6adaa9a2ef4ba23f7941da774c304cf82c (patch) | |
tree | 2228ebb65e21ee8e4a01830a08a945f2efe502ed /generic/proof-compat.el | |
parent | 71e160c2934e0120c00cdfaad440099a3138b16f (diff) |
Workaround for buffer-syntactic-context bug in XEmacs 21.1
Diffstat (limited to 'generic/proof-compat.el')
-rw-r--r-- | generic/proof-compat.el | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/generic/proof-compat.el b/generic/proof-compat.el index f4c0ac5e..742c7fff 100644 --- a/generic/proof-compat.el +++ b/generic/proof-compat.el @@ -128,9 +128,15 @@ Otherwise treat \\ in NEWTEXT string as special: newtext "")))))) (concat rtn-str (substring str start))))) - -(or (fboundp 'buffer-syntactic-context) -(defun buffer-syntactic-context (&optional buffer) +;; An implemenation of buffer-syntactic-context for FSF Emacs +(defun proof-buffer-syntactic-context-emulate (&optional buffer) + "Return the syntactic context of BUFFER at point. +If BUFFER is nil or omitted, the current buffer is assumed. +The returned value is one of the following symbols: + + nil ; meaning no special interpretation + string ; meaning point is within a string + comment ; meaning point is within a line comment" (save-excursion (if buffer (set-buffer buffer)) (let ((pp (parse-partial-sexp 1 (point)))) @@ -141,8 +147,7 @@ Otherwise treat \\ in NEWTEXT string as special: ;; distinguishing between block comments and ordinary comments ;; is problematic: not what XEmacs claims and different to what ;; (nth 7 pp) tells us in FSF Emacs. - ((nth 4 pp) 'comment)))))) - + ((nth 4 pp) 'comment))))) ;; In case Emacs is not aware of the function read-shell-command, @@ -216,7 +221,6 @@ Otherwise treat \\ in NEWTEXT string as special: - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; General Emacs version compatibility @@ -234,7 +238,21 @@ Otherwise treat \\ in NEWTEXT string as special: (autoload 'font-lock-append-text-property "font-lock")) - +;; Handle buggy buffer-syntactic-context workaround in XEmacs 21.1, +;; and FSF non-implementation. + +(cond + ((not (fboundp 'buffer-syntactic-context)) + (defalias 'proof-buffer-syntactic-context + 'proof-buffer-syntactic-context-emulate)) + ((string-match "21.1 .*XEmacs" emacs-version) + (defalias 'proof-buffer-syntactic-context + 'proof-buffer-syntactic-context-emulate)) + (t + ;; Assume this version has a good implementation + (defalias 'proof-buffer-syntactic-context + 'buffer-syntactic-context))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Nasty: Emacs bug/problem fix section |