Mercurial > emacs
changeset 73188:c0893cfe5685
(sh-prev-thing): Take `sh-leading-keywords' into account.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 30 Sep 2006 09:38:45 +0000 |
parents | 458d299b6185 |
children | 20b963c49703 |
files | lisp/progmodes/sh-script.el |
diffstat | 1 files changed, 36 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/sh-script.el Sat Sep 30 09:22:41 2006 +0000 +++ b/lisp/progmodes/sh-script.el Sat Sep 30 09:38:45 2006 +0000 @@ -2473,33 +2473,42 @@ (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 ()