comparison lisp/lisp.el @ 3543:c136144fe765

[xemacs-hg @ 2006-08-04 22:55:04 by aidan] Raw strings, from Python via SXEmacs
author aidan
date Fri, 04 Aug 2006 22:55:19 +0000
parents 1ccc32a20af4
children ecc468b62551
comparison
equal deleted inserted replaced
3542:1ce31579a443 3543:c136144fe765
58 move backward across N balanced expressions." 58 move backward across N balanced expressions."
59 ;; XEmacs change (for zmacs regions) 59 ;; XEmacs change (for zmacs regions)
60 (interactive "_p") 60 (interactive "_p")
61 (or arg (setq arg 1)) 61 (or arg (setq arg 1))
62 ;; XEmacs: evil hack! The other half of the evil hack below. 62 ;; XEmacs: evil hack! The other half of the evil hack below.
63 (if (and (> arg 0) (looking-at "#s(")) 63 (if (and (> arg 0) (looking-at "#s(\\|#r[uU]\\{0,1\\}\""))
64 (goto-char (+ (point) 2))) 64 (goto-char (1+ (- (point) (- (match-end 0) (match-beginning 0))))))
65 (goto-char (or (scan-sexps (point) arg) (buffer-end arg))) 65 (goto-char (or (scan-sexps (point) arg) (buffer-end arg)))
66 (if (< arg 0) (backward-prefix-chars)) 66 (when (< arg 0)
67 ;; XEmacs: evil hack! Skip back over #s so that structures are read 67 (backward-prefix-chars)
68 ;; properly. the current cheesified syntax tables just aren't up to 68 ;; XEmacs: evil hack! Skip back over #[sr] so that structures and raw
69 ;; this. 69 ;; strings are read properly. the current cheesified syntax tables just
70 (if (and (< arg 0) 70 ;; aren't up to this.
71 (eq (char-after (point)) ?\() 71 (let* ((diff (- (point) (point-min)))
72 (>= (- (point) (point-min)) 2) 72 (subject (buffer-substring (- (point) (min diff 3))
73 (eq (char-after (- (point) 1)) ?s) 73 (1+ (point))))
74 (eq (char-after (- (point) 2)) ?#)) 74 (matched (string-match "#s(\\|#r[uU]\\{0,1\\}\"" subject)))
75 (goto-char (- (point) 2)))) 75 (if matched
76 (goto-char (1+ (- (point) (- (length subject) matched))))))))
76 77
77 (defun backward-sexp (&optional arg) 78 (defun backward-sexp (&optional arg)
78 "Move backward across one balanced expression (sexp). 79 "Move backward across one balanced expression (sexp).
79 With argument, do it that many times. Negative arg -N means 80 With argument, do it that many times. Negative arg -N means
80 move forward across N balanced expressions." 81 move forward across N balanced expressions."