From: Eli Zaretskii Date: Sat, 30 Sep 2006 09:39:35 +0000 (+0000) Subject: (sh-prev-thing): Take `sh-leading-keywords' into account. X-Git-Tag: emacs-pretest-22.0.90~282 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=57763824f898ed8bdd00b8bbbdb3a7368662962b;p=emacs.git (sh-prev-thing): Take `sh-leading-keywords' into account. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9286c8d1d78..04e75485297 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-09-30 Michael Welsh Duggan + + * progmodes/sh-script.el (sh-prev-thing): Take + `sh-leading-keywords' into account. + 2006-09-29 Glenn Morris * custom.el (defcustom): Doc fix. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index f828c36917b..4032c9ce933 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -2473,33 +2473,42 @@ we go to the end of the previous line and do not check for continuations." (skip-chars-backward " \t;") (unless (looking-at "\\s-*;;") (skip-chars-backward "^)}];\"'`({[") - (setq c (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 ?\;)) - (save-excursion - ;; skip forward over white space newline and \ at eol - (skip-chars-forward " \t\n\\\\") - (sh-debug "Now at %d start=%d" (point) start) - (if (>= (point) start) - (progn - (sh-debug "point: %d >= start: %d" (point) start) - nil) - (sh-get-word)) - )) - (t - ;; c -- return a string - (char-to-string c) - )) - ))) + (setq c (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 (>= (point) start) + (progn + (sh-debug "point: %d >= start: %d" (point) start) + nil) + (setq kwd (sh-get-word)) + (unless (eobp) (forward-char 1)) + (if (member kwd (sh-feature sh-leading-keywords)) + (setq next (point)) + (setq done t))) + (skip-chars-forward " \t\n\\\\")) + (goto-char boundary) + kwd)) + (t + ;; c -- return a string + (char-to-string c) + )) + ))))) (defun sh-this-is-a-continuation ()