[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/sh-script.el,v
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/sh-script.el,v |
Date: |
Tue, 03 Oct 2006 20:44:27 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 06/10/03 20:44:26
Index: progmodes/sh-script.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/sh-script.el,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -b -r1.188 -r1.189
--- progmodes/sh-script.el 2 Oct 2006 08:50:50 -0000 1.188
+++ progmodes/sh-script.el 3 Oct 2006 20:44:25 -0000 1.189
@@ -2460,55 +2460,49 @@
;;
(if (bolp)
nil
- (let (c min-point
- (start (point)))
- (save-restriction
- (narrow-to-region
- (if (sh-this-is-a-continuation)
- (setq min-point (sh-prev-line nil))
- (save-excursion
- (beginning-of-line)
- (setq min-point (point))))
- (point))
- (skip-chars-backward " \t;")
- (unless (looking-at "\\s-*;;")
- (skip-chars-backward "^)}];\"'`({[")
- (setq c (char-before)))
+ (let ((start (point))
+ (min-point (if (sh-this-is-a-continuation)
+ (sh-prev-line nil)
+ (line-beginning-position))))
+ (skip-chars-backward " \t;" min-point)
+ (if (looking-at "\\s-*;;")
+ ;; (message "Found ;; !")
+ ";;"
+ (skip-chars-backward "^)}];\"'`({[" min-point)
+ (let ((c (if (> (point) min-point) (char-before))))
(sh-debug "stopping at %d c is %s start=%d min-point=%d"
(point) c start min-point)
- (if (< (point) min-point)
- (error "point %d < min-point %d" (point) min-point))
- (cond
- ((looking-at "\\s-*;;")
- ;; (message "Found ;; !")
- ";;")
- ((or (eq c ?\n)
- (eq c nil)
- (eq c ?\;))
- (let (done kwd next
- (boundary (point)))
- (skip-chars-forward " \t\n\\\\")
- (while (and (not done) (not (eobp)))
- (if next (setq boundary next))
- ;; skip forward over white space newline and \ at eol
- (sh-debug "Now at %d start=%d" (point) start)
+ (if (not (memq c '(?\n nil ?\;)))
+ ;; c -- return a string
+ (char-to-string c)
+ ;; Return the leading keyword of the "command" we supposedly
+ ;; skipped over. Maybe we skipped too far (e.g. past a `do' or
+ ;; `then' that precedes the actual command), so check whether
+ ;; we're looking at such a keyword and if so, move back forward.
+ (let ((boundary (point))
+ kwd next)
+ (while
+ (progn
+ ;; Skip forward over white space newline and \ at eol.
+ (skip-chars-forward " \t\n\\\\" start)
(if (>= (point) start)
(progn
(sh-debug "point: %d >= start: %d" (point) start)
nil)
+ (if next (setq boundary next))
+ (sh-debug "Now at %d start=%d" (point) start)
(setq kwd (sh-get-word))
- (unless (eobp) (forward-char 1))
+ ;; The reason for this next line is unclear.
+ ;; <address@hidden> says "the need for this was
+ ;; expermientally determined". --Stef
+ (when (< (point) start) (forward-char 1))
(if (member kwd (sh-feature sh-leading-keywords))
+ (progn
(setq next (point))
- (setq done t)))
- (skip-chars-forward " \t\n\\\\"))
+ t)
+ nil))))
(goto-char boundary)
- kwd))
- (t
- ;; c -- return a string
- (char-to-string c)
- ))
- ))))
+ kwd)))))))
(defun sh-this-is-a-continuation ()