aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/sh-script.el
diff options
context:
space:
mode:
authorMiles Bader2006-10-15 02:54:13 +0000
committerMiles Bader2006-10-15 02:54:13 +0000
commitbb9c4b4f8b3dcd1b5fc96d2d0275cc532832fbd6 (patch)
tree8c4ae9640abcb8f33326e96e661f711417e5307c /lisp/progmodes/sh-script.el
parent5be4d5336db8be316100a5b80ee8c5e428438b9e (diff)
parent92edaeeda5c362acf2c7e7f72b3666ab7673699a (diff)
downloademacs-bb9c4b4f8b3dcd1b5fc96d2d0275cc532832fbd6.tar.gz
emacs-bb9c4b4f8b3dcd1b5fc96d2d0275cc532832fbd6.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 460-475) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 145-152) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-118
Diffstat (limited to 'lisp/progmodes/sh-script.el')
-rw-r--r--lisp/progmodes/sh-script.el90
1 files changed, 40 insertions, 50 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index ba10393a89f..73957cab8e9 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2460,55 +2460,45 @@ we go to the end of the previous line and do not check for continuations."
2460 ;; 2460 ;;
2461 (if (bolp) 2461 (if (bolp)
2462 nil 2462 nil
2463 (let (c min-point 2463 (let ((start (point))
2464 (start (point))) 2464 (min-point (if (sh-this-is-a-continuation)
2465 (save-restriction 2465 (sh-prev-line nil)
2466 (narrow-to-region 2466 (line-beginning-position))))
2467 (if (sh-this-is-a-continuation) 2467 (skip-chars-backward " \t;" min-point)
2468 (setq min-point (sh-prev-line nil)) 2468 (if (looking-at "\\s-*;;")
2469 (save-excursion 2469 ;; (message "Found ;; !")
2470 (beginning-of-line) 2470 ";;"
2471 (setq min-point (point)))) 2471 (skip-chars-backward "^)}];\"'`({[" min-point)
2472 (point)) 2472 (let ((c (if (> (point) min-point) (char-before))))
2473 (skip-chars-backward " \t;") 2473 (sh-debug "stopping at %d c is %s start=%d min-point=%d"
2474 (unless (looking-at "\\s-*;;") 2474 (point) c start min-point)
2475 (skip-chars-backward "^)}];\"'`({[") 2475 (if (not (memq c '(?\n nil ?\;)))
2476 (setq c (char-before))) 2476 ;; c -- return a string
2477 (sh-debug "stopping at %d c is %s start=%d min-point=%d" 2477 (char-to-string c)
2478 (point) c start min-point) 2478 ;; Return the leading keyword of the "command" we supposedly
2479 (if (< (point) min-point) 2479 ;; skipped over. Maybe we skipped too far (e.g. past a `do' or
2480 (error "point %d < min-point %d" (point) min-point)) 2480 ;; `then' that precedes the actual command), so check whether
2481 (cond 2481 ;; we're looking at such a keyword and if so, move back forward.
2482 ((looking-at "\\s-*;;") 2482 (let ((boundary (point))
2483 ;; (message "Found ;; !") 2483 kwd next)
2484 ";;") 2484 (while
2485 ((or (eq c ?\n) 2485 (progn
2486 (eq c nil) 2486 ;; Skip forward over white space newline and \ at eol.
2487 (eq c ?\;)) 2487 (skip-chars-forward " \t\n\\\\" start)
2488 (let (done kwd next 2488 (if (>= (point) start)
2489 (boundary (point))) 2489 (progn
2490 (skip-chars-forward " \t\n\\\\") 2490 (sh-debug "point: %d >= start: %d" (point) start)
2491 (while (and (not done) (not (eobp))) 2491 nil)
2492 (if next (setq boundary next)) 2492 (if next (setq boundary next))
2493 ;; skip forward over white space newline and \ at eol 2493 (sh-debug "Now at %d start=%d" (point) start)
2494 (sh-debug "Now at %d start=%d" (point) start) 2494 (setq kwd (sh-get-word))
2495 (if (>= (point) start) 2495 (if (member kwd (sh-feature sh-leading-keywords))
2496 (progn 2496 (progn
2497 (sh-debug "point: %d >= start: %d" (point) start) 2497 (setq next (point))
2498 nil) 2498 t)
2499 (setq kwd (sh-get-word)) 2499 nil))))
2500 (unless (eobp) (forward-char 1)) 2500 (goto-char boundary)
2501 (if (member kwd (sh-feature sh-leading-keywords)) 2501 kwd)))))))
2502 (setq next (point))
2503 (setq done t)))
2504 (skip-chars-forward " \t\n\\\\"))
2505 (goto-char boundary)
2506 kwd))
2507 (t
2508 ;; c -- return a string
2509 (char-to-string c)
2510 ))
2511 ))))
2512 2502
2513 2503
2514(defun sh-this-is-a-continuation () 2504(defun sh-this-is-a-continuation ()
@@ -2527,7 +2517,7 @@ If AND-MOVE is non-nil then move to end of word."
2527 (goto-char where)) 2517 (goto-char where))
2528 (prog1 2518 (prog1
2529 (buffer-substring (point) 2519 (buffer-substring (point)
2530 (progn (skip-chars-forward "^ \t\n;&")(point))) 2520 (progn (skip-chars-forward "^ \t\n;&|()")(point)))
2531 (unless and-move 2521 (unless and-move
2532 (goto-char start))))) 2522 (goto-char start)))))
2533 2523