comparison lisp/progmodes/sh-script.el @ 90228:fa0da9b57058

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-82 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 542-553) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 116-121) - Merge from emacs--cvs-trunk--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Mon, 19 Sep 2005 10:20:33 +0000
parents 10fe5fadaf89 5c0acc1c2a2c
children 626b546fed64
comparison
equal deleted inserted replaced
90227:10fe5fadaf89 90228:fa0da9b57058
2570 "Move cursor momentarily to BLINKPOS and display MSG." 2570 "Move cursor momentarily to BLINKPOS and display MSG."
2571 ;; We can get here without it being a number on first line 2571 ;; We can get here without it being a number on first line
2572 (if (numberp blinkpos) 2572 (if (numberp blinkpos)
2573 (save-excursion 2573 (save-excursion
2574 (goto-char blinkpos) 2574 (goto-char blinkpos)
2575 (message msg) 2575 (if msg (message "%s" msg) (message nil))
2576 (sit-for blink-matching-delay)) 2576 (sit-for blink-matching-delay))
2577 (message msg))) 2577 (if message (message "%s" msg) (message nil))))
2578 2578
2579 (defun sh-show-indent (arg) 2579 (defun sh-show-indent (arg)
2580 "Show the how the currently line would be indented. 2580 "Show the how the currently line would be indented.
2581 This tells you which variable, if any, controls the indentation of 2581 This tells you which variable, if any, controls the indentation of
2582 this line. 2582 this line.
2589 (let* ((info (sh-get-indent-info)) 2589 (let* ((info (sh-get-indent-info))
2590 (var (sh-get-indent-var-for-line info)) 2590 (var (sh-get-indent-var-for-line info))
2591 (curr-indent (current-indentation)) 2591 (curr-indent (current-indentation))
2592 val msg) 2592 val msg)
2593 (if (stringp var) 2593 (if (stringp var)
2594 (message (setq msg var)) 2594 (message "%s" (setq msg var))
2595 (setq val (sh-calculate-indent info)) 2595 (setq val (sh-calculate-indent info))
2596 2596
2597 (if (eq curr-indent val) 2597 (if (eq curr-indent val)
2598 (setq msg (format "%s is %s" var (symbol-value var))) 2598 (setq msg (format "%s is %s" var (symbol-value var)))
2599 (setq msg 2599 (setq msg
2608 (if sh-blink 2608 (if sh-blink
2609 (let ((info (sh-get-indent-info))) 2609 (let ((info (sh-get-indent-info)))
2610 (if (and info (listp (car info)) 2610 (if (and info (listp (car info))
2611 (eq (car (car info)) t)) 2611 (eq (car (car info)) t))
2612 (sh-blink (nth 1 (car info)) msg) 2612 (sh-blink (nth 1 (car info)) msg)
2613 (message msg))) 2613 (message "%s" msg)))
2614 (message msg)) 2614 (message "%s" msg))
2615 )) 2615 ))
2616 2616
2617 (defun sh-set-indent () 2617 (defun sh-set-indent ()
2618 "Set the indentation for the current line. 2618 "Set the indentation for the current line.
2619 If the current line is controlled by an indentation variable, prompt 2619 If the current line is controlled by an indentation variable, prompt
2622 (sh-must-support-indent) 2622 (sh-must-support-indent)
2623 (let* ((info (sh-get-indent-info)) 2623 (let* ((info (sh-get-indent-info))
2624 (var (sh-get-indent-var-for-line info)) 2624 (var (sh-get-indent-var-for-line info))
2625 val old-val indent-val) 2625 val old-val indent-val)
2626 (if (stringp var) 2626 (if (stringp var)
2627 (message (format "Cannot set indent - %s" var)) 2627 (message "Cannot set indent - %s" var)
2628 (setq old-val (symbol-value var)) 2628 (setq old-val (symbol-value var))
2629 (setq val (sh-read-variable var)) 2629 (setq val (sh-read-variable var))
2630 (condition-case nil 2630 (condition-case nil
2631 (progn 2631 (progn
2632 (set var val) 2632 (set var val)
2673 ival sval diff new-val 2673 ival sval diff new-val
2674 (no-symbol arg) 2674 (no-symbol arg)
2675 (curr-indent (current-indentation))) 2675 (curr-indent (current-indentation)))
2676 (cond 2676 (cond
2677 ((stringp var) 2677 ((stringp var)
2678 (message (format "Cannot learn line - %s" var))) 2678 (message "Cannot learn line - %s" var))
2679 ((eq var 'sh-indent-comment) 2679 ((eq var 'sh-indent-comment)
2680 ;; This is arbitrary... 2680 ;; This is arbitrary...
2681 ;; - if curr-indent is 0, set to curr-indent 2681 ;; - if curr-indent is 0, set to curr-indent
2682 ;; - else if it has the indentation of a "normal" line, 2682 ;; - else if it has the indentation of a "normal" line,
2683 ;; then set to t 2683 ;; then set to t